From 9ca48e8dcf0099a663e6641e9c75199f7e55b9c8 Mon Sep 17 00:00:00 2001 From: Robert Lowry Date: Sun, 24 Nov 2024 19:55:48 -0600 Subject: [PATCH] load: accept slt # b-field in 88 mode --- load.go | 10 ++++++---- load_test.go | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/load.go b/load.go index 4a8b1bf..a62552f 100644 --- a/load.go +++ b/load.go @@ -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 { diff --git a/load_test.go b/load_test.go index ed84ef6..b21bb20 100644 --- a/load_test.go +++ b/load_test.go @@ -66,11 +66,12 @@ func TestLoadDwarf(t *testing.T) { }, data.Code) } -func TestValidInput(t *testing.T) { +func TestValidInput88(t *testing.T) { // random inputs that are valid but not worth validating output cases := []string{ "END\n", "\n\n", + "SLT $ 0, # 0\n", // not in 88 spec, pMARS supports this though } config := ConfigKOTH88 @@ -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",