(no title)
shikaan | 10 months ago
Printing with Pascal strings is actually shorter (you skip the null test, basically), but constructing Pascal strings to pass as an argument when they are not constants yielded much more code to prepare for that call. Had I had more leeway, I would have used Pascal strings, it much less headache.
2. Files in `/bin` all include from the SDK. You can pretty much do the same for utility functions.
The includes, at least in nasm, are very much like copy-pasted code (or includes in C for that matter), and then you can just jump/call to the label.
I did not do it because I haven't been able to get nasm to optimize away the code that I don't use, and I didn't want to bloat the binaries or make a file for a 5LOC function.
All in all not good reasons in general, but it made sense to me in this context.
90s_dev|10 months ago
Two more questions if you find some spare time:
3. Why does it use tty for interrupts instead of directly calling int 10?
4. How does this even print to the screen or use a tty in the first place? Is it just something inherent in bios api?
shikaan|10 months ago
3. The tty interrupt advances the cursor along with printing. So, once again, I do it to save on some instructions. In the first iterations I wanted to retain more control (by printing and moving as separate operations) so that I could reuse this across the board, but eventually I ran out of space.
4. I am relying heavily on BIOS interrupts, which are criminally underdocumented. The most reliable source is Ralph Brown's documentation[1] which is very far from what I was expecting to be authoritative documentation. Turns out this collection is really good and basically _the_ source of truth for BIOS interrupts.
To answer your question, yes, this is basically calling the BIOS API.
[1]: https://wiki.osdev.org/Ralf_Brown's_Interrupt_List