Fix a bug with non-initial ORG statements in the assembler

This commit is contained in:
CrazyEttin 2022-09-15 22:26:30 +03:00
parent 9d318c4c75
commit f0e676facb
1 changed files with 4 additions and 1 deletions

View File

@ -170,6 +170,7 @@ begin
LP := 1; LP := 1;
BP := 0; BP := 0;
SP := 0; SP := 0;
EP := 0;
//Begin the main loop //Begin the main loop
repeat repeat
@ -264,7 +265,9 @@ begin
DatOrg := ExtractWord (2, Line, [' ']); DatOrg := ExtractWord (2, Line, [' ']);
try try
if Hex2Dec (DatOrg) <=$ffff then begin if Hex2Dec (DatOrg) <=$ffff then begin
if BP > EP then EP := BP;
BP := Hex2Dec (DatOrg); BP := Hex2Dec (DatOrg);
if BP < SP then SP := BP;
end end
else ArgError; else ArgError;
except except
@ -434,7 +437,7 @@ begin
if AllRefsResolved = false then halt (1); if AllRefsResolved = false then halt (1);
//Set the end pointer and reset the byte pointer to the start of the program //Set the end pointer and reset the byte pointer to the start of the program
EP := BP; if BP > EP then EP := BP;
BP := SP; BP := SP;
//Write the program file //Write the program file