2000-05-28 13:40:48 +00:00
|
|
|
;
|
2009-07-31 12:46:38 +00:00
|
|
|
; Startup code for geos
|
|
|
|
;
|
2001-08-15 16:08:15 +00:00
|
|
|
; Maciej 'YTM/Elysium' Witkowiak
|
2002-12-23 22:14:14 +00:00
|
|
|
; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
.export _exit
|
|
|
|
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
|
|
|
.import __VLIR0_START__, __VLIR0_SIZE__ ; Linker generated
|
|
|
|
.import __STACKSIZE__ ; Linker generated
|
|
|
|
.import initlib, donelib
|
|
|
|
.import callmain
|
|
|
|
.import zerobss
|
|
|
|
.importzp sp
|
2009-07-31 12:46:38 +00:00
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
.include "jumptab.inc"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2002-12-16 09:30:52 +00:00
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; Place the startup code in a special segment.
|
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
.segment "STARTUP"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Clear the BSS data
|
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
jsr zerobss
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Setup stack
|
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
lda #<(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
|
|
|
|
sta sp
|
|
|
|
lda #>(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
|
|
|
|
sta sp+1 ; Set argument stack ptr
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-11-22 22:19:09 +00:00
|
|
|
; Call module constructors
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
jsr initlib
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-03-10 21:21:46 +00:00
|
|
|
; Push arguments and call main()
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2002-04-06 17:37:12 +00:00
|
|
|
cli
|
2012-02-08 16:56:54 +00:00
|
|
|
jsr callmain
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-04-17 10:05:21 +00:00
|
|
|
; Call module destructors.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
_exit: jsr donelib ; Run module destructors
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-08 16:56:54 +00:00
|
|
|
jmp EnterDeskTop ; return control to the system
|