..[echelon.003] .op 20 August 1984 ZCPR3 Newsletter 003 First a note: file RELS.UTL is in the public domain. Use EX.COM, also in the public domain, in place of ZEX until you get ZEX up and running. But do rename all the *.ZEX batch files to *.SUB. (These two files and MLOAD.COM are on the AMPRO RCP/M and BBS at modem phone number: 408/258-8128.) This issue contains the promised listing for buffers that are placed into your CBIOS to obtain full ZCPR3 features. It also contains CBIOS.LIB to be included in your BIOS as a convenience file (one easy to edit, make changes, without need of large source code file changes) during MAC assembly. Also a different presentation for installation is included, mainly to suggest one of many correct ways of thinking about ZCPR3 and its RAM memory map. .po 14 CP/M-80 BIOS RESERVED MEMORY AREAS (Typical Semi-Fullup ZCPR3 Implementation) Theså reserveä areaó arå useä bù ZCPR³ anä bù custoí  appli catioî programó anä ZCPR³ utilitù software. 58Ë ZCPR³ system (51k TPA) .heNewsletter 003 BIOS Reserved Memory Areas Systeí  Segmentó (modules© discusseä anä implementeä iî thå ZCPR³ overall concept: Segment Function ------- -------- CBOOT Boot System from Floppy Disk BDOS CP/M BDOS from DRI CBIOSZ Customized BIOS ZCPR3 ZCPR3 Command Processor *.ENV All Environment Descriptors *.FCP All Flow Command Packages *.IOP All Input/Output Packages *.NDR All Named Directory Definition Files *.RCP All Resident Command Packages Sample Memory Map of System: Address Range Size Function ------------- ------- -------- 0 - FF 256 b Standard CP/M Buffers except 40 - 4A 11 b for ZCPR3 External Path and 4B 1 b Wheel Byte 100 - CBFF 51 K TPA CC00 - D3FF 2 K ZCPR3 Command Processor D400 - E1FF 3.5K BDOS E200 - F1FF 4.0K CBIOS with Buffers F200 - F9FF 2.0K Resident Command Package FA00 - FBFF 0.5K Flow Command Package FC00 - FCFF 256 b Memory-Based Named Directory FD00 - FD7F 128 b ZCPR3 Shell Stack Š FD80 - FDCF 80 b ZCPR3 Message Buffers Byte 0: Error Flag (Z/NZ) Byte 1: IF (8 Levels) Byte 2: IF Active (8 Levels) Byte 3: Z3 Cmd Status 00B - Normal 01B - Shell 10B - Error Bytes 4&5: Error Address if 10B Byte 6: Program Error Code Byte 7: ZEX Message Byte 00B - Normal 01B - Z3 Prompt 10B - Suspend Intercept Byte 8: ZEX Running Flag (0=No) Bytes 9-10: Address of Next Char for ZEX to Return Bytes 11-12: Address of First Char in ZEX Memory- Based File Buffer Byte 13: SH Control Byte Bit 0: Enable SHCMT Bit 1: Enable SHECHO Bit 7: Enable Shell Entry Wait Bytes 14-15: Shell Scratch Bytes 10H-2FH: Error Cmd Bytes 30H-39H: Registers Bytes 3AH-3FH: Reserved Bytes 40H-4FH: User-Defined FDD0 - FDFF 48 b ZCPR3 External FCB ----------------- or FDD0 - FDF3 36b External FCB FDF´ - FDFÆ 12â Externaì PATÈ (insteaä of locatioî 40H) ----------------- FE00 - FEFF 256 b Environment Descriptors Bytes 00H-7FH: Z3 Parameters Bytes 80H-FFH: Z3 Terminal Cap FF00 - FFCF 208 b Multiple Command Line Buffer FFD0 - FFFF 48 b ZCPR3 External Stack .fo Page # .pn 2 Thå  51ë TPÁ (58ë system© sample implementatioî oæ  ZCPR³ containó alì standarä CP/M residenô (intrinsic© CCÐ commands¬ buô iî thå Residenô Commanä Packages¬ excepô DIÒ anä USER® Addition- ally¬ thå 58ë version usås Flo÷ Controì Packages¬  anä memory- baseä Nameä Directorù  Definitioî Fileó foò neaò fulì CP/M en- hancement. (The IO package is not included.) Á  neaô  transienô (DIR.COM© ió provideä tï handlå  thå  DIÒ functioî -- iô showó filå anä disë size¬ numbeò oæ fileó useä anä remaining¬  drive/useò areá (DÕ form© pluó thå namå (DIÒ form© oæ thå  directory¬  aó welì aó disë spacå remaining®  Thå fileó arå displayeä   alpha-sorted¬   bù  eitheò  filenamå   oò   filetype¬ horizontallù  acrosó  thå CRÔ screen®  XD.COÍ anä  XDIR.COÍ  arå provideä  foò  furtheò expandeä directorù displaù capabilitù  anä power. Use "//" or the HELP System for the trailing parameters. Š USEÒ ió noô requireä undeò ZCPR³ becauså simplù enterinç thå useò  areá  numbeò  (° tï 15© followeä bù á ":¢  aô  thå  commanä prompô putó thå systeí aô thaô area® Froí aî applicatioî prograí thå ":¢ ió usuallù optionaì anä useò ° tï 3± ió  permitted® .heNewsletter 003 CBIOS Example CBIOS CODE EXAMPLE LISTING Placå thió code¬ oò similar¬ iî thå colä booô routinå oæ your CBIOS®  Thå  codå  ió writteî tï uså thå facilitieó  oæ  Digitaì Research'ó   MAC.COÍ   macrï  assembler¬   foò  conveniencå   anä flexibility® Iæ yoõ don'ô owî á copù oæ MAC¬ it'ó á gooä ideá tï buù one! (CBIOS.LIB must be placed at beginning of your CBIOS source code file; see page 8 below.) ; o n e - t i m e c o d e (used only during cold boot) BOOT: LXI SP,100H ;start local stack ; ; the following code is required for zcpr3 cold boot initialization ; IF EXPATH NE 0 ;external paths supported LXI D,PATH ;copy cold-boot path LXI H,EXPATH ;into system external path area MVI B,9 ;always 9 bytes CALL MOVLOP ENDIF IF Z3WHL NE 0 ;wheel byte supported XRA A ;clear wheel byte STA Z3WHL ENDIF IF RCP NE 0 ;rcps supported LXI H,RCP ;rcp address (zero fill) CALL ZERO128 ;128 bytes ENDIF IF FCP NE 0 ;fcps supported LXI H,FCP ;fcp address (zero fill) CALL ZERO128 ;128 bytes ENDIF IF Z3ENV NE 0 ;envs supported IÆ INITENÖ ;initializå environmentó (eqõ iî 'cbios.lib') LXI D,DEFENV ;copy default environment ... LXI H,Z3ENV ;... into zcpr3 environment descriptor MVI B,128 ;128 bytes CALL MOVLOP MVI B,32 ;32 zeroes for z3tcap CALL ZEROM ELSE ;not initenv LXI H,Z3ENV ;env address (zero fill) MVI B,128+32 ;128 bytes of environ + 32 bytes of z3tcap CALL ZEROM ENDIF ;initenv Š ENDIF ;z3env ne 0 IF SHSTK NE 0 ;shell stack supported XRA A ;clear stack STA SHSTK ENDIF IF Z3MSG NE 0 ;zcpr3 messages supported LXI H,Z3MSG ;clear message bytes MVI B,80 ;80 bytes CALL ZEROM ENDIF IF Z3NDIR NE 0 ;named directory based in memory LXI H,Z3NDIR ;named directory base CALL ZERO128 ;128 bytes ENDIF IF Z3CL NE 0 ;multiple commands allowed LXI D,CMDSET ;set buffers for multiple command processing LXI H,Z3CL ;command line base MVI B,4 ;4 bytes CALL MOVLOP ;copy LXI D,AUTOCMD ;pt to default command LDAX D ;get char count INX D ;pt to first char MOV B,A ;count in b INR B ;include ending 0 CALL MOVLOP ;copy ENDIF ; »  iniô somå bufferó whicè overlað thå booô (iî caså yoõ neeä this) ; ; XRA A ;zero in the accum ; STA HSTACT ;host buffer inactive ; STA UNACNT ;clear unalloc count ; STA HSTSID ;assume side zero JMР GOCPÍ ;initializå anä gï tï cp/í (uså your label) AUTOCMÄ D  ¸ ;'acmd§ ió á macrï defineä iî 'cbios.lib' ACMD ; ; copy from de to hl for b bytes ; MOVLOP: LDAX D ;get and put MOV M,A INX H ;pt to next INX D DCR B ;count down JNZ MOVLOP RET .cp 5 Š; ; zero 128 bytes of memory pted to by hl ; ZERO128: MVI B,128 ;128 bytes ; ; zero memory for b bytes; memory pted to by hl ; ZEROM: MVI M,0 ;store zero INX H DCR B ;count down JNZ ZEROM RET ; ; initial value for the external command line buffer ; IF Z3CL NE 0 CMDSET: DW Z3CL+4 ;beginning of i/o buffer DB Z3CLS ;size of i/o buffer DB 0 ;empty buffer DB 0 ;empty buffer ENDIF ; ; default command search path ; IF EXPATH NE 0 PATH: DB IDISK1,IUSER1 ;du path elements (from 'cbios.lib') DB IDISK2,IUSER2 DB IDISK3,IUSER3 DB IDISK4,IUSER4 DB 0 ;end of path ENDIF ; ; signon (constants located in 'cbios.lib', starting next page) ; LOGMSG: DB CR,LF,'SUPER ' ; 'super' is your system name DB (SYSIZ/10)+'0',(SYSIZ MOD 10)+'0' DB 'K TPA CP/M 2.2 with ZCPR ' DB (CPMREV/10)+'0','.',(CPMREV MOD 10)+'0' DB CR,LF,' BIOS Version ' DB (IVERS/10)+'0','.',(IVERS MOD 10)+'0' DB ' on ' IDATE ;set date from macro in 'cbios.lib' DB 0 ; ; built-in environment descriptor ; eliminates need for 'ldr' to run to init zcpr3 environment ; descriptor ; IF INITENV ;equate definition in 'cbios.lib' MACLIB SYSENV DEFENV: JMP 0 Š SYSENV ;fill in macros ENDIF .cp 5 ; GOCPM: MVÉ  A,CBDISË  ;makå surå valuå noô changeä iî colä boot STÁ CDISË ;cp/í baså pagå locatioî 004h¬ disk/useò area. ;label should be in your 'cbios' source code (start of console, other standard cp/m i/o initialization) ORG BOOT ;uninitialized storage area starts here -------------- Now the CBIOS.LIB file: (Add to the top of your CBIOS.ASM file) * File: CBIOS.LIB -- Customize for your CBIOS and desired features * then assemble with Z3BASE.LIB and MAC.COM. ***************************************************************** * * * THE FOLLOWING REVISION NUMBER IS IN REFERENCE TO THE Z3BASE * * VERSION * * * ***************************************************************** CPMREV EQU Z3REV ;ZCPR3 revision number IVERS EQU 19 ;your BIOS Version IDATE MACRO DB '17 July 1984' ;date of last BIOS Version ENDM CBDISK EQU 0F0H ;Initial Disk to Log In, 0=A, 1=B, etc ;User 15, Disk A ***************************************************************** * * * CP/M SYSTEM EQUATES. IF RECONFIGURATION OF THE CP/M SYSTEM * * IS BEING DONE, CHANGES CAN BE MADE TO THE FOLLOWING EAUATES. * * * ***************************************************************** BDOS EQU CCP+806H ;BDOS address (800H may be req'd) BIOS EQU CCP+1600H ;CBIOS address SYSIZ EQU CCP/1024 ;Size of System ***************************************************************** * * * IF THERE IS A COMMAND INSERTED HERE, IT WILL BE AUTO-LOADED * * ON COLD BOOT. * * FOR EXAMPLE: * * * * COLDBEG DB 'MBASIC MYPROG' * * COLDEND DB 0 * * * * WILL EXECUTE MICROSOFT BASIC, AND MBASIC WILL EXECUTE THE * Š* "MYPROG" BASIC PROGRAM. * * * ***************************************************************** ACMD MACRO ;Define as Macro for Code Insertion DB 'STARTUP ' ;Cold boot command here (8 chars) DB 0 ;in 'cbios': autocmd: db 8 acmd ENDM ***************************************************************** * * * PATH TO BE SET FOR ZCPR3 ON COLD BOOT * * * ***************************************************************** ; Current Disk, Current User always checked 1st IDISK1 EQU 'A'-'@' ; 2nd: Disk A, User 0 IUSER1 EQU 0 IDISK2 EQU 'A'-'@' ; 3rd: Disk A, User 15 IUSER2 EQU 15 IDISK3 EQU 'A'-'@' ; 4th: Disk A, Current User IUSER3 EQU '$' IDISK4 EQU '$' ; 5th: Current Disk, User Zero IUSER4 EQU 0 IDISK5 EQU 0 ;No 6th Entry IUSER5 EQU 0 ***************************************************************** * * * INITIALIZE ZCPR3 ENVIRONMENT DESCRIPTOR FROM WITHIN BIOS * * SET THIS EQUATE TO TRUE TO DO SO * * * ***************************************************************** INITENV EQU TRUE ;best to leave 'true'; must be.. ;..'true' to run 'startup'. ***************************************************************** * * * ENABLE RCP/M USE - LOSS OF CARRIER = REBOOT * * * ***************************************************************** RCPM EQU FALSE ;set true if for BBS or RCP/M system .pa Š.heNewsletter 003 More Insallation Information MORE INSTALLATION INFORMATION Installatioî oæ ZCPR³ iî youò CP/Í systeí requireó knowledgå anä understandinç oæ thå principleó beinç used®  Uså youò printeò tï geô hardcopù oæ thå followinç supplieä files: Z3BASE.LI     ;baså addresó reservations Z3HDR.LIB ;ZCPR3 options selection SYSENV.ASM ;environment header and.. SYSENV.LIB ;..macro library. CBIOS.LIB ;CBIOS convenience library Scaî  (study© thå samplå Z3BASE.LIB'ó anä Z3HHDR.LIB'ó furnished® Changå equateó tï youò desires® Remembeò thaô thå assembleä ZCPÒ cannoô exceeä 2ë bytes¬  thå sizå oæ thå originaì CP/Í CCP®  Thå lasô  useä addresó cannoô bå higheò thaî thå BDOÓ  baså  address® (Uså  BDOSLOC.COÍ tï determinå CCP¬  BDOS¬  anä BIOÓ baså addresó locationó oæ youò system.© Thå fouò samplå Z3HDÒ fileó  supplieä arå  abouô  optimuí froí memorù resourcå  managemenô  standpoint® Thå tradå ió intrinsiã (residenô tï ZCPR3'ó 2ë commanä processor© versuó  externaì  (Residenô Commanä Packagå iî CBIOÓ oò  externaì executablå COÍ filå utilities© commanä functions. Makå  surå youò existinç systeí doesn'ô presentlù  uså  CP/Í baså pagå locationó 40È tï 4BH®  Iæ iô doeó changå Z3BASE.LI tï reflecô  differenô Externaì PATÈ (3.© anä WHEEÌ Bytå (4.© addres ses®  Á  gooä  locatioî woulä bå neaò thå Externaì  FC  Addresó (12.)®  Onlù 3¶ byteó neeä bå alloteä tï thå FC buffer¬ sï PATÈ anä  WHEEÌ caî bå jusô abovå iô (1± byteó foò PATÈ pluó onå  bytå foò WHEEL)® Manù RCP/Í systemó uså locatioî 3EÈ foò á WHEEÌ bytå -- yoõ  maù desirå thaô locatioî oveò thå higè memorù  onå  abovå thå suggesteä alternatå PATÈ location® Iæ Z3BASE.LI ió changed¬ alì programó thaô uså iô musô bå reassembled. Oncå  thå  systeí sizå yoõ wisè tï ruî haó beeî  determined¬ severaì ZCPR³ combinationó maù bå assembleä anä experimenteä witè tï  furtheò determinå what'ó besô foò youò desireä  environmentaì requirements. Severaì  ready-to-ruî Residenô Commanä Packageó (RCP's©  anä Flo÷  Controì  Packageó (FCP's© arå supplieä tï geô  yoõ  starteä quicklù anä arå powerfuì exampleó oæ ZCPR³ capability®  Remembeò though¬  iæ  yoõ  changå  anù  addresó  iî  Z3BASE.LI  yoõ  musô reassemblå alì packageó usinç Z3BASE. .cð 7 Assemblå alì fileó usinç Digitaì Research'ó MAC.COM® Libra rieó anä marcoó havå beeî useä foò easå oæ filå modificatioî anä simple¬  shorô edits® Adä CBIOS.LI anä Z3BASE.LI statementó tï youò CBIOÓ codå neaò thå beginning: MACLIB CBIOS ;the cbios header lib MACLIB Z3BASE ;base address reservations Assemblå  SYSENV.ASÍ anä changå itó namå afteò loadinç tï  á COÍ filå tï Systeí Segmenô SYS.ENV. Š SYS.ENÖ  caî bå initiallù loadeä bù LDR.COÍ oò caî bå  auto- loadeä  bù  thå CBIOÓ built-iî INITENÖ featurå (iæ  yoõ  uså  thå samplå BIOÓ codå fragmenô supplied above)®  Seô INITENÖ equatå TRUÅ iî CBIOS.LI  beforå  assemblù oæ youò CBIOS®  Morå flexibilitù  ió obtaineä  iæ  aî aliaó STARTUP.COÍ ió createä thaô  containó  thå LDR.COÍ utilitù commanä aó thå leadinç automatiã loadeò command: LDÒ MYTERM.Z3T,SYS.RCP,SYS.FCP,SYS.NDR; Commaó arå useä betweeî segmenô declarations¬  semicolonó betweeî commands®  Yoõ maù changå driveó anä useò areaó bù enterinç  thå characteò followeä bù á colon. 15:;LDR MYTERM.Z3T,;0:;DIR;B:;DIR Gï tï useò areá 15¬ loaä MYTERÍ anä otheò segmenô packages¬ gï tï useò 0¬  sho÷ fileó there»  theî changå tï Drivå  anä sho÷ fileó oî  iô -- possibilitieó arå essentiallù uð tï thå desireó oæ  thå consolå operatoò oò systeí installer. Remembeò  STARTUР ió  thå aliaó verâ placeä  iî  CBIOS.LIB¬ linkeä witè youò CBIOÓ assembly®  MYTERÍ ió createä bù  TCSELECÔ (oò TCMAKE© anä ió thå filå containinç youò CRÔ terminaì charact eristics®   Iô  obtainó  thå  extensioî  oæ  Z3Ô  automatically® Z3TCAP.TCÐ ió thå databaså useä bù TCSELECÔ foò terminaì capabil ities. Alì   ZCPR³   screen-orienteä   applicatioî   programó   uså MYTERM.Z3Ô  foò  CRÔ  description¬  e.g.¬  SHOW¬  VFILER¬  VMENU¬ ERROR2, DU3, MU3, HELP. Additionally¬  mosô  ZCPR³ utilitieó havå built-iî helð  in formation¬  obtaineä  bù  typinç thå utilitù namå followeä  bù  á ® ALIAS // Wå  havå manù reserveä memorù addresseó tï consider®  Don'ô trù tï remembeò anù oæ them®  Writå theí alì dowî bù editinç thå Z3BASE.LI filå and¬  wheî finished¬ prinô iô ouô foò readù view® Let'ó  approacè thå installatioî froí anotheò  angle.„  Scaî anä edit¬ aó desired¬ alì thå ASÍ anä LI fileó supplied® Then: .cp 2 1® Assemblå (usinç MAC.COM© ZCPR3.ASÍ witè Z3BASE.LIB anä Z3HDR.LI presenô oî disk. 2® Assemblå youò CBIOS.ASÍ witè Z3BASE.LIB¬ CBIOS.LIB, anä SYSENV.LI oî disk. 3® SYSGEN an image of your CP/M system into memory and save as MYCPM.SYS. Use DDT to load it. DDT MYCPM.SYS -IZCPR3.HEX -R3D8°  <-- valuå determineä bù systeí size, Š -ICBIOS.HEX see table below. -R3D80 -^C SAVE 48 MY58ZCPM.SYS SYSGEÎ <-- geô systeí imagå froí disë tracks at source drive prompt enter aô destination ¢ ¢ B