4 ; Originally by Bastian Schick
5 ; http://www.geocities.com/SiliconValley/Byte/4242/lynx/
7 ; Ported to cc65 (http://www.cc65.org) by
8 ; Shawn Jefferson, June 2004
12 ; Startup code for cc65 (Lynx version). Based on Atari 8-bit startup
13 ; code structure. The C stack is located at the end of the RAM memory
14 ; segment and grows downward. Bastian Schick's executable header is put
15 ; on the front of the fully linked binary (see EXEHDR segment.)
20 .export __STARTUP__ : absolute = 1 ; Mark as startup
22 .import callirq, initlib, donelib
26 .import __INTERRUPTOR_COUNT__
27 .import __RAM_START__, __RAM_SIZE__, __STACKSIZE__
29 .include "zeropage.inc"
32 ; ------------------------------------------------------------------------
33 ; Mikey and Suzy init data, reg offsets and data
37 SuzyInitReg: .byte $28,$2a,$04,$06,$92,$83,$90
38 SuzyInitData: .byte $7f,$7f,$00,$00,$24,$f3,$01
40 MikeyInitReg: .byte $00,$01,$08,$09,$20,$28,$30,$38,$44,$50,$8a,$8b,$8c,$92,$93
41 MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$29
44 ; ------------------------------------------------------------------------
61 ; disable all timer interrupts
72 ; disable TX/RX IRQ, set to 8E1
77 ; clear all pending interrupts
84 lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
86 lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
91 ldx #.sizeof(MikeyInitReg)-1
92 mloop: ldy MikeyInitReg,x
98 ; these are RAM-shadows of read only regs
109 ldx #.sizeof(SuzyInitReg)-1
110 sloop: ldy SuzyInitReg,x
123 ; If we have IRQ functions, set the IRQ vector
124 ; as Lynx is a console there is not much point in releasing the IRQ
126 lda #<__INTERRUPTOR_COUNT__
135 ; Call module constructors
139 ; Push arguments and call main
143 ; Call module destructors. This is also the _exit entry.
145 _exit: jsr donelib ; Run module destructors