]> git.sur5r.net Git - cc65/blob - libsrc/runtime/subysp.s
Fixed a bug and - while doing so - made it somewhat shorter.
[cc65] / libsrc / runtime / subysp.s
1 ;
2 ; Ullrich von Bassewitz, 25.10.2000
3 ;
4 ; CC65 runtime: Decrement the stackpointer by value in y
5 ;
6
7         .export         subysp
8         .importzp       sp, tmp1
9
10 .proc   subysp
11
12         pha                     ; Save A
13         sty     tmp1            ; Save the value
14         lda     sp              ; Get lo byte
15         sec
16         sbc     tmp1            ; Subtract y value
17         sta     sp              ; Put result back
18         bcs     @L1
19         dec     sp+1
20 @L1:    pla                     ; Restore A
21         rts                     ; Done
22
23 .endproc
24
25
26
27
28