Exit the assembler with a non-zero exit code on error

This commit is contained in:
Juhani Krekelä 2022-08-18 15:06:53 +03:00 committed by CrazyEttin
parent b3d043d43c
commit c3151c5113
1 changed files with 9 additions and 9 deletions

View File

@ -48,28 +48,28 @@ end;
procedure LblError;
begin
writeln ('Error (line ', LP, '): illegal label');
halt;
halt (1);
end;
//Print a reference error and abort
procedure RefError;
begin
writeln ('Error (line ', LP, '): illegal reference(s) relative to this line');
halt;
halt (1);
end;
//Print an argument error and abort
procedure ArgError;
begin
writeln ('Error (line ', LP, '): illegal argument(s)');
halt;
halt (1);
end;
//Print a memory error and abort if the assembler is about to write beyond available memory
procedure MemError;
begin
writeln ('Error (line ', LP, '): memory overflow');
halt;
halt (1);
end;
//Assemble a single register argument
@ -163,7 +163,7 @@ begin
//Check for and set up a program file
if ParamCount <> 1 then begin
writeln ('Usage: assembler program (< input)');
halt;
halt (1);
end;
//Initialise the byte and start pointers
@ -259,7 +259,7 @@ begin
end
else begin
writeln ('Error (line ', LP, '): ORG must be the first instruction');
halt;
halt (1);
end;
end
@ -321,7 +321,7 @@ begin
else if CompareText (Elem [1], 'CLNEQ') = 0 then Bin [BP] := $f0
else begin
writeln ('Error (line ', LP, '): no such instruction');
halt;
halt (1);
end;
//Check for incorrect number of arguments
@ -389,7 +389,7 @@ begin
end;
Count := Count + 1;
end;
if AllRefsResolved = false then halt;
if AllRefsResolved = false then halt (1);
//Set the end pointer and reset the byte pointer to the start of the program
EP := BP;
@ -402,7 +402,7 @@ begin
{$i+}
if IOResult <> 0 then begin
writeln ('Error: program file cannot be written to');
halt;
halt (1);
end;
repeat
write (Prog, Bin [BP]);