This week, I took the CPU from register-only programs to reading and writing memory, using a stack, and calling subroutines.
I gave the bus interface unit a second client, so data accesses share the bus with instruction fetch, with data going first when both request. I then added MOV loads and stores with BX-based addressing, a DS register and an address-generation unit. Each 16-bit access is two byte transfers on the 8088’s 8-bit bus, including words that cross a segment boundary or the top of memory.
Next I added the stack: an SS register, PUSH and POP, and near CALL and RET, which redirect instruction fetch like a taken jump. I checked PUSH SP and POP SP, where the 8088 differs from later x86 processors, against 10,000 recorded real-8088 cases each. A second write port for the stack pointer lets each instruction update everything on one clock edge.
Two repeatable demonstrations check registers, memory and every bus transaction under varied memory delays. The second runs two levels of subroutine calls and restores every register, including the stack pointer. Resetting the CPU in the middle of transfers exposed a bug where an interrupted load still wrote its register, which I fixed. The tests also caught all 16 deliberately broken versions of the design.
I also corrected our design report and added a CPU block diagram. Next are the full decoder, the remaining ALU operations, and interrupts, which the BIOS needs.
