diff --git a/CONFIG.md b/CONFIG.md index 94bd18ec..b91f3301 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -287,6 +287,12 @@ If enabled, a simple DOS wedge is available from the direct mode for tape loadin Feature needs few bytes in BASIC segment. If unsure - enable. +### `CONFIG_TAPE_HEAD_ALIGN` + +If enabled, embeds a tape head align tool into the ROM, it can be started with `←H`. Requires `CONFIG_TAPE_WEDGE`. + +Feature needs nearly 1 KB bytes in KERNAL segment. Only recomended for machines with extended ROM, like Mega65. + ### `CONFIG_BCD_SAFE_INTERRUPTS` On the most widespread CPUs the D flag is not cleared upon entering interrupts. Since the original Kernal does not clear it either, it's not safe to use BCD processor mode without disabling the interrupts first. This option makes sure the D flag is disabled at the start of the interrupt - this allows some optimizations in the code. diff --git a/Makefile b/Makefile index 9fc2abcc..8581ffa6 100644 --- a/Makefile +++ b/Makefile @@ -436,8 +436,8 @@ 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) $(TARGET_M65_PXL) - ../xemu/build/bin/xmega65.native -dmarev 2 -forcerom -loadrom $(TARGET_M65_x) +test_mega65: $(TARGET_M65_x) $(TARGET_M65_x_PXL) + ../xemu/build/bin/xmega65.native -dmarev 2 -forcerom -loadrom $(TARGET_M65_x_PXL) test_cx16: $(TARGET_X16_x) ../x16-emulator/x16emu -rom $(TARGET_X16_x) diff --git a/STATUS.md b/STATUS.md index e8013b30..7957672e 100644 --- a/STATUS.md +++ b/STATUS.md @@ -15,6 +15,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * normal tape load error log is limited by free stack space only (no artificial limitation like in original ROMs) * tape format autodetection; normal vs turbo is mostly transparent to user * improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators +* built-in tape head align tool (only feasible to use on machines with extended memory, like Mega65) * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 985b5857..1d8e77e5 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -115,7 +115,7 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_TAPE_WEDGE -// #define CONFIG_TAPE_HEAD_ALIGN +#define CONFIG_TAPE_HEAD_ALIGN #define CONFIG_BCD_SAFE_INTERRUPTS diff --git a/c64/kernal/board_m65/mega65_imports.s b/c64/kernal/board_m65/mega65_imports.s index 25399d18..0588fa89 100644 --- a/c64/kernal/board_m65/mega65_imports.s +++ b/c64/kernal/board_m65/mega65_imports.s @@ -8,7 +8,6 @@ #import "KERNAL_0_combined.sym" -.label CLALL = KERNAL_0.CLALL .label STOP = KERNAL_0.STOP .label hw_entry_reset = KERNAL_0.hw_entry_reset @@ -63,6 +62,7 @@ #if CONFIG_TAPE_HEAD_ALIGN +.label CLALL = KERNAL_0.proxy_K1_CLALL .label nmi_lock = KERNAL_0.nmi_lock #endif diff --git a/c64/kernal/board_m65/mega65_proxies.s b/c64/kernal/board_m65/mega65_proxies.s index 9585775d..cf274435 100644 --- a/c64/kernal/board_m65/mega65_proxies.s +++ b/c64/kernal/board_m65/mega65_proxies.s @@ -56,3 +56,14 @@ proxy_K1_print_return: jmp map_KERNAL_1 #endif + + +#if CONFIG_TAPE_HEAD_ALIGN + +proxy_K1_CLALL: + + jsr map_NORMAL + jsr CLALL + jmp map_KERNAL_1 + +#endif diff --git a/c64/kernal/init/fce2.hw_entry_reset.s b/c64/kernal/init/fce2.hw_entry_reset.s index 2ada16d4..c968391d 100644 --- a/c64/kernal/init/fce2.hw_entry_reset.s +++ b/c64/kernal/init/fce2.hw_entry_reset.s @@ -25,6 +25,12 @@ hw_entry_reset: ldx #$FF txs +#if ROM_LAYOUT_M65 + + jsr map_NORMAL // we want normal memory mapping + +#endif + #if CONFIG_PLATFORM_COMMODORE_64 // The following routine is based on reading the public KERNAL jumptable routine diff --git a/c64/kernal/tape/tape_head_align.s b/c64/kernal/tape/tape_head_align.s index a5f05d70..7466331e 100644 --- a/c64/kernal/tape/tape_head_align.s +++ b/c64/kernal/tape/tape_head_align.s @@ -11,9 +11,6 @@ // XXX for Mega65 it can be done more easily, by just disabling the badlines -// XXX document CONFIG_TAPE_HEAD_ALIGN option -// XXX fix Mega65 build compilation issues - .label __ha_start = 12 // starting row of the chart .label __ha_rows = 11 // number of rows for scrolling @@ -50,7 +47,7 @@ tape_head_align: sei jsr IOINIT - jsr CINT + // jsr CINT jsr nmi_lock diff --git a/doc/Development.md b/doc/Development.md index bc4c8ad7..95054f28 100644 --- a/doc/Development.md +++ b/doc/Development.md @@ -59,6 +59,10 @@ There is no official PETSCII code for `TAB` - we can't utilize the ones from C12 Bits 3 and 4 are extension to the original variable, compatible with the C128 ROMs API. There is no official way to retrieve `NO_SCRL` status as of yet. The `40/80` key status cannot be retrieved in C64 mode at all (C128 hardware limitation). +#### NMI vector modification + +Before modifying NMI vector, set it's high byte to 0. The ROM routine considers such address invalid and won't try to call the custom code, thus preventing a crash if interrupt happens in the worst possible moment. + #### Mega65 native mode Mega65 build starts in legacy mode, which is intended to be reasonably compatible with the C64 ROMs. However, a native Mega65 mode is planned too, to make it easier to utilise extra features of this machine. Soo far the following has been done: