Title MD-11 CP/M Plus (CP/M-3) Copyright (c), 1983, Morrow Designs, Inc. Subttl Disk Resident Track 1 Loader .Z80 true equ -1 false equ not true xlt1k equ 0 ;dummy include HD19DEF.MAC include DRIVES.MAC include DEFINE.MAC ;used for floppy, hard disk, and file "BOOTHD.COM" boot equ 0FE00h ;Start of boot loader revnum equ 10h ;Revision Number of boot loader revadd equ 50h ;Address of the revision number in rom ldrbdos equ 4000h ;Load address of CPMLDR ;load length is 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 ;---------------------------------------------------------------------- ; begin the cold boot loader ;--------------------------- ; .phase boot start: in a,(clrint) ;Clear any pending interrupts ld sp,boot ld a,(revadd) ;Check revision level ?.x and 0f0h ;high only cp revnum 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 ((revnum and 0f0h) shr 4) + 30h db '.x' db cr,lf,0 ds start+70h-$,0 ;fill, locate mtab at boot+70h ;MD-11 MTAB for floppy or hard disk btab2: MTMA ;DRIVE A: MTAB ;---------------------------------------------------------------------- ; disk format tables for old udecision compatibility ;--------------------------------------------------- ;these are located at boot+80h btab: db 0 db 4 ;double sided system 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 ;The loader... ;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 ;save count call rdhst ;Loop 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 page ends: if ends-boot gt 200h error ;code is too long for memory endif .dephase end