Master the fundamental concepts of bios & uefi programming through this focused micro-challenge.
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it worksBefore an OS provides drivers, software interrupts reach firmware routines for video, keyboard, disk, and more. The calling convention puts the function number in AH and passes extra arguments in other registers. For example, INT 0x10 with AH=0x0E and AL='A' prints one teletype character and advances the cursor.
nasmLoading…
BIOS data areas at 0x0040:0000 hold equipment flags and keyboard buffer pointers. Interrupts work only in real mode unless you build v8086 thunks.
These interrupts trap through the IVT; once CR0.PE is set without virtual 8086, BIOS services are unsafe. Teletype output preserves cursor state across calls, which is why boot messages rarely manually track column numbers. Testing with QEMU -fda still routes INT 0x10 to the emulated VGA BIOS, so behavior matches physical hardware closely enough for learning.
You will use INT 0x10 and INT 0x16 to print text and echo keyboard input. This exercise requires following the register-based BIOS calling convention without any C library or OS syscall layer.
In real mode, INT n is an indirect far call through the Interrupt Vector Table: 256 four-byte entries at physical address 0. Entry n is at 0000:n*4 and holds the handler's offset, then its segment, both little-endian. The BIOS installs handlers for its services, such as INT 10h (video), and a program can hook any vector by overwriting its entry. Build a small emulator of this: an IVT you can hook and inspect, and the three INT 10h functions a boot loader uses to print, driving an 80×25 text screen.
Hex values are exact-width: 2 digits for vectors and 8-bit registers, 4 for 16-bit registers, segments and offsets.
cLoading…
Registers keep their values between commands (all start at 0). The assignments on an int line are applied only if all of them are valid.
int prints the jump and does nothing else.F000:FF53:
0D returns to column 0, 0A moves down one row, 08 moves left (not past column 0), and 07 (bell) does nothing visible. Column 80 wraps to the next row. Moving below row 24 scrolls the screen up one row.0280).cLoading…
screen prints the rows from 0 to the last non-blank row, with trailing spaces removed.error: usage: hook NN SSSS:OOOO;error: usage: vector NN;error: usage: int NN [REG=VAL...];error: bad register assignment REG=VAL;error: unknown command CMD.Input:
cLoading…
Output:
cLoading…
segment × 16 + offset) exactly. Real-mode addressing is the point.Hidden tests cover hooking over the video vector, 80-column wrap, scrolling past row 24, backspace at column 0, AX-style assignments, and malformed commands.