Skip to content

Commit

Permalink
support for linking different disk and input drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
mist64 committed Sep 20, 2016
1 parent 24a0279 commit 0971b34
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

VARIANT ?= bsw
DRIVE ?= drv1541
INPUT ?= joydrv

AS=ca65
LD=ld65
Expand Down Expand Up @@ -126,12 +128,12 @@ $(BUILD_DIR)/kernal_compressed.prg: $(BUILD_DIR)/kernal_combined.prg
pucrunch -f -c64 -x0x5000 $< $@ 2> /dev/null

$(BUILD_DIR)/kernal_combined.prg: $(ALL_BINS)
@echo Creating $@
@echo Creating $@ from kernal.bin $(DRIVE).bin $(INPUT).bin
@printf "\x00\x50" > $(BUILD_DIR)/tmp.bin
@dd if=$(BUILD_DIR)/kernal/kernal.bin bs=1 count=16384 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/drv/drv1541.bin /dev/zero | dd bs=1 count=3456 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/drv/$(DRIVE).bin /dev/zero | dd bs=1 count=3456 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=24832 skip=19840 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/input/joydrv.bin >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/input/$(INPUT).bin >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@mv $(BUILD_DIR)/tmp.bin $(BUILD_DIR)/kernal_combined.prg

$(BUILD_DIR)/drv/drv1541.bin: $(BUILD_DIR)/drv/drv1541.o drv/drv1541.cfg $(DEPS)
Expand Down Expand Up @@ -163,7 +165,7 @@ $(BUILD_DIR)/input/pcanalog.bin: $(BUILD_DIR)/input/pcanalog.o input/pcanalog.cf

$(BUILD_DIR)/%.o: %.s
@mkdir -p `dirname $@`
$(AS) -D $(VARIANT)=1 $(ASFLAGS) $< -o $@
$(AS) -D $(VARIANT)=1 -D $(DRIVE)=1 -D $(INPUT)=1 $(ASFLAGS) $< -o $@

$(BUILD_DIR)/kernal/kernal.bin: $(PREFIXED_KERNAL_OBJS) kernal/kernal_$(VARIANT).cfg
@mkdir -p $$(dirname $@)
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ You can build a specific variant like this:

All output will be put into `build/<variant>`.

## Drivers

By default, the KERNAL image will contain the Commodore 1541 disk driver (`drv1541`) and the joystick input driver (`joydrv`). You can specify different drivers to be included like this:

make DRIVE=<drive> INPUT=<input>

Supported drives are `drv1541`, `drv1571` and `drv1581`. Supported input devices are `amigamse`, `joydrv`, `koalapad`, `lightpen`, `mse1531` and `pcanalog`.


## Customization

The KERNAL variant `custom` is meant for your experimentation. Inside the `.ifdef custom` section in `config.inc`, you can toggle several compile time options:
Expand Down
10 changes: 10 additions & 0 deletions config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,13 @@ useRamExp = 1
.else
REUPresent = 1
.endif

.if .defined(drv1541)
DRV_TYPE = 1 ; DRV_1541
.elseif .defined(drv1571)
DRV_TYPE = 2; DRV_1571
.elseif .defined(drv1581)
DRV_TYPE = 3; DRV_1581
.else
.error "Unknown drive type!"
.endif
3 changes: 1 addition & 2 deletions kernal/start.s
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
; everything work.
;
; TODO: * REU detection seems to be currently missing.
; * This is hardcoded to a 1541 drive.
; * It would be best to put the original GEOS 2.0 code
; here.
;
Expand Down Expand Up @@ -131,7 +130,7 @@ ASSERT_NOT_BELOW_IO
sta NUMDRV
ldy $BA
sty curDrive
lda #DRV_1541
lda #DRV_TYPE ; see config.inc
sta curType
sta _driveType,y

Expand Down

0 comments on commit 0971b34

Please sign in to comment.