summaryrefslogtreecommitdiff
path: root/src/emma.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emma.c')
-rw-r--r--src/emma.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/emma.c b/src/emma.c
index 6bbf117..6709ec8 100644
--- a/src/emma.c
+++ b/src/emma.c
@@ -36,10 +36,11 @@ static Z80Byte mem[0x10000];
/* ---------------------------------------- PROTOS
*/
-static Z80Byte ReadMem(Z80 *z80, Z80Word addr);
-static void WriteMem(Z80 *z80, Z80Word addr, Z80Byte val);
-static Z80Byte ReadPort(Z80 *z80, Z80Word addr);
-static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val);
+static Z80Byte ReadMem(Z80 *z80, Z80Word addr);
+static void WriteMem(Z80 *z80, Z80Word addr, Z80Byte val);
+static Z80Byte ReadPort(Z80 *z80, Z80Word addr);
+static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val);
+static const char *Label(Z80 *z80, Z80Word addr);
/* ---------------------------------------- MAIN
@@ -47,8 +48,10 @@ static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val);
int main(int argc, char *argv[])
{
Z80 *z80;
+ FILE *fp;
+ Z80Word pc=0;
- z80=Z80Init(WriteMem,ReadMem,WritePort,ReadPort);
+ z80=Z80Init(WriteMem,ReadMem,WritePort,ReadPort,ReadMem,Label);
if (!z80)
{
@@ -56,6 +59,23 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+ if ((fp=fopen("/files/emu/ROM/zx81.rom","rb")))
+ {
+ fread(mem,1,0x10000,fp);
+ fclose(fp);
+ }
+
+ while(1)
+ {
+ Z80Word opc=pc;
+
+ printf("%4.4x: ",pc);
+ printf("%s\n",Z80Disassemble(z80,&pc));
+
+ if (pc<opc)
+ break;
+ }
+
return EXIT_SUCCESS;
}
@@ -87,4 +107,13 @@ static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val)
}
+static const char *Label(Z80 *z80, Z80Word addr)
+{
+ if (addr==0x0a2a)
+ return "CLS";
+
+ return NULL;
+}
+
+
/* END OF FILE */