diff --git a/CONFIG.md b/CONFIG.md index 68fa3e88..c3033ba5 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -31,6 +31,10 @@ Since Open ROMs is highly modular, it should be possible to add other platforms Select if the ROM is going to be used exclusively on the specified motherboard. It prevents from enabling options not having sense, skips initialization of C128-only registers, and enables motherboard-specific features. +### `ROM_CRT` + +Has to be set for builds utilizing cartridge image as a ROM extension. + ## Brand Branding is only allowed for C64 platform, if no motherboard is specified. diff --git a/Makefile b/Makefile index bbb11c14..e746d3aa 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,10 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \ src/basic/assets \ src/basic/basic_commands \ src/basic/basic_commands_01 \ - src/basic/basic_commands_02 \ - src/basic/basic_commands_03_m65 \ + src/basic/basic_commands_04 \ src/basic/basic_operators \ src/basic/basic_functions \ + src/basic/basic_functions_06 \ src/basic/board_crt \ src/basic/board_m65 \ src/basic/board_x16 \ diff --git a/bin/README.md b/bin/README.md index 93f2ac57..b7c980d7 100644 --- a/bin/README.md +++ b/bin/README.md @@ -22,7 +22,7 @@ For Ultimate 64 motherboard the following settings are recommended:
-The generic_crt ROM set is a special version of generic set, with some code moved to external ROM on the cartridge - thus, more features could be enabled. It needs all the 3 files (BASIC, Kernal, cartridge) to be operable. +The \*\_crt ROM set is a special version, with some code moved to external ROM on the cartridge - thus, more features could be enabled. It needs all the 3 files (BASIC, Kernal, cartridge) to be operable.
diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 3683c857..6d8d0ed8 100644 Binary files a/bin/basic_generic.rom and b/bin/basic_generic.rom differ diff --git a/bin/basic_generic_crt.rom b/bin/basic_generic_crt.rom index 0720e80e..1a115f89 100644 Binary files a/bin/basic_generic_crt.rom and b/bin/basic_generic_crt.rom differ diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index af1dd73c..029dbe3e 100644 Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ diff --git a/bin/basic_ultimate64_crt.rom b/bin/basic_ultimate64_crt.rom new file mode 100644 index 00000000..ca471e34 Binary files /dev/null and b/bin/basic_ultimate64_crt.rom differ diff --git a/bin/external_generic.crt b/bin/extrom_generic_crt.crt similarity index 93% rename from bin/external_generic.crt rename to bin/extrom_generic_crt.crt index a2524d69..1dbfdc03 100644 Binary files a/bin/external_generic.crt and b/bin/extrom_generic_crt.crt differ diff --git a/bin/extrom_ultimate64_crt.crt b/bin/extrom_ultimate64_crt.crt new file mode 100644 index 00000000..e3c337fc Binary files /dev/null and b/bin/extrom_ultimate64_crt.crt differ diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 2f309c4e..9d6d01f0 100644 Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ diff --git a/bin/kernal_generic_crt.rom b/bin/kernal_generic_crt.rom index 933aae89..a23ba2c6 100644 Binary files a/bin/kernal_generic_crt.rom and b/bin/kernal_generic_crt.rom differ diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index b4a7dcb3..1d5b01dc 100644 Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ diff --git a/bin/kernal_ultimate64_crt.rom b/bin/kernal_ultimate64_crt.rom new file mode 100644 index 00000000..2ddf6345 Binary files /dev/null and b/bin/kernal_ultimate64_crt.rom differ diff --git a/bin/mega65.rom b/bin/mega65.rom index 0e0f77bd..2b08841d 100644 Binary files a/bin/mega65.rom and b/bin/mega65.rom differ diff --git a/bin/mega65_pxlfont.rom b/bin/mega65_pxlfont.rom index f0f7a8e1..4c18426b 100644 Binary files a/bin/mega65_pxlfont.rom and b/bin/mega65_pxlfont.rom differ diff --git a/doc/Development.md b/doc/Development.md index 000dc546..a63ed9b9 100644 --- a/doc/Development.md +++ b/doc/Development.md @@ -78,19 +78,21 @@ Make sure to read the main [README](../README.md) first - although any help with List of the most important make targets: -| target | description | -| :------------------ | :------------------------------------------------------------------------------ | -| `all` | builds all ROMs, places them in 'build' subdirectory | -| `clean` | removes all the compilation results and intermediate files | -| `updatebin` | upates ROMs in 'bin' subdirectory - with embedded version string, for release | -| `testsimilarity` | launches the similarity tool, see [README](../README.md) | -| `test` | builds the 'custom' configuration, launches it using VICE emulator | -| `test_generic` | builds the default ROMs, for generic C64/C128, launches using VICE | -| `test_generic_x128` | as above, but launches C128 emulator instead | -| `test_mega65` | builds the MEGA65 ROM, launches it using XEMU emulator | -| `test_ultimate64` | builds the Ultimate 64 configuration, launches it using VICE emulator | -| `test_hybrid` | builds a hybrid ROM (Open ROMs Kernal + original BASIC), launches it using VICE | -| `test_testing` | builds a rather odd testing configuration, launches it using VICE emulator | +| target | description | +| :-------------------- | :------------------------------------------------------------------------------ | +| `all` | builds all ROMs, places them in 'build' subdirectory | +| `clean` | removes all the compilation results and intermediate files | +| `updatebin` | upates ROMs in 'bin' subdirectory - with embedded version string, for release | +| `testsimilarity` | launches the similarity tool, see [README](../README.md) | +| `test` | builds the 'custom' configuration, launches it using VICE emulator | +| `test_generic` | builds the default ROMs, for generic C64/C128, launches using VICE | +| `test_generic_x128` | as above, but launches C128 emulator instead | +| `test_generic_crt` | builds the default ROM with extended cartridge image, launches using VICE | +| `test_mega65` | builds the MEGA65 ROM, launches it using XEMU emulator | +| `test_ultimate64` | builds the Ultimate 64 configuration, launches it using VICE | +| `test_ultimate64_crt` | as above, ROM with extended cartriodge image | +| `test_hybrid` | builds a hybrid ROM (Open ROMs Kernal + original BASIC), launches it using VICE | +| `test_testing` | builds a rather odd testing configuration, launches it using VICE | ### Code segments and ROM layouts diff --git a/doc/Extended-BASIC.md b/doc/Extended-BASIC.md index d8c6d046..1ea35116 100644 --- a/doc/Extended-BASIC.md +++ b/doc/Extended-BASIC.md @@ -53,19 +53,19 @@ Launches a built-in tape head alignment tool. Destroys program in memory. Press * if tape format autodetection is compiled-in, you can load file from tape using either device #1 (CBM compatible way) or from device #7 (in a way compatible with *Final* and *Action Replay* cartridges) * if autodetection is not available, than device #1 means normal CBM format, and device #7 means *Turbo Tape 64* format -### `MERGE "file_name" [, device_number]` (all) +### `MERGE "file_name" [, device_number]` (cart, MEGA65) Appends the BASIC program from a storage medium to the one currently present in memory. -### `BLOAD "file_name", device_number, start_address` (all) +### `BLOAD "file_name", device_number, start_address` (cart, MEGA65) Loads a binary file starting from the given memory location. Does not clear variables, does not perform BASIC program relinking, etc. NOTE: for now syntax differs from the BASIC V3.5+ - this will be changed once the necessary BASIC infrastructure is implemented. -### `BVERIFY "file_name", device_number, start_address` (all) +### `BVERIFY "file_name", device_number, start_address` (cart, MEGA65) Verify operation for the binary data starting from a given addres. NOTE: for now syntax differs from the BASIC V3.5+ - this will be changed once the necessary BASIC infrastructure is implemented. -### `BSAVE "file_name", device_number, start_address, end_address` (all) +### `BSAVE "file_name", device_number, start_address, end_address` (cart, MEGA65) Saves the binary data from the given memory area. NOTE: for now syntax differs from the BASIC V3.5+ - this will be changed once the necessary BASIC infrastructure is implemented. @@ -77,7 +77,7 @@ Resets the machine. In direct mode asks for confirmation first. ### `FAST`, `SLOW` (all) -Tries to switch the machine to turbo mode (or back to 1MHz operation mode) - details differ depending on the configured machine / motherboard. On MEGA65 motherboard this is not available in native mode, it is not designed to run in 1MHz due to using compound CPU instructions. +Tries to switch the machine to turbo mode (or back to 1MHz operation mode) - details differ depending on the configured machine / motherboard. On MEGA65 motherboard this is not available in native mode, it is not designed to run in 1MHz due to using compound CPU instructions usage. ### `OLD` (all) @@ -96,11 +96,11 @@ Displays BASIC memory usage information: Displays various system information. -### `CLEAR` (all) +### `CLEAR` (cart, MEGA65) Clears the screen content. -### `DISPOSE` (all) +### `DISPOSE` (cart, MEGA65) Runs the garbage collector - disposes outdated strings. diff --git a/src/,,config_ultimate64_crt.s b/src/,,config_ultimate64_crt.s index 290d2756..566868c0 100644 --- a/src/,,config_ultimate64_crt.s +++ b/src/,,config_ultimate64_crt.s @@ -7,6 +7,7 @@ ; Idea: ; - sane defaults for the Ultimate 64 FPGA computer +; - use RetroRelplay cartridge image as a ROM extension ; - do not enable features which are a significant compatibility risk diff --git a/src/basic/assets/packed_keywords_02.s b/src/basic/assets/packed_keywords_02.s deleted file mode 100644 index dc0e993e..00000000 --- a/src/basic/assets/packed_keywords_02.s +++ /dev/null @@ -1,12 +0,0 @@ -;; #LAYOUT# STD * #TAKE -;; #LAYOUT# CRT BASIC_1 #TAKE -;; #LAYOUT# M65 BASIC_1 #TAKE -;; #LAYOUT# X16 BASIC_0 #TAKE -;; #LAYOUT# * * #IGNORE - -!ifndef HAS_SMALL_BASIC { - -packed_freq_keywords_02: - - +PUT_PACKED_FREQ_keywords_02 -} diff --git a/src/basic/assets/packed_keywords_03.s b/src/basic/assets/packed_keywords_03.s deleted file mode 100644 index 916f9bdb..00000000 --- a/src/basic/assets/packed_keywords_03.s +++ /dev/null @@ -1,13 +0,0 @@ -;; #LAYOUT# STD * #TAKE -;; #LAYOUT# CRT BASIC_1 #TAKE -;; #LAYOUT# M65 BASIC_1 #TAKE -;; #LAYOUT# X16 BASIC_0 #TAKE -;; #LAYOUT# * * #IGNORE - -!ifdef CONFIG_MB_M65 { - -packed_freq_keywords_03: - - +PUT_PACKED_FREQ_keywords_03 - -} \ No newline at end of file diff --git a/src/basic/assets/packed_keywords_04.s b/src/basic/assets/packed_keywords_04.s new file mode 100644 index 00000000..d80ac41b --- /dev/null +++ b/src/basic/assets/packed_keywords_04.s @@ -0,0 +1,7 @@ +;; #LAYOUT# M65 BASIC_1 #TAKE +;; #LAYOUT# * * #IGNORE + + +packed_freq_keywords_04: + + +PUT_PACKED_FREQ_keywords_04 diff --git a/src/basic/assets/packed_keywords_06.s b/src/basic/assets/packed_keywords_06.s new file mode 100644 index 00000000..77d1eac9 --- /dev/null +++ b/src/basic/assets/packed_keywords_06.s @@ -0,0 +1,7 @@ +;; #LAYOUT# M65 BASIC_1 #TAKE +;; #LAYOUT# * * #IGNORE + + +packed_freq_keywords_06: + + +PUT_PACKED_FREQ_keywords_06 diff --git a/src/basic/basic_commands_01/cmd__jumptable_01.s b/src/basic/basic_commands_01/cmd__jumptable_01.s index 31ebb526..ad3a7490 100644 --- a/src/basic/basic_commands_01/cmd__jumptable_01.s +++ b/src/basic/basic_commands_01/cmd__jumptable_01.s @@ -6,33 +6,42 @@ ; Jumptable for BASIC commands with tokens prefixed by $01 ; +!set ITEM_01 = cmd_slow +!set ITEM_02 = cmd_fast +!set ITEM_03 = cmd_old -!set ITEM_00 = cmd_slow -!set ITEM_01 = cmd_fast -!set ITEM_02 = cmd_old +!ifndef HAS_SMALL_BASIC { - ; NOTE! These commands are temporarily placed here, they should be a part of list 02! +!set ITEM_04 = cmd_clear +!set ITEM_05 = varstr_garbage_collect ; cmd_dispose +!set ITEM_06 = cmd_merge +!set ITEM_07 = cmd_bload +!set ITEM_08 = cmd_bsave +!set ITEM_09 = cmd_bverify +!set ITEM_0A = cmd_cold +!set ITEM_0B = cmd_mem -!set ITEM_03 = cmd_merge +} -!set ITEM_04 = cmd_bload -!set ITEM_05 = cmd_bsave -!set ITEM_06 = cmd_bverify - -!set ITEM_07 = cmd_clear -!set ITEM_08 = varstr_garbage_collect ; cmd_dispose !ifndef HAS_OPCODES_65C02 { command_01_jumptable_lo: - !byte <(ITEM_00-1), <(ITEM_01-1), <(ITEM_02-1), <(ITEM_03-1), <(ITEM_04-1), <(ITEM_05-1), <(ITEM_06-1), <(ITEM_07-1), <(ITEM_08-1) + !byte <(ITEM_01-1), <(ITEM_02-1), <(ITEM_03-1) +!ifndef HAS_SMALL_BASIC { + !byte <(ITEM_04-1), <(ITEM_05-1), <(ITEM_06-1), <(ITEM_07-4), <(ITEM_08-1), <(ITEM_09-1), <(ITEM_0A-1), <(ITEM_0B-1) +} command_01_jumptable_hi: - !byte >(ITEM_00-1), >(ITEM_01-1), >(ITEM_02-1), >(ITEM_03-1), >(ITEM_04-1), >(ITEM_05-1), >(ITEM_06-1), >(ITEM_07-1), >(ITEM_08-1) + !byte >(ITEM_01-1), >(ITEM_02-1), >(ITEM_03-1) + +!ifndef HAS_SMALL_BASIC { + !byte >(ITEM_04-1), >(ITEM_05-1), >(ITEM_06-1), >(ITEM_07-4), >(ITEM_08-1), >(ITEM_09-1), >(ITEM_0A-1), >(ITEM_0B-1) +} } else { ; HAS_OPCODES_65C02 @@ -40,5 +49,10 @@ command_01_jumptable: ; Note: 65C02 has the page boundary vector bug fixed! - !word ITEM_00, ITEM_01, ITEM_02, ITEM_03, ITEM_04, ITEM_05, ITEM_06, ITEM_07, ITEM_08 + !word ITEM_01, ITEM_02, ITEM_03 + +!ifndef HAS_SMALL_BASIC { + !word ITEM_04, ITEM_05, ITEM_06, ITEM_07, ITEM_08, ITEM_09, ITEM_0A, ITEM_0B +} + } diff --git a/src/basic/basic_commands_02/cmd_bload_bverify.s b/src/basic/basic_commands_01/cmd_bload_bverify.s similarity index 96% rename from src/basic/basic_commands_02/cmd_bload_bverify.s rename to src/basic/basic_commands_01/cmd_bload_bverify.s index 87ab76d8..2e31c215 100644 --- a/src/basic/basic_commands_02/cmd_bload_bverify.s +++ b/src/basic/basic_commands_01/cmd_bload_bverify.s @@ -3,6 +3,8 @@ ;; #LAYOUT# * * #IGNORE +!ifndef HAS_SMALL_BASIC { + cmd_bverify: ; LOAD and VERIFY are very similar, from BASIC perspective there is almost no difference; @@ -40,3 +42,4 @@ cmd_bload: ; Execute next statement rts +} \ No newline at end of file diff --git a/src/basic/basic_commands_02/cmd_bsave.s b/src/basic/basic_commands_01/cmd_bsave.s similarity index 95% rename from src/basic/basic_commands_02/cmd_bsave.s rename to src/basic/basic_commands_01/cmd_bsave.s index f702a295..9a6ba5c9 100644 --- a/src/basic/basic_commands_02/cmd_bsave.s +++ b/src/basic/basic_commands_01/cmd_bsave.s @@ -3,6 +3,8 @@ ;; #LAYOUT# * * #IGNORE +!ifndef HAS_SMALL_BASIC { + cmd_bsave: ; Set default device and secondary address @@ -40,3 +42,4 @@ cmd_bsave: ; Perform SAVE - reuse regular command jmp cmd_save_do +} \ No newline at end of file diff --git a/src/basic/basic_commands_02/cmd_clear.s b/src/basic/basic_commands_01/cmd_clear.s similarity index 86% rename from src/basic/basic_commands_02/cmd_clear.s rename to src/basic/basic_commands_01/cmd_clear.s index a4af3508..1f4333db 100644 --- a/src/basic/basic_commands_02/cmd_clear.s +++ b/src/basic/basic_commands_01/cmd_clear.s @@ -3,8 +3,11 @@ ;; #LAYOUT# * * #IGNORE +!ifndef HAS_SMALL_BASIC { + cmd_clear: ; XXX in the future add separate implementation for graphics screen jmp clear_screen +} diff --git a/src/basic/basic_commands_02/cmd_cold.s b/src/basic/basic_commands_01/cmd_cold.s similarity index 100% rename from src/basic/basic_commands_02/cmd_cold.s rename to src/basic/basic_commands_01/cmd_cold.s diff --git a/src/basic/basic_commands_02/cmd_dispose.s b/src/basic/basic_commands_01/cmd_dispose.s similarity index 100% rename from src/basic/basic_commands_02/cmd_dispose.s rename to src/basic/basic_commands_01/cmd_dispose.s diff --git a/src/basic/basic_commands_02/cmd_mem.s b/src/basic/basic_commands_01/cmd_mem.s similarity index 100% rename from src/basic/basic_commands_02/cmd_mem.s rename to src/basic/basic_commands_01/cmd_mem.s diff --git a/src/basic/basic_commands_02/cmd_merge.s b/src/basic/basic_commands_01/cmd_merge.s similarity index 96% rename from src/basic/basic_commands_02/cmd_merge.s rename to src/basic/basic_commands_01/cmd_merge.s index 75e5bc44..e9740c36 100644 --- a/src/basic/basic_commands_02/cmd_merge.s +++ b/src/basic/basic_commands_01/cmd_merge.s @@ -3,6 +3,8 @@ ;; #LAYOUT# * * #IGNORE +!ifndef HAS_SMALL_BASIC { + cmd_merge: lda #$00 ; mark operation as LOAD @@ -45,3 +47,4 @@ cmd_merge_no_error: ; Relink loaded program, clear variables, execute next statement jmp update_LINKPRG_VARTAB_do_clr +} \ No newline at end of file diff --git a/src/basic/basic_commands_02/helper_ask_if_sure.s b/src/basic/basic_commands_01/helper_ask_if_sure.s similarity index 100% rename from src/basic/basic_commands_02/helper_ask_if_sure.s rename to src/basic/basic_commands_01/helper_ask_if_sure.s diff --git a/src/basic/basic_commands_02/helper_bload_fetch_address.s b/src/basic/basic_commands_01/helper_bload_fetch_address.s similarity index 92% rename from src/basic/basic_commands_02/helper_bload_fetch_address.s rename to src/basic/basic_commands_01/helper_bload_fetch_address.s index f3ab147f..940ec192 100644 --- a/src/basic/basic_commands_02/helper_bload_fetch_address.s +++ b/src/basic/basic_commands_01/helper_bload_fetch_address.s @@ -7,6 +7,8 @@ ; +!ifndef HAS_SMALL_BASIC { + helper_bload_fetch_address: jsr injest_comma @@ -20,3 +22,4 @@ helper_bload_fetch_address: ldy LINNUM+1 rts +} \ No newline at end of file diff --git a/src/basic/basic_commands_02/helper_bload_fetch_filename.s b/src/basic/basic_commands_01/helper_bload_fetch_filename.s similarity index 94% rename from src/basic/basic_commands_02/helper_bload_fetch_filename.s rename to src/basic/basic_commands_01/helper_bload_fetch_filename.s index e1b238de..6ad5ad74 100644 --- a/src/basic/basic_commands_02/helper_bload_fetch_filename.s +++ b/src/basic/basic_commands_01/helper_bload_fetch_filename.s @@ -7,6 +7,8 @@ ; +!ifndef HAS_SMALL_BASIC { + helper_bload_fetch_filename: ; Fetch the file name @@ -24,3 +26,4 @@ helper_bload_fetch_filename: sta FNLEN @1: rts +} \ No newline at end of file diff --git a/src/basic/basic_commands_02/helper_mem_tab_str.s b/src/basic/basic_commands_01/helper_mem_tab_str.s similarity index 100% rename from src/basic/basic_commands_02/helper_mem_tab_str.s rename to src/basic/basic_commands_01/helper_mem_tab_str.s diff --git a/src/basic/basic_commands_02/helper_mem_tab_x.s b/src/basic/basic_commands_01/helper_mem_tab_x.s similarity index 100% rename from src/basic/basic_commands_02/helper_mem_tab_x.s rename to src/basic/basic_commands_01/helper_mem_tab_x.s diff --git a/src/basic/basic_commands_02/helper_mem_tab_y.s b/src/basic/basic_commands_01/helper_mem_tab_y.s similarity index 100% rename from src/basic/basic_commands_02/helper_mem_tab_y.s rename to src/basic/basic_commands_01/helper_mem_tab_y.s diff --git a/src/basic/basic_commands_02/cmd__jumptable_02.s b/src/basic/basic_commands_02/cmd__jumptable_02.s deleted file mode 100644 index d51a332d..00000000 --- a/src/basic/basic_commands_02/cmd__jumptable_02.s +++ /dev/null @@ -1,49 +0,0 @@ -;; #LAYOUT# STD * #TAKE -;; #LAYOUT# * BASIC_0 #TAKE -;; #LAYOUT# * * #IGNORE - -; -; Jumptable for BASIC commands with tokens prefixed by $02 -; - -!ifndef HAS_SMALL_BASIC { - - ; NOTE! These commands are temporarily placed in list 01! - - ; cmd_merge, - - ; cmd_bload, - ; cmd_bsave, - ; cmd_bverify, - - ; cmd_clear, - ; varstr_garbage_collect, ; cmd_dispose - -!set ITEM_00 = cmd_cold -!set ITEM_01 = cmd_mem - -!ifdef CONFIG_MB_M65 { -!set ITEM_02 = cmd_sysinfo -} - -!ifndef HAS_OPCODES_65C02 { - -command_02_jumptable_lo: - - !byte <(ITEM_00-1), <(ITEM_01-1) - !ifdef CONFIG_MB_M65 { !byte <(ITEM_02-1) } - -command_02_jumptable_hi: - - !byte >(ITEM_00-1), >(ITEM_01-1) - !ifdef CONFIG_MB_M65 { !byte >(ITEM_02-1) } - -} else { ; HAS_OPCODES_65C02 - -command_02_jumptable: - - ; Note: 65C02 has the page boundary vector bug fixed! - - !word ITEM_00, ITEM_01 - !ifdef CONFIG_MB_M65 { !word ITEM_02 } -} } diff --git a/src/basic/basic_commands_03_m65/cmd__jumptable_03.s b/src/basic/basic_commands_03_m65/cmd__jumptable_03.s deleted file mode 100644 index cd3b7b54..00000000 --- a/src/basic/basic_commands_03_m65/cmd__jumptable_03.s +++ /dev/null @@ -1,15 +0,0 @@ -;; #LAYOUT# M65 BASIC_0 #TAKE -;; #LAYOUT# * * #IGNORE - -; -; Jumptable for BASIC commands with tokens prefixed by $03 -; - -!set ITEM_00 = cmd_rem ; XXX just for testing - - -command_03_jumptable: - - ; Note: 65C02 has the page boundary vector bug fixed! - - !word ITEM_00 diff --git a/src/basic/basic_commands_04/cmd__jumptable_04.s b/src/basic/basic_commands_04/cmd__jumptable_04.s new file mode 100644 index 00000000..4b623071 --- /dev/null +++ b/src/basic/basic_commands_04/cmd__jumptable_04.s @@ -0,0 +1,29 @@ +;; #LAYOUT# M65 * #TAKE +;; #LAYOUT# * * #IGNORE + +; +; Jumptable for BASIC commands with tokens prefixed by $04 +; + +!set ITEM_01 = cmd_sysinfo + + + +!ifndef HAS_OPCODES_65C02 { + +command_04_jumptable_lo: + + !byte <(ITEM_01-1) + +command_04_jumptable_hi: + + !byte >(ITEM_01-1) + +} else { ; HAS_OPCODES_65C02 + +command_04_jumptable: + + ; Note: 65C02 has the page boundary vector bug fixed! + + !word ITEM_01 +} diff --git a/src/basic/basic_commands_02/cmd_sysinfo.s b/src/basic/basic_commands_04/cmd_sysinfo.s similarity index 100% rename from src/basic/basic_commands_02/cmd_sysinfo.s rename to src/basic/basic_commands_04/cmd_sysinfo.s diff --git a/src/basic/basic_functions_06/fun__jumptable_06.s b/src/basic/basic_functions_06/fun__jumptable_06.s new file mode 100644 index 00000000..63213301 --- /dev/null +++ b/src/basic/basic_functions_06/fun__jumptable_06.s @@ -0,0 +1,28 @@ +;; #LAYOUT# M65 BASIC_0 #TAKE +;; #LAYOUT# * * #IGNORE + +; +; Jumptable for BASIC commands with tokens prefixed by $03 +; + +!set ITEM_01 = do_NOT_IMPLEMENTED_error ; just for testing + + +!ifndef HAS_OPCODES_65C02 { + +function_06_jumptable_lo: + + !byte <(ITEM_01-1) + +function_06_jumptable_hi: + + !byte >(ITEM_01-1) + +} else { ; HAS_OPCODES_65C02 + +function_06_jumptable: + + ; Note: 65C02 has the page boundary vector bug fixed! + + !word ITEM_01 +} diff --git a/src/basic/engine_editor/tokenise_line.s b/src/basic/engine_editor/tokenise_line.s index 2144abd8..500c4714 100644 --- a/src/basic/engine_editor/tokenise_line.s +++ b/src/basic/engine_editor/tokenise_line.s @@ -92,26 +92,23 @@ tokenise_line_loop: jsr tk_search bcc tokenise_line_keyword_01 ; branch if keyword identified -!ifndef HAS_SMALL_BASIC { - - lda #packed_freq_keywords_02 - sta FRESPC+1 - - jsr tk_search - bcc tokenise_line_keyword_02 ; branch if keyword identified -} - !ifdef CONFIG_MB_M65 { - lda #packed_freq_keywords_03 + lda #>packed_freq_keywords_04 sta FRESPC+1 jsr tk_search - bcc tokenise_line_keyword_03 ; branch if keyword identified + bcc tokenise_line_keyword_04 ; branch if keyword identified + + lda #packed_freq_keywords_06 + sta FRESPC+1 + + jsr tk_search + bcc tokenise_line_keyword_06 ; branch if keyword identified } ; Shorten packed keyword candidate and try again @@ -189,23 +186,18 @@ tokenise_line_char: !ifdef CONFIG_MB_M65 { -tokenise_line_keyword_03: +tokenise_line_keyword_04: ; Store the token list index - lda #$03 + lda #$04 +skip_2_bytes_trash_nvz - ; FALLTROUGH -} - -!ifndef HAS_SMALL_BASIC { - -tokenise_line_keyword_02: +tokenise_line_keyword_06: ; Store the token list index - lda #$02 + lda #$06 +skip_2_bytes_trash_nvz ; FALLTROUGH diff --git a/src/basic/engine_runtime/execute_line_statements.s b/src/basic/engine_runtime/execute_line_statements.s index 1c500524..ea128073 100644 --- a/src/basic/engine_runtime/execute_line_statements.s +++ b/src/basic/engine_runtime/execute_line_statements.s @@ -39,23 +39,19 @@ execute_statements: ; Check if token is valid for execution -!ifdef HAS_SMALL_BASIC { +!ifndef CONFIG_MB_M65 { cpx #$01 beq execute_statements_01 } else { -!ifdef CONFIG_MB_M65 { - cpx #$04 -} else { - cpx #$03 -} + cpx #$05 bcc execute_statements_extended } cpx #$CB - +beq cmd_go ; 'GO' command has a strange token, placed after function tokens + +beq cmd_go ; 'GO' command has a strange token, placed after function tokens cpx #$7F +bcc execute_statements_var_assign ; not a token - try variable assign @@ -84,25 +80,17 @@ execute_statements: jmp (command_jumptable, x) } -!ifndef HAS_SMALL_BASIC { +!ifdef CONFIG_MB_M65 { execute_statements_extended: ; Support for extended BASIC commands - ; XXX consider jumpable here - cpx #$01 beq execute_statements_01 - cpx #$02 - beq execute_statements_02 - -!ifdef CONGIH_MB_M65 { - - cpx #$03 - beq execute_statements_03 -} + cpx #$04 + beq execute_statements_04 jmp do_SYNTAX_error } @@ -141,9 +129,9 @@ execute_statements_01: jmp (command_01_jumptable - 2, x) } -!ifndef HAS_SMALL_BASIC { +!ifdef CONFIG_MB_M65 { -execute_statements_02: +execute_statements_04: ; Get the sub-token, check that it is valid @@ -151,7 +139,7 @@ execute_statements_02: cmp #$00 +beq do_SYNTAX_error - cmp #(TK__MAXTOKEN_keywords_02+1) + cmp #(TK__MAXTOKEN_keywords_04+1) +bcs do_SYNTAX_error ; Execute command @@ -161,9 +149,9 @@ execute_statements_02: ; Get the jump table entry for it, push it on the stack, and then RTS to start it. tax - lda command_02_jumptable_hi - 1, x + lda command_04_jumptable_hi - 1, x pha - lda command_02_jumptable_lo - 1, x + lda command_04_jumptable_lo - 1, x pha rts @@ -174,31 +162,10 @@ execute_statements_02: asl tax - jmp (command_02_jumptable - 2, x) + jmp (command_04_jumptable - 2, x) } -} ; !HAS_SMALL_BASIC - -!ifdef CONFIG_MB_M65 { - -execute_statements_03: - - ; Get the sub-token, check that it is valid - - jsr fetch_character - cmp #$00 - +beq do_SYNTAX_error - - cmp #(TK__MAXTOKEN_keywords_03+1) - +bcs do_SYNTAX_error - - ; Use jumptable to go to the command routine - - asl - tax - jmp (command_03_jumptable - 2, x) - -} ; CONFIG_MB_M65 +} execute_statements_end_of_line: diff --git a/src/basic/print/list_single_line.s b/src/basic/print/list_single_line.s index 485f2a16..bd2cbd31 100644 --- a/src/basic/print/list_single_line.s +++ b/src/basic/print/list_single_line.s @@ -104,13 +104,11 @@ list_not_quote: ; Check for extended BASIC tokens cmp #$01 beq list_display_token_01 -!ifndef HAS_SMALL_BASIC { - cmp #$02 - beq list_display_token_02 -} !ifdef CONFIG_MB_M65 { - cmp #$03 - beq list_display_token_03 + cmp #$04 + beq list_display_token_04 + cmp #$06 + beq list_display_token_06 } ; Check for literals @@ -232,37 +230,34 @@ list_display_token_ext_done: ; Next iteration +bra list_not_rem -!ifndef HAS_SMALL_BASIC { - -list_display_token_02: - - ; Display a 2-byte token - for extended BASIC - jsr list_fetch_subtoken - - ; Check if token is known - cpx #TK__MAXTOKEN_keywords_02 - bcs list_is_unknown - - ; Now ask for it to be printed - +phy_trash_a - jsr print_packed_keyword_02 - +bra list_display_token_ext_done -} - !ifdef CONFIG_MB_M65 { -list_display_token_03: +list_display_token_04: ; Display a 2-byte token - for extended BASIC jsr list_fetch_subtoken ; Check if token is known - cpx #TK__MAXTOKEN_keywords_03 + cpx #TK__MAXTOKEN_keywords_04 bcs list_is_unknown ; Now ask for it to be printed +phy_trash_a - jsr print_packed_keyword_03 + jsr print_packed_keyword_04 + +bra list_display_token_ext_done + +list_display_token_06: + + ; Display a 2-byte token - for extended BASIC + jsr list_fetch_subtoken + + ; Check if token is known + cpx #TK__MAXTOKEN_keywords_06 + bcs list_is_unknown + + ; Now ask for it to be printed + +phy_trash_a + jsr print_packed_keyword_06 +bra list_display_token_ext_done } diff --git a/src/basic/print/print_packed_freq_string.s b/src/basic/print/print_packed_freq_string.s index 882bf26d..cc46cdc1 100644 --- a/src/basic/print/print_packed_freq_string.s +++ b/src/basic/print/print_packed_freq_string.s @@ -59,21 +59,18 @@ print_packed_keyword_01: ; .X - token number ldy #>packed_freq_keywords_01 bne print_freq_packed_string ; branch always -!ifndef HAS_SMALL_BASIC { - -print_packed_keyword_02: ; .X - token number - - lda #packed_freq_keywords_02 - bne print_freq_packed_string ; branch always -} - !ifdef CONFIG_MB_M65 { -print_packed_keyword_03: ; .X - token number +print_packed_keyword_04: ; .X - token number - lda #packed_freq_keywords_03 + lda #packed_freq_keywords_04 + bne print_freq_packed_string ; branch always + +print_packed_keyword_06: ; .X - token number + + lda #packed_freq_keywords_06 bne print_freq_packed_string ; branch always } diff --git a/src/basic/wedge/wedge_tape.s b/src/basic/wedge/wedge_tape.s index 54926c89..0b83dc15 100644 --- a/src/basic/wedge/wedge_tape.s +++ b/src/basic/wedge/wedge_tape.s @@ -19,8 +19,12 @@ wedge_tape: cmp #$4C ; 'L' beq wedge_arrow_L + +!ifndef HAS_SMALL_BASIC { + cmp #$4D ; 'M' beq wedge_arrow_M +} !ifdef CONFIG_TAPE_HEAD_ALIGN { @@ -68,6 +72,9 @@ wedge_arrow_L: jmp cmd_load_got_params + +!ifndef HAS_SMALL_BASIC { + wedge_arrow_M: jsr wedge_tape_prepare_load @@ -77,5 +84,6 @@ wedge_arrow_M: ; Perform merging jmp cmd_merge_got_params +} } ; CONFIG_TAPE_WEDGE diff --git a/tools/generate_strings.cc b/tools/generate_strings.cc index 074393b4..17440485 100644 --- a/tools/generate_strings.cc +++ b/tools/generate_strings.cc @@ -174,7 +174,7 @@ const StringEntryList GLOBAL_Keywords_V2 = { ListType::KEYWORDS, "keywords_V2", { true, true, true, true, true, "KV2_CB", "GO", 0 }, // https://en.wikipedia.org/wiki/Goto } }; -// extended BASIC keywords - list reserved for small BASIC commands, suitable for inclusion in non-extended ROMs +// extended BASIC keywords - list reserved for small BASIC commands, suitable for inclusion in all machines with extended ROM const StringEntryList GLOBAL_Keywords_01 = { ListType::KEYWORDS, "keywords_01", { @@ -182,37 +182,33 @@ const StringEntryList GLOBAL_Keywords_01 = { ListType::KEYWORDS, "keywords_01", { true, true, true, true, true, "K01_01", "SLOW", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant { true, true, true, true, true, "K01_02", "FAST", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant { true, true, true, true, true, "K01_03", "OLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*) - - // (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c - - // NOTE! These commands are temporarily placed here, they should be a part of list 02! - - { true, true, true, true, true, "K02_01", "MERGE", }, // Not present in CBM BASIC dialects, but common to some extensions (*) - { true, true, true, true, true, "K02_02", "BLOAD", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html - { true, true, true, true, true, "K02_03", "BSAVE", }, // http://www.antonis.de/qbebooks/gwbasman/bsave.html - { true, true, true, true, true, "K02_04", "BVERIFY", }, - { true, true, true, true, true, "K02_05", "CLEAR", }, // Not present in CBM BASIC dialects, Open ROMs specific - { true, true, true, true, true, "K02_06", "DISPOSE", }, // Not present in CBM BASIC dialects, Open ROMs specific -} }; - -// extended BASIC keywords - list reserved for generic (mostly hardware independent) BASIC commands - -const StringEntryList GLOBAL_Keywords_02 = { ListType::KEYWORDS, "keywords_02", -{ - // STD CRT M65 U64 X16 - { false, true, true, false, false, "K02_07", "COLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*) - { false, true, true, false, false, "K02_08", "MEM", }, // Not present in CBM BASIC dialects, Open ROMs specific - { false, false, true, false, false, "K02_09", "SYSINFO", }, // Not present in CBM BASIC dialects, Open ROMs specific + { false, true, true, true, false, "K01_04", "CLEAR", }, // Not present in CBM BASIC dialects, Open ROMs specific + { false, true, true, true, false, "K01_05", "DISPOSE", }, // Not present in CBM BASIC dialects, Open ROMs specific + { false, true, true, true, false, "K01_06", "MERGE", }, // Not present in CBM BASIC dialects, but common to some extensions (*) + { false, true, true, true, false, "K01_07", "BLOAD", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html + { false, true, true, true, false, "K01_08", "BSAVE", }, // http://www.antonis.de/qbebooks/gwbasman/bsave.html + { false, true, true, true, false, "K01_09", "BVERIFY", }, + { false, true, true, true, false, "K01_0A", "COLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*) + { false, true, true, true, false, "K01_0B", "MEM", }, // Not present in CBM BASIC dialects, Open ROMs specific // (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c } }; // extended BASIC keywords - list reserved for hardware dependent BASIC commands -const StringEntryList GLOBAL_Keywords_03_M65 = { ListType::KEYWORDS, "keywords_03", +const StringEntryList GLOBAL_Keywords_04 = { ListType::KEYWORDS, "keywords_04", { // STD CRT M65 U64 X16 - { false, false, true, false, false, "K03_01", "TEST", }, // Not present in CBM BASIC dialects, Open ROMs specific + { false, false, true, false, false, "K04_01", "SYSINFO", }, // Not present in CBM BASIC dialects, Open ROMs specific + +} }; + +// extended BASIC keywords - list reserved for functions + +const StringEntryList GLOBAL_Keywords_06 = { ListType::KEYWORDS, "keywords_06", +{ + // STD CRT M65 U64 X16 + { false, false, true, false, false, "K06_01", "TEST", }, // Not present in CBM BASIC dialects, Open ROMs specific } }; @@ -1846,8 +1842,8 @@ void writeStrings() dataSetM65.addStrings(GLOBAL_Keywords_V2); dataSetM65.addStrings(GLOBAL_Keywords_01); - dataSetM65.addStrings(GLOBAL_Keywords_02); - dataSetM65.addStrings(GLOBAL_Keywords_03_M65); + dataSetM65.addStrings(GLOBAL_Keywords_04); + dataSetM65.addStrings(GLOBAL_Keywords_06); dataSetM65.addStrings(GLOBAL_Errors); dataSetM65.addStrings(GLOBAL_MiscStrings); @@ -1863,7 +1859,6 @@ void writeStrings() dataSetCRT.addStrings(GLOBAL_Keywords_V2); dataSetCRT.addStrings(GLOBAL_Keywords_01); - dataSetCRT.addStrings(GLOBAL_Keywords_02); dataSetCRT.addStrings(GLOBAL_Errors); dataSetCRT.addStrings(GLOBAL_MiscStrings);