Merge pull request #47 from FeralChild64/master
Floating & tape point updates, PXLFont
This commit is contained in:
156 files changed
+1972
-466
No files matched your search
@@ -17,3 +17,4 @@ build/*
|
||||
dump.mem
|
||||
*project
|
||||
.*swp
|
||||
*.log
|
||||
@@ -167,7 +167,7 @@ Needs about 100 more bytes in KERNAL segment.
|
||||
|
||||
### `CONFIG_TAPE_NO_KEY_SENSE`
|
||||
|
||||
Enable this option if you are using a tape interface adapter with some audio signal source connected. These adapters lack key sense functionality, so the computer is unable to tell whether Play got pressed or not - with this option ROM will assume Play got pressed after impulses start arriving from the tape.
|
||||
Enable this option if you are using a tape interface adapter with some audio signal source connected. These adapters lack key sense functionality, so the computer is unable to tell whether Play got pressed or not - this option changes the ROM behaviour, so that it can detect Play pressed when impulses start arriving from the tape.
|
||||
|
||||
### `CONFIG_TAPE_NO_MOTOR_CONTROL`
|
||||
|
||||
@@ -187,7 +187,7 @@ The SID support in the ROM is very limited - it only disables the sound during s
|
||||
|
||||
### `CONFIG_SID_2ND` and `CONFIG_SID_3RD`
|
||||
|
||||
Each of them add support for one additional SID - addresses should be given in `CONFIG_SID_2ND_ADDRESS` and `CONFIG_SID_3RD_ADDRESS`, respectively.
|
||||
Each of them add support for one additional SID - addresses should be given in `CONFIG_SID_2ND_ADDRESS` and `CONFIG_SID_3RD_ADDRESS`, respectively. Do not use when `CONFIG_MB_MEGA_65` is selected - the motherboard support code already knows the SID locations.
|
||||
|
||||
Each of these options needs 3 bytes in KERNAL segment.
|
||||
|
||||
@@ -195,7 +195,7 @@ Each of these options needs 3 bytes in KERNAL segment.
|
||||
|
||||
Cause the system to support SIDs in `$D4xx` and `$D5xx` ranges, respectively.
|
||||
|
||||
Each of them needs a couple of bytes in KERNAL segment - but they can share some code, and `$D4xx` range support replaces the standard `$D400` address handling, so exact amount depends on the exact configuration.
|
||||
Each of them needs a couple of bytes in KERNAL segment - but they can share some code, and `$D4xx` range support replaces the standard `$D400` address handling, so exact amount depends on the exact configuration. Do not use when `CONFIG_MB_MEGA_65` is selected - the motherboard support code already knows the SID locations.
|
||||
|
||||
## Keyboard
|
||||
|
||||
|
||||
+5
-1
@@ -1,11 +1,14 @@
|
||||
|
||||
# CREDITS to people whose work was of great help to us
|
||||
|
||||
## for source code we reused
|
||||
## for source code/assets we reused
|
||||
|
||||
* Retrofan - for his Mega65 banner artwork and PXLfont
|
||||
* TWW/CTR - for his keyboard handling code
|
||||
* Graham - for his PAL/NTSC detection routine
|
||||
* enthusi/Onslaught - for his example Turbo Tape 64 compatible loader
|
||||
* djmips - for fast 8x8 multiplication routine
|
||||
* Verz - for the integer division routine
|
||||
|
||||
## for documentation
|
||||
|
||||
@@ -16,6 +19,7 @@
|
||||
* Jochen Adler - for the JiffyDOS protocol reverse engineering
|
||||
* H2Obsession - for the JiffyDOS protocol description on [his page](https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128)
|
||||
* SD2IEC team - the project [source code](https://github.com/rkrajnc/sd2iec) helped a lot when adding IEC and JiffyDOS support
|
||||
* Luigi Di Fraia - for his tape formats [description](https://www.luigidifraia.com/c64/docs/tapeloaders.html)
|
||||
* slark - for his screen codes / PETSCII description at [slark.me](https://slark.me)
|
||||
* silverdr - for the floating point routines [description](https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics)
|
||||
* the [C64 Wiki](https://www.c64-wiki.com) contributors
|
||||
|
||||
@@ -3,7 +3,7 @@ The following copyright notices apply to the entirety of this package,
|
||||
including each source file, unless otherwise noted in each file or directory.
|
||||
|
||||
Copyright Paul Gardner-Stephen, 2019.
|
||||
Copyright Roman Standzikowski (FeralChil64), 2019-2020.
|
||||
Copyright Roman Standzikowski (FeralChild64), 2019-2020.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -12,12 +12,15 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
|
||||
c64/basic \
|
||||
c64/basic/,stubs \
|
||||
c64/basic/,stubs_math \
|
||||
c64/basic/assets \
|
||||
c64/basic/board_m65 \
|
||||
c64/basic/board_x16 \
|
||||
c64/basic/commands \
|
||||
c64/basic/init \
|
||||
c64/basic/math \
|
||||
c64/basic/math_consts \
|
||||
c64/basic/math_mov \
|
||||
c64/basic/print \
|
||||
c64/basic/rom_revision
|
||||
|
||||
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
|
||||
@@ -78,6 +81,7 @@ DEP_KERNAL = $(SRC_KERNAL) $(SRCDIR_KERNAL) $(GEN_KERNAL)
|
||||
TOOL_COLLECT_DATA = build/tools/collect_data
|
||||
TOOL_COMPRESS_TEXT = build/tools/compress_text
|
||||
TOOL_GENERATE_CONSTANTS = build/tools/generate_constants
|
||||
TOOL_PATCH_CHARGEN = build/tools/patch_chargen
|
||||
TOOL_PNGPREPARE = build/tools/pngprepare
|
||||
TOOL_BUILD_SEGMENT = build/tools/build_segment
|
||||
TOOL_RELEASE = build/tools/release
|
||||
@@ -88,29 +92,31 @@ TOOLS_LIST = $(pathsubst tools/%,build/tools/%,$(basename $(SRC_TOOLS)))
|
||||
|
||||
# List of targets
|
||||
|
||||
TARGET_CUS_B = build/basic_custom.rom
|
||||
TARGET_GEN_B = build/basic_generic.rom
|
||||
TARGET_TST_B = build/basic_testing.rom
|
||||
TARGET_U64_B = build/basic_ultimate64.rom
|
||||
TARGET_CUS_B = build/basic_custom.rom
|
||||
TARGET_GEN_B = build/basic_generic.rom
|
||||
TARGET_TST_B = build/basic_testing.rom
|
||||
TARGET_U64_B = build/basic_ultimate64.rom
|
||||
|
||||
TARGET_CUS_K = build/kernal_custom.rom
|
||||
TARGET_GEN_K = build/kernal_generic.rom
|
||||
TARGET_TST_K = build/kernal_testing.rom
|
||||
TARGET_U64_K = build/kernal_ultimate64.rom
|
||||
TARGET_CUS_K = build/kernal_custom.rom
|
||||
TARGET_GEN_K = build/kernal_generic.rom
|
||||
TARGET_TST_K = build/kernal_testing.rom
|
||||
TARGET_U64_K = build/kernal_ultimate64.rom
|
||||
|
||||
TARGET_M65_x = build/mega65.rom
|
||||
TARGET_X16_x = build/cx16-dummy.rom
|
||||
TARGET_M65_x = build/mega65.rom
|
||||
TARGET_M65_x_PXL = build/mega65_pxlfont.rom
|
||||
TARGET_X16_x = build/cx16-dummy.rom
|
||||
|
||||
TARGET_LIST_CUS = $(TARGET_CUS_B) $(TARGET_CUS_K)
|
||||
TARGET_LIST_GEN = $(TARGET_GEN_B) $(TARGET_GEN_K)
|
||||
TARGET_LIST_TST = $(TARGET_TST_B) $(TARGET_TST_K)
|
||||
TARGET_LIST_U64 = $(TARGET_U64_B) $(TARGET_U64_K)
|
||||
TARGET_LIST_CUS = $(TARGET_CUS_B) $(TARGET_CUS_K)
|
||||
TARGET_LIST_GEN = $(TARGET_GEN_B) $(TARGET_GEN_K)
|
||||
TARGET_LIST_TST = $(TARGET_TST_B) $(TARGET_TST_K)
|
||||
TARGET_LIST_U64 = $(TARGET_U64_B) $(TARGET_U64_K)
|
||||
|
||||
TARGET_LIST = build/chargen.rom \
|
||||
TARGET_LIST = build/chargen_openroms.rom \
|
||||
$(TARGET_LIST_CUS) \
|
||||
$(TARGET_LIST_GEN) \
|
||||
$(TARGET_LIST_TST) \
|
||||
$(TARGET_M65_x) \
|
||||
$(TARGET_M65_x_PXL) \
|
||||
$(TARGET_LIST_U64) \
|
||||
$(TARGET_X16_x)
|
||||
|
||||
@@ -124,7 +130,7 @@ SEG_LIST_X16 = $(DIR_X16)/basic.seg_0 \
|
||||
$(DIR_X16)/kernal.seg_0 \
|
||||
$(DIR_X16)/kernal.seg_1
|
||||
|
||||
REL_TARGET_LIST = $(TARGET_LIST_GEN) $(TARGET_LIST_TST) $(TARGET_M65_x) $(TARGET_LIST_U64)
|
||||
REL_TARGET_LIST = $(TARGET_LIST_GEN) $(TARGET_LIST_TST) $(TARGET_M65_x) $(TARGET_M65_x_PXL) $(TARGET_LIST_U64)
|
||||
|
||||
# Misc strings
|
||||
|
||||
@@ -134,11 +140,14 @@ HYBRID_WARNING = "*** WARNING *** Distributing kernal_hybrid.rom violates both o
|
||||
|
||||
GIT_COMMIT:= $(shell git log -1 --pretty='%h' | tr '[:lower:]' '[:upper:]')
|
||||
|
||||
# Rules - main
|
||||
# Rules - main XXX fast build does not always succeed, not yet clear, why
|
||||
|
||||
.PHONY: all clean updatebin
|
||||
.PHONY: all fast clean updatebin
|
||||
|
||||
all:
|
||||
$(MAKE) $(TARGET_LIST) $(EXT_TARGET_LIST)
|
||||
|
||||
fast:
|
||||
$(MAKE) -j64 --output-sync=target $(TARGET_LIST) $(EXT_TARGET_LIST)
|
||||
|
||||
clean:
|
||||
@@ -147,7 +156,7 @@ clean:
|
||||
updatebin:
|
||||
$(MAKE) -j64 --output-sync=target $(TARGET_LIST) $(TOOL_RELEASE)
|
||||
$(TOOL_RELEASE) -i ./build -o ./bin $(patsubst build/%,%,$(REL_TARGET_LIST))
|
||||
cp build/chargen.rom bin/chargen.rom
|
||||
cp build/chargen_openroms.rom bin/chargen_openroms.rom
|
||||
|
||||
# Rules - tools
|
||||
|
||||
@@ -169,8 +178,17 @@ build/tools/%: tools/%.cc tools/common.h
|
||||
|
||||
# Rules - CHARGEN
|
||||
|
||||
build/chargen.rom: $(TOOL_PNGPREPARE) assets/8x8font.png
|
||||
$(TOOL_PNGPREPARE) charrom assets/8x8font.png build/chargen.rom
|
||||
build/chargen_openroms.rom: $(TOOL_PNGPREPARE) assets/8x8font.png
|
||||
$(TOOL_PNGPREPARE) charrom assets/8x8font.png $@
|
||||
|
||||
build/chargen_pxlfont.rom: bin/chargen_pxlfont_2.3.rom
|
||||
cp $< $@
|
||||
|
||||
build/chargen_openroms.patched: $(TOOL_PATCH_CHARGEN) build/chargen_openroms.rom
|
||||
$(TOOL_PATCH_CHARGEN) -i build/chargen_openroms.rom -o $@ -n 7px-OpenROMs
|
||||
|
||||
build/chargen_pxlfont.patched: $(TOOL_PATCH_CHARGEN) build/chargen_pxlfont.rom
|
||||
$(TOOL_PATCH_CHARGEN) -i build/chargen_pxlfont.rom -o $@ -n 6px-PXLfont
|
||||
|
||||
# Dependencies - BASIC and KERNAL
|
||||
|
||||
@@ -208,7 +226,7 @@ $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_comb
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym
|
||||
|
||||
$(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combined.sym: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_X16)/BASIC_0_combined.sym
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym $(DIR_X16)/BASIC_0_combined.sym
|
||||
$(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_combined.sym: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym
|
||||
|
||||
@@ -283,22 +301,22 @@ $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_comb
|
||||
$(DIR_X16)/OUTB_0.BIN $(DIR_X16)/BASIC_0_combined.vs $(DIR_X16)/BASIC_0_combined.sym:
|
||||
@mkdir -p $(DIR_X16)
|
||||
@rm -f $@* $(DIR_X16)/BASIC_0*
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_0 -i BASIC_0-mega65 -o OUTB_0.BIN -d $(DIR_X16) -l c000 -h e4d2 $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC)
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_0 -i BASIC_0-x16 -o OUTB_0.BIN -d $(DIR_X16) -l c000 -h e4d2 $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC)
|
||||
|
||||
$(DIR_X16)/OUTK_0.BIN $(DIR_X16)/KERNAL_0_combined.vs $(DIR_X16)/KERNAL_0_combined.sym:
|
||||
@mkdir -p $(DIR_X16)
|
||||
@rm -f $@* $(DIR_X16)/KERNAL_0*
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_0 -i KERNAL_0-mega65 -o OUTK_0.BIN -d $(DIR_X16) -l e4d3 -h ffff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL)
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_0 -i KERNAL_0-x16 -o OUTK_0.BIN -d $(DIR_X16) -l e4d3 -h ffff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL)
|
||||
|
||||
$(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combined.sym:
|
||||
@mkdir -p $(DIR_X16)
|
||||
@rm -f $@* $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1*
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_1 -i BASIC_1-mega65 -o basic.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC)
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_1 -i BASIC_1-x16 -o basic.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC)
|
||||
|
||||
$(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_combined.sym:
|
||||
@mkdir -p $(DIR_X16)
|
||||
@rm -f $@* $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1*
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_1 -i KERNAL_1-mega65 -o kernal.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL)
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_1 -i KERNAL_1-x16 -o kernal.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL)
|
||||
|
||||
# Rules - BASIC and KERNAL
|
||||
|
||||
@@ -350,32 +368,49 @@ build/symbols_hybrid.vs: $(DIR_GEN)/KERNAL_combined.vs
|
||||
|
||||
# Rules - platform 'Mega65' specific
|
||||
|
||||
$(TARGET_M65_x): $(SEG_LIST_M65) build/chargen.rom
|
||||
$(TARGET_M65_x) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/chargen_openroms.rom build/chargen_openroms.patched build/chargen_pxlfont.rom build/chargen_pxlfont.patched
|
||||
dd if=/dev/zero bs=8192 count=1 of=build/m65_padding_08_KB
|
||||
dd if=/dev/zero bs=8192 count=8 of=build/m65_padding_64_KB
|
||||
@echo
|
||||
cat build/m65_padding_08_KB > $(TARGET_M65_x)
|
||||
cat build/m65_padding_08_KB >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x)
|
||||
cat build/m65_padding_08_KB >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x)
|
||||
cat build/chargen.rom >> $(TARGET_M65_x)
|
||||
cat build/chargen.rom >> $(TARGET_M65_x)
|
||||
cat build/chargen_openroms.rom >> $(TARGET_M65_x)
|
||||
cat build/chargen_openroms.patched >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x)
|
||||
cat build/m65_padding_64_KB >> $(TARGET_M65_x)
|
||||
@echo
|
||||
cat build/m65_padding_08_KB > $(TARGET_M65_x_PXL)
|
||||
cat build/m65_padding_08_KB >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_PXL)
|
||||
cat build/m65_padding_08_KB >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
|
||||
cat build/chargen_pxlfont.rom >> $(TARGET_M65_x_PXL)
|
||||
cat build/chargen_pxlfont.patched >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_PXL)
|
||||
cat build/m65_padding_64_KB >> $(TARGET_M65_x_PXL)
|
||||
@echo
|
||||
rm -f build/m65_padding_*
|
||||
@echo
|
||||
|
||||
# Rules - platform 'Commander X16' specific
|
||||
|
||||
$(TARGET_X16_x): $(SEG_LIST_X16) build/chargen.rom
|
||||
$(TARGET_X16_x): $(SEG_LIST_X16) build/chargen_openroms.rom
|
||||
dd if=/dev/zero bs=8192 count=1 of=build/x16_padding_08_KB
|
||||
dd if=/dev/zero bs=8192 count=8 of=build/x16_padding_64_KB
|
||||
@echo
|
||||
cat $(DIR_X16)/basic.seg_0 > $(TARGET_X16_x)
|
||||
cat $(DIR_X16)/kernal.seg_0 >> $(TARGET_X16_x)
|
||||
cat build/chargen.rom >> $(TARGET_X16_x)
|
||||
cat build/chargen_openroms.rom >> $(TARGET_X16_x)
|
||||
cat $(DIR_X16)/basic.seg_1 >> $(TARGET_X16_x)
|
||||
cat $(DIR_X16)/kernal.seg_1 >> $(TARGET_X16_x)
|
||||
@echo
|
||||
rm -f build/x16_padding_*
|
||||
@echo
|
||||
|
||||
# Rules - tests
|
||||
|
||||
@@ -401,7 +436,7 @@ test_testing: build/kernal_testing.rom build/basic_testing.rom build/symbols_tes
|
||||
test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs
|
||||
x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -1 $(TESTTAPE) -8 $(TESTDISK)
|
||||
|
||||
test_mega65: $(TARGET_M65_x)
|
||||
test_mega65: $(TARGET_M65_x) $(TARGET_M65_PXL)
|
||||
../xemu/build/bin/xmega65.native -dmarev 2 -forcerom -loadrom $(TARGET_M65_x)
|
||||
|
||||
test_cx16: $(TARGET_X16_x)
|
||||
|
||||
@@ -98,7 +98,7 @@ The following ROM features are currently missing:
|
||||
| Driver | Status | Remarks |
|
||||
| :----------------: | :------: | :------------------------------------------------: |
|
||||
| standard | DONE | |
|
||||
| JiffyDOS | DONE | |
|
||||
| JiffyDOS | PARTIAL | LOAD needs improvement for better performance |
|
||||
| DolphinDOS | DONE | |
|
||||
| CIA burst mod | NOT DONE | |
|
||||
| Mega65 burst | NOT DONE | |
|
||||
@@ -189,7 +189,7 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$B794` | `convert_A_to_FAC1` | NOT DONE | |
|
||||
| `$B7B5` | `STRVAL` | NOT DONE | imports string to FAC1 |
|
||||
| `$B7F7` | `convert_FAC1_to_ADDR` | NOT DONE | |
|
||||
| `$B849` | `add_HALF_FAC1` | NOT DONE | |
|
||||
| `$B849` | `add_HALF_FAC1` | DONE | |
|
||||
| `$B850` | `sub_MEM_FAC1` | DONE | |
|
||||
| `$B853` | `sub_FAC2_FAC1` | DONE | |
|
||||
| `$B862` | `add_align_exponents` | DONE | |
|
||||
@@ -197,17 +197,15 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$B86A` | `add_FAC2_FAC1` | DONE | |
|
||||
| `$B8FE` | `normal_FAC1` | DONE | |
|
||||
| `$B947` | `inv_FAC1_mantissa` | NOT DONE | |
|
||||
| `$B983` | `MULSHF` | NOT DONE | |
|
||||
| `$B9EA` | `log_FAC1` | NOT DONE | |
|
||||
| `$BA28` | `mul_MEM_FAC1` | PARTIAL | needs `mul_FAC2_FAC1` |
|
||||
| `$BA2B` | `mul_FAC2_FAC1` | NOT DONE | some work started |
|
||||
| `$BA59` | `MLTPLY` | NOT DONE | |
|
||||
| `$BA28` | `mul_MEM_FAC1` | DONE | |
|
||||
| `$BA2B` | `mul_FAC2_FAC1` | DONE | |
|
||||
| `$BA8C` | `mov_MEM_FAC2` | DONE | |
|
||||
| `$BA90` | `get_FAC2_via_INDEX` | NOT DONE | |
|
||||
| `$BAE2` | `mul10_FAC1` | NOT DONE | |
|
||||
| `$BAFE` | `div10_FAC1_p` | NOT DONE | |
|
||||
| `$BB0F` | `div_MEM_FAC1` | PARTIAL | needs `div_FAC2_FAC1` |
|
||||
| `$BB12` | `div_FAC2_FAC1` | NOT DONE | |
|
||||
| `$BAE2` | `mul10_FAC1` | DONE | |
|
||||
| `$BAFE` | `div10_FAC1_p` | DONE | |
|
||||
| `$BB0F` | `div_MEM_FAC1` | DONE | |
|
||||
| `$BB12` | `div_FAC2_FAC1` | DONE | |
|
||||
| `$BBA2` | `mov_MEM_FAC1` | DONE | |
|
||||
| `$BBA6` | `get_FAC2_via_INDEX` | NOT DONE | |
|
||||
| `$BBC7` | `mov_r_FAC1_TMP2` | PARTIAL | not fully tested yet |
|
||||
@@ -218,7 +216,7 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$BC0C` | `mov_r_FAC1_FAC2` | PARTIAL | not fully tested yet |
|
||||
| `$BC0F` | `mov_FAC1_FAC2` | DONE | |
|
||||
| `$BC1B` | `round_FAC1` | PARTIAL | not fully tested yet |
|
||||
| `$BC2B` | `sgn_FAC1_A` | NOT DONE | |
|
||||
| `$BC2B` | `sgn_FAC1_A` | DONE | |
|
||||
| `$BC39` | `sgn_FAC1` | NOT DONE | |
|
||||
| `$BC3C` | `convert_A_to_FAC1` | NOT DONE | |
|
||||
| `$BC44` | `convert_i16_to_FAC1` | NOT DONE | |
|
||||
@@ -229,19 +227,19 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$BCF3` | `FIN` | NOT DONE | imports string to FAC1, ignores spaces |
|
||||
| `$BD7E` | `FINLOG` | NOT DONE | |
|
||||
| `$BDDD` | `FOUT` | NOT DONE | outputs FAC1 to string at $0100 |
|
||||
| `$BF71` | `sqr_FAC1` | NOT DONE | |
|
||||
| `$BF71` | `sqr_FAC1` | PARTIAL | needs `sqr_FAC2` |
|
||||
| `$BF74` | `sqr_FAC2` | NOT DONE | |
|
||||
| `$BF78` | `FPWR` | NOT DONE | set FAC1 as RAM raised to the power of FAC1 |
|
||||
| `$BF7B` | `FPWRT` | NOT DONE | set FAC1 as FAC2 raised to the power of FAC1 |
|
||||
| `$BF78` | `pwr_FAC2_MEM` | PARTIAL | needs `pwr_FAC2_FAC1` |
|
||||
| `$BF7B` | `pwr_FAC2_FAC1` | NOT DONE | |
|
||||
| `$BFB4` | `toggle_sign_FAC1` | DONE | |
|
||||
| `$BFED` | `exp_FAC1` | NOT DONE | |
|
||||
| `$E043` | `poly1_FAC1` | NOT DONE | |
|
||||
| `$E059` | `poly2_FAC1` | NOT DONE | |
|
||||
| `$E097` | `rnd_FAC1` | PARTIAL | requires `sgn_FAC1_A` |
|
||||
| `$E097` | `rnd_FAC1` | DONE | |
|
||||
| `$E09A` | `rnd_A` | DONE | |
|
||||
| `$E0BE` | `rnd_generate` | DONE | |
|
||||
| `$E264` | `cos_FAC1` | NOT DONE | |
|
||||
| `$E26B` | `sin_FAC1` | NOT DONE | |
|
||||
| `$E26B` | `sin_FAC1` | NOT DONE | some work already started |
|
||||
| `$E2B4` | `tan_FAC1` | NOT DONE | |
|
||||
| `$E30E` | `atn_FAC1` | NOT DONE | |
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+10
-2
@@ -2,14 +2,14 @@
|
||||
Follow these rules, or bad things will happen!
|
||||
|
||||
|
||||
- Don't mix ROMs for different platforms - use generic BASIC with generic KERNAL, Mega65 BASIC with Mega65 KERNAL, etc.
|
||||
- Don't mix ROMs for different platforms - use generic BASIC with generic KERNAL, Ultimate64 BASIC with Ultimate64 KERNAL, etc.
|
||||
|
||||
- Don't mix these ROMs with any other ROMs; exceptions:
|
||||
|
||||
- kernal_hybrid.rom, which is meant to be used (and has to be used) with the original BASIC ROM;
|
||||
however, this hybrid ROM cannot be distributed due to legal/copyright reasons
|
||||
|
||||
- chargen.rom - this one is fully interchangeable
|
||||
- chargen_*.rom - these ones are fully interchangeable
|
||||
|
||||
- Don't mix ROMs from different builds/versions (again, CHARGEN is an exception).
|
||||
|
||||
@@ -17,3 +17,11 @@ Follow these rules, or bad things will happen!
|
||||
|
||||
|
||||
Have fun!
|
||||
|
||||
|
||||
------
|
||||
|
||||
|
||||
PXL font was created by Retrofan, we got a permission to include it with OpenROMs under GNU Lesser General Public License 3.0, see:
|
||||
|
||||
- https://www.forum64.de/index.php?thread/84000-neuer-c64-systemfont-auch-plus4-c128-atari/&postID=1493383#post1493383
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -51,14 +51,14 @@
|
||||
#define CONFIG_TAPE_NORMAL
|
||||
#define CONFIG_TAPE_TURBO
|
||||
#define CONFIG_TAPE_AUTODETECT
|
||||
// #define CONFIG_TAPE_NO_KEY_SENSE
|
||||
// #define CONFIG_TAPE_NO_MOTOR_CONTROL
|
||||
#define CONFIG_TAPE_NO_KEY_SENSE
|
||||
#define CONFIG_TAPE_NO_MOTOR_CONTROL
|
||||
// #define CONFIG_TAPE_NO_ERROR_CORRECTION
|
||||
|
||||
|
||||
// Multiple SID support
|
||||
|
||||
#define CONFIG_SID_2ND
|
||||
// #define CONFIG_SID_2ND
|
||||
.const CONFIG_SID_2ND_ADDRESS = $D440
|
||||
|
||||
// #define CONFIG_SID_3RD
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
#define CONFIG_PROGRAMMABLE_KEYS
|
||||
|
||||
.const CONFIG_KEYCMD_RUN = @"LOAD\"*\""
|
||||
.const CONFIG_KEYCMD_RUN = @"\$5FL"
|
||||
|
||||
.const CONFIG_KEYCMD_F1 = @"@"
|
||||
.const CONFIG_KEYCMD_F2 = @""
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
#define CONFIG_PANIC_SCREEN
|
||||
#define CONFIG_DOS_WEDGE
|
||||
// #define CONFIG_TAPE_WEDGE
|
||||
#define CONFIG_TAPE_WEDGE
|
||||
#define CONFIG_BCD_SAFE_INTERRUPTS
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_ULTIMATE_64 &&
|
||||
.error "CONFIG_BRAND_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64"
|
||||
#endif
|
||||
|
||||
#if CONFIG_MB_MEGA_65 && (CONFIG_SID_2ND || CONFIG_SID_3RD || CONFIG_SID_D4XX || CONFIG_SID_D5XX)
|
||||
.error "CONFIG_MB_MEGA_65 cannot be used with CONFIG_SID_*"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -108,9 +112,9 @@
|
||||
#if ROM_LAYOUT_M65 && !CONFIG_CPU_M65_45GS02
|
||||
.error "Mega65 ROM layout requires CONFIG_CPU_M65_45GS02"
|
||||
#endif
|
||||
//#if ROM_LAYOUT_M65 && !CONFIG_MB_MEGA_65
|
||||
// .error "Mega65 ROM layout requires CONFIG_MB_MEGA_65"
|
||||
//#endif
|
||||
#if ROM_LAYOUT_M65 && !CONFIG_MB_MEGA_65
|
||||
.error "Mega65 ROM layout requires CONFIG_MB_MEGA_65"
|
||||
#endif
|
||||
|
||||
.var selected = 0;
|
||||
|
||||
|
||||
+120
-1
@@ -69,6 +69,11 @@
|
||||
|
||||
#if HAS_OPCODES_65CE02
|
||||
|
||||
// CPU flags support
|
||||
|
||||
.pseudocommand cle { .byte $02 }
|
||||
.pseudocommand see { .byte $03 }
|
||||
|
||||
// .B register support
|
||||
|
||||
.pseudocommand tab { .byte $5B }
|
||||
@@ -99,7 +104,121 @@
|
||||
.byte $E3, arg
|
||||
}
|
||||
|
||||
// additional addressing modes
|
||||
// Zero page bit handling
|
||||
|
||||
.pseudocommand rmb0 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB0 requires zeropage address"
|
||||
.byte $07, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb1 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB1 requires zeropage address"
|
||||
.byte $17, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb2 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB2 requires zeropage address"
|
||||
.byte $27, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb3 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB3 requires zeropage address"
|
||||
.byte $37, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb4 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB4 requires zeropage address"
|
||||
.byte $47, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb5 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB5 requires zeropage address"
|
||||
.byte $57, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb6 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB6 requires zeropage address"
|
||||
.byte $67, arg
|
||||
}
|
||||
|
||||
.pseudocommand rmb7 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "RMB7 requires zeropage address"
|
||||
.byte $77, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb0 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB0 requires zeropage address"
|
||||
.byte $87, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb1 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB1 requires zeropage address"
|
||||
.byte $97, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb2 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB2 requires zeropage address"
|
||||
.byte $A7, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb3 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB3 requires zeropage address"
|
||||
.byte $B7, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb4 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB4 requires zeropage address"
|
||||
.byte $C7, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb5 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB5 requires zeropage address"
|
||||
.byte $D7, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb6 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB6 requires zeropage address"
|
||||
.byte $E7, arg
|
||||
}
|
||||
|
||||
.pseudocommand smb7 addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.if (arg > $FF) .error "SMB7 requires zeropage address"
|
||||
.byte $F7, arg
|
||||
}
|
||||
|
||||
// Additional addressing modes
|
||||
|
||||
.pseudocommand jsr_ind addr
|
||||
{
|
||||
|
||||
@@ -83,6 +83,15 @@
|
||||
|
||||
.label __SID_BASE = $D400 // base address of the chip
|
||||
|
||||
#if CONFIG_MB_MEGA_65
|
||||
|
||||
.label __SID_R1_OFFSET = $00 // right SID 1, $D400
|
||||
.label __SID_R2_OFFSET = $20 // right SID 2, $D420
|
||||
.label __SID_L1_OFFSET = $40 // left SID 1, $D440
|
||||
.label __SID_L2_OFFSET = $60 // left SID 2, $D460
|
||||
|
||||
#endif
|
||||
|
||||
.label SID_FRELO1 = $D400
|
||||
.label SID_FREHI1 = $D401
|
||||
.label SID_PWLO1 = $D402
|
||||
@@ -177,6 +186,8 @@
|
||||
.const C65_EXTKEYS_PR = $D607
|
||||
.const C65_EXTKEYS_DDR = $D608
|
||||
|
||||
.const M65_BADL_SLI = $D710
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// #LAYOUT# * BASIC_1 #IGNORE
|
||||
// #LAYOUT# * * #TAKE
|
||||
|
||||
// Kernal jump table
|
||||
|
||||
.label JCINT = $FF81
|
||||
.label JIOINIT = $FF84
|
||||
.label JRAMTAS = $FF87
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_0 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Routines imported from Kernal - our private API
|
||||
|
||||
@@ -18,6 +23,11 @@
|
||||
}
|
||||
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
.label map_end = KERNAL().map_end
|
||||
.label map_NORMAL = KERNAL().map_NORMAL
|
||||
#endif
|
||||
|
||||
#if CONFIG_PANIC_SCREEN
|
||||
.label panic = KERNAL().panic
|
||||
#endif
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - SHIFT routine
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 113
|
||||
//
|
||||
|
||||
// XXX implement, test
|
||||
|
||||
|
||||
MULSHF:
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
@@ -1,3 +0,0 @@
|
||||
This is an important floating point math routine, documented in many places.
|
||||
|
||||
XXX - try to find real-life example
|
||||
@@ -1,18 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - add a mantissa byte of FAC2 to FAC1, do it .A times
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 113
|
||||
//
|
||||
|
||||
// XXX implement, test
|
||||
|
||||
|
||||
MULTPLY:
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
@@ -1,3 +0,0 @@
|
||||
This is an important floating point math routine, documented in many places.
|
||||
|
||||
XXX - try to find real-life example
|
||||
@@ -1,18 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - multiply FAC1 by 10
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 114
|
||||
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
mul10_FAC1:
|
||||
STUB_IMPLEMENTATION()
|
||||
@@ -1,24 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - divide FAC2 by FAC1, ignores sign
|
||||
//
|
||||
// Input:
|
||||
// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag
|
||||
//
|
||||
// Output:
|
||||
// - leaves the quotient FAC1 and the remainder in FAC2
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 114
|
||||
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
div_FAC2_FAC1:
|
||||
STUB_IMPLEMENTATION()
|
||||
@@ -21,5 +21,5 @@
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
FPWRT:
|
||||
pwr_FAC2_FAC1:
|
||||
STUB_IMPLEMENTATION()
|
||||
@@ -15,3 +15,14 @@
|
||||
|
||||
sin_FAC1:
|
||||
STUB_IMPLEMENTATION()
|
||||
|
||||
poly_sin:
|
||||
|
||||
.byte $05 // series length - 1
|
||||
|
||||
put_const_POLY_SIN_1()
|
||||
put_const_POLY_SIN_2()
|
||||
put_const_POLY_SIN_3()
|
||||
put_const_POLY_SIN_4()
|
||||
put_const_POLY_SIN_5()
|
||||
put_const_POLY_SIN_6()
|
||||
@@ -1,6 +1,7 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_0 #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE-FLOAT
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
@@ -12,6 +13,14 @@
|
||||
|
||||
LINKPRG:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__LINKPRG
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
// Start by getting pointer to the first line
|
||||
jsr init_oldtxt
|
||||
|
||||
@@ -19,11 +28,13 @@ linkprg_loop:
|
||||
// Is the pointer to the end of the program
|
||||
ldy #1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
#else
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
@@ -38,10 +49,12 @@ linkprg_loop:
|
||||
|
||||
linkprg_end_of_line_search:
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
#else
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
@@ -70,10 +83,12 @@ linkprg_end_of_line_search:
|
||||
php
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr poke_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
#else
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
@@ -82,9 +97,11 @@ linkprg_end_of_line_search:
|
||||
adc #0
|
||||
ldy #1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr poke_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
#else
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
@@ -93,3 +110,6 @@ linkprg_end_of_line_search:
|
||||
sta OLDTXT+0
|
||||
|
||||
jmp linkprg_loop
|
||||
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -1,6 +1,7 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE-FLOAT
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// Print string at $YYAA
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
packed_message_chars:
|
||||
|
||||
put_packed_chars()
|
||||
@@ -0,0 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
packed_keywords:
|
||||
|
||||
put_packed_keywords()
|
||||
@@ -0,0 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
packed_message_tokens:
|
||||
|
||||
put_packed_tokens()
|
||||
@@ -0,0 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
packed_message_words:
|
||||
|
||||
put_packed_words()
|
||||
@@ -5,9 +5,15 @@
|
||||
// Computes Mapping the 64 p93
|
||||
|
||||
basic_do_error:
|
||||
|
||||
// Save error number
|
||||
phx_trash_a
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
// Restore normal memory map
|
||||
jsr map_NORMAL
|
||||
#endif
|
||||
|
||||
// Print ? at start
|
||||
jsr print_return
|
||||
lda #$3F
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
basic_do_new:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__basic_do_new
|
||||
jmp map_NORMAL
|
||||
|
||||
basic_do_clr:
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__basic_do_clr
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
// Setup pointers to memory storage XXX should depend on text start vector
|
||||
lda #<$0801
|
||||
sta TXTTAB+0
|
||||
lda #>$0801
|
||||
sta TXTTAB+1
|
||||
sta VARTAB+1
|
||||
lda #<$0803
|
||||
sta VARTAB+0
|
||||
|
||||
// Zero line pointer
|
||||
// XXX - We should also zero $0800, i.e., TXTTAB - 1
|
||||
ldy #$00
|
||||
tya
|
||||
sta (TXTTAB),y
|
||||
iny
|
||||
sta (TXTTAB),y
|
||||
|
||||
|
||||
// Get top of memory.
|
||||
// If a cart is present, then it is $7FFF,
|
||||
// if not, then it is $F7FF, since we support having
|
||||
// programs and variables under ROM.
|
||||
// i.e., we support 56KB RAM for BASIC, keeping some space
|
||||
// free for some optimisation structures, e.g., FOR/NEXT loop
|
||||
// records (without them going on the stack), GOSUB stack
|
||||
// (same story), expression value cache?
|
||||
|
||||
sec // Read, not write value
|
||||
jsr JMEMTOP
|
||||
cpx #$80
|
||||
beq !+
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$A000
|
||||
#endif
|
||||
.byte $2C
|
||||
!:
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$A000
|
||||
#endif
|
||||
sta MEMSIZ+1
|
||||
sta FRETOP+1
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #<$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #<$A000
|
||||
#endif
|
||||
sta MEMSIZ+0
|
||||
sta FRETOP+0
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
basic_do_clr:
|
||||
|
||||
// Clear variables, arrays and strings
|
||||
lda VARTAB+0
|
||||
sta ARYTAB+0
|
||||
sta STREND+0
|
||||
lda VARTAB+1
|
||||
sta ARYTAB+1
|
||||
sta STREND+1
|
||||
|
||||
rts
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -0,0 +1,34 @@
|
||||
// #LAYOUT# M65 BASIC_0 #TAKE-FLOAT
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Definitions for communication with Mega65 segment BASIC_1 from BASIC_0
|
||||
//
|
||||
|
||||
|
||||
#if SEGMENT_BASIC_0
|
||||
|
||||
// Label definitions
|
||||
|
||||
.label VB1__INITMSG = $4000 + 2 * 0
|
||||
.label VB1__LINKPRG = $4000 + 2 * 1
|
||||
.label VB1__tokenise_line = $4000 + 2 * 2
|
||||
.label VB1__list_single_line = $4000 + 2 * 3
|
||||
.label VB1__print_packed_message = $4000 + 2 * 4
|
||||
.label VB1__basic_do_clr = $4000 + 2 * 5
|
||||
.label VB1__basic_do_new = $4000 + 2 * 6
|
||||
|
||||
#else
|
||||
|
||||
// Vector table (OpenROMs private!)
|
||||
|
||||
.word INITMSG
|
||||
.word LINKPRG
|
||||
.word tokenise_line
|
||||
.word list_single_line
|
||||
.word print_packed_message
|
||||
.word basic_do_clr
|
||||
.word basic_do_new
|
||||
|
||||
#endif
|
||||
@@ -1,7 +0,0 @@
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Dummy, just to have anything in segment 1
|
||||
|
||||
brk
|
||||
@@ -0,0 +1,27 @@
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Definitions for calling Mega65 segments BASIC_0 and KERNAL_0 routines from BASIC_1
|
||||
//
|
||||
|
||||
#import "BASIC_0_combined.sym"
|
||||
|
||||
|
||||
.label peek_via_OLDTXT = BASIC_0.proxy_B1_peek_via_OLDTXT
|
||||
.label poke_via_OLDTXT = BASIC_0.proxy_B1_poke_via_OLDTXT
|
||||
.label JCHROUT = BASIC_0.proxy_B1_JCHROUT
|
||||
.label JMEMTOP = KERNAL_0.JMEMTOP
|
||||
.label plot_set = KERNAL_0.plot_set
|
||||
.label init_oldtxt = BASIC_0.init_oldtxt
|
||||
.label rom_revision_basic_string = BASIC_0.rom_revision_basic_string
|
||||
.label print_integer = BASIC_0.proxy_B1_print_integer
|
||||
.label print_return = BASIC_0.proxy_B1_print_return
|
||||
.label print_space = BASIC_0.proxy_B1_print_space
|
||||
#if CONFIG_SHOW_PAL_NTSC
|
||||
.label print_pal_ntsc = BASIC_0.proxy_B1_print_pal_ntsc
|
||||
#endif
|
||||
#if CONFIG_SHOW_FEATURES
|
||||
.label print_features = BASIC_0.proxy_B1_print_features
|
||||
#endif
|
||||
.label do_STRING_TOO_LONG_error = BASIC_0.do_STRING_TOO_LONG_error
|
||||
@@ -0,0 +1,28 @@
|
||||
// #LAYOUT# M65 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// ROM mapping routines for Mega65
|
||||
//
|
||||
|
||||
// Available memory maps:
|
||||
// - NORMAL - nothing mapped in (taken from Kernal)
|
||||
// - BASIC_1 - for calling KERNAL_1 segment code
|
||||
|
||||
|
||||
map_BASIC_1:
|
||||
|
||||
php
|
||||
pha
|
||||
phx
|
||||
phy
|
||||
phz
|
||||
|
||||
lda #$00
|
||||
tay
|
||||
taz
|
||||
|
||||
lda #$20
|
||||
ldx #$42 // 0x4000 <- map 8KB from 0x22000
|
||||
|
||||
jmp map_end
|
||||
@@ -0,0 +1,76 @@
|
||||
// #LAYOUT# M65 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Proxies for calling Mega65 segment BASIC_0 and KERNAL_0 routines from BASIC_1
|
||||
//
|
||||
|
||||
|
||||
proxy_B1_peek_via_OLDTXT:
|
||||
|
||||
jsr map_NORMAL
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
.error "not implemented"
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
jmp map_BASIC_1
|
||||
|
||||
proxy_B1_poke_via_OLDTXT:
|
||||
|
||||
jsr map_NORMAL
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
.error "not implemented"
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
proxy_B1_JCHROUT:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr JCHROUT
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
proxy_B1_print_integer:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_integer
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
proxy_B1_print_return:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_return
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
proxy_B1_print_space:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_space
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
#if CONFIG_SHOW_PAL_NTSC
|
||||
|
||||
proxy_B1_print_pal_ntsc:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_pal_ntsc
|
||||
jmp map_BASIC_1
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_SHOW_FEATURES
|
||||
|
||||
proxy_B1_print_features:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_features
|
||||
jmp map_BASIC_1
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
cmd_clr:
|
||||
|
||||
jsr basic_do_clr
|
||||
|
||||
// CLR command does not stop execution
|
||||
// (Cconfirmed on a c64)
|
||||
jmp basic_execute_statement
|
||||
@@ -11,6 +11,9 @@ cmd_list:
|
||||
// Set current line pointer to start of memory
|
||||
jsr init_oldtxt
|
||||
|
||||
// Always start with empty line, for readability
|
||||
jsr print_return
|
||||
|
||||
list_loop:
|
||||
|
||||
ldy #1
|
||||
@@ -39,114 +42,3 @@ list_more_lines:
|
||||
// Now link to the next line
|
||||
jsr basic_find_next_line
|
||||
jmp list_loop
|
||||
|
||||
list_single_line: // entry point needed by DOS wedge
|
||||
// Print line number
|
||||
ldy #3
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
pha
|
||||
dey
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
tax
|
||||
pla
|
||||
jsr print_integer
|
||||
jsr print_space
|
||||
|
||||
// Iterate through printing out the line
|
||||
// contents
|
||||
lda #0
|
||||
sta QTSW
|
||||
|
||||
ldy #4
|
||||
list_print_loop:
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
beq list_end_of_line
|
||||
cmp #$22
|
||||
bne list_not_quote
|
||||
lda QTSW
|
||||
eor #$FF
|
||||
sta QTSW
|
||||
lda #$22
|
||||
jmp list_is_literal
|
||||
|
||||
list_not_quote:
|
||||
// Check quote mode, and display as literal if required
|
||||
ldx QTSW
|
||||
bne list_is_literal
|
||||
|
||||
cmp #$FF
|
||||
beq list_is_pi
|
||||
|
||||
cmp #$7F
|
||||
bcc list_is_literal
|
||||
|
||||
// Display a token
|
||||
|
||||
// Save registers
|
||||
tax
|
||||
pha
|
||||
phy_trash_a
|
||||
|
||||
// Get pointer to compressed keyword list
|
||||
lda #<packed_keywords
|
||||
sta FRESPC+0
|
||||
lda #>packed_keywords
|
||||
sta FRESPC+1
|
||||
|
||||
// Subtract $80 from token to get offset in word
|
||||
// list
|
||||
txa
|
||||
and #$7f
|
||||
tax
|
||||
|
||||
// Now ask for it to be printed
|
||||
ldy #$ff
|
||||
jsr packed_word_search
|
||||
|
||||
ply_trash_a
|
||||
pla
|
||||
|
||||
cmp #$8f
|
||||
bne list_not_rem
|
||||
// REM command locks quote flag on until the end of the line, allowing
|
||||
// funny characters in REM statements without problem.
|
||||
sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here
|
||||
// FALL THROUGH
|
||||
list_not_rem:
|
||||
|
||||
iny
|
||||
bne list_print_loop // branch always
|
||||
|
||||
list_is_pi:
|
||||
lda #$7E
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
list_is_literal:
|
||||
jsr JCHROUT
|
||||
iny
|
||||
bne list_print_loop
|
||||
|
||||
list_end_of_line:
|
||||
// Print end of line
|
||||
jmp print_return
|
||||
@@ -20,11 +20,40 @@ cmd_load:
|
||||
lda #$00
|
||||
sta FNLEN
|
||||
|
||||
// Without tape support, LOAD must have a filename
|
||||
// (This also skips any leading spaces)
|
||||
// Check for the file name
|
||||
jsr basic_end_of_statement_check
|
||||
bcc !+
|
||||
jmp do_MISSING_FILENAME_error
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||
|
||||
// No file name given, just load the first file from tape
|
||||
|
||||
ldx #$00
|
||||
stx SA // secondary address
|
||||
#if CONFIG_TAPE_NORMAL
|
||||
inx // 1 - for normal tape format
|
||||
#else
|
||||
ldx #$07 // 7 - for turbo tape format
|
||||
#endif
|
||||
stx FA // device number
|
||||
bne cmd_load_got_secondaryaddress // branch always
|
||||
|
||||
#else
|
||||
|
||||
// Without tape support, try to load the first file from disk
|
||||
|
||||
lda #$01 // name length
|
||||
ldx #<cmd_load_default_filename
|
||||
ldy #>cmd_load_default_filename
|
||||
jsr JSETNAM
|
||||
jmp got_filename
|
||||
|
||||
cmd_load_default_filename:
|
||||
|
||||
.text "*"
|
||||
|
||||
#endif
|
||||
|
||||
!:
|
||||
jsr basic_fetch_and_consume_character
|
||||
cmp #$22
|
||||
|
||||
@@ -4,81 +4,9 @@
|
||||
|
||||
|
||||
cmd_new:
|
||||
|
||||
jsr basic_do_new
|
||||
|
||||
// NEW command terminates execution
|
||||
// (Confirmed on a C64)
|
||||
jmp basic_main_loop
|
||||
|
||||
cmd_clr:
|
||||
jsr basic_do_clr
|
||||
// CLR command does not stop execution
|
||||
// (Cconfirmed on a c64)
|
||||
jmp basic_execute_statement
|
||||
|
||||
basic_do_new:
|
||||
// Setup pointers to memory storage XXX should depend on text start vector
|
||||
lda #<$0801
|
||||
sta TXTTAB+0
|
||||
lda #>$0801
|
||||
sta TXTTAB+1
|
||||
sta VARTAB+1
|
||||
lda #<$0803
|
||||
sta VARTAB+0
|
||||
|
||||
// Zero line pointer
|
||||
// XXX - We should also zero $0800, i.e., TXTTAB - 1
|
||||
ldy #$00
|
||||
tya
|
||||
sta (TXTTAB),y
|
||||
iny
|
||||
sta (TXTTAB),y
|
||||
|
||||
|
||||
// Get top of memory.
|
||||
// If a cart is present, then it is $7FFF,
|
||||
// if not, then it is $F7FF, since we support having
|
||||
// programs and variables under ROM.
|
||||
// i.e., we support 56KB RAM for BASIC, keeping some space
|
||||
// free for some optimisation structures, e.g., FOR/NEXT loop
|
||||
// records (without them going on the stack), GOSUB stack
|
||||
// (same story), expression value cache?
|
||||
|
||||
sec // Read, not write value
|
||||
jsr JMEMTOP
|
||||
cpx #$80
|
||||
beq !+
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$A000
|
||||
#endif
|
||||
.byte $2C
|
||||
!:
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$A000
|
||||
#endif
|
||||
sta MEMSIZ+1
|
||||
sta FRETOP+1
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #<$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #<$A000
|
||||
#endif
|
||||
sta MEMSIZ+0
|
||||
sta FRETOP+0
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
basic_do_clr:
|
||||
// Clear variables, arrays and strings
|
||||
lda VARTAB+0
|
||||
sta ARYTAB+0
|
||||
sta STREND+0
|
||||
lda VARTAB+1
|
||||
sta ARYTAB+1
|
||||
sta STREND+1
|
||||
|
||||
rts
|
||||
@@ -11,4 +11,15 @@
|
||||
//
|
||||
|
||||
INITMSG:
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__INITMSG
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
jmp initmsg_real
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Routine is too long to fit in the original location
|
||||
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
INITMSG:
|
||||
|
||||
#else
|
||||
|
||||
initmsg_real:
|
||||
|
||||
#endif
|
||||
|
||||
// Clear the screen first, some cartridges (like IEEE-488) leeave a mess on the screen
|
||||
lda #147
|
||||
jsr JCHROUT
|
||||
@@ -126,6 +135,20 @@ initmsg_real:
|
||||
ldy #>startup_banner
|
||||
jsr STROUT
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
// XXX make it different for future Mega65 native mode
|
||||
|
||||
ldx #$02
|
||||
ldy #$21
|
||||
jsr plot_set
|
||||
|
||||
lda #<text_mode_64
|
||||
ldy #>text_mode_64
|
||||
jsr STROUT
|
||||
|
||||
#endif
|
||||
|
||||
ldx #$05
|
||||
ldy #$00
|
||||
jsr plot_set
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
@@ -78,24 +79,46 @@ pre_revision_string:
|
||||
|
||||
#elif CONFIG_BANNER_BRAND && CONFIG_BRAND_MEGA_65
|
||||
|
||||
// Fancy Mega65 banner - from Retrofan, slightly tweaked
|
||||
|
||||
.byte $9A, $12, $20, $20, $7F, $A9, $20, $20, $1F, $20, $9A, $20, $20, $20, $20, $1F
|
||||
.byte $20, $9A, $A9, $20, $20, $20, $92, $A1, $1F, $12, $20, $9A, $A9, $20, $20, $20
|
||||
.byte $7F, $1F, $20, $20, $9A, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $1F
|
||||
.byte $0D
|
||||
.byte $9A, $12, $20, $20, $20, $20, $20
|
||||
.byte $20, $1F, $20, $9A, $20, $20, $92, $A2, $bb, $1F, $12, $20, $9A, $20, $20, $92
|
||||
.byte $Ac, $A2, $A2, $1F, $12, $20, $9A, $20, $20, $1F, $20, $9A, $20, $20, $1F, $20
|
||||
.byte $20, $1e, $A3, $A3, $A3, $A3, $A3, $A3, $1F
|
||||
.byte $0D
|
||||
.byte $9A, $12, $20, $20, $92, $7F, $A9, $12, $20, $20, $1F, $20, $9A, $20, $20, $A2
|
||||
.byte $92, $be, $1F, $12, $20, $9A, $20, $20, $92, $bc, $12, $20, $20, $1F, $20, $9A
|
||||
.byte $20, $20, $20, $20, $20, $1F, $20, $20, $9e, $A3, $A3, $A3, $A3, $A3, $1F
|
||||
.byte $0D
|
||||
.byte $9A, $12, $20, $20, $1F, $20, $20, $9A, $20, $20, $1F, $20, $9A, $20, $20, $20
|
||||
.byte $20, $1F, $20, $9A, $20, $20, $20, $20, $20, $1F, $20, $9A, $20, $20, $1F, $20
|
||||
.byte $9A, $20, $20, $1F, $20, $20, $96, $A3, $A3, $A3, $A3, $1F, $92
|
||||
.byte $0D, $0D, $05, $00
|
||||
|
||||
// Fancy Mega65 banner - from Retrofan
|
||||
.byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20
|
||||
.byte $20, $1f, $20, $9a, $a9, $20, $20, $20, $92, $a1, $1f, $12, $20, $9a, $a9, $20
|
||||
.byte $20, $20, $7f, $1f, $20, $20, $9a, $a3, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20
|
||||
.byte $20, $20, $20, $05, $92, $4d, $45, $47, $41, $9a, $12, $20, $20, $20, $20, $20
|
||||
.byte $20, $1f, $20, $9a, $20, $20, $92, $a2, $bb, $1f, $12, $20, $9a, $20, $20, $92
|
||||
.byte $ac, $a2, $a2, $1f, $12, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20
|
||||
.byte $20, $1e, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $42
|
||||
.byte $41, $53, $49, $43, $9a, $12, $20, $20, $92, $7f, $a9, $12, $20, $20, $1f, $20
|
||||
.byte $9a, $20, $20, $a2, $92, $be, $1f, $12, $20, $9a, $20, $20, $92, $bc, $12, $20
|
||||
.byte $20, $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $20, $9e, $a3, $a3, $a3
|
||||
.byte $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $2d, $2d, $2d, $2d, $2d, $2d, $9a
|
||||
.byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20
|
||||
.byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a
|
||||
.byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f
|
||||
.byte $92, $0D, $0D, $05, $00
|
||||
//
|
||||
// .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20
|
||||
// .byte $20, $1f, $20, $9a, $a9, $20, $20, $20, $92, $a1, $1f, $12, $20, $9a, $a9, $20
|
||||
// .byte $20, $20, $7f, $1f, $20, $20, $9a, $a3, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20
|
||||
// .byte $20, $20, $20, $05, $92, $4d, $45, $47, $41, $9a, $12, $20, $20, $20, $20, $20
|
||||
// .byte $20, $1f, $20, $9a, $20, $20, $92, $a2, $bb, $1f, $12, $20, $9a, $20, $20, $92
|
||||
// .byte $ac, $a2, $a2, $1f, $12, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20
|
||||
// .byte $20, $1e, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $42
|
||||
// .byte $41, $53, $49, $43, $9a, $12, $20, $20, $92, $7f, $a9, $12, $20, $20, $1f, $20
|
||||
// .byte $9a, $20, $20, $a2, $92, $be, $1f, $12, $20, $9a, $20, $20, $92, $bc, $12, $20
|
||||
// .byte $20, $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $20, $9e, $a3, $a3, $a3
|
||||
// .byte $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $2d, $2d, $2d, $2d, $2d, $2d, $9a
|
||||
// .byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20
|
||||
// .byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a
|
||||
// .byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f
|
||||
// .byte $92, $0D, $0D, $05, $00
|
||||
|
||||
// Original Mega65 banner - supplied by Deft
|
||||
//
|
||||
// .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0
|
||||
// .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9B,$92,$20,$05,$12,$A0,$A0
|
||||
// .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9A,$92,$20,$05,$20,$20,$20
|
||||
@@ -112,4 +135,15 @@ pre_revision_string:
|
||||
// .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D
|
||||
// .byte $0D,$05,$92,$00
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
text_mode_64:
|
||||
|
||||
.text "LEGACY"
|
||||
.byte $11, $9D, $9D, $9D, $9D, $9D
|
||||
.text "MODE"
|
||||
.byte $00
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -9,8 +9,6 @@
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 115
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
|
||||
// XXX finish and test this
|
||||
|
||||
add_align_exponents:
|
||||
|
||||
// XXX assume here none of the exponents is 0, check if this is true for orignal ROMs
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 112
|
||||
|
||||
// XXX implement
|
||||
|
||||
add_HALF_FAC1:
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
ldy #>const_HALF
|
||||
lda #<const_HALF
|
||||
|
||||
jmp add_MEM_FAC1
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,41 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - multiply FAC1 by 10
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 114
|
||||
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
mul10_FAC1:
|
||||
|
||||
// Handle special case of FAC1 equal 0
|
||||
|
||||
lda FAC1_exponent
|
||||
beq mul10_FAC1_done
|
||||
|
||||
// Start by multiplying FAC1 by 2
|
||||
|
||||
jsr mul10_FAC1_mul2
|
||||
|
||||
// Move FAC1 to FAC2, so that FAC1 = FAC2 = 2 * initial
|
||||
|
||||
jsr mov_FAC1_FAC2
|
||||
|
||||
// Multiply FAC1 by 4
|
||||
|
||||
jsr mul10_FAC1_mul2
|
||||
jsr mul10_FAC1_mul2
|
||||
|
||||
// Now we have FAC1 = 8 * initial and FAC2 = 2 * initial; so just add these 2 values
|
||||
|
||||
jmp add_FAC2_FAC1
|
||||
|
||||
mul10_FAC1_done:
|
||||
|
||||
rts
|
||||
@@ -16,7 +16,14 @@
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
// XXX test this
|
||||
|
||||
div10_FAC1_p:
|
||||
STUB_IMPLEMENTATION()
|
||||
|
||||
lda #$00
|
||||
sta FAC1_sign
|
||||
|
||||
ldy #>const_TEN
|
||||
lda #<const_TEN
|
||||
|
||||
jmp div_MEM_FAC1
|
||||
File renamed without changes.
@@ -0,0 +1,85 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - divide FAC2 (dividend) by FAC1 (divisor)
|
||||
//
|
||||
// Input:
|
||||
// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag (but our routine does not need this)
|
||||
//
|
||||
// Output:
|
||||
// - FAC1
|
||||
//
|
||||
// Note:
|
||||
// - some documentation suggest this is a division leaving quotient and remainder (left in FAC2),
|
||||
// but it seems (experimentation) that this is not true
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 114
|
||||
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
div_FAC2_FAC1:
|
||||
|
||||
// 'Pamiętaj, cholero - nie dziel przez zero!' - ancient polish proverb
|
||||
|
||||
lda FAC1_exponent
|
||||
beq_16 do_DIVISION_BY_ZERO_error
|
||||
|
||||
// Handle special case - dividing 0 by non-zero value
|
||||
|
||||
lda FAC2_exponent
|
||||
beq_16 set_FAC1_zero
|
||||
|
||||
// Multiply signs
|
||||
|
||||
lda FAC1_sign
|
||||
eor FAC2_sign
|
||||
sta FAC1_sign
|
||||
|
||||
// Subtract the exponents
|
||||
|
||||
lda #$A0 // correction for bias and FAC2 digits
|
||||
sta RESHO+0
|
||||
lda #$00
|
||||
sta RESHO+1
|
||||
|
||||
lda FAC2_exponent // add FAC2 exponent to temporary variable
|
||||
jsr muldiv_RESHO_01_add_A
|
||||
|
||||
lda RESHO+0 // subtract FAC1 exponent from temporary variable
|
||||
sec
|
||||
sbc FAC1_exponent
|
||||
sta RESHO+0
|
||||
bcs !+
|
||||
dec RESHO+1
|
||||
!:
|
||||
|
||||
lda RESHO+1
|
||||
bmi_16 set_FAC1_zero // result too low, set 0 and quit
|
||||
|
||||
lda RESHO+0
|
||||
sta FAC1_exponent
|
||||
|
||||
// Divide the mantissas
|
||||
jsr div_FAC1_denorm
|
||||
jsr muldiv_RESHO_set_0
|
||||
jsr div_mantissas
|
||||
|
||||
// Copy the result to FAC1 - XXX we probably already have similar code somewhere...
|
||||
|
||||
lda FAC2_mantissa+3
|
||||
sta FAC1_mantissa+3
|
||||
lda FAC2_mantissa+2
|
||||
sta FAC1_mantissa+2
|
||||
lda FAC2_mantissa+1
|
||||
sta FAC1_mantissa+1
|
||||
lda FAC2_mantissa+0
|
||||
sta FAC1_mantissa+0
|
||||
|
||||
// Normalize and quit
|
||||
|
||||
jmp normal_FAC1
|
||||
File renamed without changes.
File renamed without changes.
@@ -15,7 +15,12 @@
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
sgn_FAC1_A:
|
||||
STUB_IMPLEMENTATION()
|
||||
|
||||
lda FAC1_exponent
|
||||
beq !+
|
||||
lda FAC1_sign
|
||||
bne !+
|
||||
lda #$01
|
||||
!:
|
||||
rts
|
||||
File renamed without changes.
@@ -15,7 +15,8 @@
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
sqr_FAC1:
|
||||
STUB_IMPLEMENTATION()
|
||||
|
||||
jsr mov_FAC1_FAC2
|
||||
|
||||
// FALLLTROUGH to sqr_FAC2
|
||||
File renamed without changes.
@@ -4,7 +4,7 @@
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - set FAC1 as RAM raised to the power of FAC1
|
||||
// Math package - set FAC1 as RAM raised to the power of FAC2
|
||||
//
|
||||
// Input:
|
||||
// - .A - address low byte
|
||||
@@ -12,11 +12,13 @@
|
||||
//
|
||||
// See also:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 117 (FPWRT)
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
pwr_FAC2_MEM:
|
||||
|
||||
FPWR:
|
||||
STUB_IMPLEMENTATION()
|
||||
jsr mov_MEM_FAC1
|
||||
|
||||
// FALLTROUGH to pwr_FAC2_FAC1
|
||||
@@ -0,0 +1,68 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - denormalize FAC1 mantissa and adapt its exponent accordingly for division
|
||||
//
|
||||
|
||||
div_FAC1_denorm:
|
||||
|
||||
// Set FACOV to 0, no need for increased precision here
|
||||
|
||||
lda #$00
|
||||
sta FACOV
|
||||
|
||||
// Start by moving whole bytes, if possible
|
||||
|
||||
lda FAC1_mantissa+3
|
||||
bne div_FAC1_denorm_by_bit // branch if last byte of mantissa is non-zero
|
||||
|
||||
lda FAC1_exponent
|
||||
cmp #$08
|
||||
bcc div_FAC1_denorm_by_bit // branch if not suitable to increment exponent by 8
|
||||
|
||||
// Increment exponent
|
||||
|
||||
sbc #$08 // Carry already sec
|
||||
sta FAC1_exponent
|
||||
|
||||
// Move mantissa bytes
|
||||
|
||||
lda FAC1_mantissa+2
|
||||
sta FAC1_mantissa+3
|
||||
lda FAC1_mantissa+1
|
||||
sta FAC1_mantissa+2
|
||||
lda FAC1_mantissa+0
|
||||
sta FAC1_mantissa+1
|
||||
lda #$00
|
||||
sta FAC1_mantissa+0
|
||||
|
||||
beq div_FAC1_denorm // branch always
|
||||
|
||||
div_FAC1_denorm_by_bit:
|
||||
|
||||
lda FAC1_mantissa+3
|
||||
and #$01
|
||||
bne div_FAC1_denorm_done // branch if lowest bit of mantissa is already 1
|
||||
|
||||
lda FAC1_exponent
|
||||
beq div_FAC1_denorm_done // branch if not suitable to decrement exponent
|
||||
|
||||
// Decrement exponent
|
||||
|
||||
dec FAC1_exponent
|
||||
|
||||
// Move mantissa bits
|
||||
|
||||
clc
|
||||
ror FAC1_mantissa+0
|
||||
ror FAC1_mantissa+1
|
||||
ror FAC1_mantissa+2
|
||||
ror FAC1_mantissa+3
|
||||
|
||||
bcc div_FAC1_denorm_by_bit // branch always
|
||||
|
||||
div_FAC1_denorm_done:
|
||||
|
||||
rts
|
||||
@@ -0,0 +1,84 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// Math package - 32-bit mantissa division, based on code by Verz
|
||||
//
|
||||
// divident: FAC2_mantissa, divisor: FAC1_mantissa (without FACOV), result: FAC2_mantissa, remainder: RESHO
|
||||
// temporary storage: INDEX+0, INDEX+1, INDEX+2, INDEX+3
|
||||
//
|
||||
// RESHO (remainder) should be set to 0 before
|
||||
//
|
||||
// see https://codebase64.org/doku.php?id=base:24bit_division_24-bit_result
|
||||
|
||||
// XXX test this
|
||||
|
||||
div_mantissas:
|
||||
|
||||
ldx #32 // repeat for each bit
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
div_mantissas_loop:
|
||||
|
||||
// Multiply divident by 2, msb -> Carry
|
||||
|
||||
asl FAC2_mantissa+3
|
||||
rol FAC2_mantissa+2
|
||||
rol FAC2_mantissa+1
|
||||
rol FAC2_mantissa+0
|
||||
|
||||
// Multiply remainder by 2, lsb <- Carry
|
||||
|
||||
rol RESHO+3
|
||||
rol RESHO+2
|
||||
rol RESHO+1
|
||||
rol RESHO+0
|
||||
|
||||
// Subtract divisor from the remainder, result to INDEX and .Y
|
||||
|
||||
sec
|
||||
lda RESHO+3
|
||||
sbc FAC1_mantissa+3
|
||||
sta INDEX+3
|
||||
|
||||
lda RESHO+2
|
||||
sbc FAC1_mantissa+2
|
||||
sta INDEX+2
|
||||
|
||||
lda RESHO+1
|
||||
sbc FAC1_mantissa+1
|
||||
sta INDEX+1
|
||||
|
||||
lda RESHO+0
|
||||
sbc FAC1_mantissa+0
|
||||
|
||||
bcc div_mantissas_skip // if Carry is not set then divisor did not fit in remainder yet
|
||||
sta INDEX+0
|
||||
|
||||
// Save subtraction result as new remainder
|
||||
|
||||
lda INDEX+3
|
||||
sta RESHO+3
|
||||
|
||||
lda INDEX+2
|
||||
sta RESHO+2
|
||||
|
||||
lda INDEX+1
|
||||
sta RESHO+1
|
||||
|
||||
lda INDEX+0
|
||||
sta RESHO+0
|
||||
|
||||
// Increment result cause divisor fit in 1 times
|
||||
|
||||
inc FAC2_mantissa+3
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
div_mantissas_skip:
|
||||
|
||||
dex
|
||||
bne div_mantissas_loop
|
||||
|
||||
rts
|
||||
@@ -0,0 +1,16 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Multiply FAC1 by 2, do not normalize
|
||||
//
|
||||
|
||||
mul10_FAC1_mul2:
|
||||
|
||||
// Increment the exponent
|
||||
|
||||
inc FAC1_exponent
|
||||
beq_16 set_FAC1_max
|
||||
|
||||
rts
|
||||
+149
-44
@@ -17,7 +17,14 @@
|
||||
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
//
|
||||
|
||||
// XXX provide implementation
|
||||
set_FAC1_zero:
|
||||
|
||||
lda #$00
|
||||
sta FAC1_exponent
|
||||
|
||||
mul_FAC2_FAC1_done:
|
||||
|
||||
rts
|
||||
|
||||
mul_FAC2_FAC1:
|
||||
|
||||
@@ -37,54 +44,152 @@ mul_FAC2_FAC1:
|
||||
eor FAC2_sign
|
||||
sta FAC1_sign
|
||||
|
||||
// Check if exponents can be added without overflow/underflow
|
||||
|
||||
lda FAC1_exponent
|
||||
and #$80
|
||||
eor FAC2_exponent
|
||||
|
||||
bmi mul_FAC2_FAC1_add_exponents // exponent signs are opposite, we can add them safely
|
||||
|
||||
// Both exponents are either negative (below $80), or both are non-negative ($80 or above),
|
||||
// try to add them
|
||||
|
||||
lda FAC1_exponent
|
||||
clc
|
||||
adc FAC2_exponent
|
||||
bpl mul_FAC2_FAC1_sub_exp_bias // branch if we can add values
|
||||
|
||||
// We cannot add them, result would over/underflow; set result as
|
||||
// either 0 or maximum possible float
|
||||
|
||||
lda FAC1_exponent
|
||||
bmi_16 set_FAC1_max
|
||||
// Add the exponents (subtract the bias) - XXX can this be optimized somehow?
|
||||
|
||||
jsr muldiv_RESHO_set_0
|
||||
|
||||
lda #$00
|
||||
sta FAC1_exponent
|
||||
rts
|
||||
|
||||
mul_FAC2_FAC1_add_exponents:
|
||||
|
||||
// Add the exponents
|
||||
|
||||
lda FAC1_exponent
|
||||
clc
|
||||
adc FAC2_exponent
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
mul_FAC2_FAC1_sub_exp_bias:
|
||||
|
||||
sec
|
||||
sbc #$80 // bias
|
||||
jsr muldiv_RESHO_01_add_A
|
||||
|
||||
lda FAC2_exponent
|
||||
jsr muldiv_RESHO_01_add_A
|
||||
|
||||
lda RESHO+0
|
||||
sbc #$80 // we need to correct double BIAS
|
||||
sta RESHO+0
|
||||
bcs !+
|
||||
lda RESHO+1
|
||||
sbc #$00
|
||||
bcc set_FAC1_zero
|
||||
sta RESHO+1
|
||||
!:
|
||||
lda RESHO+1
|
||||
bne_16 set_FAC1_max // overflow
|
||||
|
||||
lda RESHO+0
|
||||
sta FAC1_exponent
|
||||
|
||||
|
||||
// Multiply the mantissas
|
||||
|
||||
// XXX
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
jsr muldiv_RESHO_set_0
|
||||
clc
|
||||
|
||||
mul_FAC2_FAC1_done:
|
||||
// XXX maybe we should preserve .X on stack? this will not cost us too much
|
||||
|
||||
lda FACOV
|
||||
jsr mul_FAC2_FAC1_by_A
|
||||
jsr mul_FAC2_FAC1_shift
|
||||
bcc !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
lda FAC1_mantissa+3
|
||||
jsr mul_FAC2_FAC1_by_A
|
||||
jsr mul_FAC2_FAC1_shift
|
||||
bcc !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
lda FAC1_mantissa+2
|
||||
jsr mul_FAC2_FAC1_by_A
|
||||
jsr mul_FAC2_FAC1_shift
|
||||
bcc !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
lda FAC1_mantissa+1
|
||||
jsr mul_FAC2_FAC1_by_A
|
||||
jsr mul_FAC2_FAC1_shift
|
||||
bcc !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
lda FAC1_mantissa+0
|
||||
jsr mul_FAC2_FAC1_by_A
|
||||
jsr mul_FAC2_FAC1_shift
|
||||
bcc !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
// Copy RESHO to FAC1 mantissa
|
||||
|
||||
lda RESHO+4
|
||||
sta FACOV
|
||||
lda RESHO+3
|
||||
sta FAC1_mantissa+3
|
||||
lda RESHO+2
|
||||
sta FAC1_mantissa+2
|
||||
lda RESHO+1
|
||||
sta FAC1_mantissa+1
|
||||
lda RESHO+0
|
||||
sta FAC1_mantissa+0
|
||||
|
||||
// Correct the exponent
|
||||
|
||||
lda FAC1_exponent
|
||||
clc
|
||||
adc #$08
|
||||
bcs_16 set_FAC1_max // branch if overflow
|
||||
sta FAC1_exponent
|
||||
jmp normal_FAC1
|
||||
|
||||
mul_FAC2_FAC1_by_A:
|
||||
|
||||
beq mul_FAC2_FAC1_by_A_done
|
||||
sta INDEX+3
|
||||
|
||||
// Multiply FAC2_mantissa+3
|
||||
|
||||
lda FAC2_mantissa+3
|
||||
jsr mul_FAC2_FAC1_8x8
|
||||
|
||||
adc RESHO+4
|
||||
sta RESHO+4
|
||||
txa
|
||||
adc RESHO+3
|
||||
sta RESHO+3
|
||||
bcc !+
|
||||
inc RESHO+2
|
||||
bne !+
|
||||
inc RESHO+1
|
||||
bne !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
// Multiply FAC2_mantissa+2
|
||||
|
||||
lda FAC2_mantissa+2
|
||||
jsr mul_FAC2_FAC1_8x8
|
||||
|
||||
adc RESHO+3
|
||||
sta RESHO+3
|
||||
txa
|
||||
adc RESHO+2
|
||||
sta RESHO+2
|
||||
bcc !+
|
||||
inc RESHO+1
|
||||
bne !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
// Multiply FAC2_mantissa+1
|
||||
|
||||
lda FAC2_mantissa+1
|
||||
jsr mul_FAC2_FAC1_8x8
|
||||
|
||||
adc RESHO+2
|
||||
sta RESHO+2
|
||||
txa
|
||||
adc RESHO+1
|
||||
sta RESHO+1
|
||||
bcc !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
// Multiply FAC2_mantissa+0
|
||||
|
||||
lda FAC2_mantissa+0
|
||||
jsr mul_FAC2_FAC1_8x8
|
||||
adc RESHO+1
|
||||
sta RESHO+1
|
||||
txa
|
||||
adc RESHO+0
|
||||
sta RESHO+0
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
mul_FAC2_FAC1_by_A_done:
|
||||
|
||||
rts
|
||||
@@ -0,0 +1,77 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routine, based on code by djmips from:
|
||||
// - https://codebase64.org/doku.php?id=base:8bit_multiplication_16bit_product_fast_no_tables
|
||||
//
|
||||
// input: .A (and Zero flag set according to .A), INDEX+3
|
||||
// output: .X (high byte), .A (low byte), carry always clear
|
||||
//
|
||||
|
||||
mul_FAC2_FAC1_8x8:
|
||||
|
||||
// Special case (optimization) - handle 0 in INDEX+2
|
||||
beq mul_FAC2_FAC1_8x8_zero
|
||||
|
||||
sta INDEX+2
|
||||
lda #$00
|
||||
|
||||
dec INDEX+3 // decrement because we will be adding with carry set for speed (an extra one)
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
bcc !+
|
||||
adc INDEX+3
|
||||
!:
|
||||
ror
|
||||
ror INDEX+2
|
||||
inc INDEX+3
|
||||
|
||||
tax
|
||||
lda INDEX+2
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
mul_FAC2_FAC1_8x8_zero:
|
||||
|
||||
lda #$00
|
||||
tax
|
||||
|
||||
clc
|
||||
rts
|
||||
@@ -0,0 +1,46 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Shift RESHO by one byte - for multiplication
|
||||
//
|
||||
|
||||
mul_FAC2_FAC1_shift:
|
||||
|
||||
// Check if rounding is needed
|
||||
|
||||
php
|
||||
clc
|
||||
lda RESHO+4
|
||||
bpl !+
|
||||
sec
|
||||
!:
|
||||
// Copy bytes
|
||||
|
||||
lda RESHO+3
|
||||
sta RESHO+4
|
||||
lda RESHO+2
|
||||
sta RESHO+3
|
||||
lda RESHO+1
|
||||
sta RESHO+2
|
||||
lda RESHO+0
|
||||
sta RESHO+1
|
||||
lda #$00
|
||||
sta RESHO+0
|
||||
bcc !+
|
||||
|
||||
// Perform rounding
|
||||
|
||||
inc RESHO+4
|
||||
bne !+
|
||||
inc RESHO+3
|
||||
bne !+
|
||||
inc RESHO+2
|
||||
bne !+
|
||||
inc RESHO+1
|
||||
bne !+
|
||||
inc RESHO+0
|
||||
!:
|
||||
plp
|
||||
rts
|
||||
@@ -0,0 +1,30 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - helper routines for RESHO manipulation
|
||||
//
|
||||
|
||||
|
||||
muldiv_RESHO_set_0:
|
||||
|
||||
lda #$00
|
||||
sta RESHO+0
|
||||
sta RESHO+1
|
||||
sta RESHO+2
|
||||
sta RESHO+3
|
||||
sta RESHO+4
|
||||
|
||||
rts
|
||||
|
||||
|
||||
muldiv_RESHO_01_add_A:
|
||||
|
||||
clc
|
||||
adc RESHO+0
|
||||
sta RESHO+0
|
||||
bcc !+
|
||||
inc RESHO+1
|
||||
!:
|
||||
rts
|
||||
@@ -44,8 +44,7 @@ normal_FAC1_by_bit:
|
||||
|
||||
// Multiply the mantissa by 2
|
||||
|
||||
clc
|
||||
rol FACOV
|
||||
asl FACOV
|
||||
rol FAC1_mantissa+3
|
||||
rol FAC1_mantissa+2
|
||||
rol FAC1_mantissa+1
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 156 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user