Split from cpm repository

This commit is contained in:
2021-01-14 02:46:09 +01:00
commit eeb7a64290
4 changed files with 103 additions and 0 deletions

30
src/loader.z80 Normal file
View File

@@ -0,0 +1,30 @@
;Retrieves CP/M from disk and loads it in memory starting at E400h
;Uses calls to ROM subroutine for disk read.
;Reads track 0, sectors 2 to 26, then track 1, sectors 1 to 25
;This program is loaded into LBA sector 0 of disk, read to loc. 0800h by ROM disk_read subroutine, and executed.
#target bin
#code _HOME, 0x1100
hstbuf equ 0x1200 ;will put 256-byte raw sector here
disk_read equ 0x0296 ;subroutine in 2K ROM
cpm equ 0xFA00 ;CP/M cold start entry in BIOS
main:
ld c,1 ;LBA bits 0 to 7
ld b,0 ;LBA bits 8 to 15
ld e,0 ;LBA bits 16 to 23
ld hl,0xE400 ; Memory address -- start of CCP
loop:
call disk_read ;subroutine in ROM
ld a,c
cp 50
jp z,done
inc a
ld c,a
jp loop
done:
out (1),a ;switch memory config to all-RAM
jp cpm ;to BIOS cold start entry