Title SPECIAL Hard Disk Drive Park Program (22_Mar_84) ; Copyright 1984 ; Morrow Designs, Inc. ; San Leandro, Ca. ; John Zalabak .z80 aseg org 0100h ; Index: Park (8_Jan_84) ;----------------------- ; ; PARK Park the Hard Disk Heads ; PSTR Print a String ; DOCOLD Call the Bios Cold Boot Entry Point ; ; DATA Print Strings ; ;---------------------------------------------------------------------- ; Equates (8_Jan_84) ;------------------- ; Rev equ 20h ;Park Program Revision Number ;System Addresses and Constants Wbadd equ 1 ;Warm Boot Address Bdos equ 5 ;Bdos Entry Point Extd14 equ 14 ;Extended Bios Function 14 (Execute system mem) PrkOff equ 2Bh ;Offset to the start of the Park jump vector ;Bdos Function Numbers ChrFun equ 2 ;Bdos Print Character Function Number StrFun equ 9 ;Bdos Print String Function Number ;Ascii Character Definitions cr equ 0Dh ;Carriage Return lf equ 0Ah ;Line Feed page ;---------------------------------------------------------------------- ; PARK - Park the Hard Disk Heads (8_Jan_84) ;------------------------------------------- ; Park: ld de,SignOn call Pstr ;Print the Sign-On Message ;Read the Mtabs to the Local Buffer ld a,3 ;A:= Function Number (read Mtabs) call GetBuf ;Fill the Local Buffer with the Mtabs ld a,Extd14 ;A:= Function_14 (Execute in System Memory) ld hl,PrkOff ;HL:= Vector to Park Program call DoCold ;Park the Hard Disk Drives ld de,DonMsg call Pstr Loop: ld c,11 ;Repeat C:= Bdos Function Number call 5 ; call the Bdos or a jr z,Loop ;Until (a character has been hit) jp 0 ;Warm Boot ;---------------------------------------------------------------------- ; PSTR - Print a String (8_Jan_84) ;--------------------------------- ; 1) This routine calls the Bdos Print string function. ; 2) The BC register pair is preserved ; 3) On entry the DE register pair must be pointing to the print string. ; Pstr: push bc ld c,StrFun ;C:= Print String Function call Bdos ;Print the String pop bc ret ;Return ;---------------------------------------------------------------------- ; PCHR - Print a Character (8_Jan_84) ;------------------------------------ ; 1) This routine calls the Bdos Character function. ; 2) The BC register pair is preserved ; 3) On entry the E register must Contain the character to print. ; Pchr: push bc ld c,ChrFun ;C:= Print String Function call Bdos ;Print the String pop bc ret ;Return ;---------------------------------------------------------------------- ; GETBUF - Move system memory into the local buffer (4_Jan_84) ;------------------------------------------------------------- ; 1) This routine forces the destination to be the local buffer, calls ; the cold start (extended bios functions) entry point, and then saves ; the registers after swapping hl and de. ; GetBuf: ld de,LocBuf ;DE:= Pointer to Local Buffer call DoCold ;Move System Memory into the local buffer ld (saveBC),bc ;Save the returned registers ex de,hl ;HL:= Pointer to first xlt ld (saveDE),de ld (saveHL),hl ret ;Return ;---------------------------------------------------------------------- ; PUTBUF - Put the Local Buffer into System Memory (4_Jan_84) ;------------------------------------------------------------ ; 1) This is the inverse of GetBuf; It replaces the system's memory ; with the contents of the local buffer. ; 2) GetBuf MUST be called before entering this routine. ; PutBuf: ld a,1 ;Function_1:= Write to system memory ld bc,(SaveBC) ld de,(SaveDE) ld hl,(SaveHL) ;Restore the Returned Registers call DoCold ;Write the Mtabs back into system memory ret ;---------------------------------------------------------------------- ; DOCOLD - Call the Bios Cold Boot Entry Point (4_Jan_84) ;-------------------------------------------------------- ; 1) The Cold Boot Entry point to the bios (1st entry in the bios ; jump table) is located by looking at locations 1 & 2 which ; point to the warm boot address (the desired address + 3). ; DoCold: push hl ;Save the HL Register Pair ld hl,(Wbadd) ;HL:= Warm Boot Address ld l,0 ;HL:= Cold Boot Address ex (sp),hl ;Restore the HL Register Pair ret ;Goto The Cold Boot entry page ;---------------------------------------------------------------------- ; Data Areas (8_Jan_84) ;---------------------- ; SaveBC: dw 0 ;Save Location for the BC Register pair SaveDE: dw 0 ; " " " " DE " " SaveHL: dw 0 ; " " " " HL " " LocBuf: ds 100h,0 ;Local Buffer for Mtabs ;---------------------------------------------------------------------- ; DATA - Print Strings (30_Jan_84) ;--------------------------------- ; SignOn: db cr,lf,'MD-11 Drive Shut Down Program for Dan' db ((Rev and 0f0h) shr 4) + '0','.',(Rev and 0fh) + '0' db cr,lf,'Copyright 1984 Morrow Designs Inc.' db cr,lf,'$' DonMsg: db cr,lf,'You may now turn off the power to your system $' end