-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotepad.asm
More file actions
61 lines (50 loc) · 1.26 KB
/
notepad.asm
File metadata and controls
61 lines (50 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
notepad_app:
; Clear screen
mov ah, 0x00
int 0x10
; Display notepad header
mov bx, notepad_header
call print_msg
; Initialize file system (if needed)
call init_fs
; Loop to read and display characters
notepad_loop:
mov ah, 0x00
int 0x16
cmp al, 0x1B ; ESC key to exit
je notepad_exit
cmp al, 0x13 ; Ctrl+S to save
je save_file
mov ah, 0x0E
int 0x10
call append_char_to_buffer
jmp notepad_loop
save_file:
call save_buffer_to_disk
jmp notepad_loop
notepad_exit:
ret
append_char_to_buffer:
; Append character in AL to buffer
; ...implementation...
ret
save_buffer_to_disk:
; Save buffer to disk
; Switch to protected mode
call switch_to_protected_mode
; ...implementation...
; Switch back to real mode
call switch_to_real_mode
ret
switch_to_protected_mode:
; ...implementation...
ret
switch_to_real_mode:
; ...implementation...
ret
init_fs:
; Initialize file system
; ...implementation...
ret
notepad_header:
db "Notepad - Press ESC to exit, Ctrl+S to save", 0x0A, 0