Skip to content

Commit

Permalink
Merge pull request #118 from Konamiman/fix-return-values-and-ram-usag…
Browse files Browse the repository at this point in the history
…e-for-fdisk
  • Loading branch information
Konamiman committed Apr 12, 2023
2 parents 4f1def0 + 0855f28 commit 181d3e0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
Empty file modified buildtools/linux/mknexrom 100644 → 100755
Empty file.
49 changes: 35 additions & 14 deletions source/kernel/Makefile
Expand Up @@ -4,7 +4,7 @@
# See the "all" main rule for some handy aliases to generate specific ROMs
# (e.g. you can run "make base" or "make ide").

# The N80 and LK80 binaries to use can be overriden with environment variables, e.g.:
# The N80, LK80, LB80 and MKNEXROM binaries to use can be overriden with environment variables, e.g.:
# N80=/path/to/N80 make


Expand All @@ -28,6 +28,10 @@ endif

export LB80_ARGS=--no-show-banner --verbosity 0

ifeq ($(strip $(MKNEXROM)),)
MKNEXROM=mknexrom
endif

define SymToEqus
$(eval REGEX:=([0-9A-F]{4}) ($(3)))
cat $(1) | grep -Eo "$(REGEX)" | sed -r "s/$(REGEX)/\2 equ \1h\n\tpublic \2\n/g" > $(2)
Expand Down Expand Up @@ -62,7 +66,7 @@ endef

all: base ide ide-masteronly ide-emu ide-masteronly-emu ascii8 ascii16 mfrsd flashjacks ocm

TOOLS := $(N80) $(LK80) $(LB80) objcopy sdcc mknexrom dd
TOOLS := $(N80) $(LK80) $(LB80) objcopy sdcc $(MKNEXROM) dd

.phony: prerequisites

Expand Down Expand Up @@ -95,7 +99,7 @@ drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.ROM: \
drivers/SunriseIDE/sunride.bin \
drivers/SunriseIDE/chgbnk.bin

mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/sunride.bin /m:drivers/SunriseIDE/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/SunriseIDE/sunride.bin /m:drivers/SunriseIDE/chgbnk.bin
$(call copy_to_bin,$@)

drivers/SunriseIDE/sunride.bin: \
Expand All @@ -113,7 +117,7 @@ drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.ROM: \
drivers/SunriseIDE/sunride.masteronly.bin \
drivers/SunriseIDE/chgbnk.bin

mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/sunride.masteronly.bin /m:drivers/SunriseIDE/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/SunriseIDE/sunride.masteronly.bin /m:drivers/SunriseIDE/chgbnk.bin
$(call copy_to_bin,$@)

drivers/SunriseIDE/sunride.masteronly.bin: \
Expand All @@ -133,7 +137,7 @@ drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.emulators.ROM: \
256.bytes

cat 256.bytes drivers/SunriseIDE/driver.bin > drivers/SunriseIDE/_driver.BIN
mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/_driver.BIN /m:drivers/SunriseIDE/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/SunriseIDE/_driver.BIN /m:drivers/SunriseIDE/chgbnk.bin
$(call copy_to_bin,$@)

drivers/SunriseIDE/driver.bin: \
Expand All @@ -153,7 +157,7 @@ drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.emulators.ROM: \
256.bytes

cat 256.bytes drivers/SunriseIDE/drvmonly.bin > drivers/SunriseIDE/_driver.BIN
mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/_driver.BIN /m:drivers/SunriseIDE/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/SunriseIDE/_driver.BIN /m:drivers/SunriseIDE/chgbnk.bin
$(call copy_to_bin,$@)

drivers/SunriseIDE/drvmonly.bin: \
Expand Down Expand Up @@ -181,7 +185,7 @@ drivers/StandaloneASCII8/Nextor-$(VERSION).StandaloneASCII8.ROM: \
256.bytes

cat 256.bytes drivers/StandaloneASCII8/driver.bin > drivers/StandaloneASCII8/_driver.bin
mknexrom nextor_base.dat $@ /d:drivers/StandaloneASCII8/_driver.bin /m:drivers/StandaloneASCII8/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/StandaloneASCII8/_driver.bin /m:drivers/StandaloneASCII8/chgbnk.bin
$(call copy_to_bin,$@)

drivers/StandaloneASCII8/driver.bin: \
Expand All @@ -206,7 +210,7 @@ drivers/StandaloneASCII16/Nextor-$(VERSION).StandaloneASCII16.ROM: \
256.bytes

cat 256.bytes drivers/StandaloneASCII8/driver.bin > drivers/StandaloneASCII16/_driver.bin
mknexrom nextor_base.dat $@ /d:drivers/StandaloneASCII16/_driver.bin /m:drivers/StandaloneASCII16/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/StandaloneASCII16/_driver.bin /m:drivers/StandaloneASCII16/chgbnk.bin
$(call copy_to_bin,$@)

drivers/StandaloneASCII16/chgbnk.bin: \
Expand Down Expand Up @@ -243,7 +247,7 @@ drivers/MegaFlashRomSD/Nextor-$(VERSION).MegaFlashSDSCC.1-slot.ROM: \
drivers/StandaloneASCII8/chgbnk.bin \
drivers/MegaFlashRomSD/mfrsd-1slot.bin

mknexrom nextor_base.dat $@ /d:drivers/MegaFlashRomSD/mfrsd-1slot.bin /m:drivers/StandaloneASCII8/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/MegaFlashRomSD/mfrsd-1slot.bin /m:drivers/StandaloneASCII8/chgbnk.bin
$(call copy_to_bin,$@)

drivers/MegaFlashRomSD/Nextor-$(VERSION).MegaFlashSDSCC.1-slot.Recovery.ROM: \
Expand All @@ -261,7 +265,7 @@ drivers/MegaFlashRomSD/Nextor-$(VERSION).MegaFlashSDSCC.2-slots.ROM: \
drivers/StandaloneASCII8/chgbnk.bin \
drivers/MegaFlashRomSD/mfrsd-2slots.bin

mknexrom nextor_base.dat $@ /d:drivers/MegaFlashRomSD/mfrsd-2slots.bin /m:drivers/StandaloneASCII8/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/MegaFlashRomSD/mfrsd-2slots.bin /m:drivers/StandaloneASCII8/chgbnk.bin
$(call copy_to_bin,$@)

drivers/MegaFlashRomSD/Nextor-$(VERSION).MegaFlashSDSCC.2-slots.Recovery.ROM: \
Expand Down Expand Up @@ -289,7 +293,7 @@ drivers/Flashjacks/Nextor-$(VERSION).Flashjacks.ROM: \
drivers/Flashjacks/flashjacks.bin \
drivers/SunriseIDE/chgbnk.bin

mknexrom nextor_base.dat $@ /d:drivers/Flashjacks/flashjacks.bin /m:drivers/SunriseIDE/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/Flashjacks/flashjacks.bin /m:drivers/SunriseIDE/chgbnk.bin
$(call copy_to_bin,$@)


Expand All @@ -301,7 +305,7 @@ drivers/OCM/Nextor-$(VERSION).OCM.ROM: \
nextor_base.dat \
drivers/StandaloneASCII8/chgbnk.bin

mknexrom nextor_base.dat $@ /d:drivers/OCM/driver.dat /m:drivers/StandaloneASCII8/chgbnk.bin
$(MKNEXROM) nextor_base.dat $@ /d:drivers/OCM/driver.dat /m:drivers/StandaloneASCII8/chgbnk.bin
$(call copy_to_bin,$@)


Expand Down Expand Up @@ -533,11 +537,10 @@ bank6/B6.BIN: \
--code 40FFh ../codes.rel ../kvar.rel ../data.rel b6.rel \
--code 7fd0h ../chgbnk.rel

bank5/fdisk.dat bank5/fdisk2.dat: \
bank5/fdisk.dat: \
bank5/fdisk_crt0.rel \
bank5/fdisk.h \
bank5/fdisk.c \
$(patsubst %.dat,%.c,$@) \
bank5/drivercall.h \
bank5/drivercall.c \
../tools/C/system.h \
Expand All @@ -552,6 +555,24 @@ bank5/fdisk.dat bank5/fdisk2.dat: \
--max-allocs-per-node 1000 --allow-unsafe-read --opt-code-size --no-std-crt0 bank5/fdisk_crt0.rel $(patsubst %.dat,%.c,$@)
$(call hex2bin,$(patsubst %.dat,%.ihx,$@),$@)

bank5/fdisk2.dat: \
bank5/fdisk_crt0.rel \
bank5/fdisk.h \
bank5/fdisk2.c \
bank5/drivercall.h \
bank5/drivercall.c \
../tools/C/system.h \
../tools/C/dos.h \
../tools/C/types.h \
../tools/C/asmcall.h \
../tools/C/printf.c \
../tools/C/asmcall.c \
../tools/C/partit.h

sdcc -o bank5/ --code-loc 0x4120 --data-loc 0xA020 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 \
--max-allocs-per-node 1000 --allow-unsafe-read --opt-code-size --no-std-crt0 bank5/fdisk_crt0.rel $(patsubst %.dat,%.c,$@)
$(call hex2bin,$(patsubst %.dat,%.ihx,$@),$@)

bank5/fdisk_crt0.rel: \
bank5/fdisk_crt0.s

Expand Down
6 changes: 3 additions & 3 deletions source/kernel/bank5/fdisk.c
Expand Up @@ -784,13 +784,13 @@ void GoPartitioningMainMenuScreen()
AddAutoPartition();
} else if(key == 'u' && !partitionsExistInDisk && partitionsCount > 0) {
UndoAddPartition();
}else if(key == 't') {
} else if(key == 't') {
TestDeviceAccess();
} else if(key == 'f' && canDoDirectFormat) {
if(FormatWithoutPartitions()) {
mustRetrievePartitionInfo = true;
}
}else if(key == 'w' && !partitionsExistInDisk && partitionsCount > 0) {
} else if(key == 'w' && !partitionsExistInDisk && partitionsCount > 0) {
if(WritePartitionTable()) {
mustRetrievePartitionInfo = true;
}
Expand Down Expand Up @@ -1679,7 +1679,7 @@ int CallFunctionInExtraBank(int functionNumber, void* parametersBuffer)
regs.Words.HL = (int)parametersBuffer;
regs.Words.IX = (int)0x4100; //Address of "main" for extra functions program
AsmCall(CALBNK, &regs, REGS_ALL, REGS_MAIN);
return regs.Words.HL;
return regs.Words.DE;
}


Expand Down

0 comments on commit 181d3e0

Please sign in to comment.