]> git.sur5r.net Git - cc65/blob - libsrc/runtime/ldeax.s
This commit was generated by cvs2svn to compensate for changes in r2,
[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
11 ldeax:  pla                     ; Low byte of return address
12         sta     ptr4
13         pla                     ; high byte of return address
14         sta     ptr4+1
15         ldy     #4              ; high byte of value
16         lda     (ptr4),y
17         sta     sreg+1
18         dey
19         lda     (ptr4),y
20         sta     sreg
21         dey
22         lda     (ptr4),y
23         tax
24         dey
25         lda     (ptr4),y
26         tay                     ; Save low byte
27         clc
28         lda     #4
29         adc     ptr4
30         sta     ptr4
31         lda     ptr4+1
32         adc     #$00
33         pha                     ; High byte of new return address
34         lda     ptr4
35         pha                     ; Low byte of new return address
36         tya                     ; Low byte of fetched value
37         rts
38