Master the fundamental concepts of boot sector development through this focused micro-challenge.
You have read the whole brief, and the concepts above stay free on every task. Writing and running the code needs a plan.
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 worksFunction AX=0xE820 returns an array of memory regions usable for planning page tables and kernel placement. Each call fills one 20-byte record: base, length, type, ACPI attributes. For example, type 1 means usable RAM; type 2 is reserved for firmware or ACPI.
nasmLoading…
EDX is mandatory on first callKernels expect a known structure like Multiboot mmap entries or a custom array tagged with a signature. Place the buffer above 0x7E00 and record the count and pointer in registers or fixed cells for stage two. Type 3 ACPI reclaim and type 2 reserved must not be treated as free RAM. If E820 returns CF on first call, your buffer or signature is wrong; verify ECX is at least 20.
You will call E820 repeatedly and store region type, base, and length records. This exercise requires handling the continuation value in EBX and distinguishing usable RAM from reserved areas.
Parse a captured E820 memory map and compute the usable-RAM summary.
Input (stdin): one region record per line, three whitespace-separated fields (base (hex), length (hex), type (decimal 1-5)) as returned by INT 0x15, AX=0xE820.
Types: 1 usable RAM, 2 reserved, 3 ACPI reclaimable, 4 ACPI NVS, 5 bad memory; anything else prints as "Unknown" and counts as reserved.
Requirements:
Output exactly these lines after the region lines: entries=<decimal> usable_bytes=<decimal> reserved_bytes=<decimal> largest_usable_base=0x<16 hex digits, uppercase> largest_usable_len=0x<hex>