
Write a Boot Sector That Prints Hello in 16-Bit Real Mode
Write a 512-byte boot sector in NASM that sets up segments and a stack, prints a string with BIOS int 0x10 and ends with the 0xAA55 signature, line by line.
Tag
24 posts

Write a 512-byte boot sector in NASM that sets up segments and a stack, prints a string with BIOS int 0x10 and ends with the 0xAA55 signature, line by line.

Load and store bytes, words, dwords and qwords on x86-64 with MOV, and widen small values correctly with MOVZX, MOVSX and MOVSXD. Worked examples included.

Learn the x86-64 memory operand form [base + index*scale + displacement], what each part may be, which combinations are illegal, and how arrays map onto it.

How the x86-64 carry, zero, sign and overflow flags are set by add, sub and cmp, with worked 8-bit examples and the conditional jumps that read them.

Write, assemble and link a complete x86-64 program with NASM on Linux. It prints a line, exits with a status code, and uses no C library at all.

The sixteen x86-64 general-purpose registers, their 32, 16 and 8-bit names, what each is conventionally for, and the write rules that trip up beginners.

How VMX and SVM add a guest mode to x86 processors, what the VMCS and VMCB hold, why VM exits happen and how nested paging removes shadow page tables.

Choose an x86 assembler by platform, syntax, macro power and output formats. A decision table compares NASM, GNU as, MASM and FASM, with when not to pick each.

Read x86 assembly in Intel and AT&T syntax with a six-rule translation method, a side-by-side table of operands and addressing, and a guide to choosing one.

A complete x86-64 kernel core: GDT, IDT, exceptions, PIC and APIC interrupts, timers, a frame allocator, four-level paging, page faults, a heap and PCI.

Build an x86 bootloader in NASM from a 512-byte boot sector to a loaded kernel, covering disk reads, A20, the memory map, protected mode and long mode.

A complete guide to x86-64 assembly on Linux: registers, flags, addressing, branches, the stack, calling C, atomics, encoding and a full worked program.