Rev 630 | Blame | Compare with Previous | Last modification | View Log | Download
;; BDS.LIB for BDS C v1.51 January 19, 1985;; Header file for .CSM assembly language source files. Contains; addresses within the C.CCC run-time package to be used by the machine; language CRL library functions.;; If you alter the C.CCC run-time package by reassembling CCC.ASM,; be sure to go through this file and make sure all the addresses perfectly; match the corresponding addresses resulting from the CCC.ASM assembly.; Then the .CSM library functions will be ready to process with CASM.SUB.;;page 76;; System addresses:;if not CPMCCCORG: EQU WHATEVER ;if not runninng under cp/m, set this to load addr,RAM: EQU WHATEVER2 ;set this to address of CCC's ram areaBASE: EQU WHATEVER3 ;and this to the base of system memory (`base' is;the re-boot location under cp/m; for non-cp/m oper-;ation, it should be set to a safe place to jump to on;error or user-abort.endifif CPMbase: equ 0000h ;either 0 or 4200h for CP/M systemsfcb: equ base+5ch ;default file control blocktbuff: equ base+80h ;sector bufferbdos: equ base+5 ;bdos entry pointtpa: equ base+100h ;transient program areanfcbs: equ 9 ;max number of open files allowed at one timeerrorv: equ 255 ;error value returned by BDOS callscccorg: equ tpa ;where run-time package residesORIGIN equ tpaEXITAD equ base ;warm boot location;**************************************************;ram: equ 667h ;THIS WILL PROBABLY CHANGE IF YOU CUSTOMIZE CCC.ASM;**************************************************endifcr: equ 0dh ;ASCII codes: carriage returnlf: equ 0ah ; linefeednewlin: equ lf ; newlinetab: equ 9 ; tabbs: equ 08h ; backspacecntrlc: equ 3 ; control-C;; Subroutines in C.CCC (the addresses should be that of the; appropriate jump vector entry points):;if 1==0fexitv: equ cccorg+09h ;where to go to terminate executionerror: equ cccorg+1dh ;return -1 in HL:exit: equ error+3 ;close all open files and rebootif CPMclose: equ error+6setfcb: equ error+9 ;set up fcb at HL from text at DEfgfd: equ error+12 ;set C according to whether file fd is openfgfcb: equ error+15 ;figure address of internal fcb for file fdsetfcu: equ error+18 ;set up fcb with possible user number prefixsetusr: equ error+21 ;set current user area to high 5 bits of Arstusr: equ error+24 ;reset user area to value before last setusr callkhack: equ error+33 ;Kirkland interrupt vector initializationclrex: equ error+36 ;clear external data routineendifeqwel: equ cccorg+0e5hsmod: equ cccorg+10fhusmod: equ cccorg+129hsmul: equ cccorg+13fhusmul: equ cccorg+16bhusdiv: equ cccorg+189hsdiv: equ cccorg+1cbhcmphd: equ cccorg+1ddhcmh: equ cccorg+1fahcmd: equ cccorg+202hma1toh: equ cccorg+20ah ;get 1st stack element into HL and Ama2toh: equ cccorg+213h ; 2ndma3toh: equ ma2toh+6 ; 3rdma4toh: equ ma2toh+12 ; 4thma5toh: equ ma2toh+18 ; 5thma6toh: equ ma2toh+24 ; 6thma7toh: equ ma2toh+30 ; 7tharghak: equ ma2toh+36 ;copy first 6 or so stack elements to argc areaendif;; The following addresses will depend on the value of RAM if you; customize CCC.ASM....be sure they correspond to the assembly; results of CCC.ASM in such cases. If you remove some of the data; areas from CCC.ASM (in case they aren't needed), be sure to remove; from here also.;if 1==0;org ramerrnum=ram;: ds 1 ;error code from file I/O operationsrseed=errnum+1;: ds 8 ;the random generator seedargs=rseed+8;: ds 14 ;"arghak" puts args passed on stack here.iohack=args+14;: ds 6 ;room for I/O subroutines for use by "inp";and "outp" library routinesallocp=iohack+6;: ds 2 ;pointer to free storage for use by "sbrk" funcalocmx=allocp+2;: ds 2 ;highest location to be made available to the;storage allocator;20 bytes of misc. scratch & state variables:tmp=alocmx+2; ds 1tmp1=tmp+1; ds 1tmp2=tmp1+1; ds 2tmp2a=tmp2+2; ds 2unused=tmp2a+2; ds 2curusr=unused+2; ds 1 ;used to save current user number during file I/Ousrnum=curusr+1; ds 1 ;set by "setfcu" to user number of given filename;Console I/O control data:chmode=usrnum+1; db 0 ;0: single char mode, 1: line buffered modenleft=chmode+1; db 0 ;# of chars left in buffer (if chmode == 1)ungetl=nleft+1; db 0 ;"ungetch" data byte (0 if no char pushback)iobrf=ungetl+1; db 1 ;check for break on character input/outputspsav=iobrf+1; ds 2 ;BDOS's saved SP value upon entry from CCP;ds 4 ;total of 20 bytes of misc. data areaendif;; Nothing beyond this point will ordinarily require any modifications; by the user.;if 1==0extrns: equ cccorg+15h ;base of external data area (set by CLINK)cccsiz: equ cccorg+17h ;size of C.CCC for use by CLINK onlycodend: equ cccorg+19h ;address of byte following last byte of program code; (set by CLINK)freram: equ cccorg+1bh ;first free address after external area; (set by CLINK)endifarg1: equ args ;these are just convenient names forarg2: equ args+2 ;the words in the "args" areaarg3: equ args+4arg4: equ args+6arg5: equ args+8arg6: equ args+10arg7: equ args+12;; BDOS call codes:;if CPMconin: equ 1 ;get a character from consoleconout: equ 2 ;write a character to consolelstout: equ 5 ;write a character to list devicedconio: equ 6 ;direct console I/O (only for CP/M 2.0)pstrng: equ 9 ;print string (terminated by '$')getlin: equ 10 ;get buffered line from consolecstat: equ 11 ;get console statusselect: equ 14 ;select diskopenc: equ 15 ;open a fileclosec: equ 16 ;close a filedelc: equ 19 ;delete a filereads: equ 20 ;read a sector (sequential)creatc: equ 22 ;make a filerenc: equ 23 ;rename filesdma: equ 26 ;set dmagsuser: equ 32 ;get/set user codereadr: equ 33 ;read random sectorwritr: equ 34 ;write random sectorcfsizc: equ 35 ;compute file sizesrrecc: equ 36 ;set random recordendif