ack/mach/6500/libem/ror.s

31 lines
502 B
ArmAsm
Raw Normal View History

1984-12-17 11:03:13 +00:00
.define Ror
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 right a integer twobyte word.
! The number of rotates is in X.
! The result is returned in registerpair AX.
Ror:
txa
bne 1f ! a zero rotate just return input
jmp Pop
1: tay
jsr Pop ! get word
stx Ytmp ! save lowbyte
2: clc
ror a ! rotate highbyte
ror Ytmp ! rotate lowbyte
bcc 1f ! no carry
ora #80h ! put carry in leftmost bit
1: dey
bne 2b
ldx Ytmp ! get lowbyte
rts