1984-12-17 11:03:13 +00:00
|
|
|
.define Ror4
|
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 fourbyte word.
|
|
|
|
! The number of rotates is in X.
|
|
|
|
|
|
|
|
|
|
|
|
Ror4:
|
|
|
|
txa
|
|
|
|
bne 1f ! a zero rotate skip
|
|
|
|
rts
|
|
|
|
1: tay
|
|
|
|
jsr Pop
|
|
|
|
stx ARTH
|
|
|
|
sta ARTH+1
|
|
|
|
jsr Pop
|
|
|
|
stx ARTH+2
|
|
|
|
sta ARTH+3
|
|
|
|
2: lsr ARTH+3 ! rotate word
|
|
|
|
ror ARTH+2
|
|
|
|
ror ARTH+1
|
|
|
|
ror ARTH
|
|
|
|
bcc 1f ! no carry
|
1988-08-19 17:05:03 +00:00
|
|
|
lda #0x80 ! put carry in leftmost bit
|
1984-12-17 11:03:13 +00:00
|
|
|
ora ARTH+3
|
|
|
|
sta ARTH+3
|
|
|
|
1: dey
|
|
|
|
bne 2b
|
|
|
|
lda ARTH+3
|
|
|
|
ldx ARTH+2
|
|
|
|
jsr Push
|
|
|
|
lda ARTH+1
|
|
|
|
ldx ARTH
|
|
|
|
jmp Push ! push result onto the stack
|
|
|
|
|
|
|
|
|