Hacker News new | ask | show | jobs
by vram22 927 days ago
>- integrated assembler - you could inline assembly language really easily

Yes, as easily as this:

some BASIC statements here

[ some assembly statements here ]

some BASIC statements here

IOW, you just had to enclose your assembly language statements in square brackets. That's it.

Of course, you would need to know what memory addresses to operate on, in a real-life program, as opposed to a demo, so that you could share data in some way between the BASIC code and the assembly code, otherwise the program might not be able to do anything useful.

I don’t know about the multi-pass assembler feature that others have mentioned in this thread.

1 comments

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.
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.