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
|
1988-08-19 17:05:03 +00:00
|
|
|
ora #0x80 ! put carry in leftmost bit
|
1984-12-17 11:03:13 +00:00
|
|
|
1: dey
|
|
|
|
bne 2b
|
|
|
|
ldx Ytmp ! get lowbyte
|
|
|
|
rts
|
|
|
|
|
|
|
|
|