improved MEM command
This commit is contained in:
1 parent
db1c658a13
commit
704bdfccbf
5 files changed
+79
-18
No files matched your search
@@ -78,11 +78,11 @@ Tries to restore program destroyed by the `NEW` command or a reset.
|
|||||||
### `MEM`
|
### `MEM`
|
||||||
|
|
||||||
Displays BASIC memory usage information:
|
Displays BASIC memory usage information:
|
||||||
* `TXT` - size of BASIC program text, always at least 2 bytes are used
|
* `TEXT` - 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
|
* `VARS` - 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)
|
* `ARRS` - bytes occupied by arrays (note: for string arrays only descriptors are stored here)
|
||||||
* `STR` - bytes occupied by strings, also the ones belonging to arrays
|
* `STRS` - bytes occupied by strings, also the ones belonging to arrays
|
||||||
* `SPC` - unused space
|
* `FREE` - unused space
|
||||||
|
|
||||||
### `CLEAR`
|
### `CLEAR`
|
||||||
|
|
||||||
|
|||||||
@@ -29,16 +29,60 @@ cmd_mem_cont:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Print header
|
||||||
|
|
||||||
|
lda #$12
|
||||||
|
jsr JCHROUT
|
||||||
|
ldx #IDX__STR_MEM_HDR
|
||||||
|
jsr print_packed_misc_str
|
||||||
|
|
||||||
// Print all the information, in a loop, in reverse order
|
// Print all the information, in a loop, in reverse order
|
||||||
|
|
||||||
ldy #$04
|
ldy #$04
|
||||||
!:
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_mem_loop:
|
||||||
|
|
||||||
// First print the information string
|
// First print the information string
|
||||||
|
|
||||||
ldx helper_mem_tab_str, y
|
ldx helper_mem_tab_str, y
|
||||||
phy_trash_a
|
phy_trash_a
|
||||||
jsr print_packed_misc_str
|
jsr print_packed_misc_str
|
||||||
|
|
||||||
|
// Print start address
|
||||||
|
|
||||||
|
ldx #IDX__STR_MEM_1
|
||||||
|
jsr print_packed_misc_str
|
||||||
|
|
||||||
|
#if HAS_OPCODES_65C02
|
||||||
|
ply
|
||||||
|
phy
|
||||||
|
#else
|
||||||
|
pla
|
||||||
|
pha
|
||||||
|
tay
|
||||||
|
#endif
|
||||||
|
ldx helper_mem_tab_y, y
|
||||||
|
lda $01, x
|
||||||
|
jsr print_hex_byte
|
||||||
|
|
||||||
|
#if HAS_OPCODES_65C02
|
||||||
|
ply
|
||||||
|
phy
|
||||||
|
#else
|
||||||
|
pla
|
||||||
|
pha
|
||||||
|
tay
|
||||||
|
#endif
|
||||||
|
ldx helper_mem_tab_y, y
|
||||||
|
lda $00, x
|
||||||
|
jsr print_hex_byte
|
||||||
|
|
||||||
|
|
||||||
|
ldx #IDX__STR_MEM_2
|
||||||
|
jsr print_packed_misc_str
|
||||||
|
|
||||||
// Fetch addresses of zeropage variables
|
// Fetch addresses of zeropage variables
|
||||||
|
|
||||||
#if HAS_OPCODES_65C02
|
#if HAS_OPCODES_65C02
|
||||||
@@ -76,23 +120,31 @@ cmd_mem_cont:
|
|||||||
|
|
||||||
// Before printing, make sure the result is not negative
|
// Before printing, make sure the result is not negative
|
||||||
|
|
||||||
bcc cmd_mem_error
|
bcs !+
|
||||||
|
lda #$3F
|
||||||
|
jsr JCHROUT
|
||||||
|
#if HAS_OPCODES_65C02
|
||||||
|
bra cmd_mem_next
|
||||||
|
#else
|
||||||
|
jmp cmd_mem_next
|
||||||
|
#endif
|
||||||
|
|
||||||
|
!:
|
||||||
jsr print_integer
|
jsr print_integer
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_mem_next:
|
||||||
|
|
||||||
// Check if more iterations needed
|
// Check if more iterations needed
|
||||||
|
|
||||||
ply_trash_a
|
ply_trash_a
|
||||||
dey
|
dey
|
||||||
bpl !-
|
bpl cmd_mem_loop
|
||||||
|
|
||||||
// Finish
|
// Finish
|
||||||
|
|
||||||
jmp print_return
|
jmp print_return
|
||||||
|
|
||||||
|
|
||||||
cmd_mem_error:
|
|
||||||
|
|
||||||
jsr print_return
|
|
||||||
jmp do_MEMORY_CORRUPT_error
|
|
||||||
|
|
||||||
#endif // ROM layout
|
#endif // ROM layout
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
.label plot_set = KERNAL_0.plot_set
|
.label plot_set = KERNAL_0.plot_set
|
||||||
.label init_oldtxt = BASIC_0.init_oldtxt
|
.label init_oldtxt = BASIC_0.init_oldtxt
|
||||||
.label rom_revision_basic_string = BASIC_0.rom_revision_basic_string
|
.label rom_revision_basic_string = BASIC_0.rom_revision_basic_string
|
||||||
|
.label print_hex_byte = BASIC_0.proxy_B1_print_hex_byte
|
||||||
.label print_integer = BASIC_0.proxy_B1_print_integer
|
.label print_integer = BASIC_0.proxy_B1_print_integer
|
||||||
.label print_return = BASIC_0.proxy_B1_print_return
|
.label print_return = BASIC_0.proxy_B1_print_return
|
||||||
.label print_space = BASIC_0.proxy_B1_print_space
|
.label print_space = BASIC_0.proxy_B1_print_space
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ proxy_B1_JCHROUT:
|
|||||||
jsr JCHROUT
|
jsr JCHROUT
|
||||||
jmp map_BASIC_1
|
jmp map_BASIC_1
|
||||||
|
|
||||||
|
proxy_B1_print_hex_byte:
|
||||||
|
|
||||||
|
jsr map_NORMAL
|
||||||
|
jsr print_hex_byte
|
||||||
|
jmp map_BASIC_1
|
||||||
|
|
||||||
proxy_B1_print_integer:
|
proxy_B1_print_integer:
|
||||||
|
|
||||||
|
|||||||
@@ -319,11 +319,14 @@ const StringEntryList GLOBAL_MiscStrings = { ListType::STRINGS_BASIC, "misc",
|
|||||||
{ 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_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
|
// 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_HDR", "\r\x12 AREA START SIZE \r" },
|
||||||
{ true, true, true, true, "STR_MEM_VARS", "\rVAR: " },
|
{ true, true, true, true, "STR_MEM_1", " $" },
|
||||||
{ true, true, true, true, "STR_MEM_ARRS", "\rARR: " },
|
{ true, true, true, true, "STR_MEM_2", " " },
|
||||||
{ true, true, true, true, "STR_MEM_STRS", "\rSTR: " },
|
{ true, true, true, true, "STR_MEM_TEXT", "\r TEXT" },
|
||||||
{ true, true, true, true, "STR_MEM_FREE", "\r\rSPC: " },
|
{ true, true, true, true, "STR_MEM_VARS", "\r VARS" },
|
||||||
|
{ true, true, true, true, "STR_MEM_ARRS", "\r ARRS" },
|
||||||
|
{ true, true, true, true, "STR_MEM_STRS", "\r STRS" },
|
||||||
|
{ true, true, true, true, "STR_MEM_FREE", "\r\r FREE" },
|
||||||
|
|
||||||
// Note: depending on configuration, additional strings will be added here
|
// Note: depending on configuration, additional strings will be added here
|
||||||
} };
|
} };
|
||||||
|
|||||||
Reference in new issue
Block a user