diff --git a/assembler.pas b/assembler.pas index 7b58a79..4a6da48 100644 --- a/assembler.pas +++ b/assembler.pas @@ -170,6 +170,7 @@ begin LP := 1; BP := 0; SP := 0; + EP := 0; //Begin the main loop repeat @@ -264,7 +265,9 @@ begin DatOrg := ExtractWord (2, Line, [' ']); try if Hex2Dec (DatOrg) <=$ffff then begin + if BP > EP then EP := BP; BP := Hex2Dec (DatOrg); + if BP < SP then SP := BP; end else ArgError; except @@ -434,7 +437,7 @@ begin if AllRefsResolved = false then halt (1); //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; //Write the program file