fixed ass2

This commit is contained in:
Jaka Furlan 2025-12-08 12:08:50 +01:00
parent c707e3253c
commit 1bbc80de29
37 changed files with 753 additions and 18 deletions

View file

@ -85,7 +85,7 @@ let getOperandF3 (state : Processor.state) (nixbpe : nixbpe) (disp : int) : int
(*pridobi operand*)
let value =
if nixbpe.n = 1 && nixbpe.i = 1 then Processor.readMemAddr state ea (*direktno*)
else if nixbpe.n = 0 && nixbpe.i = 1 then disp (* immediate value *)
else if nixbpe.n = 0 && nixbpe.i = 1 then ea (* immediate value *)
else if nixbpe.n = 1 && nixbpe.i = 0 then Processor.readMemAddr state (Processor.readMemAddr state ea) (* indirect *)
else failwith "Invalid addressing mode"
in
@ -102,7 +102,7 @@ let getOperandF4 (state : Processor.state) (nixbpe : nixbpe) (disp : int) : int
(*pridobi operand*)
let value =
if nixbpe.n = 1 && nixbpe.i = 1 then Processor.readMemAddr state ea (*direktno*)
else if nixbpe.n = 0 && nixbpe.i = 1 then disp (* immediate value *)
else if nixbpe.n = 0 && nixbpe.i = 1 then ea (* immediate value *)
else if nixbpe.n = 1 && nixbpe.i = 0 then Processor.readMemAddr state (Processor.readMemAddr state ea) (* indirect *)
else failwith "Invalid addressing mode"
in
@ -191,9 +191,9 @@ let executeFormat3 (state : Processor.state) (nixbpe : nixbpe) (mnemonic: Opcode
| LDT -> IzvajalnikF3.ldt state operand
| LDX -> IzvajalnikF3.ldx state operand
| LPS -> notImplemented "LPS4"
| STA -> IzvajalnikF3.sta state operand
| STB -> IzvajalnikF3.stb state operand
| STCH -> IzvajalnikF3.stch state operand
| STA -> IzvajalnikF3.sta state ea
| STB -> IzvajalnikF3.stb state ea
| STCH -> IzvajalnikF3.stch state ea
| STF -> notImplemented "STF4"
| STL -> IzvajalnikF3.stl state ea
| STS -> IzvajalnikF3.sts state ea
@ -208,7 +208,7 @@ let executeFormat3 (state : Processor.state) (nixbpe : nixbpe) (mnemonic: Opcode
let executeFormat4 (state : Processor.state) (nixbpe : nixbpe) (mnemonic: OpcodeTable.mnemonic): unit =
let address = readAddress state in
let _, operand = getOperandF4 state nixbpe address in
let ea, operand = getOperandF4 state nixbpe address in
(*debugging*)
Printf.printf "[Izvajalnik/executeFormat4] Mnemonic: %s, nixbpe: %s, operand: %d = 0x%02X\n"
(string_of_mnemonic mnemonic) (string_of_nixbpe nixbpe) operand operand;
@ -246,15 +246,15 @@ let executeFormat4 (state : Processor.state) (nixbpe : nixbpe) (mnemonic: Opcode
| LDT -> IzvajalnikF4.ldt state operand
| LDX -> IzvajalnikF4.ldx state operand
| LPS -> notImplemented "LPS4"
| STA -> IzvajalnikF4.sta state operand
| STB -> IzvajalnikF4.stb state operand
| STA -> IzvajalnikF4.sta state ea
| STB -> IzvajalnikF4.stb state ea
| STCH -> notImplemented "STCH4"
| STF -> notImplemented "STF4"
| STL -> IzvajalnikF4.stl state operand
| STS -> IzvajalnikF4.sts state operand
| STSW -> IzvajalnikF4.stsw state operand
| STT -> IzvajalnikF4.stt state operand
| STX -> IzvajalnikF4.stx state operand
| STL -> IzvajalnikF4.stl state ea
| STS -> IzvajalnikF4.sts state ea
| STSW -> IzvajalnikF4.stsw state ea
| STT -> IzvajalnikF4.stt state ea
| STX -> IzvajalnikF4.stx state ea
(* Control / IO *)
| TIX -> IzvajalnikF3.tix state operand