]> git.sur5r.net Git - cc65/blob - libsrc/runtime/land.s
few 6502 and some 65SC02 optimizations
[cc65] / libsrc / runtime / land.s
1 ;
2 ; Ullrich von Bassewitz, 06.08.1998
3 ; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
4 ;
5 ; CC65 runtime: and on longs
6 ;
7
8         .export         tosand0ax, tosandeax
9         .import         addysp1
10         .importzp       sp, sreg, tmp1
11
12         .macpack        cpu
13                                    
14 tosand0ax:
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 tosandeax:
25 .if (.cpu .bitand ::CPU_ISET_65SC02)
26         and     (sp)            ; byte 0
27         ldy     #1
28 .else
29         ldy     #0
30         and     (sp),y          ; byte 0
31         iny
32 .endif        
33         sta     tmp1
34         txa
35         and     (sp),y          ; byte 1
36         tax
37         iny
38         lda     sreg
39         and     (sp),y          ; byte 2
40         sta     sreg
41         iny
42         lda     sreg+1
43         and     (sp),y          ; byte 3
44         sta     sreg+1
45
46         lda     tmp1
47         jmp     addysp1
48