From 930a04473c4ed692f9c62bbbe9fe3a2e7e193de1 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Sun, 8 Apr 2012 18:24:39 +0200 Subject: [PATCH] JSR implemented --- dcpu_16.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dcpu_16.py b/dcpu_16.py index 6c2f90d..78de45b 100644 --- a/dcpu_16.py +++ b/dcpu_16.py @@ -46,8 +46,9 @@ class valcode(object): @opcode(0x0, 0x01) def JSR(c, a): """pushes the address of the next instruction to the stack, then sets PC to a""" - #pushnext - c.pc = c[a] + c.sp = (c.sp - 1) & wmask + c.m[c.sp] = c.pc + c.pc = a() @opcode(0x1) def SET(c, a, b):