changeset 10:484a6777511b

forgot to hg addremove
author james <jb302@eecs.qmul.ac.uk>
date Sun, 08 Dec 2013 18:43:28 +0000
parents ad2121f39b91
children bba1e3a7877b
files doc/elb816_opcodes.ods emulator/a.out emulator/emu.h emulator/mem.dump emulator/mem.h
diffstat 5 files changed, 78 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
Binary file doc/elb816_opcodes.ods has changed
Binary file emulator/a.out has changed
--- a/emulator/emu.h	Sun Dec 08 18:27:37 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-// emu.h
-#ifndef EMU_H
-#define EMU_H
-
-typedef unsigned char BYTE;
-typedef unsigned short WIDE;
-
-struct
-registers {
-    // 8 bit registers
-    BYTE A;
-    BYTE R0;
-    BYTE R1;
-    BYTE R2;
-    BYTE R3;
-    BYTE flags;
-    
-    // 16 bit registers
-    WIDE DPTR;
-    WIDE SP;
-    WIDE PC;
-};
-
-// 64kB byte-addressable main memory
-BYTE
-memory[0x10000];
-
-// memory access function definitions
-BYTE
-read_mem(WIDE addr);
-
-void
-write_mem(BYTE data, WIDE addr);
-
-// get byte at PC
-BYTE
-fetch(void);
-
-// set PC
-void
-set(WIDE data);
-
-#endif
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emulator/mem.dump	Sun Dec 08 18:43:28 2013 +0000
@@ -0,0 +1,1 @@
+
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emulator/mem.h	Sun Dec 08 18:43:28 2013 +0000
@@ -0,0 +1,77 @@
+// mem.h
+#ifndef EMU_H
+#define EMU_H
+
+/*
+ * data types 
+ *  - 8 bit BYTE
+ *  - 16 bit WIDE
+ */
+
+typedef unsigned char BYTE;
+typedef unsigned short WIDE;
+
+/*
+ * emulator memory
+ *  - registers
+ *  - 64kB 16-bit main memory
+ */
+
+struct
+registers {
+    // 8 bit registers
+    BYTE A;
+    BYTE R0;
+    BYTE R1;
+    BYTE R2;
+    BYTE R3;
+    BYTE flags;
+    
+    // 16 bit registers
+    WIDE DPTR;
+    WIDE SP;
+    WIDE PC;
+};
+
+BYTE
+memory[0x10000];
+
+/*
+ * memory access function definitions
+ *  - read_mem(WIDE) returns BYTE
+ *  - write_mem(WIDE, BYTE) 
+ *  - fetch() returns BYTE
+ *  - set_pc(WIDE)
+ *  - get_reg(BYTE) returns BYTE
+ *  - set_reg(BYTE, BYTE)
+ *  - get_reg_wide(BYTE) returns WIDE
+ *  - set_reg_wide(BYTE, WIDE)
+ */
+
+BYTE
+read_mem(WIDE addr);
+
+void
+write_mem(WIDE addr, BYTE data);
+
+BYTE
+fetch(void);
+
+void
+set_pc(WIDE data);
+
+BYTE
+get_reg(BYTE reg);
+
+void
+set_reg(BYTE reg, BYTE data);
+
+WIDE
+get_reg_wide(BYTE reg);
+
+void
+set_reg_wide(BYTE reg, WIDE data);
+
+#endif
+
+