mirror of
https://github.com/simh/simh.git
synced 2026-02-27 17:13:44 +00:00
AltairZ80: Adds "ROM" option to "load -h"
Adds the ability to mark pages as ROM when loading Intel HEX files.
This commit is contained in:
@@ -7511,10 +7511,17 @@ t_stat sim_load(FILE *fileref, CONST char *cptr, CONST char *fnam, int flag) {
|
||||
https://deramp.com/downloads/misc_software/hex-binary utilities for the PC/
|
||||
*/
|
||||
static t_stat cpu_hex_load(FILE *fileref, CONST char *cptr, CONST char *fnam, int flag) {
|
||||
char gbuf[CBUFSIZE];
|
||||
char linebuf[1024], datastr[1024], *bufptr;
|
||||
int32 bytecnt, rectype, databyte, chksum, line = 0, cnt = 0;
|
||||
uint32 makeROM = FALSE;
|
||||
t_addr addr, org = 0;
|
||||
|
||||
get_glyph(cptr, gbuf, 0);
|
||||
if (strcmp(gbuf, "ROM") == 0) {
|
||||
makeROM = TRUE;
|
||||
}
|
||||
|
||||
while (!feof(fileref)) {
|
||||
if (fgets(linebuf, sizeof(linebuf), fileref) == NULL)
|
||||
break;
|
||||
@@ -7552,7 +7559,13 @@ static t_stat cpu_hex_load(FILE *fileref, CONST char *cptr, CONST char *fnam, in
|
||||
}
|
||||
bufptr += 2;
|
||||
|
||||
PutBYTE(addr++, databyte);
|
||||
if (makeROM) {
|
||||
mmu_table[addr >> LOG2PAGESIZE] = ROM_PAGE;
|
||||
} else {
|
||||
mmu_table[addr >> LOG2PAGESIZE] = RAM_PAGE;
|
||||
}
|
||||
|
||||
M[addr++] = databyte;
|
||||
|
||||
chksum += databyte;
|
||||
cnt++;
|
||||
@@ -7568,7 +7581,7 @@ static t_stat cpu_hex_load(FILE *fileref, CONST char *cptr, CONST char *fnam, in
|
||||
}
|
||||
}
|
||||
|
||||
return sim_messagef(SCPE_OK, "%d byte%s loaded at %x.\n", PLURAL(cnt), org);
|
||||
return sim_messagef(SCPE_OK, "%d byte%s loaded at %x%s.\n", PLURAL(cnt), org, (makeROM) ? " [ROM]" : "");
|
||||
}
|
||||
|
||||
void cpu_raise_interrupt(uint32 irq) {
|
||||
|
||||
Reference in New Issue
Block a user