From: rs <> Date: Tue, 14 Oct 2025 00:53:20 +0000 (-0500) Subject: Add push, pop, and pc set commands to emulator X-Git-Url: https://git.the-white-hart.net/?a=commitdiff_plain;h=a92c995907b3fa93eee241234cb583b944146e10;p=vhdl Add push, pop, and pc set commands to emulator --- diff --git a/projects/cpu_0/asm/emu.py b/projects/cpu_0/asm/emu.py index 473d393..4c2e9af 100755 --- a/projects/cpu_0/asm/emu.py +++ b/projects/cpu_0/asm/emu.py @@ -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