.z80 title boot (excboot) 1st sector rom bootstrap ; 1983-03-21 issue bios boot err msg on read errors ; 1983-03-20 set for 1st release ; 1983-02-21 boot hdr, enable key table ; 1983-02-17 clear screen before font load, len err msg ;**************************************** ;* * ;* EXECUTIVE BIOS * ;* for * ;* CP/M 3.XX * ;* by * ;* * ;* Glenn S. Tenney * ;* COMPRO * ;* P.O. Box 5260 * ;* San Mateo, CA 94402 * ;* * ;* Copyright (c) 1983 * ;* Osborne Computer Corporation * ;* * ;**************************************** ; By: Glenn S. Tenney 1982-12-27 ; this code is limited to 1 physical sector ; (or 1k) and must read in the ccpldr from the ; remainder of the 1st track ; system track layout ; track 0 this program sector 1 (max of 1k) ; cpmldr sector 2-5 (max of 4k) ; track 1 sector 1-4 ccp.com (actually only 3+k) ; sector 5 bios overrides ; track 2 sectors 1-4 are character generation tables ; sector 5 rom's ram overrides ; this bootstrap is read in by the rom into bank 0 ; location 4000h and then reads the ccpldr into 4400h ; include EXCBIOSE.LIB .xlist include EXCBIOSE.LIB .list aseg ; the following is the layout of the rom's ram ; override sector (track 2 sector 5) table equ 0f000h ; place in common to load a table ; 1st is rom's version number (not used) ikbdtbl equ table+2 ; keyboard masks and decode tables ; function keys ikbdlen equ 11+320+512 ; length of all of that ihz equ ikbdtbl+ikbdlen ; frequency (50 or 60) icur equ ihz+1 ; escape sequence char for cursor type ibg equ icur+1 ; esc seq char for background type iclick equ ibg+1 ; esc seq char for kbd click cpmldr equ 4400h ; place cpmldr is linked to execute org 4000h ; must be here !!! ; the following is the header that MUST appear ; at the beginning of the 1st sector of the system ; disk. This header is used by the rom to verify ; that this is a valid system diskette and may be ; used in the future by this and other bios'es to ; determine diskette formats. nop ; x'00' = system bootable disk jp start ; followed by jmp to real code db 2 ; product code (must match rom) db 0 ; feature code ; the next byte is a length byte. ; this tells how many table bytes follow. ; it is here for future expansion, since it is ; expected that the media type byte and the dpb for ; this diskette will be here. That will allow diskettes ; to be other than O1 format double density. ; It is zero now so that when the format is resolved ; future bios'es can tell the difference. db 0 ; number of table bytes following start: ld sp,0fd00h ; stack up in common in a,(sys) ; current bank or 80h ; turn on rom out (sys),a ; reads in cpmldr from system track 0 ld hl,raminit ; init parms in ram from here ld a,04 ; read 4 sectors (2-5) call read ; read disk or a ; any errors? jp nz,booterr ; yes--issue a msg and hang ; reads in 4k of character sets from track 2 ld hl,chrinit ; init parms to read in char sets ld a,4 ; read both character sets call read ; read disk jp nz,booterr ; yes--issue a msg and hang ; font ram will be loaded a little later ; read in table of rom's ram to init ld hl,tblinit ; disk parm table ld a,1 ; read 1 sector call read jp nz,booterr ; yes--issue a msg and hang ; table is as follows ; rom version (2) unused ; kbd decode (11+320) ; fcn keys (512) ; hertz (1) ; crt esc chars (3) curtype,bg,click di ; just in case kbd is touched ld bc,11+320+512 ; copy keyboard masks, decode and function keys ld de,kbdtbl ; where it is to be in rom's ram ld hl,ikbdtbl ; from disk ldir ; move it in ld b,08h ; bit on if 50hz ld a,(ihz) ; get hertz value ld (hertz),a ; set into rom's ram cp 60 ; see how to init the port jr nz,not50 ; 50hz means b is right ld b,0 ; 60hz, so no bit gets set not50: in a,(sysb) ; get crnt status and 255-08h ; clear 50/60 bit or b ; and set to desired rate out (sysb),a ; so it is all set ei ; now ready to alter the screen etc. ld c,1ah ; ctl-z = clear screen call 100h+cout ; 1st clear the screen ; then copy font data to font memory ld hl,chrfont ; from what we just read ld de,0 ; into font memory ld bc,4*1024 ; both fonts ldir ; just move it in ; (rom is already enabled) ; send escape sequences to set cursor type, bg type and click ld c,1bh ; escape call cout+100h ld c,'.' ; period call cout+100h ld a,(icur) ; and initial cursor type ld c,a call cout+100h ld c,1bh call cout+100h ld c,'x' call cout+100h ld a,(ibg) ; initial background ld c,a call cout+100h ld c,1bh call cout+100h ld a,(iclick) ; and initial keyboard click ld c,a call cout+100h ld c,1bh call cout+100h ld c,'e' ; enable kbd table decode call cout+100h ; all done, turn rom off in a,(sys) ; current bank and 07fh ; turn off rom out (sys),a ; all ready for cpmldr jp cpmldr ; off to it now page ; subroutines etc.... ; read ; hl=ptr to parms in our ram area here ; a=number of sectors to read ; setup disk parms and read disk read: ld de,dmabank ; to common ram area ld bc,ramilen ; this many bytes ldir ; copy ld b,a ; copy number of sectors to read jp rsec+100h ; let rom read now! ; booterr ; when we detect any disk error we come ; here to issue a message and then just hang booterr: ; issue an error message ld hl,errmsg ; pt to start of message errlp: ld c,(hl) ; get next character of msg ld a,c ; see if this is the end of the msg or a ; if so, forcibly loop forever jr z,errlp ; end ----> loop forever inc hl ; advance to next character push hl call cout+100h ; send that character pop hl jr errlp ; keep sending the msg page ; equates and constants ; the error message we issue in case of any disk read error ; (a 00h byte ends the msg) errmsg: db 0dh,0ah,07 db 'BIOS boot error reading disk. ' db 'System reset required.' db 0dh,0ah,00 raminit: ; table to init ram parms for disk read db 00h ; bank dw cpmldr ; dma address db 2 ; start at sector 2 dw 0 ; of track 0 db 0 ; from drive 0 ramilen equ $-raminit ; length to init chrfont equ cpmldr+4096 ; after cpmldr comes fonts chrinit: ; table for reading character sets db 80h ; rom bank dw chrfont ; where character sets are db 1 ; start sector 1 dw 2 ; track 2 db 0 ; from drive 0 tblinit: ; to init rom's other ram areas from disk db 80h ; any bank (really in common) dw table ; up in hi memory db 5 ; sector 5 dw 2 ; track 2 db 0 ; drive 0 ; at the very end of this boot sector will be the ; serialization info. Therefore, show it takes up some ; space in case the boot is too large. bootlen equ $-start ; length of this program if bootlen and 0fc00h ; if > 1k (1 sector) .' error, boot is too large ' endif end