Added 'sim6502' and 'sim65C02' targets.
The targets allow to run cc65 programs in the sim65 exection einvironment. As there are no "real" i/o facilities there's no need for header files. Paravirtualized entry points are mapped to $FFF0 ff. There's a large cc65 progam area from $0200-$FFEF. The binary format includes a one-byte header indicating the required execution environment: The value 0 means 6502 and the value 1 means 65C02. The load adress for the binary is fixed to $0200. Note: Running sim65C02 programs currently doesn't work bcause sim65 doesn't actually implement 65C02 opcodes.
This commit is contained in:
32
libsrc/sim6502/crt0.s
Normal file
32
libsrc/sim6502/crt0.s
Normal file
@@ -0,0 +1,32 @@
|
||||
;
|
||||
; Oliver Schmidt, 2013-05-16
|
||||
;
|
||||
; Startup code for cc65 (sim6502 version)
|
||||
;
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.import zerobss, callmain
|
||||
.import initlib, donelib
|
||||
.import exit
|
||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||
.import __STACKSIZE__ ; Linker generated
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
cld
|
||||
ldx #$FF
|
||||
txs
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta sp
|
||||
stx sp+1
|
||||
jsr zerobss
|
||||
jsr initlib
|
||||
jsr callmain
|
||||
_exit: pha
|
||||
jsr donelib
|
||||
pla
|
||||
jsr exit
|
||||
Reference in New Issue
Block a user