Title Micro_Decision Installation SubProceedure Number 1 (5_Jul_84) ; ; Copyright 1984 ; Morrow Designs, Inc. ; San Leandro, Ca. ; John Zalabak ; .z80 Aseg Org 0100h ; This is the First of Two SubProceedures used to install the ; number of Physical Drives on a Micro-Decision. This is done as part ; of the Micro-Desision installation proceedure. ; ; This SubProceedure obtains the number of drives by quering ; the user and then updates the bios in memory. The Second SubProceedure ; uses the running bios to update the bios image on the system tracks ; so that it has the right number of physical drives. ; ; ;---------------------------------------------------------------------- ; Index (5_Jul_84) ;----------------- ; ; Isub1_Main Main Line of Terminal Initialization ; ; Get_Version Check the CP/M version ; Get_Response Get the Response from the user ; Verify_Response Verify the Response from the User ; Install_Drives Install the Number of Physical Drives ; ; Get_Bios_Pntr Get One of the Bios Pointers ; Get_DE_Indr_HL Load the DE register Pair Indirectly Through the HL ; ; Report_Errors Report an Error on the Console ; Print_Message Print a Message on the Console ; page 60 ;---------------------------------------------------------------------- ; Equates (12_Sept_84) ;--------------------- ; ;Bios/Bdos Equates Bios_Entry equ 0 ;Bios Entry Point Bdos_Entry equ 5 ;Bdos: Entry Vector Location Bdos_ConIn equ 1 ; Console Input Bdos_PString equ 9 ; Print a Sting on the Console Bdos_Ret_Ver equ 12 ; Return CP/M version ; Cp/m 2.2 Bios Jump Table Offsets RamDatX_Offset equ 40h ;RamDatX Area RamDatY_Offset equ 42h ;RamDatY Area Mtab_Offset equ 44h ;Mtabs Mtab_Leng equ 9 ;Length of one Mtab Tot_Mtab equ 5 ;Total Number of Mtabs ;Message String Codes Drives_Prompt equ 1 ;Number of Drives Prompt Drives_Verify equ 2 ;Verification Prompt ; Error String Codes Error_Opening equ 10 ;Error Intro Error_Version equ 11 ;Wrong Version of CP/M ;Non Printing Ascii Equates Control_C equ 03h ;Control C (Force CPM Warm Boot) Tab equ 09h ;Tab Lf equ 0Ah ;Line Feed Cr equ 0Dh ;Carriage Return Esc equ 1Bh ;Escape Bright equ '(' ;High Lighting Dim equ ')' ;Low Lighting page ;====================================================================== ; Main Line of Sub Installation Proceedure 1 (5_Jul_84) ;====================================================== ; Isub1_Main: call Get_Version ;Check the CP/M Version Number jr z,ImLp1 ;If (this is NOT Version 2.x) call Report_Errors ; Report the Error jr ImDone ; Done ImLp1: call Get_Response ;Repeat Get the Response from the User call Verify_Response ; Verify the User's Response or a jr nz,ImLp1 ;Until (User Responds Yes) call Install_Drives ;Install the Physical Drives ImDone: jp Bios_Entry ;Return ;====================================================================== ; Check the CP/M version (5_Jul_84) ;================================== ; 1) This routine checks the CP/M version. It returns with the ; Z flag = 1 if CP/M 2. ; Get_Version: ld c,Bdos_Ret_Ver ;Return version Bdos call call Bdos_Entry ld a,0F0h and l cp 20h ;If (this is NOT CP/M 2.x) ld a,Error_Version ; A:= Version Error ret nz ; Return ld a,0 ;Else A:= No Error ret ; Return page ;====================================================================== ; Get the Response from the user (5_Jul_84) ;========================================== ; 1) This routine gets the response from the user. If the response is ; valid then the accm is returned equal to zero (else its returned ; non-zero). ; Get_Response: ld a,Drives_Prompt call Print_Message ;Print the prompt string GrLp1: ld c,Bdos_ConIn ;Loop call Bdos_Entry ; Get the User's Response cp Control_C ; If (Response eq Warm Boot) jp z,Bios_Entry ; Goto Warm Boot cp '1' jr c,GrLp1 cp Tot_Mtab + '0' jr nc,GrLp1 ;Until (Valid Number of Drives Entered) ld (DrvRsp),a ;Save the Number of Drives in Ascii ret ;Return ;====================================================================== ; Verify the Response from the User (5_Jul_84) ;============================================= ; 1) This routine gets a Yes or No response from the user. ; 2) Register Usage: ; A -> Returned: 0 for YES; 0FFh for NO ; Verify_Response: ld a,Drives_Verify call Print_Message ;Print the Verify Prompt VRlp1: ld c,Bdos_ConIn ;Loop C:= Get Character Function call Bdos_Entry ; Get the User's Response and 5Fh ; (force response to upper case) cp Control_C ; If (Response eq Force Warm Boot) jp z,Bios_Entry ; Goto Warm Boot cp 'Y' ; If (Response is Yes) jr nz,VRsk1 ld a,0 ret ; Return (Ok) VRsk1: cp 'N' ; Else If (Response is No) jr nz,VRlp1 ld a,0FFh ret ; Return (Not Ok) page ;====================================================================== ; Install the Number of Physical Drives (5_Jul_84) ;================================================= ; 1) This routine Updates Vnum and all Virtual Drives except the last one. ; Install_Drives: ld de,RamDatY_Offset call Get_Bios_Pntr ;DE:= Pointer to Start of RamDatY ld a,(DrvRsp) ;A:= Number of Drives Response in Ascii sub '1' ;A:= Number of Drives - 1 in Binary dec de dec de ;DE:= Pointer to Vnum ld (de),a ;Update Vnum ld de,Mtab_Offset call Get_Bios_Pntr ex de,hl ;HL:= Pointer to Start of Mtabs push hl ld de,Mtab_Leng * (Tot_Mtab - 1) add hl,de ;HL:= Pointer to Start of Last Mtab ld a,(hl) ld (DskDef1),a ;Initialize Local Copy of DskDef1 inc hl ld a,(hl) ld (DskDef2),a ;Initialize Local Copy of DskDef2 pop hl ld a,(DrvRsp) ;A:= Number of Physical Drives in Ascii sub '0' ld b,a ;B:= Number of Physical Drives in Binary ld a,Tot_Mtab - 1 sub b ;A:= Number of Virtual Drives - 1 ld de,Mtab_Leng ;DE:= Length of an Mtab IdLp1: add hl,de ;Repeat HL:= HL + Mtab_Leng djnz IdLp1 ;Until (HL pointing at 1st virtual drive) ld b,a ;B:= Number of Virtual Drives - 1 IdLp2: ld a,(DskDef1) ;Repeat ld (hl),a ; Install DskDef1 inc hl ld a,(DskDef2) ; Install DskDef2 ld (hl),a ld de,Mtab_Leng - 1 add hl,de ; HL:= Pointer to Next Mtab djnz IdLp2 ;Until (all Virtual Mtab's Updated) ret page ;---------------------------------------------------------------------- ; Get One of the Bios Pointers (20_Jun_84) ;----------------------------------------- ; 1) This routine picks up one of the Vectors from the Bios Jump Table. ; 2) On Entry the DE register pair holds the offset to the desired entry ; 3) On Return the DE register pair holds the vector. ; 4) Register Usage: ; DE -> Enter:= Offset to Vector; Exit:= Vector ; HL -> Pointer to base of Bios (Cold Start Entry) ; Get_Bios_Pntr: ld hl,(Bios_Entry+1) ;HL:= Pointer to Warm Boot Entry ld l,0 ;HL:= Pointer to Base of Bios call Get_DE_Indr_HL ;DE:= Contents of Addr Pointed to by HL ret ;Return ;---------------------------------------------------------------------- ; Load the DE register Pair Indirectly Through the HL (5_Jul_84) ;--------------------------------------------------------------- ; 1) This routine Loads the DE register pair Indirectly through the ; HL register pair after adding the entry values of the DE and HL. ; 2) Register Usage: ; DE -> On Entry = Offset; On Exit = (HL + DE) ; HL -> [preseved] Base Address ; Get_DE_Indr_HL: push hl add hl,de ;HL:= Pointer to RamDatY Pointer ld e,(hl) inc hl ld d,(hl) ;DE:= Contents of Addr Pointed to by HL pop hl ret ;Return page ;====================================================================== ; Report Errors (5_Jun_84) ;========================= ; 1) Report Errors on the console. ; 2) Register Usage: ; A -> Has Error Code on entry ; Report_Errors: push af ld a,Error_Opening call Print_Message ;Print the Error Opening Message pop af call Print_Message ;Print the Error Message ret ;====================================================================== ; Print a Message on the Console (5_Jul_84) ;========================================== ; 1) This routine prints a message string on the console. ; 2) Register Usage: ; A -> Has Error Code on entry ; B -> Counter ; C -> Holds copy of Error Code ; DE -> Pointer to Message String ; HL -> Pointer into Message Code Table ; Print_Message: push af ld de,CrLf ;DE:= Pointer to Cr/Lf String ld c,Bdos_PString ;C:= Print String Function call Bdos_Entry ;Print Carriage Return Line Feed pop af ld c,a ;C:= Error Code to Find ld b,Max_Table ld hl,Message_Table ;HL:= Start of the Message table PMLp1: ld a,(hl) ;Repeat A:= Table's Message Code inc hl ld e,(hl) inc hl ld d,(hl) ; DE:= Pointer to String inc hl ; (HL equal to start next entry) cp c ; If (Code eq table) jr z,PMprn ; Goto Print djnz PMLp1 ;Until (the whole tables been checked) ld de,NoCode ;(set pointer to 'Unrecognized Message') PMprn: ld c,Bdos_PString ; call Bdos_Entry ; Print the Message ret page ;---------------------------------------------------------------------- ; Message Strings (5_Jul_84) ;--------------------------- ; ; Message String Lookup Table ;----------------------------- ; Message_Table: ; Message Codes db Drives_Prompt ;Number of Drives Prompt dw DPmsg db Drives_Verify ;Verification Prompt dw DVmsg ; Error Codes db Error_Opening ;Error Intro dw ErrOpn db Error_Version ;Wrong Version of CP/M dw EVmsg End_Table: Max_Table equ ( (End_Table - Message_Table)/3 ) + 1 ;---------------------------------------------------------------------- ; Text Strings (12_Sept_84) ;-------------------------- ; ; Message Strings ;---------------- ; DPmsg: db Cr,Lf,Lf,Tab,Esc,Dim db 'Please enter the Number of ' db Esc,Bright db 'Physical Drives ' db Esc,Dim db Cr,Lf,Tab db 'present in your system (from 1 to 4) ' db Esc,Bright,'$' DVmsg: db Cr,Lf,Lf,Tab db Esc,Dim db 'You have ' db Esc,Bright DrvRsp: db 0 ;Number of Physical Drives from the user's response db Esc,Dim db ' Physical Drive(s).' db Cr,Lf,Tab db 'Is this correct ' db Esc,Bright db '(Y/N) ' db Esc,Dim,'$' ;Error Strings ;------------- ; ErrOpn: db Tab,'*=> Error: $' EVmsg: db Tab,'This Program only runs under CP/M 2.x $' CrLf: db Cr,Lf,'$' NoCode: db Tab,'Unrecognized Message $' ;---------------------------------------------------------------------- ; Data Area (5_Jul_84) ;--------------------- ; DskDef1: db 0 ;Local Copy of Last Drive's DskDef1 DskDef2: db 0 ;Local Copy of Last Drive's DskDef2 end ;---------------------------------------------------------------------- ; Untainted Text ;--------------- ; Please enter the Number of Physical Drives present in your system (from 1 to 4) You have # Physical Drive(s) Is this correct (Y/N)