0% found this document useful (0 votes)
13 views22 pages

Project Abstract

The project involves developing a basic text editor application in EMU8086 Assembly Language, simulating Notepad-like functionality with features such as file creation, opening, saving, and editing. It emphasizes low-level programming concepts, including memory addressing and file handling, aimed at assembly language learners and enthusiasts. The application operates in a constrained environment, showcasing real-time user interaction and file I/O without high-level libraries.

Uploaded by

71762331045
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views22 pages

Project Abstract

The project involves developing a basic text editor application in EMU8086 Assembly Language, simulating Notepad-like functionality with features such as file creation, opening, saving, and editing. It emphasizes low-level programming concepts, including memory addressing and file handling, aimed at assembly language learners and enthusiasts. The application operates in a constrained environment, showcasing real-time user interaction and file I/O without high-level libraries.

Uploaded by

71762331045
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

COIMBATORE INSTITUTE OF TECHNOLOGY

(An Autonomous Institution Affiliated to Anna University)

MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

PROJECT

NAME : SASHRUTHI R

REG-NO :2303717672622052

SUBJECT-CODE :20MSS46

CLASS : MSC- SOFTWARE SYSTEMS

BATCH : 2023 - 2028

DATE : 22.02.2025
ABSTRACT:
A text editor is an essential tool that enables users to create, modify, and manage plain
text files efficiently.
This project focuses on developing a simple yet functional text editor application, offering
core features like file creation, open, save, save as, edit (append/overwrite), and backspace
operations.
Designed to mimic basic notepad functionality, the editor supports interaction through a
user-friendly interface and menu options.
This project is built using EMU8086 Assembly Language, showcasing low-level programming
capabilities by directly interacting with system resources.
The editor reads input from the user, performs real-time editing, and saves data to disk, all in
assembly. It reflects an understanding of memory addressing, file handling, and string
operations at the machine level.
The primary aim of the project is to demonstrate how a basic notepad can be implemented
in assembly, which is often considered challenging due to the absence of high-level abstractions.
Additionally, the editor emphasizes the importance of usability in system-level applications,
serving as an ideal educational project for understanding how text editors operate internally.
This application has practical usage in embedded systems or bootloaders, where minimal text
editing is required without relying on large software environments.
PROBLEM STATEMENT:
OBJECTIVE:
Develop a basic file editor in EMU8086 assembly to simulate Notepad-like functionality.
• Allow users to create, open, write, append, and read text files.
• Provide an interactive menu-driven interface using DOS interrupt services.
• Enable "Save" and "Save As" features through reuse of write/create logic.
• Support a "New Window" functionality by clearing the screen.
• Provide real-time input reading and handling of user-typed characters.
• Implement a backspace effect through overwrite/append control (can be extended).
• Perform file error checking using DOS function return flags.
• Display success/failure messages after each operation.
• Work as an educational example of file handling, memory usage, and string operations in 8086
Assembly.

SCOPE
Target Users: Assembly language learners, students, and low-level programming enthusiasts.
• Provides basic text operations in .asm format, usable for code writing or plain text editing.
• Supports 9 core operations through a single keypress menu:

New Window (Clear screen),Open File,Save,Save As,Exit,Create File,Append Text,Write (Over,write


Text),Read File
• Simple console-based user interface that runs directly in EMU8086 or DOSBox.
• Uses low-level INT 21h DOS interrupts for file handling and screen I/O.
• Reads strings character by character until Enter is pressed (ASCII 13).
• Handles filenames up to 20 characters and buffers up to 200 characters.
• Shows how assembly can be used for real-time user interaction and file I/O without high-level libraries.
• Useful in constrained environments like bootloaders, BIOS-level apps, or embedded systems.

TOOLS USED:
SOFTWARE:
 Emu8086
 Int 21h DOS interrupts
 Int 10h
 Memory buffers
HARDWARE:
 Ram
 Hard disk
 I5 processor
BLOCK DIAGRAM:
_____________
| start |
_____________
|
_____________
| Display menu |
_______________
|
_______________
| Get user input |
_______________
|
/ \
/ if \ yes
/ menu \ __________
\ !=5 / |
\ / |
\ / |
|
| no |
_______________ |
| Perform the task| |
________________ |
| |
_______ |
| End | ____________
_______
SOURCE CODE :
ORG 100h ; Start of the program (.COM file starts at 100h)

; === Main Menu ===

START:

MOV AH, 09h

MOV DX, OFFSET menuText ; Display the menu text

INT 21h

MOV AH, 01h ; Wait for user to input a character

INT 21h

SUB AL, '0' ; Convert ASCII to number

; Check which option the user selected

CMP AL, 1

JE NEW_WINDOW

CMP AL, 2

JE OPEN_FILE

CMP AL, 3

JE SAVE_FILE

CMP AL, 4

JE SAVE_AS

CMP AL, 5

JE EXIT

CMP AL, 6

JE CREATE_FILE

CMP AL, 7

JE APPEND_FILE

CMP AL, 8
JE WRITE_FILE

CMP AL, 9

JE READ_FILE

JMP START ; Invalid option, show menu again

; === New Window (clear screen) ===

NEW_WINDOW:

MOV AH, 0 ; BIOS interrupt to set video mode

INT 10h ; Clears screen by setting mode

JMP START

; === Open File ===

OPEN_FILE:

MOV AH, 09h

MOV DX, OFFSET enterFileMsg ; Prompt for filename

INT 21h

MOV SI, 0

READ_OPEN_FILENAME:

MOV AH, 01h

INT 21h

CMP AL, 13 ; Check for Enter key

JE DONE_OPEN_FILENAME

MOV filename[SI], AL ; Store character

INC SI

JMP READ_OPEN_FILENAME

DONE_OPEN_FILENAME:
MOV filename[SI], 0 ; Null-terminate filename

MOV AH, 3Dh ; Function to open file

MOV AL, 0 ; Read mode

MOV DX, OFFSET filename

INT 21h

JC FILE_ERROR ; Jump if open failed

MOV fileHandle, AX ; Save handle

MOV AH, 09h

MOV DX, OFFSET successOpenMsg

INT 21h

JMP START

; === Create File ===

CREATE_FILE:

MOV AH, 09h

MOV DX, OFFSET enterFileMsg

INT 21h

MOV SI, 0

READ_FILENAME:

MOV AH, 01h

INT 21h

CMP AL, 13

JE DONE_FILENAME

MOV filename[SI], AL

INC SI

JMP READ_FILENAME
DONE_FILENAME:

MOV filename[SI], 0 ; Null-terminate filename

MOV AH, 3Ch ; Create new file

MOV CX, 0

MOV DX, OFFSET filename

INT 21h

JC FILE_ERROR ; Jump if error occurred

MOV AH, 09h

MOV DX, OFFSET successMsg

INT 21h

JMP START

; === Append to File ===

APPEND_FILE:

MOV AH, 09h

MOV DX, OFFSET enterFileMsg

INT 21h

MOV SI, 0

READ_APPEND_FILENAME:

MOV AH, 01h

INT 21h

CMP AL, 13

JE DONE_APPEND_FILENAME

MOV filename[SI], AL

INC SI
JMP READ_APPEND_FILENAME

DONE_APPEND_FILENAME:

MOV filename[SI], 0

MOV AH, 3Dh ; Open existing file

MOV AL, 1 ; Write mode

MOV DX, OFFSET filename

INT 21h

JC FILE_ERROR

MOV fileHandle, AX

MOV AH, 09h

MOV DX, OFFSET enterTextMsg ; Ask user to enter text

INT 21h

MOV SI, 0

READ_APPEND_TEXT:

MOV AH, 01h

INT 21h

CMP AL, 13

JE DONE_APPEND_TEXT

MOV buffer[SI], AL

INC SI

JMP READ_APPEND_TEXT

DONE_APPEND_TEXT:

MOV CX, SI ; Number of bytes to write

MOV DX, OFFSET buffer


MOV AH, 40h ; Write file

MOV BX, fileHandle

INT 21h

MOV AH, 3Eh ; Close file

MOV BX, fileHandle

INT 21h

MOV AH, 09h

MOV DX, OFFSET successAppendMsg

INT 21h

JMP START

; === Write to File (overwrite content) ===

WRITE_FILE:

MOV AH, 09h

MOV DX, OFFSET enterFileMsg

INT 21h

MOV SI, 0

READ_WRITE_FILENAME:

MOV AH, 01h

INT 21h

CMP AL, 13

JE DONE_WRITE_FILENAME

MOV filename[SI], AL

INC SI

JMP READ_WRITE_FILENAME
DONE_WRITE_FILENAME:

MOV filename[SI], 0

MOV AH, 3Ch ; Create (overwrite) file

MOV CX, 0

MOV DX, OFFSET filename

INT 21h

JC FILE_ERROR

MOV fileHandle, AX

MOV AH, 09h

MOV DX, OFFSET enterTextMsg

INT 21h

MOV SI, 0

READ_WRITE_TEXT:

MOV AH, 01h

INT 21h

CMP AL, 13

JE DONE_WRITE_TEXT

MOV buffer[SI], AL

INC SI

JMP READ_WRITE_TEXT

DONE_WRITE_TEXT:

MOV CX, SI

MOV DX, OFFSET buffer

MOV AH, 40h

MOV BX, fileHandle


INT 21h

MOV AH, 3Eh

MOV BX, fileHandle

INT 21h

MOV AH, 09h

MOV DX, OFFSET successWriteMsg

INT 21h

JMP START

; === Read File Contents ===

READ_FILE:

MOV AH, 09h

MOV DX, OFFSET enterFileMsg

INT 21h

MOV SI, 0

READ_READ_FILENAME:

MOV AH, 01h

INT 21h

CMP AL, 13

JE DONE_READ_FILENAME

MOV filename[SI], AL

INC SI

JMP READ_READ_FILENAME

DONE_READ_FILENAME:

MOV filename[SI], 0
MOV AH, 3Dh

MOV AL, 0

MOV DX, OFFSET filename

INT 21h

JC FILE_ERROR

MOV fileHandle, AX

MOV AH, 3Fh ; Read file

MOV BX, fileHandle

MOV CX, 100 ; Read 100 bytes

MOV DX, OFFSET buffer

INT 21h

MOV SI, AX

MOV buffer[SI], '$' ; Add $ to print string

MOV AH, 09h

MOV DX, OFFSET buffer

INT 21h

MOV AH, 3Eh

MOV BX, fileHandle

INT 21h

JMP START

; === Save File ===

SAVE_FILE:

; Could implement as overwrite of last opened file


JMP START

; === Save As ===

SAVE_AS:

; Could reuse WRITE_FILE logic

JMP WRITE_FILE

; === Exit Program ===

EXIT:

MOV AH, 4Ch

INT 21h

; === Handle File Errors ===

FILE_ERROR:

MOV AH, 09h

MOV DX, OFFSET errorMsg

INT 21h

JMP START

; === Data Section ===

menuText DB 10,13, "File Editor Menu", 10,13

DB "1. New Window",10,13

DB "2. Open File",10,13

DB "3. Save",10,13

DB "4. Save As",10,13

DB "5. Exit",10,13

DB "6. Create File",10,13

DB "7. Append",10,13

DB "8. Write",10,13
DB "9. Read",10,13

DB "Enter choice: $"

enterFileMsg DB 10,13, "Enter filename: $"

enterTextMsg DB 10,13, "Enter text (end with Enter): $"

successMsg DB 10,13, "File created successfully!", 10,13, "$"

successAppendMsg DB 10,13, "Text appended successfully!", 10,13, "$"

successWriteMsg DB 10,13, "Text written successfully!", 10,13, "$"

successOpenMsg DB 10,13, "File opened successfully!", 10,13, "$"

errorMsg DB 10,13, "Error creating or opening file!", 10,13, "$"

filename DB 20 DUP(0)

buffer DB 200 DUP(0)

fileHandle DW ?

END
TECHNICAL DISCRIPTION:
The emu8086 file editor project is a basic text editing application implemented in assembly language.

It simulates essential file operations like creating, opening, saving, appending, and reading files, along
with text editing capabilities such as typing, backspacing, and managing files. the editor runs on the
emu8086 emulator, which mimics a 16-bit x86 architecture.

The program uses dos interrupts (int 21h) for file handling and keyboard input/output.

It allows the user to interact with files through a menu system, edit text in a memory buffer, and
perform file operations, all within a memory-constrained environment typical of assembly language
programs. the project aims to simulate a simple notepad-like application with a focus on file
manipulation and basic text operations.
ERROR DETECTION & CORRECTION:

RECOVERD:
Changed the function into unique

RECOVERD:
Mov bx,dx

Mov al,[bx]

RECOVERD:
Al is 8 bit register,si is 16 bit register
Mov al,[si]
RECOVERD:
Changed the function name into unique
RECOVERD:
mov ah, 3Ch ; DOS function to create file

mov cx, 0 ; File attribute: normal

lea dx, filename ; DS:DX -> address of filename

int 21h ; DOS interrupt

jc error ; jump if error

mov [filehandle], ax ; save file handle

RECOVERD:
mov si, ax

mov byte ptr buffer[si], 36

INPUT&OUTPUT:
CONCLUSION:
the EMU8086 file editor project successfully implements a basic text editing application in assembly
language, replicating the core functions of a simple text editor. By utilizing DOS interrupts for file
operations and user input, the project demonstrates essential concepts of file handling, memory
management, and text manipulation in a 16-bit environment. It provides a hands-on experience in low-
level programming, focusing on understanding the inner workings of file operations and text editing
without the use of higher-level abstractions. While constrained by memory limitations, the project
effectively simulates a notepad-like editor, offering valuable insights into working with assembly
language and the x86 architecture.

BIBLIOGRAPHY:
Git hub: https://github.com/uzairahmednasir/8086-asm-text-editor/blob/main/TEXT_EDITOR.asm

Stack overflow: https://stackoverflow.com/questions/65709728/assembly-8086-using-int21h-function-


5ah-to-create-a-randomly-named-file

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy