Skip to content

Commit

Permalink
ALTAIRZ80: Fixes problem with MEM dump command
Browse files Browse the repository at this point in the history
The MEM dump command would not display past SET CPU xK memory
size. This prevented displaying ROMs or other RAM windows when
a lower amount of memory was specified. This PR changes MEM to
always display a minimum of a 64K regardless of main RAM size.
  • Loading branch information
deltecent authored and pkoning2 committed Feb 1, 2024
1 parent 3b4333d commit b273cac
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions AltairZ80/altairz80_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -7430,10 +7430,13 @@ static t_addr disp_addr = 0;

static t_stat cpu_cmd_memory(int32 flag, const char *cptr) {
char abuf[16];
t_addr lo, hi, last;
t_addr lo, hi, max, last;
t_value byte;

if (get_range(NULL, cptr, &lo, &hi, 16, MEMORYMASK, 0) == NULL) {
/* 64K minimum */
max = (MEMORYMASK < 0xffff) ? 0xffff : MEMORYMASK;

if (get_range(NULL, cptr, &lo, &hi, 16, max, 0) == NULL) {
lo = hi = disp_addr;
}
else {
Expand All @@ -7446,7 +7449,7 @@ static t_stat cpu_cmd_memory(int32 flag, const char *cptr) {

last = hi | 0x00000f;

while (disp_addr <= last && disp_addr <= MEMORYMASK) {
while (disp_addr <= last && disp_addr <= max) {

if (!(disp_addr & 0x0f)) {
if (MEMORYSIZE <= 0x10000) {
Expand Down Expand Up @@ -7474,7 +7477,7 @@ static t_stat cpu_cmd_memory(int32 flag, const char *cptr) {
disp_addr++;
}

if (disp_addr > MEMORYMASK) {
if (disp_addr > max) {
disp_addr = 0;
}

Expand Down

0 comments on commit b273cac

Please sign in to comment.