ack/mach/6500/libem/rol.s

32 lines
508 B
ArmAsm
Raw Permalink Normal View History

1984-12-17 11:03:13 +00:00
.define Rol
1987-01-30 18:41:42 +00:00
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
1984-12-17 11:03:13 +00:00
! This subroutine rotates left an integer n times
! N is in register X.
! The result is returned in registerpair AX.
Rol:
txa
bne 1f
jmp Pop ! zero rotate return input
1: tay ! Y contains number of rotates
jsr Pop
stx Ytmp ! save lowbyte
2: clc
rol Ytmp ! rotate lowbyte
rol a ! rotate highbyte
bcc 1f ! no carry
inc Ytmp ! put carry in rightmost bit
1: dey
bne 2b
ldx Ytmp ! store lowbyte in X
rts