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
|
|
|
|
2009-07-31 12:46:38 +00:00
|
|
|
.export _exit
|
|
|
|
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
|
|
|
|
2002-12-23 22:14:14 +00:00
|
|
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
2000-11-22 22:19:09 +00:00
|
|
|
.import initlib, donelib
|
2003-03-10 21:21:46 +00:00
|
|
|
.import callmain
|
2000-11-22 22:19:09 +00:00
|
|
|
.import zerobss
|
2002-12-23 22:14:14 +00:00
|
|
|
.importzp sp
|
2003-04-17 10:13:01 +00:00
|
|
|
.include "../inc/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.
|
|
|
|
|
|
|
|
.segment "STARTUP"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Clear the BSS data
|
|
|
|
|
|
|
|
jsr zerobss
|
|
|
|
|
|
|
|
; Setup stack
|
|
|
|
|
2002-12-23 22:14:14 +00:00
|
|
|
lda #<(__RAM_START__ + __RAM_SIZE__)
|
2000-05-28 13:40:48 +00:00
|
|
|
sta sp
|
2002-12-23 22:14:14 +00:00
|
|
|
lda #>(__RAM_START__ + __RAM_SIZE__)
|
2000-05-28 13:40:48 +00:00
|
|
|
sta sp+1 ; Set argument stack ptr
|
|
|
|
|
2000-11-22 22:19:09 +00:00
|
|
|
; Call module constructors
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-11-22 22:19:09 +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
|
2003-03-10 21:21:46 +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
|
|
|
|
2000-11-22 22:19:09 +00:00
|
|
|
_exit: jsr donelib ; Run module destructors
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-04-17 10:13:01 +00:00
|
|
|
jmp EnterDeskTop ; return control to the system
|