]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lxor.s
few 6502 and some 65SC02 optimizations
[cc65] / libsrc / runtime / lxor.s
1 ;
2 ; Ullrich von Bassewitz, 06.08.1998
3 ; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
4 ;
5 ; CC65 runtime: xor on longs
6 ;
7
8         .export         tosxor0ax, tosxoreax
9         .import         addysp1
10         .importzp       sp, sreg, tmp1
11
12         .macpack        cpu
13
14 tosxor0ax:
15 .if (.cpu .bitand ::CPU_ISET_65SC02)
16         stz     sreg
17         stz     sreg+1
18 .else
19         ldy     #$00
20         sty     sreg
21         sty     sreg+1
22 .endif
23
24 tosxoreax:
25 .if (.cpu .bitand ::CPU_ISET_65SC02)
26         eor     (sp)            ; byte 0
27         ldy     #1
28 .else                         
29         ldy     #0
30         eor     (sp),y          ; byte 0
31         iny
32 .endif
33         sta     tmp1
34         txa
35         eor     (sp),y          ; byte 1
36         tax
37         iny
38         lda     sreg
39         eor     (sp),y          ; byte 2
40         sta     sreg
41         iny
42         lda     sreg+1
43         eor     (sp),y          ; byte 3
44         sta     sreg+1
45
46         lda     tmp1
47         jmp     addysp1
48
49
50