JF Tetu schrieb:
> Hum, okay... Do you mind sharing your crt0.s ?
I've attached it, though I don't think it will be useful to you, since
it's for the ColecoVision video game console, which needs a special
header, so my ROM images start at 0x8000 with this crt0.s and the BIOS
reads some header data and then starts executing my program from start:
label.
Philipp
; crt0.s for Colecovision cart
.module crt0
.globl _main
.globl _cv_init
.globl _cv_nmi
.area _HEADER(ABS)
.org 0x8000
.db 0x55, 0xaa ; Title screen and 12 second delay -
swap 0x55 and 0xaa not to skip it.
.dw 0 ;
sprite table stuff? - rarely used by the BIOS as a pointer
.dw 0 ;
unknown - rarely used as a pointer to a single byte of RAM by the BIOS.
.dw 0 ;
unknown - frequently used in BIOS routines as a pointer to a memory location
(data is both written to and read from there, at least 124 bytes are used -
maybe this is where the bios routines store most of their data, though with the
common value of 0 this would be in the BIOS ROM itself - strange).
.dw 0 ;
unknown - rarely used as a pointer to a single byte of RAM by the BIOS.
.dw start ; where to
start execution of program.
ei ; RST 0x08
reti
ei ; RST 0x10
reti
ei ; RST 0x18
reti
ei ; RST 0x20
reti
ei ; RST 0x28
reti
ei ; RST 0x30
reti
ei ; RST 0x38 - spinner interrupt
reti
jp nmi ; NMI
nop
.ascii " / / NOT"
start:
ld sp, #0x73ff ; Set stack pointer to top of memory.
call gsinit ; Initialize global
variables.
call _cv_init ; Initialize Colecovision specific
stuff.
call _main
rst 0x0 ; Restart when main() returns.
;; Ordering of segments for the linker - copied from sdcc crt0.s
.area _HOME
.area _CODE
.area _GSINIT
.area _GSFINAL
.area _DATA
.area _BSS
.area _HEAP
.area _CODE
nmi: push af
push bc
push de
push hl
;push ix ; saved by callee
push iy
call _cv_nmi
pop iy
;pop ix
pop hl
pop de
pop bc
pop af
retn
.area _GSINIT
gsinit::
.area _GSFINAL
ret
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user