mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-04 19:48:08 +11:00
zasm: add memdump mode
This commit is contained in:
parent
89848dbfe2
commit
6aa53afabc
@ -31,6 +31,9 @@
|
|||||||
|
|
||||||
// Other consts
|
// Other consts
|
||||||
#define STDIN_BUFSIZE 0x8000
|
#define STDIN_BUFSIZE 0x8000
|
||||||
|
// When defined, we dump memory instead of dumping expected stdout
|
||||||
|
//#define MEMDUMP
|
||||||
|
|
||||||
static Z80Context cpu;
|
static Z80Context cpu;
|
||||||
static uint8_t mem[0x10000];
|
static uint8_t mem[0x10000];
|
||||||
// STDIN buffer, allows us to seek and tell
|
// STDIN buffer, allows us to seek and tell
|
||||||
@ -57,7 +60,10 @@ static void io_write(int unused, uint16_t addr, uint8_t val)
|
|||||||
{
|
{
|
||||||
addr &= 0xff;
|
addr &= 0xff;
|
||||||
if (addr == STDIO_PORT) {
|
if (addr == STDIO_PORT) {
|
||||||
|
// When mem-dumping, we don't output regular stuff.
|
||||||
|
#ifndef MEMDUMP
|
||||||
putchar(val);
|
putchar(val);
|
||||||
|
#endif
|
||||||
} else if (addr == STDIN_REWIND) {
|
} else if (addr == STDIN_REWIND) {
|
||||||
inpt_ptr = 0;
|
inpt_ptr = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -107,6 +113,11 @@ int main()
|
|||||||
while (!cpu.halted) {
|
while (!cpu.halted) {
|
||||||
Z80Execute(&cpu);
|
Z80Execute(&cpu);
|
||||||
}
|
}
|
||||||
|
#ifdef MEMDUMP
|
||||||
|
for (int i=0; i<0x10000; i++) {
|
||||||
|
putchar(mem[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user