System information

;
wboot: ;simplest case is to read the disk until all sectors loaded
lxi sp, 80h ;use space below buffer for stack
mvi c, 0 ;select disk 0
call seldsk
call home ;go to track 00
;
mvi b, nsects ;b counts * of sectors to load
mvi c, 0 ;c has the current track number
mvi d, 2 ;d has the next sector to read
; note that we begin by reading track 0, sector 2 since sector 1
; contains the cold start loader, which is skipped in a warm start
lxi h, ccp ;base of cp/m (initial load point)
load1: ;load one more sector
push b ;save sector count, current track
push d ;save next sector to read
push h ;save dma address
mov c, d ;get sector address to register C
call setsec ;set sector address from register C
pop b ;recall dma address to b, C
push b ;replace on stack for later recall
call setdma ;set dma address from b, C
;
; drive set to 0, track set, sector set, dma address set
call read
cpi 00h ;any errors?
jnz wboot ;retry the entire boot if an error occurs
;
; no error, move to next sector
pop h ;recall dma address
lxi d, 128 ;dma=dma+128
dad d ;new dma address is in h, l
pop d ;recall sector address
pop b ;recall number of sectors remaining, and current trk
dcr b ;sectors=sectors-1
jz gocpm ;transfer to cp/m if all have been loaded
;
; more sectors remain to load, check for track change
inr d
mov a,d ;sector=27?, if so, change tracks
cpi 27
jc load1 ;carry generated if sector<27
;
; end of current track, go to next track
mvi d, 1 ;begin with first sector of next track
Appendix B : A Sekletal CBIOS CP/M Operating System Manual
B-3