Add KIM-1 Support

This commit is contained in:
Dave Plummer
2022-06-04 13:00:48 -07:00
parent 30dc9b8d1a
commit 799aec23a6
18 changed files with 425 additions and 1 deletions

47
libsrc/kim1/crt0.s Normal file
View File

@@ -0,0 +1,47 @@
;
; 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). There may be a more elegant way to9
; return to the monitor on the Kim-1, but I don't know it!
_exit: brk