4 ms·
It used to be way easier. Something like this: debug hn.com a 100 mov dx, 200 mov ah, 9 int 21 mov ax, 4c00 int 21 a 200
by fmakunbound 7y ago
It used to be way easier. Something like this:
debug hn.com
a 100
mov dx, 200
mov ah, 9
int 21
mov ax, 4c00
int 21
a 200
db "Hello, World$"
w 300
q
Replace 100 with 0 and write it to the first sector of a disk and you had a bootable program (BIOS interrupts only, of course).
Edit: Geezus. It's just an example of how accessible getting something running in assembly language was compared to all the qemu, UEFI stuff in the article.
- 0xff00ffee 7y agoint 21h uses ... A BIOS CALL. :) Still not bare metal. :) (I'm totally gatekeeping for laughs: write your own BIOS you noob!)
- non-entity 7y agoOn a random, but interesting note though, manuals from some of the early IBM PC's have the BIOs source listing in them
- homarp 7y agoe.g. https://archive.org/details/bitsavers_ibmpcpc602renceAug81_17295874/page/n189/mode/2up https://archive.org/details/bitsavers_ibmpcpc602renceAug81_1... https://sites.google.com/site/pcdosretro/ibmpcbios https://sites.google.com/site/pcdosretro/ibmpcbios has the source code for various models typed.
- 0xff00ffee 7y agoI had a giant pink book of PC BIOS that was my bible from 1988 to 1994 before the internet took off. I can't for the life of me remember who published it, but it had everything you needed to know about PC BIOS and an old IBM bios source listing. It was over 600 pages. It look liked this 1200 page book, but this isn't it (also a book I used): https://www.amazon.com/PC-Interrupts-Programmers-Reference-Third-Party/dp/0201624850 https://www.amazon.com/PC-Interrupts-Programmers-Reference-T... I also had the Apple ][+ ROM listing in one of those spiral-bound books from apple circa 1980 but that too has been lost, sadly.
- spc476 7y agoSounds like the The Programmer's PC Sourcebook (which is on my shelf, and yes, one could say it has a pink cover).
- 0xff00ffee 7y agoYES! That is exactly it. I wish I saved mine for nostalgia.
- therealcamino 7y agoWe had something like this but it was a four-inch thick printout on green-bar paper and nobody knew where it came from.
- userbinator 7y agoINT 21 is DOS, not BIOS. You can still use INT 10 for BIOS video services. Or just write into the text framebuffer directly; it's at B800:0000 in colour modes and B000:0000 in monochrome modes (it's surprising how much I still remember from when I exclusively did x86 PC Asm, ~3 decades ago.)
- fmakunbound 7y agoErr I don't know... Didn't the bios set the video controller up for you? Not bare metal enough, I'm afraid. /s
- deleted 7y ago[deleted]
- gruturo 7y agoWasn't int21h a call to MS-DOS functions? (Also understood by Windows) I'm not sure it would work if you stuck this in a boot sector.
- a1369209993 7y agoDon't remember (and can't be arsed to check) if it was int21, but IBM PC BIOS does have a call to write text to the (B8000, usually) screen text buffer, complete with scrolling.
- spc476 7y agoI do remember (and don't have to check [1]) but MS-DOS used interrupts 20h through 2Fh (mostly 21h). BIOS used interrupts 10h through 1Fh. 10h was for text and graphics. The "text" screen could be at either B000:0000 (physical address B0000) or B800:0000 (physical address B8000) depending on if it was monochrome or color, so to be pedantic, one had to make a few checks to see what card was installed (if you wanted to bypass the BIOS). [1] Why do I even remember this stuff? I haven't used any of this since the early 90s! Sheesh!
- fmakunbound 7y agoDOS used a bunch in from 20 to 2F, but mostly 21. IIRC, BIOS was 10 and 13.
- basementcat 7y agoI'm just tickled that someone can post a snippet of x86 assembly on HN and several people start pointing out perceived issues with it.
- saagarjha 7y agoI would like to point out that your bio is a crime against humanity.