Hacker News new | past | comments | ask | show | jobs | submit login

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

int 21h uses ...


Still not bare metal.


(I'm totally gatekeeping for laughs: write your own BIOS you noob!)

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

Err I don't know... Didn't the bios set the video controller up for you? Not bare metal enough, I'm afraid. /s

On a random, but interesting note though, manuals from some of the early IBM PC's have the BIOs source listing in them

I 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):


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.

Sounds like the The Programmer's PC Sourcebook (which is on my shelf, and yes, one could say it has a pink cover).

YES! That is exactly it. I wish I saved mine for nostalgia.

We had something like this but it was a four-inch thick printout on green-bar paper and nobody knew where it came from.

I'm just tickled that someone can post a snippet of x86 assembly on HN and several people start pointing out perceived issues with it.

I would like to point out that your bio is a crime against humanity.

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

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

I 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!

DOS used a bunch in from 20 to 2F, but mostly 21.

IIRC, BIOS was 10 and 13.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact