/usr/share/z88dk/lib/ti83_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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | ; Stub for the TI 83 calculator
;
; Stefano Bodrato - Dec 2000
; Henk Poley - Apr 2001 Fixed and add some things
;
; $Id: ti83_crt0.asm,v 1.20 2007/06/27 20:49:28 dom Exp $
;
; startup =
; n - Primary shell(s); compatible shell(s)
; (Primary shell merely means it's the smallest implementation
; for that shell, that uses full capabilities of the shell)
;
; 1 - Ion; Ti-Explorer (default)
; 2 - Venus;
; 3 - ZES;
; 4 - Anova; SOS
; 5 - Ti-Explorer, AShell; SOS, Anova (same as 6)
; 6 - AShell, Ti-Explorer; SOS, Anova (same as 5)
; 7 - SOS; Anova
; 8 - Venus Explorer; Venus
; 9 - Ion, Ti-Explorer; ZASMLOAD, plain TIOS
; 10 - Plain TIOS, ZASMLOAD
;
;-----------------------------------------------------
; Some general XDEFs and XREFs needed by the assembler
;-----------------------------------------------------
MODULE Ti83_crt0
XREF _main ; No matter what set up we have, main is
; always, always external to this file.
XDEF cleanup ; used by exit()
XDEF l_dcal ; used by calculated calls = "call (hl)"
XDEF _std_seed ; Integer rnd seed
XDEF _vfprintf ; vprintf is internal to this file so we
; only ever include one of the set of
; routines
XDEF exitsp ; Exit variables
XDEF exitcount ;
XDEF heaplast ;Near malloc heap variables
XDEF heapblocks
XDEF __sgoioblk ; For stdin, stdout, stder
XDEF base_graphics ; Graphics stuff
XDEF coords ;
XDEF cpygraph ; TI calc specific stuff
XDEF tidi ;
XDEF tiei ;
;-------------------------
; Begin of (shell) headers
;-------------------------
LSTOFF ; Don't list these (huge) files
INCLUDE "#Ti83.def" ; ROM / RAM adresses on Ti83
INCLUDE "zcc_opt.def" ; Receive all compiler-defines
LSTON ; List again
;----------------------------------
; 2-Venus and 8-Venus Explorer (VE)
;----------------------------------
IF (startup=2) | (startup=8)
DEFINE Venus
DEFINE NOT_DEFAULT_SHELL ; else we would use Ion
org $932C
defm "ç9_[?" ; send(9prgm0 (where 0 is theta)
IF (startup=2) ; 2-Venus
defb $0,$1,$1 ; No description nor icon
ELSE ; 8-Venus Explorer
DEFINE V_Explorer
defb $1
defb enddesc-description+1 ; lengthOfDescription+1
.description
DEFINE NEED_name ; The next time we'll include zcc_opt.def
; it will have the programs namestring.
; Usage in C file:
; #pragma string name xxxx
INCLUDE "zcc_opt.def"
UNDEFINE NEED_name
IF !DEFINED_NEED_name
; If no namestring provided, display full compiler ident
defm "Z88DK Small C+ Program"
ENDIF
.enddesc
defb endicon-icon+1 ; heightOfIcon+1
.icon
DEFINE NEED_icon
INCLUDE "zcc_opt.def" ; Get icon from zcc_opt.def
UNDEFINE NEED_icon
IF !DEFINED_NEED_icon
defb @00000000 ; Icon (max. heightOfIcon = 7 bytes)
defb @00110010 ; C with a small '+'
defb @01000111
defb @01000010
defb @01000000
defb @00110000
defb @00000000
ENDIF
.endicon
.externals
ENDIF
IF DEFINED_GRAYlib
defb $1 ; numberOfExternals+1 (maximum = 11d)
ELSE
; No graylib, so we use FastCopy
defc vnFastCopy = $FE6F
defb $2 ; numberOfExternals+1 (maximum = 11d)
defb $5 ; We use the FastCopy-lib
defm "~FCPY" ;
defb $ff ;
ENDIF
ENDIF
;------
; 3-ZES
;------
IF (startup=3)
DEFINE ZES
DEFINE NOT_DEFAULT_SHELL
org $931E
defm "ç9_ZES" ; Send(9prgmZES
defb $3F,$D5,$3F ; :Return
ENDIF
;--------
; 4-Anova
;--------
IF (startup=4)
DEFINE Anova
DEFINE NOT_DEFAULT_SHELL
org Entry
xor a ; One byte instruction, meaningless
jr start ; Relative jump
defw 0 ; pointer to libs, 0 if no libs used
defw description ; pointer to a description
defw icon ; pointer to an 8x5 icon
.description
DEFINE NEED_name
INCLUDE "zcc_opt.def"
UNDEFINE NEED_name
IF !DEFINED_NEED_name
defm "Z88DK Small C+ Program"
ENDIF
defb $0
.icon
DEFINE NEED_icon
INCLUDE "zcc_opt.def"
UNDEFINE NEED_icon
IF !DEFINED_NEED_icon
defb @00110010 ; icon (5 bytes, Anova icon)
defb @01000111 ; C with a small '+'
defb @01000010
defb @01000000 ; Bigger icons don't give problems
defb @00110000 ; They are only truncated to 5 bytes
ENDIF
ENDIF
;-------------------------------
; 5,6 - Ti-Explorer, AShell, SOS
;-------------------------------
IF (startup=5) | (startup=6)
DEFINE Ti_Explorer
DEFINE NOT_DEFAULT_SHELL
org Entry
nop ; makes it compatible with AShell
jr start
defw 0 ; pointer to libs, 0 if no libs used
defw description ; pointer to a description
defw icon ; pointer to an 8x8 icon.description
.description
DEFINE NEED_name
INCLUDE "zcc_opt.def"
UNDEFINE NEED_name
IF !DEFINED_NEED_name
defm "Z88DK Small C+ Program"
ENDIF
defb $0
.icon
DEFINE NEED_icon
INCLUDE "zcc_opt.def"
UNDEFINE NEED_icon
IF !DEFINED_NEED_icon
defb @00000000 ; 8x8 icon
defb @00110010 ; C with a small '+'
defb @01000111
defb @01000010
defb @01000000
defb @00110000
defb @00000000 ; Bigger icons don't give problems
defb @00000000 ; They are only truncated to 8 bytes
ENDIF
ENDIF
;---------
; 7 - SOS
;---------
IF (startup=7)
DEFINE SOS
DEFINE NOT_DEFAULT_SHELL
org Entry
ccf ; Makes program invisible to AShell
jr start
defw 0 ; pointer to libs, 0 if no libs used
defw description ; pointer to a description
.description
DEFINE NEED_name
INCLUDE "zcc_opt.def"
UNDEFINE NEED_name
IF !DEFINED_NEED_name
defm "Z88DK Small C+ Program"
ENDIF
defb $0
ENDIF
;---------------------------
; 9-Ion, ZASMLOAD compatible
;---------------------------
IF (startup=9)
DEFINE ZASMLOAD
DEFINE NOT_DEFAULT_SHELL
org Entry
xor a ; We don't use the Ionlibs
jr nc,start ; Ion identifier
DEFINE NEED_name
INCLUDE "zcc_opt.def"
UNDEFINE NEED_name
IF !DEFINED_NEED_name
defm "Z88DK Small C+ Program"
ENDIF
defb $0
ENDIF
;----------------------------------------------------------
; 10-No shell, send(9 or ZASMLOAD version (NOT recommended)
;----------------------------------------------------------
;
; for send(9 version, create .83p file with bin2var2.exe
; for ZASMLOAD version, create .83p file with bin2var.exe
IF (startup=10)
DEFINE ZASMLOAD
DEFINE NOT_DEFAULT_SHELL
org Entry
ENDIF
;----------------
; 1-Ion (default)
;----------------
IF !NOT_DEFAULT_SHELL
DEFINE Ion
org Entry
IF DEFINED_GRAYlib
xor a ; We don't use the Ionlibs (doesn't matter)
ELSE
ret ; We use the Ionlibs (doesn't matter)
ENDIF
jr nc,start ; Ion identifier
.description
DEFINE NEED_name
INCLUDE "zcc_opt.def"
UNDEFINE NEED_name
IF !DEFINED_NEED_name
defm "Z88DK Small C+ Program"
ENDIF
defb $0
ENDIF
;-------------------------------------
; End of header, begin of startup part
;-------------------------------------
.start
IF ZASMLOAD
call _runindicoff ; stop anoing run-indicator
ENDIF
ld hl,0 ; Store current StackPointer
add hl,sp
ld (start1+1),hl
IF !DEFINED_atexit ; Less stack use
ld hl,-6 ; 3 pointers (more likely value)
add hl,sp
ld sp,hl
ld (exitsp),sp
ELSE
ld hl,-64 ; 32 pointers (ANSI standard)
add hl,sp
ld sp,hl
ld (exitsp),sp
ENDIF
LIB fputc_cons
ld hl,12
push hl
call fputc_cons
pop hl
IF ZASMLOAD
IF NONANSI
call _CLRTXTSHD ; Clear textbuffer
call _homeup ; Set cursor to (0,0)
ENDIF
call _clrScrnFull ; Clear plotSScreen and LCD
ENDIF
IF DEFINED_GRAYlib
INCLUDE "#gray83.asm"
ELSE
INCLUDE "#intwrap83.asm"
ENDIF
im 2
call _main
.cleanup ; exit() jumps to this point
.start1 ld sp,0 ; writeback
ld iy,_IY_TABLE ; Restore flag-pointer
IF !(Ion | SOS | Ti_Explorer | V_Explorer | Anova)
IF NONANSI
call _CLRTXTSHD ; Clear textbuffer
call _homeup ; Set cursor to (0,0)
ENDIF
call _clrScrnFull ; Clear plotSScreen and LCD
res oninterrupt,(iy+onflags) ; Reset [On]-flag (stops "ERR:Break")
ENDIF
im 1
.tiei ei
IF DEFINED_GRAYlib
.cpygraph
ENDIF
.tidi ret
;----------------------------------------
; End of startup part, routines following
;----------------------------------------
defc l_dcal = $52E8 ; jp (hl)
IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND
.__sgoioblk
INCLUDE "#stdio_fp.asm"
ENDIF
; Now, which of the vfprintf routines do we need?
IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND
IF DEFINED_floatstdio
._vfprintf
LIB vfprintf_fp
jp vfprintf_fp
ELSE
IF DEFINED_complexstdio
._vfprintf
LIB vfprintf_comp
jp vfprintf_comp
ELSE
IF DEFINED_ministdio
._vfprintf
LIB vfprintf_mini
jp vfprintf_mini
ENDIF
ENDIF
ENDIF
ENDIF
;Seed for integer rand() routines
._std_seed defw 0
;Atexit routine
.exitsp defw 0
.exitcount defb 0
; Heap stuff
.heaplast defw 0
.heapblocks defw 0
; mem stuff
.base_graphics defw plotSScreen
.coords defw 0
IF !DEFINED_GRAYlib
IF Ion
DEFINE Do_Not_Include_FastCopy
defc cpygraph = $9157+80+15 ; ionFastCopy call
ENDIF
IF Venus
DEFINE Do_Not_Include_FastCopy
defc cpygraph = vnFastCopy
ENDIF
IF !Do_Not_Include_FastCopy
.cpygraph
;(ion)FastCopy from Joe Wingbermuehle
di
ld a,$80 ; 7
out ($10),a ; 11
ld hl,plotSScreen-12-(-(12*64)+1) ; 10
ld a,$20 ; 7
ld c,a ; 4
inc hl ; 6 waste
dec hl ; 6 waste
fastCopyAgain:
ld b,64 ; 7
inc c ; 4
ld de,-(12*64)+1 ; 10
out ($10),a ; 11
add hl,de ; 11
ld de,10 ; 10
fastCopyLoop:
add hl,de ; 11
inc hl ; 6 waste
inc hl ; 6 waste
inc de ; 6
ld a,(hl) ; 7
out ($11),a ; 11
dec de ; 6
djnz fastCopyLoop ; 13/8
ld a,c ; 4
cp $2B+1 ; 7
jr nz,fastCopyAgain ; 10/1
ret ; 10
ENDIF
ENDIF
IF NEED_floatpack
INCLUDE "#float.asm"
;seed for random number generator - not used yet..
.fp_seed defb $80,$80,0,0,0,0
;Floating point registers...
.extra defs 6
.fa defs 6
.fasign defb 0
ENDIF
|