home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
KAYPRO
/
KPNUROM.LBR
/
KBOOT.ZQ0
/
KBOOT.Z80
Wrap
Text File
|
2000-06-30
|
7KB
|
244 lines
title KAYPRO IV RESIDENT SOFTWARE PACKAGE
subttl Cold start and configure
;
.z80
;
; ########################################################
; ## ##
; ## Cold start routine, reset and configure ##
; ## system for power up condition. ##
; ## ##
; ## Copyright (C) 1982 By Non-Linear Systems, Inc ##
; ## No warranty is made, expressed or implied. ##
; ## ##
; ########################################################
; ## Last update: july 13/1982 [001] ##
; ## by JIM NICKERSON ##
; ## change list out with busy jump to ##
; ## to check status of serial port ##
; ########################################################
; ## Code revised to Kaypro 4 rom - 3 Mar. 84 cbf ##
; ########################################################
; ## Revised to eliminate anomalous corrections and to ##
; ## reserve space for future connectors. All routines ##
; ## are now connected through the vector. 85/6/14 cbf ##
; ########################################################
; ## Modified initial diskinit call, to allow for error ##
; ## summary retention. 85/6/18 cbf ##
; ########################################################
;
true equ -1
false equ not true
debug equ false
;
extrn diskinit, vidinit, devinit, datainit
extrn home
extrn seldsk, settrk, setsec, setdma
extrn read, write
extrn sectran, diskon, diskoff
extrn kbdstat, kbdin, kbdout
extrn ttystat, ttyin, ttyout, ttyostat
extrn liststat, list
extrn vidout
extrn thnsd, clkspd
if debug
extrn bitport, bankbit
extrn initvid, initdev, initdisk, outvid
endif
;
; Jump vector entry points, for external linkages
entry .start, .dinit, .vinit, .pinit; initializers
entry .home
entry .seldsk, .settrk, .setsec, .setdma
entry .read, .write
entry .sectran, .diskon, .diskoff
entry .kbdstat, .kbdin, .kbdout
entry .ttystat, .ttyin; serial input
entry .ttyout, .ttyostat; serial output
entry .liststat, .list; parallel output
entry .vidout, .print; screen output
entry .thnsd; delay b*10 millisec
;
cr equ 0dh
lf equ 0ah
esc equ 1bh; ascii esc
bell equ 07h; kbd bell
;
;
; This data segment will be the FIRST to be allocated.
;
dseg; OVERLAYS start of all system storage
bootld: ds 512; (usually at 0fa00h, overwritten)
stack equ $ + 1024; (usually 0, wrapped around)
;
cseg
;
; ROM master jump table
.start: jp start; start up computer
.dinit: if debug
jp initdisk
else
jp diskinit; disk initialize
endif
.vinit: if debug
jp initvid; needs rom to run
else
jp vidinit; video initialize
endif
.pinit: if debug
jp initdev
else
jp devinit; device initialize
endif
;
.home: jp home; home selected disk drive
.seldsk: jp seldsk; select a disk drive
.settrk: jp settrk; seek a track
.setsec: jp setsec; set sector number to read
.setdma: jp setdma; set dma address
.read: jp read; read logical sector
.write: jp write; write logical sector
.sectran: jp sectran; xlate sector number
.diskon: jp diskon; turn on disk
.diskoff: jp diskoff; turn off disk
;
.kbdstat: jp kbdstat; KeyBoarD character ready
.kbdin: jp kbdin; input from keyboard
.kbdout: jp kbdout; output to keyboard
; (used to ring bell)
;
.ttystat: jp ttystat; status of serial input port
.ttyin: jp ttyin; serial input
.ttyout: jp ttyout; serial output
;
.liststat: jp liststat; list out status (Centronics)
.list: jp list; list output
;
.ttyostat: jp ttyostat; teststatus of serial output
;
.vidout: if debug
jp outvid; needs rom to run
else
jp vidout; video output
endif
;
.thnsd: jp thnsd; short delay
; END of vectors originally known to system.
;
.xinit jp datainit; Clear error summaries
.print jp print; string de^ to video
;
;
ds 66h - ($-.start),0; spare connectors, zeroed
;
; NMI vector used for disk driver synchronization. Must be at 066h
ret; return from "halt", NMI sequence when in rom
;
; ------------------------------------------------------------------
;
; System initialization
start: di; stop interupts while setup
ld sp,stack; rom stack point
ld hl,1670; approx delay count, preliminary
ld (clkspd),hl; will be set right on .pinit
ld b,10; delay to let the hardware stabilize
call .thnsd
call .pinit; init device sub-system
call .vinit; init video sub-system
call .xinit; Clear the error summaries etc
call .dinit; init disk sub-system
; " "
; boot system, the first sector (0) of the first track (0) holds
; system boot information. It does NOT hold a short boot routine!
; the image is:
; self: jr self; hang if booted and run
; defw loadpt; where to load the opsys image
; defw bios; where to go after booting system
; defw length; length of image in 128 byte sectors
; (* the rest of the sector is not used *)
;
; This image is loaded and inspected at bootld during boot process
; (bootld is normally 0fa00h)
ld de,bmsg
call print
ld c,0
call .seldsk; select disk, set density,
; do home after diskinit
ld bc,0; set track
call .settrk
ld c,0; read the first sector
call .setsec
ld bc,bootld; header sector to go here
call .setdma
call .read; read sector to FA00
di; read does EI upon exit
or a; trouble reading?
jp nz,booterr; tell crt
; " "
ld hl,(bootld+4); where to go after loading system
push hl; save for latter use
ld hl,(bootld+2); where to load system image
push hl; save dma
ld b,h
ld c,l
call .setdma
ld hl,(bootld+6); length of system in 128 byte sectors
ld b,l; reg B holds # of sectors to load
ld c,1; initial sector (0 was header sector)
; " "
cb1: push bc; save sector count and current sector
ld b,0
call .setsec; select sector
call .read
di; read does EI upon exit
pop bc
pop hl; dma
or a
jp nz,booterr; bad read of sector
ld de,128
add hl,de; advance dma address
dec b
ret z; done booting, goto system
push hl; save dma
push bc; save sector/count
ld b,h
ld c,l
call .setdma
pop bc
inc c; bump sector count
ld a,40; over sectors/track?
cp c
jp nz,cb1; fetch another sector
ld c,16; first sector to read on next track
push bc; save counts
ld bc,1; set for next track
call .settrk
pop bc
jp cb1
;
booterr:
ld de,xmsg
call print
call .diskoff; turn off disk drive
self: jp self; hang till user pushes reset
;
bmsg: db esc,'=',' '+10,' '+30
db '* Kaypro 4-83 1.2 *'
db esc,'=',' '+13,' '+20
db ' Please place your diskette into Drive A',8,0
;
xmsg: db cr,lf, cr,lf
db bell,'I cannot read your diskette.',0
;
; Output string de^ until zero byte
; a,f,c,d,e,h,l
print: ld a,(de)
inc de
or a
ret z
ld c,a
call .vidout
jp print
;
end