Master the fundamental concepts of real mode programming through this focused micro-challenge.
LODSB loads from DS:SI, STOSB stores to ES:DI, MOVSB copies byte from DS:SI to ES:DI, each optionally repeating with REP using CX as a counter. For example, REP MOVSB copies 80 bytes from a source buffer to 0xB8000 for a fast screen fill when direction flag is cleared.
nasmLoading…
SCASB/CMPSB for strlen and strcmpES is fixed for STOS/MOVS destinationString instructions shrink loop code dramatically inside the 510-byte budget of a boot sector. Always issue CLD before forward REP MOVSB unless you intentionally copy backward for overlapping regions. Remember that ES cannot be the same arbitrary segment as DS unless you load it; many snippets set both to the same paragraph for video memory copies to 0xB800.
You will implement memory fill and copy with REP STOSB and REP MOVSB. This exercise requires setting DS, ES, SI, DI, and CX correctly and clearing the direction flag before forward copies.
Implement x86 string instruction simulation in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github