/usr/share/z88dk/lib/nc100_crt0.asm is in z88dk-data 1.8.ds1-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | ; Kludgey startup for nc100
;
; djm 17/4/2000
;
; I've never used one of these brutes so I dunno if it's
; correct at all, this is all taken from the file nciospec.doc
; on nvg.unit.no, I assume that the PCMCIA RAM card is an
; actual fact addressable RAM and we can overwrite variables
; etc NB. Values of static variables are not reinitialised on
; future entry.
;
; $Id: nc100_crt0.asm,v 1.6 2007/06/27 20:49:27 dom Exp $
;
MODULE nc100_crt0
;--------
; Include zcc_opt.def to find out some info
;--------
INCLUDE "zcc_opt.def"
;--------
; Some scope definitions
;--------
XREF _main ;main() is always external to crt0 code
XDEF cleanup ;jp'd to by exit()
XDEF l_dcal ;jp(hl)
XDEF _std_seed ;Integer rand() seed
XDEF _vfprintf ;jp to the printf() core
XDEF exitsp ;atexit() variables
XDEF exitcount
XDEF heaplast ;Near malloc heap variables
XDEF heapblocks
XDEF __sgoioblk ;stdio info block
XDEF base_graphics ;Graphical variables
XDEF coords
org $C000
jp start
defs 509 ;Waste 509 bytes of space
;--------
; Card header
;--------
defm "NC100PRG"
defb 0,0,0,0,0,0,0,0
jp start ;c210
defm "z88dk NC100"
defb 0,0
.start ;Entry point at $c2220
ld (start+1),sp ;Save entry sp
ld hl,-64 ;Create the atexit stack
add hl,sp
ld sp,hl
ld (exitsp),sp
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
; Set up the std* stuff so we can be called again
ld hl,__sgoioblk+2
ld (hl),19 ;stdin
ld hl,__sgoioblk+6
ld (hl),21 ;stdout
ld hl,__sgoioblk+10
ld (hl),21 ;stderr
ENDIF
ENDIF
call _main ;Call user code
.cleanup
push hl
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
LIB closeall ;Close all opened files
call closeall
ENDIF
ENDIF
exx ;???? Hangover from ZX code?
ld hl,10072
exx
pop bc
.start1 ld sp,0
ret
.l_dcal jp (hl)
; Now, define some values for stdin, stdout, stderr
.__sgoioblk
IF DEFINED_ANSIstdio
INCLUDE "#stdio_fp.asm"
ENDIF
;-------
; Now, which of the vfprintf routines do we need?
;-------
._vfprintf
IF DEFINFED_floatstdio
LIB vfprintf_fp
jp vfprintf_fp
ELSE
IF DEFINED_complexstdio
LIB vfprintf_comp
jp vfprintf_comp
ELSE
IF DEFINED_ministdio
LIB vfprintf_mini
jp vfprintf_mini
ENDIF
ENDIF
ENDIF
;-------
; Some variables
;-------
._std_seed defw 0 ;Integer rand() seed
;Atexit routine
.exitsp defw 0 ;atexit() stack address
.exitcount defb 0 ;Number of atexit() routines
.heaplast defw 0 ;heap variables
.heapblocks defw 0
.base_graphics defw 0 ;Graphics variables
.coords defw 0
defm "Small C+ nc100"
defb 0
;-------
; Floating point
;-------
IF NEED_floatpack
INCLUDE "#float.asm"
.fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM)
.extra defs 6 ;FP spare register
.fa defs 6 ;FP accumulator
.fasign defb 0 ;FP variable
ENDIF
|