57 lines
1.2 KiB
Z80 Assembly
57 lines
1.2 KiB
Z80 Assembly
;Copies the memory image of CP/M loaded at E400h onto tracks 0 and 1 of the first CP/M disk
|
|
;Load and run from ROM monitor
|
|
;Uses calls to BIOS, in memory at FA00h
|
|
;Writes track 0, sectors 2 to 26, then track 1, sectors 1 to 25
|
|
|
|
#target bin
|
|
#code _HOME, 0x1400
|
|
|
|
_bios equ (0x4A00+0xB000)
|
|
seldsk equ _bios+0x1b
|
|
settrk equ _bios+0x1e
|
|
setsec equ _bios+0x21
|
|
setdma equ _bios+0x24
|
|
write equ _bios+0x2a
|
|
|
|
monitor_warm_start equ 0x0433 ;Return to ROM monitor
|
|
|
|
main:
|
|
ld c,00h ;CP/M disk a
|
|
call seldsk
|
|
|
|
;Write track 0, sectors 2 to 51
|
|
ld a,1 ;starting sector
|
|
ld (sector),a
|
|
ld hl, 0x6400 ;start of CCP
|
|
ld (address),hl
|
|
ld c,0 ;CP/M track
|
|
call settrk
|
|
|
|
wr_trk_0_loop:
|
|
ld a,(sector)
|
|
ld c,a ;CP/M sector
|
|
call setsec
|
|
ld bc,(address) ;memory location
|
|
call setdma
|
|
call write
|
|
ld a,(sector)
|
|
cp 50 ;done:
|
|
jp z,done ;yes
|
|
inc a ;no, next sector
|
|
ld (sector),a
|
|
ld hl,(address)
|
|
ld de,128
|
|
add hl,de
|
|
ld (address),hl
|
|
jp wr_trk_0_loop
|
|
|
|
done:
|
|
jp 0x0000
|
|
|
|
sector:
|
|
db 00h
|
|
|
|
address:
|
|
dw 0000h
|
|
end
|