Do not put variables after code

Apparently the original assembler does not do this, and putting
them inline with the code is needed for subroutines
This commit is contained in:
2022-10-27 17:37:25 -04:00
parent 86b642ba25
commit d648660889
2 changed files with 3 additions and 8 deletions

View File

@@ -65,8 +65,7 @@ func main () {
origin := 0
originSet := false
operations := []Statement { }
symbols := []Statement { }
statements := []Statement { }
symbolTable := map[string] int { }
// parse
@@ -87,11 +86,7 @@ func main () {
}
if statement.opcode != ORG {
if statement.isOperation {
operations = append(operations, statement)
} else {
symbols = append(symbols, statement)
}
statements = append(statements, statement)
}
if err != nil {
@@ -105,7 +100,6 @@ func main () {
// get symbol addresses
placer := origin
statements := append(operations, symbols...)
for _, statement := range statements {
if statement.label != "" {
_, alreadyDefined := symbolTable[statement.label]