]> git.the-white-hart.net Git - vhdl/commitdiff
Add push, pop, and pc set commands to emulator
authorrs <>
Tue, 14 Oct 2025 00:53:20 +0000 (19:53 -0500)
committerrs <>
Tue, 14 Oct 2025 00:53:20 +0000 (19:53 -0500)
projects/cpu_0/asm/emu.py

index 473d3931a6ad0bfcb73788f41fd873d9708f7f7d..4c2e9af96d41b31f52eaa935a01890289fbc1401 100755 (executable)
@@ -255,8 +255,11 @@ def main() -> int:
     emu.p_push(0)
     emu.pc = 0
     emu.dump()
-    emu.run_until('vga_console_putc')
+    emu.run_until('start')
     emu.dump()
+    for i in range(256):
+        addr = emu.symbol_to_addr('vga_scr')
+        emu.st8(addr + (i*2), i)
     i = ''
     while True:
         p = i
@@ -299,6 +302,36 @@ def main() -> int:
         elif c[0] == 's':
             emu.step()
             emu.dump()
+        elif c[0] == 'push':
+            a = c[1]
+            if a[0].isdigit():
+                a = int(a, 0)
+            else:
+                a = emu.symbol_to_addr(a)
+            emu.p_push(a)
+            emu.dump()
+        elif c[0] == 'rpush':
+            a = c[1]
+            if a[0].isdigit():
+                a = int(a, 0)
+            else:
+                a = emu.symbol_to_addr(a)
+            emu.r_push(a)
+            emu.dump()
+        elif c[0] == 'pop':
+            emu.p_pop()
+            emu.dump()
+        elif c[0] == 'rpop':
+            emu.r_pop()
+            emu.dump()
+        elif c[0] == 'pc':
+            a = c[1]
+            if a[0].isdigit():
+                a = int(a, 0)
+            else:
+                a = emu.symbol_to_addr(a)
+            emu.pc = a
+            emu.dump()
 
     return 0