eris2010

Documentation: http://frombelow.net/projects/eris2010/
Clone: git clone https://git.frombelow.net/eris2010.git
Log | Files | Refs | README | LICENSE

crt0.s (1312B)


      1 	; Based on non/crt0.s from CC65 repository.
      2 	.setcpu "65C02"
      3 	.include "/usr/share/cc65/asminc/zeropage.inc"
      4 	.include "os.inc"
      5 .IFDEF SYMON
      6 	.include "../../../../eris2010/roms/os/ds_symon.l"
      7 	.include "../../../../eris2010/roms/os/os_symon.l"
      8 .ELSE
      9 	.include "../../../../eris2010/roms/os/ds.l"
     10 	.include "../../../../eris2010/roms/os/os.l"
     11 .ENDIF
     12 
     13 	.export         _exit
     14 	.export         __STARTUP__ : absolute = 1      ; Mark as startup
     15 	.export		initmainargs
     16 	.import         zerobss, _main
     17 	.import         initlib, donelib
     18 	.import         __STACKSTART__                  ; Linker generated
     19 	.import         __ERIS_STACK_START__                  ; Linker generated
     20 	.import pusha
     21 
     22 	.segment "STARTUP"
     23 
     24 	pha			; Application number
     25 	;; Set default IRQ handler
     26 	lda #<default_irq_handler
     27 	sta ram_end-1
     28 	lda #>default_irq_handler
     29 	sta ram_end
     30 	jsr init_acia		; Ready to communicate
     31 	;; Initialize CC65 parameter stack
     32 	lda #<__STACKSTART__
     33 	ldx #>__STACKSTART__
     34 	sta sp
     35 	stx sp+1
     36 	;; Initialize Eris 2010 OS data stack
     37 	lda #<__ERIS_STACK_START__
     38 	sta ptr			; Eris 2010 stack pointer imported from ds.l
     39 	lda #>__ERIS_STACK_START__
     40 	sta ptr+1
     41 	jsr zerobss
     42 	jsr initlib
     43 	pla			; Pass application number to main
     44 	jsr pusha
     45 	jsr _main
     46 _exit:	pha
     47 	jsr donelib
     48 	pla
     49 	jmp ($fffc)		; Reset
     50 	rts
     51 
     52 initmainargs:
     53 	rts