1
0
mirror of https://github.com/cc65/cc65.git synced 2024-10-31 04:04:49 +00:00
cc65/libsrc/osic1p/crt0.s
Oliver Schmidt d8c31cf1d3 Renamed RAM to MAIN for all disk based targets.
The name RAM doesn't make much sense in general for a memeory area because i.e. the zero page is for sure RAM but is not part of the memory area named RAM.

For disk based targets it makes sense to put the disk file more into focus and here MAIN means the main part of the file - in contrast to some header.

Only for ROM based targets the name RAM is kept as it makes sense to focus on the difference between RAM and ROM.
2016-03-07 01:28:55 +01:00

56 lines
1.7 KiB
ArmAsm

; ---------------------------------------------------------------------------
; crt0.s
; ---------------------------------------------------------------------------
;
; Startup code for Ohio Scientific Challenger 1P
.export _init, _exit
.import _main
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import __MAIN_START__, __MAIN_SIZE__ ; Linker generated
.import __STACKSIZE__
.import zerobss, initlib, donelib
.include "zeropage.inc"
.include "extzp.inc"
.include "osic1p.inc"
; ---------------------------------------------------------------------------
; Place the startup code in a special segment
.segment "STARTUP"
; ---------------------------------------------------------------------------
; A little light 6502 housekeeping
_init: ldx #$FF ; Initialize stack pointer to $01FF
txs
cld ; Clear decimal mode
; ---------------------------------------------------------------------------
; Set cc65 argument stack pointer
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp
stx sp+1
; ---------------------------------------------------------------------------
; Initialize memory storage
jsr zerobss ; Clear BSS segment
jsr initlib ; Run constructors
; ---------------------------------------------------------------------------
; Call main()
jsr _main
; ---------------------------------------------------------------------------
; Back from main (this is also the _exit entry):
_exit: jsr donelib ; Run destructors
jmp RESET ; Display boot menu after program exit