added test command to display memory information

This commit is contained in:
FeralChild64 committed 2020-07-12 06:13:04 +02:00
1 parent 6e90102f76
commit 02f532e2ec
10 files changed
+227 -34

No files matched your search

+36 -25
View File
@@ -39,31 +39,7 @@ Like above, but merges a BASIC program to the one already stored in memory.
Launches a built-in tape head alignment tool. Destroys program in memory. Press `RUN/STOP` to terminate the tool.
## Additional BASIC commands
### `COLD`
Resets the machine. In direct mode asks for confirmation first.
### `FAST`
Tries to switch the machine to turbo mode - details differ depending on the configured machine / motherboard.
### `SLOW`
Tries to switch the machine back to 1 MHz operation mode.
### `OLD`
Tries to restore program destroyed by `NEW` or a reset.
### `CLEAR`
Clears the screen content.
### `DISPOSE`
Runs the garbage collector - disposes outdated strings.
## Additional BASIC commands - I/O
### `MERGE "file_name" [, device_number]`
@@ -81,6 +57,41 @@ Verify operation for the binary data starting from a given addres. NOTE: for now
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.
## Additional BASIC commands - misc
### `COLD`
Resets the machine. In direct mode asks for confirmation first.
### `FAST`
Tries to switch the machine to turbo mode - details differ depending on the configured machine / motherboard.
### `SLOW`
Tries to switch the machine back to 1 MHz operation mode.
### `OLD`
Tries to restore program destroyed by the `NEW` command or a reset.
### `MEM`
Displays BASIC memory usage information:
* `TXT` - size of BASIC program text, always at least 2 bytes are used
* `VAR` - bytes occupied by float and integer variables, string variable descriptors, and function descriptors
* `ARR` - bytes occupied by arrays (note: for string arrays only descriptors are stored here)
* `STR` - bytes occupied by strings, also the ones belonging to arrays
* `SPC` - unused space
### `CLEAR`
Clears the screen content.
### `DISPOSE`
Runs the garbage collector - disposes outdated strings.
# Planned BASIC features, when V2 compatibility is reached
Ideas for the future, most of them suitable for Mega65 or other power machines only
@@ -19,7 +19,8 @@
cmd_cold,
cmd_clear,
varstr_garbage_collect // cmd_dispose
varstr_garbage_collect, // cmd_dispose
cmd_mem
)
+98
View File
@@ -0,0 +1,98 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if (!ROM_LAYOUT_M65 || SEGMENT_BASIC_0)
cmd_mem:
// First perform the garbage collection - to be able to determine real values
jsr varstr_garbage_collect
#endif // ROM layout
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
jsr map_BASIC_1
jsr_ind VB1__cmd_mem_cont
jmp map_NORMAL
#else
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_1)
cmd_mem_cont:
#endif
// Print all the information, in a loop, in reverse order
ldy #$04
!:
// First print the information string
ldx helper_mem_tab_str, y
phy_trash_a
jsr print_packed_misc_str
// Fetch addresses of zeropage variables
#if HAS_OPCODES_65C02
ply
phy
#else
pla
pha
tay
#endif
ldx helper_mem_tab_x, y
lda helper_mem_tab_y, y
tay
// Print difference between two zeropage variables
sec
lda $00, x
sbc $0000, y
pha
inx
iny
lda $00, x
sbc $0000, y
#if HAS_OPCODES_65C02
plx
#else
tay
pla
tax
tya
#endif
// Before printing, make sure the result is not negative
bcc cmd_mem_error
jsr print_integer
// Check if more iterations needed
ply_trash_a
dey
bpl !-
// Finish
jmp print_return
cmd_mem_error:
jsr print_return
jmp do_MEMORY_CORRUPT_error
#endif // ROM layout
@@ -0,0 +1,17 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Helper table for 'MEM' command - list of strings to print
//
helper_mem_tab_str:
.byte IDX__STR_MEM_FREE
.byte IDX__STR_MEM_STRS
.byte IDX__STR_MEM_ARRS
.byte IDX__STR_MEM_VARS
.byte IDX__STR_MEM_TEXT
@@ -0,0 +1,17 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Helper table for 'MEM' command - list of minuend zeropage variables
//
helper_mem_tab_x:
.byte FRETOP
.byte MEMSIZ
.byte STREND
.byte ARYTAB
.byte VARTAB
@@ -0,0 +1,17 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Helper table for 'MEM' command - list of subtrahend zeropage variables
//
helper_mem_tab_y:
.byte STREND
.byte FRETOP
.byte ARYTAB
.byte VARTAB
.byte TXTTAB
@@ -20,6 +20,7 @@
.label VB1__do_new = $4000 + 2 * 6
.label VB1__do_clr = $4000 + 2 * 7
.label VB1__do_restore = $4000 + 2 * 8
.label VB1__cmd_mem_cont = $4000 + 2 * 9
#else
@@ -34,5 +35,6 @@
.word do_new
.word do_clr
.word do_restore
.word cmd_mem_cont
#endif
+2 -1
View File
@@ -22,5 +22,6 @@
#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
.label do_error_fetch = BASIC_0.do_error_fetch
.label do_basic_error = BASIC_0.do_basic_error
.label str_rev_question = BASIC_0.str_rev_question
+22
View File
@@ -1,4 +1,5 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
@@ -43,7 +44,11 @@ do_kernal_error: // .A = KERNAL error code, also almost ma
beq do_BREAK_error // XXX is 0 really a proper error code?
dex
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_1)
jmp do_basic_error
#else
bpl do_basic_error // branch always
#endif
// Error messages specific to OpenROMs BASIC dialect
@@ -138,6 +143,16 @@ do_FILE_OPEN_error:
do_TO_MANY_FILES_error:
.byte $EA
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_1)
jmp do_error_fetch
#else
// FALLTROUGH
do_error_fetch:
// Now get the error id and restore $E6 to its correct value
lda $E6
@@ -162,6 +177,11 @@ do_TO_MANY_FILES_error:
do_basic_error: // error code in .X
#if ROM_LAYOUT_M65
// Make sure we are back with normal memory map
jsr map_NORMAL
#endif
// "?"
phx_trash_a
@@ -197,3 +217,5 @@ do_basic_error: // error code in .X
txs
jmp shell_main_loop
#endif // ROM layout
+14 -7
View File
@@ -186,6 +186,7 @@ const StringEntryList GLOBAL_Keywords_CC = { ListType::KEYWORDS, "keywords_CC",
{ true, true, true, true, "KCC_06", "COLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
{ true, true, true, true, "KCC_07", "CLEAR", }, // Not present in CBM BASIC dialects, OpenROMs specific
{ true, true, true, true, "KCC_08", "DISPOSE", }, // Not present in CBM BASIC dialects, OpenROMs specific
{ true, true, true, true, "KCC_09", "MEM", }, // Not present in CBM BASIC dialects, OpenROMs specific
// (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c
} };
@@ -310,14 +311,20 @@ 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 " },
{ true, true, true, true, "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 " },
{ true, true, true, true, "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 OpenROMs, not present in CBM ROMs
{ true, true, true, true, "STR_BRK_AT", "\rBRK AT $" },
{ true, true, true, true, "STR_BRK_AT", "\rBRK AT $" },
{ true, true, true, true, "STR_MEM_TEXT", "\rTXT: " },
{ true, true, true, true, "STR_MEM_VARS", "\rVAR: " },
{ true, true, true, true, "STR_MEM_ARRS", "\rARR: " },
{ true, true, true, true, "STR_MEM_STRS", "\rSTR: " },
{ true, true, true, true, "STR_MEM_FREE", "\r\rSPC: " },
// Note: depending on configuration, additional strings will be added here
} };