]> git.sur5r.net Git - cc65/blob - libsrc/geos/devel/crt0.s
This commit was generated by cvs2svn to compensate for changes in r2,
[cc65] / libsrc / geos / devel / crt0.s
1 ;
2 ; This must be the *second* file on the linker command line
3 ; (.cvt header must be the *first* one)
4
5 ; Maciej 'YTM/Alliance' Witkowiak
6 ; 26.10.99, 10.3.2000
7
8 ; no __hinit
9
10         .export         _exit
11         .import         pushax
12         .import         _main
13         .import         zerobss, doatexit
14
15 ; ------------------------------------------------------------------------
16 ; Define and export the ZP variables for the C64 runtime
17
18         .exportzp       sp, sreg, regsave, regbank
19         .exportzp       ptr1, ptr2, ptr3, ptr4
20         .exportzp       tmp1, tmp2, tmp3, tmp4
21
22 sp      =       $72             ; stack pointer
23 sreg    =       $74             ; secondary register/high 16 bit for longs
24 regsave =       $76             ; slot to save/restore (E)AX into
25 ptr1    =       $7A             ;
26 ptr2    =       $7C
27 ptr3    =       $7E
28 ptr4    =       $70
29 tmp1    =       $fb
30 tmp2    =       $fc
31 tmp3    =       $fd
32 tmp4    =       $fe
33
34 regbank =       $a3             ; 6 bytes hopefully not used by Kernal
35
36 ; ------------------------------------------------------------------------
37
38 ;       .org $0400-508          ; $0400 - length of .cvt header
39 ;       .include "cvthead.s"
40
41         .reloc
42
43 ; ------------------------------------------------------------------------
44 ; Actual code
45
46 ; Clear the BSS data
47
48         jsr     zerobss
49
50 ; Setup stack
51
52         lda     #<$7900
53         sta     sp
54         lda     #>$7900
55         sta     sp+1            ; Set argument stack ptr
56
57 ; Initialize the heap
58
59 ;;!     jsr     __hinit
60
61 ; Pass an empty command line
62
63         lda     #0
64         tax
65         jsr     pushax          ; argc
66         jsr     pushax          ; argv
67
68         ldy     #4              ; Argument size
69         jsr     _main           ; call the users code
70         jmp     $c1c3           ; jump to GEOS MainLoop
71
72 ; exit must be called from the code!
73
74 _exit:  
75         jsr     doatexit        ; call exit functions
76
77         jmp     $c22c           ; EnterDeskTop