From 19dfa0f4a13f5a1dc504a89f7e34330a05f50e54 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 23 Aug 2020 13:51:14 +0200 Subject: [PATCH] added 'SYSINFO' BASIC command --- doc/Extended-BASIC.md | 4 + src/aliases/,aliases_hardware_m65.s | 1 + .../basic_commands_02/cmd__jumptable_02.s | 3 +- src/basic/basic_commands_02/cmd_sysinfo.s | 105 ++++++++++++++ .../board_m65/4000.mega65_vectable_basic_1.s | 6 +- src/basic/init/initmsg_real.s | 2 + tools/generate_strings.cc | 131 ++++++++++++------ 7 files changed, 210 insertions(+), 42 deletions(-) create mode 100644 src/basic/basic_commands_02/cmd_sysinfo.s diff --git a/doc/Extended-BASIC.md b/doc/Extended-BASIC.md index af4afb53..93d70e2a 100644 --- a/doc/Extended-BASIC.md +++ b/doc/Extended-BASIC.md @@ -84,6 +84,10 @@ Displays BASIC memory usage information: * `STRS` - bytes occupied by strings, also the ones belonging to arrays * `FREE` - unused space +### `SYSINFO` (Mega65) + +Displays various system information. + ### `CLEAR` (all) Clears the screen content. diff --git a/src/aliases/,aliases_hardware_m65.s b/src/aliases/,aliases_hardware_m65.s index 6202f37d..75688eaf 100644 --- a/src/aliases/,aliases_hardware_m65.s +++ b/src/aliases/,aliases_hardware_m65.s @@ -27,6 +27,7 @@ // MISC registers + .label MISC_BOARDID = $D629 // board identification byte .label MISC_EMU = $D710 // to enable badlines and slow interrupts #endif diff --git a/src/basic/basic_commands_02/cmd__jumptable_02.s b/src/basic/basic_commands_02/cmd__jumptable_02.s index f554611f..32285618 100644 --- a/src/basic/basic_commands_02/cmd__jumptable_02.s +++ b/src/basic/basic_commands_02/cmd__jumptable_02.s @@ -22,7 +22,8 @@ // varstr_garbage_collect, // cmd_dispose cmd_cold, - cmd_mem + cmd_mem, + cmd_sysinfo ) diff --git a/src/basic/basic_commands_02/cmd_sysinfo.s b/src/basic/basic_commands_02/cmd_sysinfo.s new file mode 100644 index 00000000..f8725753 --- /dev/null +++ b/src/basic/basic_commands_02/cmd_sysinfo.s @@ -0,0 +1,105 @@ +// #LAYOUT# M65 * #TAKE +// #LAYOUT# * * #IGNORE + + +#if SEGMENT_BASIC_0 + +cmd_sysinfo: + + jsr map_BASIC_1 + jsr_ind VB1__cmd_sysinfo + jmp map_NORMAL + +#else + +cmd_sysinfo: + + jsr print_return + + // Print mode and build information + + ldx #IDX__STR_SI_HEADER + jsr print_packed_misc_str + + jsr M65_ISMODE65 + bcc !+ + + ldx #IDX__STR_SI_MODE64 + skip_2_bytes_trash_nvz +!: + ldx #IDX__STR_SI_MODE65 + jsr print_packed_misc_str + + ldx #IDX__STR_SI_HDR_REL + jsr print_packed_misc_str + + lda #rom_revision_basic_string + jsr STROUT + + // Print board ID + + ldx #IDX__STR_SI_HDR_HW + jsr print_packed_misc_str + + lda MISC_BOARDID + ldy #(__cmd_sysinfo_hw_ids_end - cmd_sysinfo_hw_ids - 1) +!: + cmp cmd_sysinfo_hw_ids, y + beq !+ + dey + bpl !- + ldy #(__cmd_sysinfo_hw_ids_end - cmd_sysinfo_hw_ids) +!: + ldx cmd_sysinfo_hw_str, y + jsr print_packed_misc_str + + // Print video system information + + ldx #IDX__STR_SI_HDR_VID + jsr print_packed_misc_str + + ldx #IDX__STR_NTSC + lda TVSFLG + beq !+ + ldx #IDX__STR_PAL +!: + jsr print_packed_misc_str + + // Print build featires information + + ldx #IDX__STR_SI_FEATURES + jmp print_packed_misc_str + + + +cmd_sysinfo_hw_ids: + + .byte $01 + .byte $02 + .byte $03 + .byte $21 + .byte $40 + .byte $41 + .byte $42 + .byte $FD + .byte $FE + +__cmd_sysinfo_hw_ids_end: + +cmd_sysinfo_hw_str: + + .byte IDX__STR_SI_HW_01 + .byte IDX__STR_SI_HW_02 + .byte IDX__STR_SI_HW_03 + .byte IDX__STR_SI_HW_21 + .byte IDX__STR_SI_HW_40 + .byte IDX__STR_SI_HW_41 + .byte IDX__STR_SI_HW_42 + .byte IDX__STR_SI_HW_FD + .byte IDX__STR_SI_HW_FE + .byte IDX__STR_SI_HW_XX + + + +#endif diff --git a/src/basic/board_m65/4000.mega65_vectable_basic_1.s b/src/basic/board_m65/4000.mega65_vectable_basic_1.s index 17f96e1b..c81cea55 100644 --- a/src/basic/board_m65/4000.mega65_vectable_basic_1.s +++ b/src/basic/board_m65/4000.mega65_vectable_basic_1.s @@ -22,8 +22,9 @@ .label VB1__do_clr = $4000 + 2 * 7 .label VB1__do_restore = $4000 + 2 * 8 .label VB1__cmd_mem_cont = $4000 + 2 * 9 - .label VB1__prepare_direct_execution = $4000 + 2 * 10 - .label VB1__helper_ask_if_sure = $4000 + 2 * 11 + .label VB1__cmd_sysinfo = $4000 + 2 * 10 + .label VB1__prepare_direct_execution = $4000 + 2 * 11 + .label VB1__helper_ask_if_sure = $4000 + 2 * 12 #if CONFIG_DOS_WEDGE .label VB1__wedge_dos = $4000 + 2 * 12 @@ -43,6 +44,7 @@ .word do_clr .word do_restore .word cmd_mem_cont + .word cmd_sysinfo .word prepare_direct_execution .word helper_ask_if_sure diff --git a/src/basic/init/initmsg_real.s b/src/basic/init/initmsg_real.s index c7779163..29566f4c 100644 --- a/src/basic/init/initmsg_real.s +++ b/src/basic/init/initmsg_real.s @@ -6,6 +6,8 @@ // Routine is too long to fit in the original location +// XXX banner-related code needs cleanup, move MEGA65 stuff to a separate file + #if ROM_LAYOUT_M65 diff --git a/tools/generate_strings.cc b/tools/generate_strings.cc index a86fba98..8343aa28 100644 --- a/tools/generate_strings.cc +++ b/tools/generate_strings.cc @@ -202,6 +202,7 @@ const StringEntryList GLOBAL_Keywords_02 = { ListType::KEYWORDS, "keywords_02", { false, true, false, false, "K02_07", "COLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*) { false, true, false, false, "K02_08", "MEM", }, // Not present in CBM BASIC dialects, Open ROMs specific + { false, true, false, false, "K02_09", "SYSINFO", }, // Not present in CBM BASIC dialects, Open ROMs specific // (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c } }; @@ -283,22 +284,41 @@ const StringEntryList GLOBAL_Errors = { ListType::STRINGS_BASIC, "errors", const StringEntryList GLOBAL_MiscStrings = { ListType::STRINGS_BASIC, "misc", { // STD M65 U64 X16 --- misc strings as on CBM machines - { true, true, true, true, "STR_RET_QM", "\r?" }, - { true, true, true, true, "STR_BYTES", " BASIC BYTES FREE" }, // https://github.com/stefanhaustein/expressionparser - { true, true, true, true, "STR_READY", "\rREADY.\r" }, // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser - { true, true, true, true, "STR_ERROR", " ERROR" }, // simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html - { true, true, true, true, "STR_IN", " IN " }, - { false, true, false, false, "STR_IF_SURE", "\rARE YOU SURE? " }, // https://docs.microsoft.com/en-us/windows/win32/uxguide/mess-confirm + { true, true, true, true, "STR_RET_QM", "\r?" }, + { true, true, true, true, "STR_BYTES", " BASIC BYTES FREE" }, // https://github.com/stefanhaustein/expressionparser + { true, true, true, true, "STR_READY", "\rREADY.\r" }, // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser + { true, true, true, true, "STR_ERROR", " ERROR" }, // simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html + { true, true, true, true, "STR_IN", " IN " }, + { false, true, false, false, "STR_IF_SURE", "\rARE YOU SURE? " }, // https://docs.microsoft.com/en-us/windows/win32/uxguide/mess-confirm // STD M65 U64 X16 --- misc strings specific to Open ROMs, not present in CBM ROMs - { true, true, true, true, "STR_BRK_AT", "\rBRK AT $" }, - { false, true, false, false, "STR_MEM_HDR", "\r\x12 AREA START SIZE \r" }, - { false, true, false, false, "STR_MEM_1", " $" }, - { false, true, false, false, "STR_MEM_2", " " }, - { false, true, false, false, "STR_MEM_TEXT", "\r TEXT" }, - { false, true, false, false, "STR_MEM_VARS", "\r VARS" }, - { false, true, false, false, "STR_MEM_ARRS", "\r ARRS" }, - { false, true, false, false, "STR_MEM_STRS", "\r STRS" }, - { false, true, false, false, "STR_MEM_FREE", "\r\r FREE" }, + { true, true, true, true, "STR_BRK_AT", "\rBRK AT $" }, + + { false, true, false, false, "STR_MEM_HDR", "\r\x12 AREA START SIZE \r" }, + { false, true, false, false, "STR_MEM_1", " $" }, + { false, true, false, false, "STR_MEM_2", " " }, + { false, true, false, false, "STR_MEM_TEXT", "\r TEXT" }, + { false, true, false, false, "STR_MEM_VARS", "\r VARS" }, + { false, true, false, false, "STR_MEM_ARRS", "\r ARRS" }, + { false, true, false, false, "STR_MEM_STRS", "\r STRS" }, + { false, true, false, false, "STR_MEM_FREE", "\r\r FREE" }, + + { false, true, false, false, "STR_SI_HEADER", "OPEN ROMS, " }, + { false, true, false, false, "STR_SI_MODE64", "LEGACY MODE" }, + { false, true, false, false, "STR_SI_MODE65", "NATIVE MODE" }, + { false, true, false, false, "STR_SI_HDR_REL", "\rRELEASE " }, + { false, true, false, false, "STR_SI_HDR_HW", "\r\rBOARD : " }, + { false, true, false, false, "STR_SI_HW_01", "MEGA65 R1" }, + { false, true, false, false, "STR_SI_HW_02", "MEGA65 R2" }, + { false, true, false, false, "STR_SI_HW_03", "MEGA65 R3" }, + { false, true, false, false, "STR_SI_HW_21", "MEGAPHONE R1" }, + { false, true, false, false, "STR_SI_HW_40", "NEXYS4 PSRAM" }, + { false, true, false, false, "STR_SI_HW_41", "NEXYS4 DDR" }, + { false, true, false, false, "STR_SI_HW_42", "NEXYS4 DDR WIDGET" }, + { false, true, false, false, "STR_SI_HW_FD", "WUKONG A100T" }, + { false, true, false, false, "STR_SI_HW_FE", "SIMULATION VHDL" }, + { false, true, false, false, "STR_SI_HW_XX", "UNKNOWN" }, + { false, true, false, false, "STR_SI_HDR_VID", "\rVIDEO : " }, + // Note: depending on configuration, additional strings will be added here } }; @@ -1108,68 +1128,91 @@ void DataSet::generateConfigDepStrings() // Generate string to show the build features std::string featureStr; - + std::string featureStrM65 = "\r"; + // Tape support features if (GLOBAL_ConfigOptions["CONFIG_TAPE_NORMAL"] && GLOBAL_ConfigOptions["CONFIG_TAPE_TURBO"]) { - featureStr = "TAPE LOAD NORMAL TURBO\r"; + featureStr += "TAPE LOAD NORMAL TURBO\r"; + featureStrM65 += "TAPE : LOAD NORMAL TURBO\r"; } else if (GLOBAL_ConfigOptions["CONFIG_TAPE_NORMAL"]) { - featureStr = "TAPE LOAD NORMAL\r"; + featureStr += "TAPE LOAD NORMAL\r"; + featureStrM65 += "TAPE : LOAD NORMAL\r"; } else if (GLOBAL_ConfigOptions["CONFIG_TAPE_TURBO"]) { - featureStr = "TAPE LOAD TURBO\r"; + featureStr += "TAPE LOAD TURBO\r"; + featureStrM65 += "TAPE : LOAD TURBO\r"; } // IEC support features if (GLOBAL_ConfigOptions["CONFIG_IEC"]) { - featureStr += "IEC"; + featureStr += "IEC"; + featureStrM65 += "IEC :"; bool extendedIEC = false; if (GLOBAL_ConfigOptions["CONFIG_IEC_BURST_CIA1"]) { - featureStr += " BURST1"; - extendedIEC = true; + featureStr += " BURST1"; + extendedIEC = true; } if (GLOBAL_ConfigOptions["CONFIG_IEC_BURST_CIA2"]) { - featureStr += " BURST2"; - extendedIEC = true; + featureStr += " BURST2"; + extendedIEC = true; } if (GLOBAL_ConfigOptions["CONFIG_IEC_BURST_MEGA65"]) { - featureStr += " BURST"; - extendedIEC = true; + featureStr += " BURST"; + featureStrM65 += " BURST"; + extendedIEC = true; } if (GLOBAL_ConfigOptions["CONFIG_IEC_DOLPHINDOS"]) { - featureStr += " DOLPHIN"; - extendedIEC = true; + featureStr += " DOLPHIN"; + featureStrM65 += " DOLPHIN"; + extendedIEC = true; } if (GLOBAL_ConfigOptions["CONFIG_IEC_JIFFYDOS"]) { - featureStr += " JIFFY"; - extendedIEC = true; + featureStr += " JIFFY"; + featureStrM65 += " JIFFY"; + extendedIEC = true; } - if (!extendedIEC) featureStr += " NORMAL"; - - featureStr += "\r"; + if (!extendedIEC) + { + featureStr += " NORMAL ONLY"; + featureStrM65 += " NORMAL ONLY"; + } + + featureStr += "\r"; + featureStrM65 += "\r"; } - + else + { + featureStrM65 += "IEC : NO\r"; + } + // RS-232 support features if (GLOBAL_ConfigOptions["CONFIG_RS232_UP2400"]) featureStr += "UP2400\r"; if (GLOBAL_ConfigOptions["CONFIG_RS232_UP9600"]) featureStr += "UP9600\r"; + featureStrM65 += "RS-232 : NO\r"; + + // CBDOS features + + featureStrM65 += "CBDOS : NO\r"; + // Keyboard support features if (GLOBAL_ConfigOptions["CONFIG_KEYBOARD_C128"]) featureStr += "KBD 128\r"; @@ -1183,18 +1226,28 @@ void DataSet::generateConfigDepStrings() // List found - if (GLOBAL_ConfigOptions["CONFIG_SHOW_FEATURES"]) + if (GLOBAL_ConfigOptions["CONFIG_SHOW_FEATURES"] || GLOBAL_ConfigOptions["CONFIG_BRAND_MEGA_65"]) { StringEntry newEntry1 = { true, true, true, true, "STR_PAL", "PAL\r" }; StringEntry newEntry2 = { true, true, true, true, "STR_NTSC", "NTSC\r" }; - StringEntry newEntry3 = { true, true, true, true, "STR_FEATURES", featureStr }; stringEntryList.list.push_back(newEntry1); stringEntryList.list.push_back(newEntry2); - stringEntryList.list.push_back(newEntry3); - - break; } + + if (GLOBAL_ConfigOptions["CONFIG_SHOW_FEATURES"]) + { + StringEntry newEntry = { true, true, true, true, "STR_FEATURES", featureStr }; + stringEntryList.list.push_back(newEntry); + } + + if (GLOBAL_ConfigOptions["CONFIG_BRAND_MEGA_65"]) + { + StringEntry newEntry = { false, true, false, false, "STR_SI_FEATURES", featureStrM65 }; + stringEntryList.list.push_back(newEntry); + } + + break; } }