2 ; This must be the *second* file on the linker command line
3 ; (.cvt header must be the *first* one)
5 ; Maciej 'YTM/Elysium' Witkowiak
6 ; 26.10.99, 10.3.2000, 15.8.2001
11 .import initlib, donelib
16 ; ------------------------------------------------------------------------
17 ; Define and export the ZP variables for the C64 runtime
19 .exportzp sp, sreg, regsave, regbank
20 .exportzp ptr1, ptr2, ptr3, ptr4
21 .exportzp tmp1, tmp2, tmp3, tmp4
23 sp = $72 ; stack pointer
24 sreg = $74 ; secondary register/high 16 bit for longs
25 regsave = $76 ; slot to save/restore (E)AX into
35 regbank = $a3 ; 6 bytes hopefully not used by Kernal
37 ; ------------------------------------------------------------------------
39 ; .org $0400-508 ; $0400 - length of .cvt header
40 ; .include "cvthead.s"
44 ; ------------------------------------------------------------------------
45 ; Create an empty LOWCODE segment to avoid linker warnings
49 ; ------------------------------------------------------------------------
50 ; Place the startup code in a special segment.
63 sta sp+1 ; Set argument stack ptr
65 ; Call module constructors
69 ; Pass an empty command line
77 ldy #4 ; Argument size
78 jsr _main ; call the users code
79 jmp $c1c3 ; jump to GEOS MainLoop
81 ; Call module destructors. This is also the _exit entry which must be called
82 ; explicitly by the code.
84 _exit: jsr donelib ; Run module destructors
86 jmp $c22c ; EnterDeskTop