added test command to display memory information
This commit is contained in:
1 parent
6e90102f76
commit
02f532e2ec
10 files changed
+227
-34
No files matched your search
@@ -19,7 +19,8 @@
|
||||
|
||||
cmd_cold,
|
||||
cmd_clear,
|
||||
varstr_garbage_collect // cmd_dispose
|
||||
varstr_garbage_collect, // cmd_dispose
|
||||
cmd_mem
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in new issue
Block a user