Hacker News new | ask | show | jobs
by rahimnathwani 926 days ago
On your last point: on the first pass the assembler wouldn't know about labels that came later on the assembly, but on the second pass it would have seen them. IIRC normal way to run the assembler was to do to a for loop from 0 to 3 with step size 3, as 0 indicated suppressing all assembler errors.
1 comments

Ah, got it, thanks. But why not 0 to 1 with step size 1? Wouldn't that also give two passes, which should be sufficient, and which the said normal way also does?
There were four OPT (modes) for the assembler, numbered 0 to 3. 0 suppressed all errors and screen output. 3 did the opposite.

Using 1 would suppress errors, which would mean you wouldn't know if your code was bad.

You could use 0 and 3 or, if you don't want a listing, 0 and 2.

Search this page for 'first pass', for a more complete explanation: https://central.kaserver5.org/Kasoft/Typeset/BBC/Ch43.html

I think it's clear now - mode 0 is used to suppress the error messages about yet-unseen labels in the first pass, and 3 to give the output with any errors. Meanwhile, by the end of the first pass, all labels would have been seen, so in the second pass, the assembler could insert the correct addresses for them, at the places where those labels were used in jump statements, even if some of those statements were before where the labels were defined.

But I'll check that page out anyway.

Thanks again.

100% correct.