mirror of
https://github.com/cc65/cc65.git
synced 2024-11-17 09:07:32 +00:00
806ffe5675
Tested on real KIM-1 hardware. read.s: - Remove commented out line. - Remove unused check for bell character. - Remove echo of newline (hardware always echoes entered characters). - This fixes gets() and fgets() so they return when CR is entered. write.s: - Fix check for adding return after linefeed (failed to work because OUTCHR changes A) - Remove unused check for bell character. kim1.inc: - Add symbol for monitor entry crt0.s: - Jump to KIM-1 monitor by address rather than using BRK (which relies on vector being set in RAM)
46 lines
1.1 KiB
ArmAsm
46 lines
1.1 KiB
ArmAsm
;
|
|
; Startup code for cc65 (KIM-1 version)
|
|
;
|
|
|
|
.export _init, _exit
|
|
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
|
|
|
.import _main
|
|
.import initlib, donelib, copydata, zerobss
|
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
|
.import __STACKSIZE__ ; Linker generated
|
|
|
|
.include "zeropage.inc"
|
|
.include "kim1.inc"
|
|
|
|
|
|
; Place the startup code in a special segment
|
|
|
|
.segment "STARTUP"
|
|
|
|
|
|
; A little light housekeeping
|
|
|
|
_init: cld ; Clear decimal mode
|
|
|
|
; Set cc65 argument stack pointer
|
|
|
|
lda #<(__RAM_START__ + __RAM_SIZE__)
|
|
sta sp
|
|
lda #>(__RAM_START__ + __RAM_SIZE__)
|
|
sta sp+1
|
|
|
|
; Initialize memory storage
|
|
|
|
jsr zerobss ; Clear BSS segment
|
|
jsr copydata ; Initialize DATA segment
|
|
jsr initlib ; Run constructors
|
|
|
|
; Call main()
|
|
|
|
jsr _main
|
|
|
|
; Back from main (this is also the _exit entry). Jumps to the KIM-1 monitor.
|
|
|
|
_exit: jmp START
|