/usr/share/z88dk/lib/test_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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | ;
; Startup for test emulator
;
; $Id: test_crt0.asm,v 1.1 2007/10/07 17:49:34 dom Exp $
module test_crt0
org 0x0000
INCLUDE "#test_cmds.def"
;--------
; 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 _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
if (ASMPC<>$0000)
defs CODE_ALIGNMENT_ERROR
endif
jp program
defs $0008-ASMPC
if (ASMPC<>$0008)
defs CODE_ALIGNMENT_ERROR
endif
jp restart08
defs $0010-ASMPC
if (ASMPC<>$0010)
defs CODE_ALIGNMENT_ERROR
endif
jp restart10
defs $0018-ASMPC
if (ASMPC<>$0018)
defs CODE_ALIGNMENT_ERROR
endif
jp restart18
defs $0020-ASMPC
if (ASMPC<>$0020)
defs CODE_ALIGNMENT_ERROR
endif
jp restart20
defs $0028-ASMPC
if (ASMPC<>$0028)
defs CODE_ALIGNMENT_ERROR
endif
jp restart28
defs $0030-ASMPC
if (ASMPC<>$0030)
defs CODE_ALIGNMENT_ERROR
endif
jp restart30
defs $0038-ASMPC
if (ASMPC<>$0038)
defs CODE_ALIGNMENT_ERROR
endif
; IM1 interrupt routine
ei
ret
.restart08
; a = command to execute
defb $ED, $FE ;trap
ret
; Restart routines, nothing sorted yet
.restart10
.restart18
.restart20
.restart28
.restart30
ret
.program
ld sp,65535
ld hl,-64
add hl,sp
ld sp,hl
ld (exitsp),sp
ei
call _main
.cleanup
ld a,CMD_EXIT ;exit
rst 8
.l_dcal jp (hl) ;Used for function pointer calls
;-----------
; Define the stdin/out/err area. For the z88 we have two models - the
; classic (kludgey) one and "ANSI" model
;-----------
.__sgoioblk
IF DEFINED_ANSIstdio
INCLUDE "#stdio_fp.asm"
ELSE
defw -11,-12,-10
ENDIF
;---------------------------------
; Select which printf core we want
;---------------------------------
._vfprintf
IF DEFINED_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
;-----------
; Now some variables
;-----------
.coords defw 0 ; Current graphics xy coordinates
.base_graphics defw 0 ; Address of the Graphics map
IF !DEFINED_HAVESEED
XDEF _std_seed ;Integer rand() seed
._std_seed defw 0 ; Seed for integer rand() routines
ENDIF
.exitsp defw 0 ; Address of where the atexit() stack is
.exitcount defb 0 ; How many routines on the atexit() stack
.heaplast defw 0 ; Address of last block on heap
.heapblocks defw 0 ; Number of blocks
defm "Small C+ TEST" ;Unnecessary file signature
defb 0
;-----------------------
; Floating point support
;-----------------------
IF NEED_floatpack
INCLUDE "#float.asm"
.fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM)
.extra defs 6 ;FP register
.fa defs 6 ;FP Accumulator
.fasign defb 0 ;FP register
ENDIF
|