-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREAD_FILE.ASM
More file actions
49 lines (44 loc) · 743 Bytes
/
READ_FILE.ASM
File metadata and controls
49 lines (44 loc) · 743 Bytes
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
assume cs:code, ds:data
data segment
fname db "test.txt"
buff db 100 dup(?)
m1 db 0ah, 0dh,"File Closed $"
m2 db 0ah, 0dh,"File Not Found$"
data ends
code segment
start:
mov ax, data
mov ds, ax
mov ax,3d00h
lea dx, fname
int 21h
jnc read
lea dx, m2
mov ah, 9
int 21h
jmp finish
read:
mov bx, ax
mov ah, 3fh
mov cx, 100d
lea dx, buff
int 21h
lea si, buff
mov cx, 100d
print:
mov dl, [si]
mov ah, 02h
int 21h
inc si
loop print
mov ah, 3eh
int 21h
je finish
lea dx, m1
mov ah, 09h
int 21h
finish:
mov ah, 4ch
int 21h
code ends
end start