Split from cpm repository
This commit is contained in:
commit
eeb7a64290
BIN
.build/loader.bin
Normal file
BIN
.build/loader.bin
Normal file
Binary file not shown.
57
.build/loader.lst
Normal file
57
.build/loader.lst
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
; --------------------------------------
|
||||||
|
; zasm: assemble "loader.z80"
|
||||||
|
; date: 2021-01-14 02:43:53
|
||||||
|
; --------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
;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
|
||||||
|
|
||||||
|
|
||||||
|
; +++ segments +++
|
||||||
|
|
||||||
|
#CODE _HOME = $1100 = 4352, size = $001C = 28
|
||||||
|
|
||||||
|
; +++ global symbols +++
|
||||||
|
|
||||||
|
_HOME = $1100 = 4352 _HOME loader.z80:6 (unused)
|
||||||
|
_HOME_end = $111C = 4380 _HOME loader.z80:6 (unused)
|
||||||
|
_HOME_size = $001C = 28 _HOME loader.z80:6 (unused)
|
||||||
|
cpm = $FA00 = 64000 _HOME loader.z80:11
|
||||||
|
disk_read = $0296 = 662 _HOME loader.z80:10
|
||||||
|
done = $1117 = 4375 _HOME loader.z80:28
|
||||||
|
hstbuf = $1200 = 4608 _HOME loader.z80:9 (unused)
|
||||||
|
loop = $1109 = 4361 _HOME loader.z80:19
|
||||||
|
main = $1100 = 4352 _HOME loader.z80:13 (unused)
|
||||||
|
|
||||||
|
|
||||||
|
total time: 0.0002 sec.
|
||||||
|
no errors
|
16
Makefile
Normal file
16
Makefile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
BUILDDIR=.build
|
||||||
|
_BIN= loader.bin
|
||||||
|
BIN = $(patsubst %,$(BUILDDIR)/%,$(_BIN))
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(BUILDDIR) $(BIN)
|
||||||
|
|
||||||
|
$(BUILDDIR)/%.bin: src/%.z80 | $(BUILDDIR)
|
||||||
|
@zasm -w -i $< -o $@
|
||||||
|
|
||||||
|
$(BUILDDIR):
|
||||||
|
@mkdir $(BUILDDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -df $(BUILDDIR)/*.bin $(BUILDDIR)/*.lst .build
|
30
src/loader.z80
Normal file
30
src/loader.z80
Normal 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
|
Loading…
Reference in New Issue
Block a user