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
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _exit
|
|
|
|
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
|
|
|
.import __STACKADDR__, __STACKSIZE__ ; Linker generated
|
|
|
|
.import __BACKBUFSIZE__ ; Linker generated
|
|
|
|
.import initlib, donelib
|
|
|
|
.import callmain
|
|
|
|
.import zerobss
|
|
|
|
.importzp sp
|
|
|
|
|
|
|
|
.include "jumptab.inc"
|
|
|
|
.include "geossym.inc"
|
|
|
|
.include "const.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.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.segment "STARTUP"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-28 21:24:17 +00:00
|
|
|
; GEOS 64/128 initializes the screen before starting an application while
|
|
|
|
; Apple GEOS does not. In order to provide identical startup conditions
|
|
|
|
; we initialize the screen here on Apple GEOS. For the same reason we set
|
|
|
|
; the pattern and dispBufferOn even on GEOS 64/128 although we don't use
|
|
|
|
; them here.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #2 ; Checkerboard pattern
|
|
|
|
jsr SetPattern
|
|
|
|
lda #<(ST_WR_FORE | .MIN (ST_WR_BACK, __BACKBUFSIZE__))
|
|
|
|
sta dispBufferOn
|
2012-02-28 21:24:17 +00:00
|
|
|
.ifdef __GEOS_APPLE__
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr i_Rectangle
|
|
|
|
.byte 0
|
|
|
|
.byte SC_PIX_HEIGHT-1
|
|
|
|
.word 0
|
|
|
|
.word SC_PIX_WIDTH-1
|
2012-02-28 21:24:17 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
; Clear the BSS data.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr zerobss
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-28 21:24:17 +00:00
|
|
|
; Setup stack.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #<(__STACKADDR__ + __STACKSIZE__)
|
|
|
|
ldx #>(__STACKADDR__ + __STACKSIZE__)
|
|
|
|
sta sp
|
|
|
|
stx sp+1
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-28 21:24:17 +00:00
|
|
|
; Call module constructors.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr initlib
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-02-28 21:24:17 +00:00
|
|
|
; Push arguments and call main().
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
cli
|
|
|
|
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
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
_exit: jsr donelib
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jmp EnterDeskTop ; Return control to the system
|