Added STS and LOS routines

This commit is contained in:
ceriel 1989-01-18 10:51:57 +00:00
parent 7c39967dc5
commit 6420525753
2 changed files with 22 additions and 6 deletions

View file

@ -1,15 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss .sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text .sect .text
.define .loi .define .loi
.define .los
! #bytes in cx ! #bytes in cx
! address in bx ! address in bx
! save si/di. they might be register variables ! save si/di. they might be register variables
.loi: .los:
pop ax
mov dx,si mov dx,si
mov si,bx mov si,bx
mov bx,ax pop bx
mov ax,cx mov ax,cx
sar cx,1 sar cx,1
jnb 1f jnb 1f
@ -20,6 +20,16 @@
jmp bx jmp bx
1: 1:
sub sp,ax sub sp,ax
jmp 1f
.loi:
! only called with size > 4
mov dx,si
mov si,bx
pop bx
sub sp,cx
sar cx,1
1:
mov ax,di mov ax,di
mov di,sp mov di,sp
rep movs rep movs

View file

@ -1,21 +1,27 @@
.sect .text; .sect .rom; .sect .data; .sect .bss .sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text .sect .text
.define .sti .define .sti
.define .sts
! #bytes in cx ! #bytes in cx
! address in bx ! address in bx
! save di/si. they might be register variables ! save di/si. they might be register variables
.sti: .sts:
mov dx,di ! save di mov dx,di ! save di
pop ax ! return address
mov di,bx mov di,bx
mov bx,ax pop bx
sar cx,1 sar cx,1
jnb 1f jnb 1f
pop ax pop ax
stosb stosb
mov di,dx mov di,dx
jmp bx jmp bx
.sti:
! only called with count > 4
mov dx,di
mov di,bx
pop bx
sar cx,1
1: 1:
mov ax,si mov ax,si
mov si,sp mov si,sp