; ; PROGRAM: Z3LOC ; AUTHOR: RICHARD CONN ; VERSION: 1.0 ; DATE: 18 MAY 84 ; PREVIOUS VERSIONS: None ; DERIVATION: CCPLOC 1.1 (6 Jan 83) ; ;VERS EQU 10 ; Version 1.3 by Howard goldstein. Added local stack and ; rearranged some code so program works as intended under ; plain ol' CP/M. No functional changes. vers equ 13 ; January 19, 1988 ; Version 1.2 by Bruce Morgen, to report addresses correctly, ; specifically no longer rely on the BDOS jump vector, which ; is too often munged by an RSX of some kind to be at all ; trustworthy. Added RSX display line (if one is detected). ; Display lengths of FCP, RCP, NDR, command line, and path. ; Display DateStamper address if DS is running. Display CPU ; type after BIOS address. Display decent guess at CCP type ; after its address, ditto ZRDOS or CP/M version number. ; Refuse "Z" option if Z3LOC is uninstalled or running in a ; non-Z3 environment. Z3LOC12.MAC assembles with Kluger- ; modified RMAC, M80 or SLRMAC, any 8080-compatible ; versions of Z3LIB and SYSLIB should link up just fine. ; Sample assembly & linkage sequence using NightOwl's ProLink: ; ; RMAC Z3LOC12 $-SP Z (or) M80 =Z3LOC12 (or) SLRMAC Z3LOC12/6 ; ; PROLINK ORIGIN 100 ; ; ProLink Vers. 1.5 ; Created 12/24/85 ; Copyright (C) 1985 ; by NightOwl Software, Inc. ; *LINK Z3LOC12 ; Z3LOC1 ; *SEARCH Z3LIB,SYSLIB ; Z3INI SCOMPH SEPRIN SEPSTR SPAFDC ; SPHL4H SPA2HC SCRLF SBDOS SBOUT ; *EXIT ; ; [Origin: 0100H End: 06F2H Size:#1523] ; Free space: 38535 ;vers equ 12 ; January 12, 1988 ; Version 1.1 by Joe Wright, to report addresses correctly ;vers equ 11 z3env set 0000h ; To flag non-Z3 environments & ; uninstalled copies under Z30. ; ; Z3LOC -- ZCPR3 Environment Element Locator ; ; The purpose of Z3LOC is to locate the addresses of the running ; ZCPR3 CCP, BDOS, and BIOS, and to display these values to the user. ; If the Z option is given, the addresses of the following system elements ; are also presented: ; ; External Path ; RCP ; IOP ; FCP ; RSX (if one is active) ; Named Directory ; Command Line Buffer ; Shell Stack ; Environment Descriptor ; External FCB ; ZCPR3 Message Buffer ; External Stack ; Wheel Byte ; ; ; CP/M Constants ; base equ 0 ; CP/M Base page bdose equ 5 ; BDOS Entry fcb equ 5ch ; Default file control block ;fcb+1 equ 5dh ; 1st char in FCB cr equ 0dh lf equ 0ah tab equ 9 idoff equ 5bh zrdosv equ 48 ; ; Externals ; public cout extrn z3init,envptr extrn eprint,epstr,phl4hc,bout,bdos,crlf,pafdc,comphd ; ; Environment Definition ; ; External ZCPR3 Environment Descriptor ; jmp start db 'Z3ENV' ; This is a ZCPR3 Utility db 1 ; External Environment Descriptor z3eadr: dw z3env start: lxi h,0 dad sp shld stack ; Store system stack lxi sp,stack ; And set up local stack ; lhld z3eadr ; Pt to ZCPR3 environment ; ; Start of Program -- Initialize ZCPR3 Environment ; call z3init ; Initialize the ZCPR3 Environment call eprint db 'Z3LOC Version ' db (vers/10)+'0','.',(vers mod 10)+'0',0 lda fcb+1 ; Check for help cpi 'Z' ; Z is only option jz start1 cpi ' ' ; No option? jz start1 call eprint db cr,lf,'Syntax:' db cr,lf,'Z3LOC',tab,' Gives the addresses of the CCP,' db cr,lf,tab,' BDOS, BIOS, and, if active, the' db cr,lf,tab,' lowest RSX and the DateStamper.' db cr,lf,lf,'Z3LOC Z',tab,' Adds all key ZCPR3 addresses.',0 jmp exit start1: sta z3flag ; A non-zero to ZCPR3 flag call eprint db cr,lf,'System Elements Base Addresses' db cr,lf,'---------------- ---------------',0 lhld base+1 ; BIOS wm. boot jump vector lxi d,-1603h ; Offset to CCP entry dad d ; HL pts to CCP call eprint db cr,lf,' CCP',tab,tab,0 call prdata call ccptyp lhld base+1 ; BIOS wm. boot jump vector lxi d,-0e00H+3 ; Offset to BDOS entry dad d call eprint db cr,lf,' BDOS',tab,0 call prdata call zrdosq lhld base+1 ; WARM BOOT ENTRY mvi l,0 ; PAGE BOUNDARY call eprint db cr,lf,' BIOS',tab,0 call prdata call cputst mov a,h lhld bdose+1 sub h cpi 0eh jz norsx call eprint db cr,lf,' RSX (lowest) ',0 call hdata norsx: call dschek jnz nods call eprint db cr,lf,' DateStamper ',0 call hdata nods: call crlf ; New line lda fcb+1 ; Check for Z option cpi 'Z' jnz exit ; Done if not Z lda z3flag ora a jz isz3 call eprint db cr,lf,'Non-ZCPR3 system or Z3LOC is uninstalled' db 0 jmp exit isz3: call eprint db cr,lf,'Env Descriptor',tab,0 lxi d,18 ; Offset to env descriptor element call z3data call eprint db cr,lf,lf,'Pack: FCP',tab,0 lxi d,9 call z3data jz nofcp call pdigit lxi h,recs call epstr nofcp: call eprint db cr,lf,' IOP',tab,0 lxi d,6 call z3data jz noiop call pdigit lxi h,recs call epstr noiop: call eprint db cr,lf,' RCP',tab,0 lxi d,3 call z3data jz norcp call pdigit call eprint recs: db ' recs)',0 norcp: call eprint db cr,lf,lf,'Buf: Cmd Line',tab,0 lxi d,15 call z3data jz noz3cl call pdigit call eprint db ' chars)',0 noz3cl: call eprint db cr,lf,' Ext FCB',tab,0 lxi d,27 call z3data call eprint db cr,lf,' Ext Path',tab,0 lxi d,0 call z3data jz nopath call pdigit call eprint db ' elements)' ; nopath: db cr,lf,' Ext Stk',tab,0 lxi d,29 call z3data call eprint db cr,lf,' Messages',tab,0 lxi d,25 call z3data call eprint db cr,lf,' Named Dir',tab,0 lxi d,12 call z3data jz nondr call pdigit call eprint db ' entries)',0 nondr: call eprint db cr,lf,' Shell Stk',tab,0 lxi d,21 call z3data call eprint db cr,lf,' Wheel Byte',tab,0 lxi d,32 call z3data exit: lhld stack ; Get system stack pointer sphl ret ; ; Z3DATA -- Print Data Fields for a ZCPR3 Element ; z3data: lhld envptr ; Pt to environment dad d ; HL pts to element lxi d,9 ; Add 9 for initial offset dad d ; Fall thru to PRDATA mov e,m ; Get address inx h mov d,m xchg inx d ; ; PRDATA -- Print Data Field (Base Address) ; prdata: call eprint db ' ',0 mov a,l ora h jnz hdata call eprint db '[Not implemented]',0 ret ; hdata: call phl4hc ; Print full address mvi a,'h' call bout ldax d ora a ret pdigit: call eprint db ' (',0 jmp pafdc ; Check for ZCPR 3.3 or later and for BGii, display if found ccptyp: push h ; Save incoming HL lhld envptr ; Get environment pointer mov a,l ; Test for 0000h ora h jnz doz3ck ; Then it's not Z3 or Z3LOC n/g dcr a ; So make PSW NZ jmp dobgck ; Go do BGii stuff doz3ck: lxi d,27 ; Offset to ENV pointer in ENV push h ; Save our original pointer dad d ; Make pointer-to-pointer mov e,m ; Get ENV pointer into DE inx h mov d,m pop h ; Get back original pointer call comphd ; Compare them dobgck: pop h ; Get back incoming HL push h ; Re-save it on stack inx h ; Adjust CCP pointer inx h inx h notz3: jnz ifcbg ; Do check for Backgrounder II xra a sta z3flag mov a,m cpi 18h jnz ifcbg call eprint zcprp: db ' (ZCPR ',0 inx h inx h mov l,m call prnz33 pop h ret ; Adapted from Jay Sage's COMIF: ; ifcbg: lxi d,idoff-3 ; Offset to 'BGii' ID string in BG CPR dad d lxi d,idstr ; Point to reference ID string mvi b,idlen ; Length of ID string bgchk1: ldax d ; Get reference character cmp m ; Compare to actual character jnz bgfals ; Set false if mismatch inx h ; Move to next characters inx d dcr b jnz bgchk1 ; Loop through all characters call eprint db ' (' idstr: db 'BGii' idlen equ $-idstr db ')',0 bgfals: pop h rz lda z3flag ora a jnz earlyz mvi a,30h przcpr: lxi h,zcprp call epstr mov l,a call prnz33 ret earlyz: inx h mov e,m inx h mov d,m inx h inx h mov a,m inx h mov h,m mov l,a call comphd jnz nozcpr mvi a,0ffh jmp przcpr nozcpr: mvi c,0ch call bdos jmp dricpm ; Adapted and cleaned up from DOSVER02 by D. McCord zrdosq: mvi c,0ch ; Return version function call bdos cpi 22h jnz dricpm mvi c,zrdosv call bdos ; Get dos ver # mov a,l ora h ; Is it 0? jnz iszrds cpm22: mvi a,22h dricpm: call eprint db ' (CP/M ',0 mov l,a jmp prnz33 iszrds: call eprint db ' (ZRDOS ',0 prnz33: mov a,l rrc ; Move to proper position rrc rrc rrc call prndig mvi a,'.' ; Period call bout mov a,l call prndig mvi a,')' cout: jmp bout prndig: ani 0fh adi '0' jmp bout ; Adapted from TM-DS10.Z80 by Jim Lill dschek: mvi e,'D' ; DateStamper ID character mvi c,0ch ; Return version function call bdose cpi 22h ; Must be CP/M 2.2 rnz ; If not, return NZ mov a,h ; Check for return of ID cpi 'D' rnz ; If not, return NZ xchg ; Get time subroutine addr into HL ret ; Return Z showing success cputst: call eprint db ' (',0 sub a ; Bob Freed's Z80 test jpe eighty lxi b,0101h ; My HD64180 test db 0edh,04ch ; 64180's "MLT BC", Z80 ignores dcr b ; 64180 will make B = 0, so if B jz zeighty ; still has a 1, we're a Z80 call eprint db 'HD64180/Z180)',0 ret zeighty: call eprint db 'Z80/NSC800)',0 ret eighty: call eprint db '8080/8085)',0 ret z3flag: ds 1 ds 28 ; Room for 14-level stack stack: ds 2 end