1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-14 05:05:45 +00:00
cc65/libsrc/geos/devel/crt0.s
izydorst 2edcb9d73b fixes in structs, added common cc65 color definitions, cgetc laces cursor in
correct line, interrupts are enabled before jumping into _main


git-svn-id: svn://svn.cc65.org/cc65/trunk@1217 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-04-06 17:37:12 +00:00

81 lines
1.6 KiB
ArmAsm

;
; This must be the *second* file on the linker command line
; (.cvt header must be the *first* one)
; Maciej 'YTM/Elysium' Witkowiak
; 26.10.99, 10.3.2000, 15.8.2001
; no __hinit
.export _exit
.import initlib, donelib
.import pushax
.import _main
.import zerobss
; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime
.exportzp sp, sreg, regsave, regbank
.exportzp ptr1, ptr2, ptr3, ptr4
.exportzp tmp1, tmp2, tmp3, tmp4
sp = $72 ; stack pointer
sreg = $74 ; secondary register/high 16 bit for longs
regsave = $76 ; slot to save/restore (E)AX into
ptr1 = $7A ;
ptr2 = $7C
ptr3 = $7E
ptr4 = $70
tmp1 = $fb
tmp2 = $fc
tmp3 = $fd
tmp4 = $fe
regbank = $a3 ; 6 bytes hopefully not used by Kernal
; ------------------------------------------------------------------------
; .org $0400-508 ; $0400 - length of .cvt header
; .include "cvthead.s"
.reloc
; ------------------------------------------------------------------------
; Actual code
; Clear the BSS data
jsr zerobss
; Setup stack
lda #<$6000
sta sp
lda #>$6000
sta sp+1 ; Set argument stack ptr
; Call module constructors
jsr initlib
; Pass an empty command line
lda #0
tax
jsr pushax ; argc
jsr pushax ; argv
cli
ldy #4 ; Argument size
jsr _main ; call the users code
jmp $c1c3 ; jump to GEOS MainLoop
; Call module destructors. This is also the _exit entry which must be called
; explicitly by the code.
_exit: jsr donelib ; Run module destructors
jmp $c22c ; EnterDeskTop