Skip to content

Commit

Permalink
compiler: handle 88 dat op address modes properly (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobertlo authored Nov 20, 2024
1 parent cc776b8 commit b2049cf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit b2049cf

Please sign in to comment.