Skip to content

Commit

Permalink
Make load routine wrap into next RAM bank (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjgignac authored and mist64 committed Oct 12, 2019
1 parent 13f3438 commit 25db122
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion loadsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ LOAD()
// IO addresses
} else if(start < 0xc000) {
// banked RAM
bytes_read = fread(RAM + ((uint16_t)memory_get_ram_bank() << 13) + start, 1, 0xc000 - start, f);
while(1) {
size_t len = 0xc000 - start;
bytes_read = fread(RAM + ((uint16_t)memory_get_ram_bank() << 13) + start, 1, len, f);
if(bytes_read < len) break;

// Wrap into the next bank
start = 0xa000;
memory_set_ram_bank(1 + memory_get_ram_bank());
}
} else {
// ROM
}
Expand Down

0 comments on commit 25db122

Please sign in to comment.