From b2049cf29d742e7804eb32fdf9d2fb6d17c03990 Mon Sep 17 00:00:00 2001 From: Robert Lowry Date: Tue, 19 Nov 2024 19:47:08 -0600 Subject: [PATCH] compiler: handle 88 dat op address modes properly (#79) --- compile.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compile.go b/compile.go index 3aba9c0..d555fdd 100644 --- a/compile.go +++ b/compile.go @@ -115,9 +115,14 @@ func (c *compiler) expandExpression(expr []token, line int) ([]token, error) { } func (c *compiler) assembleLine(in sourceLine) (Instruction, error) { + opLower := strings.ToLower(in.op) var aMode, bMode AddressMode if in.amode == "" { - aMode = DIRECT + if c.config.Mode == ICWS88 && opLower == "dat" { + aMode = IMMEDIATE + } else { + aMode = DIRECT + } } else { mode, err := getAddressMode(in.amode) if err != nil { @@ -126,7 +131,11 @@ func (c *compiler) assembleLine(in sourceLine) (Instruction, error) { aMode = mode } if in.bmode == "" { - bMode = DIRECT + if c.config.Mode == ICWS88 && opLower == "dat" { + bMode = IMMEDIATE + } else { + bMode = DIRECT + } } else { mode, err := getAddressMode(in.bmode) if err != nil {