]> git.sur5r.net Git - cc65/blob - libsrc/runtime/ldeax.s
Remove bash pecularities.
[cc65] / libsrc / runtime / ldeax.s
1 ;
2 ; Ullrich von Bassewitz, 29.12.1999
3 ;
4 ; CC65 runtime: Load eax from immidiate value following the call
5 ;
6
7         .export         ldeax
8         .importzp       sreg, ptr4
9
10         .macpack        generic
11
12 ldeax:  pla                     ; Low byte of return address
13         sta     ptr4
14         pla                     ; high byte of return address
15         sta     ptr4+1
16         ldy     #4              ; high byte of value
17         lda     (ptr4),y
18         sta     sreg+1
19         dey
20         lda     (ptr4),y
21         sta     sreg
22         dey
23         lda     (ptr4),y
24         tax
25         dey
26         lda     (ptr4),y
27         tay                     ; Save low byte
28
29 ; Calculate the return address (remember: RTS address is one low) and
30 ; jump to it
31
32         lda     ptr4
33         add     #5
34         sta     ptr4
35         bcc     @L9
36         inc     ptr4+1
37 @L9:    tya                     ; restore low byte
38         jmp     (ptr4)