2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; This must be the *second* file on the linker command line
|
|
|
|
; (.cvt header must be the *first* one)
|
|
|
|
|
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
|
|
|
|
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
|
2000-05-28 13:40:48 +00:00
|
|
|
.import pushax
|
|
|
|
.import _main
|
2002-12-23 22:14:14 +00:00
|
|
|
.import _MainLoop, _EnterDeskTop
|
2000-11-22 22:19:09 +00:00
|
|
|
.import zerobss
|
2002-12-23 22:14:14 +00:00
|
|
|
.importzp sp
|
|
|
|
.export _exit
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
2002-12-16 09:30:52 +00:00
|
|
|
; Create an empty LOWCODE segment to avoid linker warnings
|
|
|
|
|
|
|
|
.segment "LOWCODE"
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; 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
|
|
|
|
|
|
|
; Pass an empty command line
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
tax
|
|
|
|
jsr pushax ; argc
|
|
|
|
jsr pushax ; argv
|
|
|
|
|
2002-04-06 17:37:12 +00:00
|
|
|
cli
|
2000-05-28 13:40:48 +00:00
|
|
|
ldy #4 ; Argument size
|
|
|
|
jsr _main ; call the users code
|
2002-12-23 22:14:14 +00:00
|
|
|
jmp _MainLoop ; jump to GEOS MainLoop
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-11-22 22:19:09 +00:00
|
|
|
; Call module destructors. This is also the _exit entry which must be called
|
|
|
|
; explicitly by the code.
|
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
|
|
|
|
2002-12-23 22:14:14 +00:00
|
|
|
jmp _EnterDeskTop ; return control to the system
|