a1d1f38691
EM instructions _rol_ and _ror_ do rotate an integer left or right. Our compilers and optimizers never emit _rol_ nor _ror_, but I might want to use them in the future. Add _rol_ and _ror_ to powerpc. Fix `rol 4` and `ror 4` in both i80 and i86, where the rules for `rol 4` and `ror 4` seem to have never been tested until now.
53 lines
569 B
ArmAsm
53 lines
569 B
ArmAsm
.define .rol4
|
|
.sect .text
|
|
.sect .rom
|
|
.sect .data
|
|
.sect .bss
|
|
.sect .text
|
|
|
|
! Rotate 4 bytes left
|
|
! Expects in de-reg: number of rotates
|
|
! Expects on stack: operand
|
|
! Yields on stack: result
|
|
|
|
.rol4: pop h
|
|
shld .retadr
|
|
mov h,b
|
|
mov l,c
|
|
shld .bcreg
|
|
|
|
pop h ! low-order bytes of operand
|
|
pop b ! high order bytes of operand
|
|
|
|
mov a,e
|
|
ani 31
|
|
jz 2f
|
|
mov e,a
|
|
|
|
mov a,b
|
|
1: ral
|
|
mov a,l
|
|
ral
|
|
mov l,a
|
|
mov a,h
|
|
ral
|
|
mov h,a
|
|
mov a,c
|
|
ral
|
|
mov c,a
|
|
mov a,b
|
|
ral
|
|
mov b,a
|
|
|
|
dcr e
|
|
jnz 1b ! keep looping
|
|
|
|
2: push b
|
|
push h
|
|
|
|
lhld .bcreg
|
|
mov b,h
|
|
mov c,l
|
|
lhld .retadr
|
|
pchl
|