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 ; ------------------------------------------------------------------------
56 sta sp+1 ; Set argument stack ptr
58 ; Call module constructors
62 ; Pass an empty command line
70 ldy #4 ; Argument size
71 jsr _main ; call the users code
72 jmp $c1c3 ; jump to GEOS MainLoop
74 ; Call module destructors. This is also the _exit entry which must be called
75 ; explicitly by the code.
77 _exit: jsr donelib ; Run module destructors
79 jmp $c22c ; EnterDeskTop