2 .export __STARTUP__ : absolute = 1 ; Mark as startup
4 .import initlib, donelib, callmain
5 .import push0, _main, zerobss, copydata
9 ; Linker generated symbols
10 .import __RAM_START__, __RAM_SIZE__
11 .import __ROM_START__, __ROM_SIZE__
12 .import __STARTUP_LOAD__,__STARTUP_RUN__, __STARTUP_SIZE__
13 .import __CODE_LOAD__,__CODE_RUN__, __CODE_SIZE__
14 .import __RODATA_LOAD__,__RODATA_RUN__, __RODATA_SIZE__
16 .include "zeropage.inc"
21 .word 0 ; +00 checksum from 7000-7fff (simple 8bit adds)
22 .byte 1, 0, 1 ; +02 flags
23 .byte "COPYRIGHT BIT CORPORATION", 0, $ff ; +05 copyright
25 jmp reset ; +20 reset entry
26 jmp nmi ; +23 nmi entry
27 jmp IRQStub ; +26 irq entry (135 hz)
29 ;-------------------------------------------------------------------------------
31 ; setup the CPU and System-IRQ
37 ; Setup stack and memory mapping
38 ldx #$FF ; Stack top ($01FF)
44 ; Copy the .data segment to RAM
48 lda #<(__RAM_START__+__RAM_SIZE__)
50 lda #>(__RAM_START__+__RAM_SIZE__)
53 ; Call module constructors
56 cli ; allow IRQ only after constructors have run
58 ; Pass an empty command line
62 ldy #4 ; Argument size
63 jsr _main ; call the users code
65 ; Call module destructors. This is also the _exit entry.
67 jsr donelib ; Run module destructors
76 ;-------------------------------------------------------------------------------