preparation for a couple of new BASIC commands

This commit is contained in:
FeralChild64 committed 2020-06-21 19:58:11 +02:00
1 parent 97131d8d55
commit e74fd4140a
13 files changed
+195 -24

No files matched your search

+2
View File
@@ -14,6 +14,8 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
c64/basic/,stubs_math \
c64/basic/assets \
c64/basic/basic_commands \
c64/basic/basic_commands_CC \
c64/basic/basic_commands_CD \
c64/basic/basic_operators \
c64/basic/basic_functions \
c64/basic/board_m65 \
+1 -1
View File
@@ -3,7 +3,7 @@
// #LAYOUT# * * #IGNORE
//
// Jumptable for all known BASIC commands
// Jumptable for BASIC V2 dialect commands
//
@@ -0,0 +1,49 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Jumptable for BASIC commands with tokens prefixed by $CC
//
.const command_CC_list = List().add(
cmd_merge,
cmd_bload,
cmd_bsave,
cmd_bverify
)
#if !HAS_OPCODES_65C02
command_CC_jumptable_lo:
put_jumptable_lo(command_CC_list)
command_CC_jumptable_hi:
put_jumptable_hi(command_CC_list)
#else // HAS_OPCODES_65C02
__before_command_CC_jumptable:
.if (mod(*, $2) == 1) { brk } // align code so that vector never crosses page boundary
command_CC_jumptable:
put_jumptable(command_CC_list)
// Make sure routine size is always the same - build system limitation
.if (__before_command_CC_jumptable == command_CC_jumptable) { brk }
#endif
+8
View File
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_bload:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
+8
View File
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_bsave:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_bverify:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
+8
View File
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_merge:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
@@ -0,0 +1,46 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Jumptable for BASIC commands with tokens prefixed by $CD
//
.const command_CD_list = List().add(
cmd_slow,
cmd_fast
)
#if !HAS_OPCODES_65C02
command_CD_jumptable_lo:
put_jumptable_lo(command_CD_list)
command_CD_jumptable_hi:
put_jumptable_hi(command_CD_list)
#else // HAS_OPCODES_65C02
__before_command_CD_jumptable:
.if (mod(*, $2) == 1) { brk } // align code so that vector never crosses page boundary
command_CD_jumptable:
put_jumptable(command_CD_list)
// Make sure routine size is always the same - build system limitation
.if (__before_command_CD_jumptable == command_CD_jumptable) { brk }
#endif
+8
View File
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_fast:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
+8
View File
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_slow:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
+1 -1
View File
@@ -3,7 +3,7 @@
// #LAYOUT# * * #IGNORE
//
// Jumptable for all known BASIC functions
// Jumptable for BASIC V2 dialect functions
//
+33 -14
View File
@@ -33,18 +33,7 @@
// message that the $2C method would result in.
// XXX consider reworking the two errors below to reuse '$E6' mechanism
do_NOT_IMPLEMENTED_error:
ldx #IDX__EV7_28
bpl do_basic_error // branch always
do_MEMORY_CORRUPT_error:
ldx #IDX__EOR_2A
bpl do_basic_error // branch always
// Error messages reported by KERNAL
do_kernal_error: // .A = KERNAL error code, also almost matches BASIC error codes
@@ -52,9 +41,39 @@ do_kernal_error: // .A = KERNAL error code, also almost ma
tax
dex
bpl do_basic_error
bpl do_basic_error // branch always
// FALLTROUGN
// Error messages specific to OpenROMs BASIC dialect
do_MEMORY_CORRUPT_error:
.byte $E6
// Error messages compatible with CBM BASIC V7 dialect
do_FILE_READ_error:
.byte $E6
do_NOT_IMPLEMENTED_error:
.byte $E6
do_UNRESOLVED_REFERENCE_error:
.byte $E6
do_LINE_NUMBER_TOO_LARGE_error:
.byte $E6
do_BEND_NOT_FOUND_error:
.byte $E6
do_BAD_DISK_error:
.byte $E6
do_NO_GRAPHICS_AREA_error:
.byte $E6
do_DIRECT_MODE_ONLY_error:
.byte $E6
do_LOOP_WITHOUT_DO_error:
.byte $E6
do_LOOP_NOT_FOUND_error:
.byte $E6
do_CANT_RESUME_error:
.byte $E6
// Error messages compatible with CBM BASIC V2 dialect
do_BREAK_error:
.byte $E6
+15 -8
View File
@@ -180,10 +180,11 @@ const StringEntryList GLOBAL_Keywords_V2 = { ListType::KEYWORDS, "keywords_V2",
const StringEntryList GLOBAL_Keywords_CC = { ListType::KEYWORDS, "keywords_CC",
{
// STD M65 X16
{ false, false, false, "KCC_01", "BLOAD", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html
{ false, false, false, "KCC_02", "BSAVE", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html
{ false, false, false, "KCC_03", "BVERIFY", },
// STD M65 X16
{ true, true, true, "KCC_01", "MERGE", }, // OpenROMs specific, not present in CBM BASIC dialects
{ true, true, true, "KCC_02", "BLOAD", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html
{ true, true, true, "KCC_03", "BSAVE", }, // http://www.antonis.de/qbebooks/gwbasman/bsave.html
{ true, true, true, "KCC_04", "BVERIFY", },
} };
// extended BASIC keywords - reserved for BASIC commands likely making sense on most C64-compatible machines
@@ -191,8 +192,8 @@ const StringEntryList GLOBAL_Keywords_CC = { ListType::KEYWORDS, "keywords_CC",
const StringEntryList GLOBAL_Keywords_CD = { ListType::KEYWORDS, "keywords_CD",
{
// STD M65 X16
{ false, false, false, "KCD_01", "SLOW", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
{ false, false, false, "KCD_02", "FAST", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
{ true, true, true, "KCD_01", "SLOW", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
{ true, true, true, "KCD_02", "FAST", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
} };
// extended BASIC keywords - reserved for board-specific BASIC commands
@@ -289,13 +290,13 @@ const StringEntryList GLOBAL_Errors = { ListType::STRINGS_BASIC, "errors",
{ false, false, false, "EV7_1F", "CAN'T RESUME" }, // not used for now
{ false, false, false, "EV7_20", "LOOP NOT FOUND" }, // not used for now
{ false, false, false, "EV7_21", "LOOP WITHOUT DO" }, // not used for now
{ false, false, false, "EV7_22", "DIRECT MODE ONLY" }, // not used for now
{ true, true, true, "EV7_22", "DIRECT MODE ONLY" },
{ false, false, false, "EV7_23", "NO GRAPHICS AREA" }, // not used for now
{ false, false, false, "EV7_24", "BAD DISK" }, // not used for now
{ false, false, false, "EV7_25", "BEND NOT FOUND" }, // not used for now
{ false, false, false, "EV7_26", "LINE NUMBER TOO LARGE" }, // not used for now
{ false, false, false, "EV7_27", "UNRESOLVED REFERENCE" }, // not used for now
{ true, true, true, "EV7_28", "NOT IMPLEMENTED" }, // this message actually differs rom CBM one
{ true, true, true, "EV7_28", "NOT IMPLEMENTED" }, // this message actually differs from the CBM one
{ false, false, false, "EV7_29", "FILE READ" }, // not used for now
// STD M65 X16 --- error strings specific to OpenROMs, not present in CBM BASIC dialects
{ true, true, true, "EOR_2A", "MEMORY CORRUPT" },
@@ -926,14 +927,20 @@ void writeStrings()
// Add input data to computation objects
dataSetSTD.addStrings(GLOBAL_Keywords_V2);
dataSetSTD.addStrings(GLOBAL_Keywords_CC);
dataSetSTD.addStrings(GLOBAL_Keywords_CD);
dataSetSTD.addStrings(GLOBAL_Errors);
dataSetSTD.addStrings(GLOBAL_MiscStrings);
dataSetM65.addStrings(GLOBAL_Keywords_V2);
dataSetM65.addStrings(GLOBAL_Keywords_CC);
dataSetM65.addStrings(GLOBAL_Keywords_CD);
dataSetM65.addStrings(GLOBAL_Errors);
dataSetM65.addStrings(GLOBAL_MiscStrings);
dataSetX16.addStrings(GLOBAL_Keywords_V2);
dataSetX16.addStrings(GLOBAL_Keywords_CC);
dataSetX16.addStrings(GLOBAL_Keywords_CD);
dataSetX16.addStrings(GLOBAL_Errors);
dataSetX16.addStrings(GLOBAL_MiscStrings);