]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lsubeq.s
Renamed module, part of code no longer needed
[cc65] / libsrc / runtime / lsubeq.s
1 ;
2 ; Ullrich von Bassewitz, 07.04.2000
3 ;
4 ; CC65 runtime: -= operator
5 ;
6 ; On entry, the low byte of the address of the variable to decrement is
7 ; in ptr1, the high byte is in Y, and the decrement is in eax.
8 ;
9
10         .export         lsubeq1, lsubeqa, lsubeq
11         .importzp       sreg, ptr1, tmp1
12
13
14 lsubeq1:
15         lda     #$01
16
17 lsubeqa:
18         ldx     #$00
19         stx     sreg
20         stx     sreg+1
21
22 lsubeq: sty     ptr1+1                  ; Store high byte of address
23         ldy     #$00                    ; Address low byte
24         sec
25
26         sta     tmp1
27         lda     (ptr1),y                ; Load byte 0
28         sbc     tmp1
29         sta     (ptr1),y
30         pha                             ; Save byte 0 of result for later
31
32         iny                             ; Address byte 1
33         stx     tmp1
34         lda     (ptr1),y                ; Load byte 1
35         sbc     tmp1
36         sta     (ptr1),y
37         tax
38
39         iny                             ; Address byte 2
40         lda     (ptr1),y
41         sbc     sreg
42         sta     (ptr1),y
43         sta     sreg
44
45         iny                             ; Address byte 3
46         lda     (ptr1),y
47         sbc     sreg+1
48         sta     (ptr1),y
49         sta     sreg+1
50
51         pla                             ; Retrieve byte 0 of result
52
53         rts                             ; Done
54
55
56
57