Title Disk Resident Loader for MD-HD (5_Sept_84) ; ; Copyright (c), 1983, 1984, ; Morrow Designs, Inc. ; 600 McCormick ; San Leandro, Ca. 94577 .z80 .Phase 0FE00h ; This is the Part of the Loader that is resident on the first ; track of a bootable Floppy or Hard Disk. ; ;---------------------------------------------------------------------- ; Include Files ;-------------- ; ; .sall ;Suppress all Macro Expansions .xlist ;Suppress Listing of Include Files Include HD23DEF.MAC ;General Definitions/Equates File Include DRIVES.MAC ;Drive Definition Include DEFINE.MAC ;Drive Selection .list ;Resume Listing ;---------------------------------------------------------------------- ; Equates (5_Sept_84) ;-------------------- ; xlt1k equ 0 ;dummy Boot_Orign equ 0FE00h ;Start of boot loader Rev_Address equ 50h ;Address of the revision number in rom LdrBdos equ 4000h ;Load address of CPMLDR (load len=4k) ;Rom Jump Table Definitions Mesg equ Rom + 3 ;output a message string (I/O mod.) RdHst equ Rom + 9 ;read a sector (disk mod.) BtErr equ Rom + 18h ;output boot error and halt (disk mod.) page 60 ;---------------------------------------------------------------------- ; begin the cold boot loader ;--------------------------- ; Start: ld a,$AutoE out (BnkStb),a ;Set Auto Enable ld a,0 out (CtlStb),a ;Clear the Control Strobe im 1 ;Set interrupt mode 1 in a,(ClrInt) ;Clear any pending interrupts nop ;Time Pad for Mode Clear to propogate nop ld a,0 out (BnkStb),a ;Clear State Latch of disk controller ld sp,Boot_Orign ld a,(Rev_Address) ;Check revision level ?.x and 0F0h ;high only cp RomRev jp z,strsk1 ;if not compatible, exit ld de,RvMsg call Mesg ;"Wrong revision of rom... jp BtErr ;"Press Reset...halt RvMsgº dâ cr,lf,'Wronç revisioî oæ Rom.' db ' This version of Cp/m requires Rom Rev ' db ((RomRev and 0F0h) shr 4) + 30h db '.x' db Cr,Lf,0 ds Start+70h-$,0 ;fill, locate mtab at Boot_Orign+70h ;MD-11 MTAB for floppy or hard disk btab2: MTMA ;DRIVE A: MTAB ;---------------------------------------------------------------------- ; disk format tables for old udecision compatibility ;--------------------------------------------------- ; 1) This Code is located at Boot_Orign+80h ; btab: db 0 db 4 ;double sided system flag byte db 0 db 0 db 0 db 0 db 0 db 0 db 0 dw 40 ;Disk Parameter Block db 4 db 15 db 1 dw 194 dw 191 db 0e0h db 0 dw 48 dw 2 db 89h page ;---------------------------------------------------------------------- ; Remainder of the Cold Start Loader ;----------------------------------- ; 1) The rom is on, bank 1 is selected, iy -> ramdaty @ fc00 ; ;Copy Mtab behind RamDatY strsk1: push iy ;calc. mtab position pop hl ld de,mtoff ;offset to mtab position add hl,de ex de,hl ;DE:= Destination ld hl,btab2 ;HL:= Source (Start of Boot MTAB) ld bc,16 ;BC:= Count (length of an MTAB) ldir ;Move the boot mtab into ramdatY MTAB ; Set up to read starting at track-0 sector-2 sptsk1: ld (iy+hsttrk),0 ld (iy+hsttrk+1),0 ;Track:= 0 ld (iy+hstsec),2 ld (iy+hstsec+1),0 ;Sector:= 2 ld (iy+hstbuf),0 ld (iy+hstbuf+1),high ldrbdos ;Disk Buffer address:= cpm load base ld b,4 ;4 sectors = 4k rdlop: push bc ;Loop save count call rdhst ; Read a Sector ld a,(iy+erflag) ; If (returned status eq error) or a jp nz,bterr ; exit to rom ld hl,dskbuf ; HL:= Source (Disk buffer) ld e,0 ld d,(iy+hstbuf+1) ; DE:= Destination (cpm system) ld bc,1024 ; BC:= Length (1 sector) ldir ; Move disk buffer to system area ld (iy+hstbuf+1),d ; Host_Buffer:= Host_Buffer+1024 inc (iy+hstsec) ; Sector:= Sector + 1 pop bc ;restore count djnz rdlop ;again jp ldrbdos ;Start CPM End_Boot: if (End_Boot - Boot_Orign) gt 200h .Printx "Boot Loader Has OverFlowed" ;code is too long for memory endif .dephase end