# File putsys3.asm 0000 ;Putsys3 by Donn Stewart, June 2019 0000 ;Copies the memory image of CP/M loaded at E400h onto track 0 of the first CP/M disk 0000 ;Image size is 6400 bytes, so need to save 6400/128 = 50 sectors 0000 ;For system with 64-sector tracks, image can all be on track 0 0000 ;Load and run from ROM monitor 0000 ;Uses calls to cbios, in memory at FA00h 0000 ;This version for z80_cbios3, with improved disk read and write routines 0000 ;Writes track 0, sectors 1 to 50 (sector 0 has cpm loader) 0000 seldsk: equ 0fb5fh ;pass disk no. in c 0000 setdma: equ 0fb89h ;pass address in bc 0000 settrk: equ 0fb78h ;pass track in reg C 0000 setsec: equ 0fb7dh ;pass sector in reg c 0000 write: equ 0fbfdh ;write one CP/M sector to disk 0000 monitor_warm_start: equ 046Fh ;Return to ROM monitor 0000 org 0800h 0800 0e 00 ld c,00h ;CP/M disk a 0802 cd 5f fb call seldsk 0805 ;Write track 0, sectors 1 to 50 0805 3e 01 ld a,1 ;starting sector 0807 32 42 08 ld (sector),a 080a 21 00 e4 ld hl,0E400h ;memory address to start 080d 22 43 08 ld (address),hl 0810 0e 00 ld c,0 ;CP/M track 0812 cd 78 fb call settrk 0815 3a 42 08 wr_trk_0_loop: ld a,(sector) 0818 4f ld c,a ;CP/M sector 0819 cd 7d fb call setsec 081c ed 4b 43 08 ld bc,(address) ;memory location 0820 cd 89 fb call setdma 0823 cd fd fb call write 0826 3a 42 08 ld a,(sector) 0829 fe 32 cp 50 082b ca 3f 08 jp z,done 082e 3c inc a 082f 32 42 08 ld (sector),a 0832 2a 43 08 ld hl,(address) 0835 11 80 00 ld de,128 0838 19 add hl,de 0839 22 43 08 ld (address),hl 083c c3 15 08 jp wr_trk_0_loop 083f c3 6f 04 done: jp monitor_warm_start 0842 00 sector: db 00h 0843 00 00 address: dw 0000h 0845 end # End of file putsys3.asm 0845