DEVICE ZXSPECTRUM128
include "../_sdk/sys_h.asm"
include "8080.asm"
;
; CCC.ASM: BDS C Run-Time Package (C.CCC) v1.6, 2/86
;
; Copyright (c) 1982, 1983, 1986 by BD Software, Inc.
;
; This is the source to the BDS C run-time package module. When running
; in a standard CP/M system environment, the run-time package object module
; resides at the start of the TPA (typically 100h). The code generated by
; the BDS C Compiler usually has its origin immediately following the end of
; the run-time package module.
;
; This file may be assembled either by Digital Research's assemblers
; (ASM and MAC) or by Microsoft's assembler (M80/L80). Set the M80 symbol
; (below) to specify which assembler shall be used. The final result of the
; assembly is a run-time package module named "C.CCC", ready for use by
; CLINK.COM or L2.COM.
;
; Assembly instructions for MAC.COM / ASM.COM:
; (set M80 to FALSE)
; >asm ccc
; >load ccc
; >ren c.ccc=ccc.com
;
; Assembly instructions with M80.COM for standard CP/M TPA operation:
; (set M80 to TRUE)
; >m80 ccc,ccc=ccc.asm
; >l80 /p:100,ccc/n,ccc/e
; >ren c.ccc=ccc.com
;
M80 EQU FALSE ;TRUE for M80 and L80, FALSE if using ASM/MAC and LOAD
;
; Equate statements in CAPITAL letters may be configured to control the
; following environmental and auxilliary options of the run-time environment:
;
; a) operating system environment, or lack thereof (CPM, MPM2)
; b) recognition of the CP/M "user area" mechandsm (USAREA)
; c) CDB debugger interface (USERST, RSTNUM)
; d) code compression through use of restart vectors 1-7 (ZOPT1-ZOPT7)
;
; All the above options (except CPM and sometimes ZOPT1-ZOPT7) may be altered
; freely WITHOUT requiring the reassembly of the CSM-coded portions of the
; C library (object in DEFF2.CRL). Changing ZOPT1-ZOPT7 requires library
; reassembly only when PRESRV is set to FALSE.
;
; If generating code for an operating-system-independent application (when
; the CPM equate is set to FALSE), make sure to set the following values:
;
; e) the origin of the run-time package code segment (ORIGIN)
; f) the origin of the run-time package's local data area (RAM)
; g) the transfer address upon program termination (EXITAD)
;
FALSE equ 0
TRUE equ not FALSE
CPM EQU TRUE ;True if to be run under any CP/M- or MP/M-like system
MPM2 EQU FALSE ;True ONLY if running MP/M II (forces R/O file closes)
NEDOOS EQU 1
;
; Use this section to configure run-time package
; for non-CP/M-resident operation (e.g., for ROM):
;
IF NOT CPM ;fill in the appropriate values...
ORIGIN EQU NEWBASE ;Address at which programs are to run
RAM EQU WHATEVER ;R/W memory area for non-CP/M configurations
;(default: immediately after C.Ccall c,under CP/M)
EXITAD EQU WHENDONE ;where to go when done executing
ENDIF
;
; Some CP/M-specific symbolic values:
;
if CPM
nfcbs EQU 8 ;maximum # of files open at one time
base equ 0 ;start of system ram
bdos equ base+5 ;bdos entry pt.
tpa equ base+100h
tbuff equ base+80h
ORIGIN equ tpa
EXITAD equ base ;warm boot location
conin equ 1 ;BDOS call codes...console input
cstat equ 11 ;interrogate console status
closec equ 16 ;close file
gsuser equ 32 ;get/set user code
endif
;
; The location of the jump vectors and utility routines must remain
; constant relative to the beginning of this run-time module.
;
; Do NOT change ANYTHING between here and the start of the
; "init" routine!!!!!!!!
;
;IF NOT M80
org ORIGIN
begin
;ENDIF
include "ccc.asm"
end
savebin "c.ccc",begin,end-begin
LABELSLIST "../../us/user.l"