1985-03-18 12:46:51 +00:00
|
|
|
.define .ror4
|
1987-01-28 18:57:04 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
.sect .text
|
1985-03-18 12:46:51 +00:00
|
|
|
|
|
|
|
! Rotate 4 bytes right
|
|
|
|
! Expects in de-reg: number of rotates
|
|
|
|
! Expects on stack: operand
|
|
|
|
! Yields on stack: result
|
|
|
|
|
1987-01-28 22:23:14 +00:00
|
|
|
.ror4: pop h
|
1985-03-18 12:46:51 +00:00
|
|
|
shld .retadr
|
|
|
|
mov h,b
|
|
|
|
mov l,c
|
|
|
|
shld .bcreg
|
|
|
|
|
1987-01-28 22:54:52 +00:00
|
|
|
pop h ! low-order bytes of operand
|
1985-03-18 12:46:51 +00:00
|
|
|
pop b ! high order bytes of operand
|
|
|
|
|
|
|
|
mov a,e
|
|
|
|
ani 31
|
|
|
|
jz 2f
|
|
|
|
mov e,a
|
|
|
|
|
|
|
|
mov a,l
|
2017-12-07 22:16:21 +00:00
|
|
|
1: rar
|
|
|
|
mov a,b
|
1985-03-18 12:46:51 +00:00
|
|
|
rar
|
|
|
|
mov b,a
|
|
|
|
mov a,c
|
|
|
|
rar
|
|
|
|
mov c,a
|
|
|
|
mov a,h
|
|
|
|
rar
|
|
|
|
mov h,a
|
|
|
|
mov a,l
|
|
|
|
rar
|
|
|
|
mov l,a
|
|
|
|
|
|
|
|
dcr e
|
|
|
|
jnz 1b ! keep looping
|
|
|
|
|
|
|
|
2: push b
|
|
|
|
push h
|
|
|
|
|
|
|
|
lhld .bcreg
|
|
|
|
mov b,h
|
|
|
|
mov c,l
|
|
|
|
lhld .retadr
|
|
|
|
pchl
|