ack/mach/6500/libem/xor.s

36 lines
710 B
ArmAsm
Raw Permalink Normal View History

1984-12-17 11:03:13 +00:00
.define Xor
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 performs the exclusive or on two groups of bytes.
! The groups consists of atmost 254 bytes.
! The result is on top of the stack.
Xor:
lda SP+1
sta ADDR+1 ! address of first group (lowbyte)
lda SP+2
sta ADDR ! address of first group (highbyte)
clc
tya
adc SP+2
sta SP+2 ! new stackpointer (lowbyte)
sta ADDR+2 ! address of second group (lowbyte)
lda #0
adc SP+1
sta SP+1 ! new stackpointer (highbyte)
sta ADDR+3 ! address of second group (highbyte)
1: dey
lda (ADDR),y ! get byte first group
eor (ADDR+2),y ! exclusive or with byte second group
sta (ADDR+2),y ! restore result
tya
bne 1b
rts