polio: exit copy, add writefile
This commit is contained in:
42
src/polio.s
42
src/polio.s
@@ -40,20 +40,6 @@ dosdbt: # assumes es=0
|
|||||||
|
|
||||||
.section .text.int80stuff
|
.section .text.int80stuff
|
||||||
|
|
||||||
# near copy [param 2] bytes, ds:[param 0] -> ds:[param 1]
|
|
||||||
copy:
|
|
||||||
mov ax, [bp-14] # ds
|
|
||||||
mov es, ax
|
|
||||||
mov ds, ax
|
|
||||||
mov cl, 4
|
|
||||||
shl si, cl
|
|
||||||
mov si, [bp+0] # source
|
|
||||||
mov di, [bp+2] # destination
|
|
||||||
mov cx, [bp+4] # length
|
|
||||||
cld
|
|
||||||
rep movsb
|
|
||||||
ret
|
|
||||||
|
|
||||||
## floppy stuff
|
## floppy stuff
|
||||||
|
|
||||||
# same as read but with a different int13h:ah value
|
# same as read but with a different int13h:ah value
|
||||||
@@ -122,8 +108,19 @@ readfile:
|
|||||||
add ax, si
|
add ax, si
|
||||||
mov dx, [bp+2]
|
mov dx, [bp+2]
|
||||||
add dx, si
|
add dx, si
|
||||||
call fat12_readfile
|
jmp fat12_readfile
|
||||||
ret
|
|
||||||
|
# params: ds:fname, ds:src, size
|
||||||
|
writefile:
|
||||||
|
mov si, [bp-14] # ds
|
||||||
|
mov cl, 4
|
||||||
|
shl si, cl
|
||||||
|
mov ax, [bp+0]
|
||||||
|
add ax, si
|
||||||
|
mov dx, [bp+2]
|
||||||
|
add dx, si
|
||||||
|
mov cx, [bp+4]
|
||||||
|
jmp fat12_writefile
|
||||||
|
|
||||||
# params: ds:addr, size
|
# params: ds:addr, size
|
||||||
sendpara:
|
sendpara:
|
||||||
@@ -133,8 +130,7 @@ sendpara:
|
|||||||
mov ax, [bp+0]
|
mov ax, [bp+0]
|
||||||
add ax, si
|
add ax, si
|
||||||
mov dx, [bp+2]
|
mov dx, [bp+2]
|
||||||
call parasend
|
jmp parasend
|
||||||
ret
|
|
||||||
|
|
||||||
# params: ds:addr, size
|
# params: ds:addr, size
|
||||||
recvpara:
|
recvpara:
|
||||||
@@ -144,7 +140,10 @@ recvpara:
|
|||||||
mov ax, [bp+0]
|
mov ax, [bp+0]
|
||||||
add ax, si
|
add ax, si
|
||||||
mov dx, [bp+2]
|
mov dx, [bp+2]
|
||||||
call pararecv
|
jmp pararecv
|
||||||
|
|
||||||
|
dummy:
|
||||||
|
mov ax, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.section .text.int80h
|
.section .text.int80h
|
||||||
@@ -155,6 +154,7 @@ int80h:
|
|||||||
push bp
|
push bp
|
||||||
push ds
|
push ds
|
||||||
push es
|
push es
|
||||||
|
mov bp, sp
|
||||||
xor cx, cx
|
xor cx, cx
|
||||||
mov es, cx
|
mov es, cx
|
||||||
mov ds, cx
|
mov ds, cx
|
||||||
@@ -163,7 +163,6 @@ int80h:
|
|||||||
cmp cl, offset int80h_entries
|
cmp cl, offset int80h_entries
|
||||||
jge 0f
|
jge 0f
|
||||||
mov si, cx
|
mov si, cx
|
||||||
mov bp, sp
|
|
||||||
add bp, 16 # 10 for us, 6 for the interrupt
|
add bp, 16 # 10 for us, 6 for the interrupt
|
||||||
call cs:[int80h_table+si]
|
call cs:[int80h_table+si]
|
||||||
jmp 1f
|
jmp 1f
|
||||||
@@ -179,7 +178,7 @@ int80h:
|
|||||||
|
|
||||||
.section .rodata.int80h
|
.section .rodata.int80h
|
||||||
int80h_table:
|
int80h_table:
|
||||||
.word offset copy # 0x00
|
.word offset dummy # 0x00
|
||||||
.word offset readsector # 0x01
|
.word offset readsector # 0x01
|
||||||
.word offset writesector # 0x02
|
.word offset writesector # 0x02
|
||||||
.word offset formattrack # 0x03
|
.word offset formattrack # 0x03
|
||||||
@@ -187,5 +186,6 @@ int80h_table:
|
|||||||
.word offset recvpara # 0x05
|
.word offset recvpara # 0x05
|
||||||
.word offset sendpara # 0x06
|
.word offset sendpara # 0x06
|
||||||
.word offset xferpara # 0x07
|
.word offset xferpara # 0x07
|
||||||
|
.word offset writefile # 0x08
|
||||||
|
|
||||||
int80h_entries = . - int80h_table
|
int80h_entries = . - int80h_table
|
||||||
|
Reference in New Issue
Block a user