Merge pull request #8 from folkertvanheusden/SOB
made SOB into how simh does it
This commit is contained in:
commit
3afe220ac1
1 changed files with 2 additions and 9 deletions
11
op07.py
11
op07.py
|
@ -195,16 +195,9 @@ def op074_xor(cpu, inst):
|
|||
|
||||
def op077_sob(cpu, inst):
|
||||
srcreg = (inst & 0o000700) >> 6
|
||||
r = cpu.r[srcreg]
|
||||
|
||||
if r == 1:
|
||||
r = 0
|
||||
else:
|
||||
if r > 0:
|
||||
r -= 1
|
||||
else:
|
||||
r = 0o177777 # 0 means max, that's how SOB is defined
|
||||
r = (cpu.r[srcreg] - 1) & 0xffff
|
||||
|
||||
if r != 0:
|
||||
# technically if this instruction occurs low enough in memory
|
||||
# this PC subtraction could wrap, so be technically correct & mask
|
||||
cpu.r[cpu.PC] = (cpu.r[cpu.PC] - 2 * (inst & 0o077)) & cpu.MASK16
|
||||
|
|
Loading…
Add table
Reference in a new issue