-
Notifications
You must be signed in to change notification settings - Fork 0
/
FIO.ASM
92 lines (81 loc) · 1.37 KB
/
FIO.ASM
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
;:ts=8
;***************************
; This file contains the interface to the DOS
; file i/o routines used by rogue
;***************************
dataseg segment para public 'data'
extrn errno_:word
dataseg ends
codeseg segment para public 'code'
assume cs:codeseg, ds:dataseg
public open_, close_, read_, write_, unlink_, creat_, lseek_
open_ proc near
push bp
mov bp,sp
mov dx,4[bp] ; File name in dx
mov al,6[bp] ; Open mode
mov ah,3dh
fio_dos:
push si
push di
int 21h
jnc aok
mov errno_,ax
mov ax,0ffffh
aok:
pop di
pop si
pop bp
ret
open_ endp
close_ proc near
push bp
mov bp,sp
mov bx,4[bp]
mov ah,3eh
jmp fio_dos
close_ endp
read_ proc near
push bp
mov bp,sp
mov bx,4[bp] ; File handle
mov cx,8[bp] ; Byte count
mov dx,6[bp] ; buffer addr
mov ah,3fh
jmp fio_dos
read_ endp
write_ proc near
push bp
mov bp,sp
mov bx,4[bp] ; File handle
mov cx,8[bp] ; Byte count
mov dx,6[bp] ; buffer addr
mov ah,40h
jmp fio_dos
write_ endp
unlink_ proc near
push bp
mov bp,sp
mov dx,4[bp]
mov ah,41h
jmp fio_dos
unlink_ endp
creat_ proc near
push bp
mov bp,sp
mov dx,4[bp]
mov cx,0
mov ah,3ch
jmp fio_dos
creat_ endp
lseek_ proc near
push bp
mov bp,sp
mov bx,4[bp]
mov dx,6[bp]
mov cx,8[bp]
mov al,10[bp]
mov ah,42h
jmp fio_dos
lseek_ endp
codeseg ends