Add opcodes
This commit is contained in:
parent
84de7cd481
commit
739548d99f
4 changed files with 48 additions and 8 deletions
|
@ -86,7 +86,7 @@ class Microprogram:
|
|||
self.c["MAR"]=self.c["SP"]
|
||||
self.c["H"]=self.c["TOS"]
|
||||
self.rd()
|
||||
self.c["TOS"]=(self.c["MDR"] and self.c["H"])
|
||||
self.c["TOS"]=(self.c["MDR"] & self.c["H"])
|
||||
self.c["MDR"]=self.c["TOS"]
|
||||
self.wr()
|
||||
elif opcode==ijvm["IOR"]:
|
||||
|
@ -94,7 +94,7 @@ class Microprogram:
|
|||
self.c["MAR"]=self.c["SP"]
|
||||
self.c["H"]=self.c["TOS"]
|
||||
self.rd()
|
||||
self.c["TOS"]=(self.c["MDR"] or self.c["H"])
|
||||
self.c["TOS"]=(self.c["MDR"] | self.c["H"])
|
||||
self.c["MDR"]=self.c["TOS"]
|
||||
self.wr()
|
||||
elif opcode==ijvm["SWAP"]:
|
||||
|
@ -107,6 +107,34 @@ class Microprogram:
|
|||
self.c["MAR"]=self.c["SP"]-1
|
||||
self.wr()
|
||||
self.c["TOS"]=self.c["H"]
|
||||
elif opcode==ijvm["ILOAD"]:
|
||||
self.fetch();self.c["PC"]+=1 # Fetch local variable to push onto the stack
|
||||
self.c["H"]=self.c["LV"]
|
||||
self.c["MAR"]=self.c["MBRU"]+self.c["H"]
|
||||
self.rd()
|
||||
self.c["SP"]+=1
|
||||
self.c["MAR"]=self.c["SP"]
|
||||
self.wr()
|
||||
self.c["TOS"]=self.c["MDR"]
|
||||
elif opcode==ijvm["ISTORE"]:
|
||||
self.fetch();self.c["PC"]+=1 # Fetch local variable offset where to store
|
||||
self.c["H"]=self.c["LV"]
|
||||
self.c["MAR"]=self.c["MBRU"]+self.c["H"]
|
||||
self.c["MDR"]=self.c["TOS"]
|
||||
self.wr()
|
||||
self.c["SP"]-=1
|
||||
self.c["MAR"]=self.c["SP"]
|
||||
self.rd()
|
||||
self.c["TOS"]=self.c["MDR"]
|
||||
elif opcode==ijvm["IINC"]:
|
||||
self.fetch();self.c["PC"]+=1 # Fetch local variable offset to inc
|
||||
self.c["H"]=self.c["LV"]
|
||||
self.c["MAR"]=self.c["MBRU"]+self.c["H"]
|
||||
self.rd()
|
||||
self.fetch();self.c["PC"]+=1 # Fetch inc value
|
||||
self.c["H"]=self.c["MDR"]
|
||||
self.c["MDR"]=self.c["MBR"]+self.c["H"]
|
||||
self.wr()
|
||||
elif opcode==ijvm["OUT"]:
|
||||
self.fetch();self.c["PC"]+=1 # Fetch byte to push in MBR
|
||||
print(str(chr(self.c["MBR"])),end="")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue