Skip to content

Commit

Permalink
load: accept slt # b-field in 88 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bobertlo committed Nov 25, 2024
1 parent aadb921 commit d458f21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions load.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ func getOpModeAndValidate88(Op OpCode, AMode AddressMode, BMode AddressMode) (Op

case SLT:
// SLT;
// AB if #A, B otherwise, no #B allowed
if BMode == IMMEDIATE {
return 0, fmt.Errorf("invalid b mode '#' for op 'slt'")
}
// AB if #A, B otherwise

// #B is not allowed by the 88 standard but is allowed on hills
// if BMode == IMMEDIATE {
// return 0, fmt.Errorf("invalid b mode '#' for op 'slt'")
// }
if AMode == IMMEDIATE {
return AB, nil
} else {
Expand Down
3 changes: 2 additions & 1 deletion load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func TestValidInput94(t *testing.T) {
// random inputs that are valid but not worth validating output
cases := []string{
"ADD.BA $ 1, $ 1\n",
"SLT $ 0, # 0\n", // not in 88 spec, pMARS supports this though
}

config := ConfigNOP94
Expand Down Expand Up @@ -112,7 +113,7 @@ func TestInvalidInput(t *testing.T) {
"DAT # 0, $ 0\n",
"DAT # 0, @ 0\n",
"CMP $ 0, # 0\n",
"SLT $ 0, # 0\n",
// "SLT $ 0, # 0\n", // pMARS supports this
"ADD $ 0, # 0\n",
"SUB $ 0, # 0\n",
"JMP # 0, $ 0\n",
Expand Down

0 comments on commit d458f21

Please sign in to comment.