ack/mach/i80/libem/sli4.s
1985-03-18 12:46:51 +00:00

46 lines
522 B
ArmAsm

.define .sli4
! Shift 32 bits integer left
! Expects on stack: number of shifts
! number to be shifted
! Yields on stack: result
.sli4:
pop h
shld .retadr
mov h,b
mov l,c
shld .bcreg
pop b !number of shifts
pop d !low-order bytes of number to be shifted
pop h !high-order bytes
mov a,b !if bc>=32 return 0
ora a
jnz 2f
mov a,c
cpi 32
jnc 2f
1: dcr c
jm 3f
dad h
xchg
dad h
xchg
jnc 1b
inx h
jmp 1b
2: lxi h,0
lxi d,0
3: push h
push d
lhld .bcreg
mov b,h
mov c,l
lhld .retadr
pchl