Switched to sdcc based toolchain

This commit is contained in:
Dreaded_X 2021-06-18 23:18:33 +02:00
parent 3047e36053
commit 66f9451983
3 changed files with 56 additions and 39 deletions

View File

@ -1,16 +1,34 @@
BUILDDIR=.build
_BIN= loader.bin
BIN = $(patsubst %,$(BUILDDIR)/%,$(_BIN))
AS = sdasz80
LD = sdldz80
OBJCOPY = sdobjcopy
BUILD = .build
TARGET = loader
ASFLAGS = -plosff
SRC = \
src/loader.s \
OBJ = $(addprefix $(BUILD)/, $(notdir $(SRC:.s=.rel)))
vpath %.s $(sort $(dir $(SRC)))
.PHONY: all clean
all: $(BUILDDIR) $(BIN)
all: $(BUILD) $(BUILD)/$(TARGET).bin
$(BUILDDIR)/%.bin: src/%.z80 | $(BUILDDIR)
@zasm -w -i $< -o $@
$(BUILD)/%.rel: %.s Makefile | $(BUILD)
$(AS) $(ASFLAGS) $@ $<
$(BUILDDIR):
@mkdir $(BUILDDIR)
$(BUILD)/$(TARGET).ihx: $(OBJ)
$(LD) -i $@ $(OBJ) -b MAIN=0x1100
%.bin: %.ihx
$(OBJCOPY) -I ihex -O binary $< $@
$(BUILD):
mkdir $@
clean:
@rm -df $(BUILDDIR)/*.bin $(BUILDDIR)/*.lst .build
rm -fr $(BUILD)

29
src/loader.s Normal file
View File

@ -0,0 +1,29 @@
;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.
hstbuf .equ (0x1200) ; Will put 256-byte raw sector here
disk_read .equ (0x029C) ; Subroutine in 2K ROM
cpm .equ (0xFA00) ; CP/M cold start entry in BIOS
.area MAIN
main:
ld c, #0x01 ; LBA bits 0 to 7
ld b, #0x00 ; LBA bits 8 to 15
ld e, #0x00 ; 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 (0x01), a ; Switch memory config to all-RAM
jp cpm ; lto BIOS cold start entry

View File

@ -1,30 +0,0 @@
;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 0x029C ;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