Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/rars/assembler/Assembler.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ else if (Memory.inDataSegment(statement.getAddress())) {
statement.getStrippedTokenList().get(0), errors);
}
textSegmentLines.add(statement);
// Update the textAddress pointer because the logic for adding fake instructions when START AT MAIN is enabled also needs this value to point after the last inserted instruction, and the logic for expanding pseudoinstructions modifies it
textAddress.set(statement.getAddress());
textAddress.increment(Instruction.INSTRUCTION_LENGTH);
} else if (statement.getInstruction() != null) {
// It is a pseudo-instruction:
// 1. Fetch its basic instruction template list
Expand Down Expand Up @@ -232,7 +235,7 @@ else if (Memory.inDataSegment(statement.getAddress())) {
templateList = inst.getBasicIntructionTemplateList();


// subsequent ProgramStatement constructor needs the correct text segment address.
// subsequent ProgramStatement constructor needs the correct text segment address. The logic for adding fake instructions when START AT MAIN is enabled also needs this value to point after the last inserted instruction.
textAddress.set(statement.getAddress());
// Will generate one basic instruction for each template in the list.
int PC = textAddress.get(); // Save the starting PC so that it can be used for PC relative stuff
Expand Down