← blog

Building an Intel 8088 computer by hand

Close-up of the hand-wire-wrapped 8088 computer: rows of pins laced with colorful wires

In the fall of 2007, for my final project in ECE 3710 (Microprocessors), I designed and built a small computer around an Intel 8088, the 8-bit-bus version of the 8086 that runs the same 16-bit x86 code. Its one job was to run a game I wrote for it in x86 assembly: a rudimentary “Duck Hunt”-like game that I called Skeet Shoot.

The only copy of the source I had left was a printout from February 2008. I recently scanned it, transcribed it (with an AI assistant, then checked it), and put it on GitHub: 8088-duck-hunt (opens in a new tab).

This was a semester-long project for Microprocessors. We each bought a Ziploc bag of the required parts from the university store and were essentially told to “figure it out,” based on the material and concepts presented in lecture.

I spent several overnight sessions in that stuffy ECE lab, having pizza delivered to the building and showering at the gym to avoid the long trip home. It was exhausting, stressful… and ultimately extremely rewarding.

Blood, sweat, and tears all made their contributions to this build.

The hardware

The schematics

These are the six figures from my December 2007 report, redrawn in KiCad in 2026 from the printouts (the original files are long gone), plus the system schematic that joins them. Where a printed figure showed a subsystem mid-build, the redraw follows the final design, and each sheet notes what changed. The scans of the original printouts (opens in a new tab) are on GitHub. Use the arrows (or swipe) to step through them; click a figure for the full-size version.

Schematic of the 8088 microprocessor wired to two 74LS373 address latches and two 74LS245 bus transceivers, with clock lines from the 8284
Schematic of the 29010 EEPROM with address lines A0 to A16, a 74LS138 decoder on A17 to A19, and red and green indicator LEDs
Schematic of the 6264 RAM chip with address lines A0 to A12 and data lines D0 to D7
Schematic of the 8255 parallel interface connected to a ten-LED bar, two discrete LEDs, a 74LS47 seven-segment driver and display, four DIP switches and a push button
Schematic of the 8253 interval timer with its outputs to a speaker driver, the 8255 and the 8259, and a 74LS138 port decoder
Schematic of the 8259A interrupt controller with IR7 from the timer, its INT output to the 8088, and the 74LS138 I/O port decoder
KiCad top sheet of the system schematic: blocks for clock and reset, the 8088 microprocessor, EEPROM, RAM, PPI, PIT and PIC, with the memory and I/O address maps
The whole computer on one schematic sheet: the 8284 clock, 8088, latches, buffers, timer and interrupt controller across the top, the I/O decoder, 8255, LEDs, display and switches plus the memory decoder, EEPROM and RAM along the bottom, joined by continuous address and data buses

Figure 1: Microprocessor subsystem. The 8088, its clock from the 8284, two 74LS373 latches that separate the address from the data on the shared pins, and two 74LS245 bus buffers.

Figure 2: Memory: EEPROM. A 29010 EEPROM, 128 KB (17 address lines), selected by a 74LS138 decoding the top address bits. The red and green LEDs hang off two other decoder outputs.

Figure 3: Memory: RAM. A 6264 static RAM, 8 KB (13 address lines).

Figure 4: I/O: the 8255 PPI. Port A and two bits of port B drive the twelve LEDs, the top half of port B feeds a 74LS47 that drives the 7-segment score digit, and port C reads the DIP switches, the button and a timer output. The original title block said "Lab 6: PPI".

Figure 5: Timer: the 8253 PIT. Output 0 drives the speaker through a 75452 driver and a 1k volume pot, output 1 goes back to the PPI for the delay loop, and output 2 is the 30 ms tick to the interrupt controller.

Figure 6: Interrupts: the 8259A PIC. Wired as a master, with the timer on IR7 and its output to the 8088's INTR pin. The same 74LS138 decodes the I/O ports: 00H for the PPI, 40H for the timer, 50H for this chip, matching the code.

The system schematic (2026). The top sheet of the KiCad project: clock and reset (reconstructed), the 8088, EEPROM at E0000H, RAM at 00000H, and the PPI, timer and interrupt controller at I/O ports 00H, 40H and 50H. All eight sheets (PDF) (opens in a new tab).

The whole computer on one sheet (2026). The same circuit as the system schematic, drawn as one page: every connection is a wire, and one address bus and one data bus run across the middle to every chip. Click for the full-size image, or open the PDF (opens in a new tab) to zoom in.

Putting it all together

The original PSpice files are long gone, so in 2026 I redrew all six figures in KiCad (with an AI assistant), keeping the original layouts, and then joined them into a single system schematic. Its top sheet, slide 7 above, has one block per subsystem, and slide 8 draws the whole computer on a single page.

Redrawing them turned up something I’d forgotten: I drew each figure while building and testing that subsystem on its own, so a few of them show the board mid-build. For example, the 8088’s interrupt input is still tied to ground. The system schematic closes those gaps and adds the clock and reset circuit, which the figures only show as pin labels. That circuit is reconstructed from the datasheet and the code, and it’s marked as such. The KiCad files, with every correction listed, are on GitHub (opens in a new tab).

The game

Press the button, and after a short random delay a "skeet" flies across a row of twelve LEDs, one LED per step, with a rising note at each step. Press the button again to fire: a gunshot noise plays, and it counts as a hit only if you fire while the skeet is at one particular spot near the end of its flight. A 7-segment digit shows your score.

The code

A few parts I still like, and one I didn't like even then.

Reading the button in an interrupt

Every 30 ms the timer interrupt reads the button and keeps only the new presses, so holding the button down doesn't fire twice:

in al, portc                   ; Get the button state
mov ah, al
not al                         ; Need button closures to be 1s not 0s
xchg al, [not_port_c]          ; Update not_port_c, get old copy in al
xor al, [not_port_c]           ; al is now the changes
and al, [not_port_c]           ; al contains only the closures
or [bool_button_pressed], al   ; set the button (closure) flag

The same interrupt counts a "random" value up and around, so the delay before each skeet depends on exactly when you pressed the button.

Waiting on the timer

Delays reload the timer, then poll its output pin through the parallel interface until the count runs out:

monitor:
    in al, portc
    and al, 40H   ; The Mask For The Timer On The PPI
    cmp al, 40H
    jne monitor   ; Stay in this loop until the timer has finished
loop loop_delay

The part I was ashamed of

On the 8088, a conditional jump can only reach about 127 bytes forward or back. The skeet's flight is one long, unrolled sequence, so the checks near the start couldn't reach the code that handles a shot. My fix was a trampoline in the middle, and my 2007 comments were honest about it:

mediaryGunShotJump:   ; This is just shitty programming - and I am ashamed of myself.
    jmp gunHasShot    ; The je 's are too short to reach the gunshot.
                      ; So they jump here, and this is a 'launching' point to the gunshot.
                      ; And I'm not really sure how to fix that any other way - but I know there must be a better way.

The standard idiom is to flip the condition and jump over an unconditional jmp; my trampoline is a close cousin. The better fix is a loop over a table of LED patterns and notes instead of twelve unrolled copies, which would also have made the program much shorter.

Power-on

The last 16 bytes of the ROM are where an 8088 begins after reset. The program pads up to that point and puts its start-up code there:

times prog_size - 10H - ($-$$) db 0FFH

xor ax, ax
mov ds, ax
mov ss, ax
mov es, ax
mov sp, ram_size-2
jmp code_seg:startup

The full source

All 864 lines from the 2008 printout, with one loop label renamed for clarity (scroll inside the box). Also on GitHub (opens in a new tab).

;------------------------------------------------------------------------------------------
; PROGRAM 8
; David Kennedy
; ECE 3710 - Microprocessors
; Final Project - Skeet Shoot
; 10 December 2007
;------------------------------------------------------------------------------------------
ram_size                     equ 8192
rom_size                     equ 131072
prog_size                    equ 2048
red_led_seg                  equ 2000H
green_led_seg                equ 4000H
;------------------------------------------------------------------------------------------
; PPI
;------------------------------------------------------------------------------------------
porta                        equ 00H
portb                        equ 01H
portc                        equ 02H
PPI_Command_Port             equ 03H
PPI_Command_Word             equ 89H
;------------------------------------------------------------------------------------------
; PIT
;------------------------------------------------------------------------------------------
PIT_ToSpeaker_Port           equ 40H
PIT_ToPPI_Port               equ 41H
PIT_ToPIC_Port               equ 42H
PIT_Command_Port             equ 43H
PIT_ToSpeaker_Word           equ 36H
PIT_ToPPI_Word               equ 70H
PIT_ToPIC_Word               equ 0B6H     ; Just like 36H for Timer0, except the leading two bits are 10 instead of 00
;------------------------------------------------------------------------------------------
;PIC
;------------------------------------------------------------------------------------------
PIC_Port0                    equ 50H
PIC_Port1                    equ 51H
PIC_ICW1                     equ 13H      ; Edge Triggered, single mode using ICW4
PIC_ICW2                     equ 20H      ; Interrupts Vectors 20-27
PIC_ICW4                     equ 03H      ; Auto EOI and 8086 Mode
PIC_OCW1                     equ 7FH      ; Enable IR7 Only (vector 27H)
;------------------------------------------------------------------------------------------
; Some Other Constants
;------------------------------------------------------------------------------------------
Timer_Int_Vector             equ 27H      ; 30 msec Timer Interrupt Vector
PIT_Interval_Time            equ 60000    ; 30 msec at 2MHz Clock
pushButton_bit               equ 80H
;------------------------------------------------------------------------------------------
; Musical Note Frequencies
;------------------------------------------------------------------------------------------
See                          equ 7633     ; I may replace all of these at a later date with a table.
SeeSh                        equ 7220     ; There actually is a table below now - but I am not currently using it.
D                            equ 6802     ; The table is just hanging out.
DSh                          equ 6430
E                            equ 6060
F                            equ 5730
FSh                          equ 5390
G                            equ 5102
GSh                          equ 4819
A                            equ 4545
ASh                          equ 4291
B                            equ 4049
C5                           equ 3822
B5                           equ 3407
Pauz                         equ 0000
;------------------------------------------------------------------------------------------
; Code Startup Stuff
;------------------------------------------------------------------------------------------
SEGMENT .bss start=0
intvec0                      resd 256
theChamp                     resb 1
gameSpeed                    resb 1
random                       resb 1
not_port_c                   resb 1
bool_button_pressed          resb 1
bool_skeet_inAir             resb 1
bool_has_gunshot             resb 1
bool_hit_rightLED            resb 1
bool_game_over               resb 1
score                        resb 1
shotsLeft                    resb 1
highScore                    resb 1

code_seg                 equ 0F000H

SEGMENT .text start=100000H-prog_size
;------------------------------------------------------------------------------------------
; The Code!
;------------------------------------------------------------------------------------------
startup:
    call initialize
    call getDIPs
    call game

    waitForNewGame:
            test byte [bool_button_pressed], pushButton_bit
        jz continueWaiting
        jmp doneWaiting

        doneWaiting:
            mov byte [bool_button_pressed], 0     ; This Mov MUST be Here (for now)
            jmp startup
        continueWaiting:
        jmp waitForNewGame
;------------------------------------------------------------------------------------------
; Initialize Stuff        I will also eventually need PIC Stuff
;------------------------------------------------------------------------------------------
initialize:
        xor ax, ax
        mov bx, (100000H-rom_size)/16        ; Starting Segment of ROM Memory

        mov al, PPI_Command_Word             ; Set the PPI Command Word
        out PPI_Command_Port, al

        mov al, PIT_ToSpeaker_Word           ; Set the Timer 0 Command Word
        out PIT_Command_Port, al             ; MAKE SURE THAT YOU'RE OUTPUTTING TO pit_command_port AND NOT ppi_command_port

        mov al, PIT_ToPPI_Word               ; Set The Timer 1 Command Word
        out PIT_Command_Port, al

        mov al, PIT_ToPIC_Word
        out PIT_Command_Port, al
        mov al, PIT_Interval_Time & 0FFH ; For The PIC
        out PIT_ToPIC_Port, al
        mov al, PIT_Interval_Time >> 8
        out PIT_ToPIC_Port, al

        mov al, PIC_ICW1
        out PIC_Port0, al
        mov al, PIC_ICW2
        out PIC_Port1, al
        mov al, PIC_ICW4
        out PIC_Port1, al
        mov al, PIC_OCW1
        out PIC_Port1, al

        mov word [Timer_Int_Vector*4], ISR
        mov word [Timer_Int_Vector*4+2], code_seg

        mov ax, 00FFH                        ; Not sure why this is here - it's left over from the jingle bells program <-- Which Works!
        out PIT_ToPPI_Port, al
        out PIT_ToPPI_Port, al

        mov byte [theChamp], 00H
        mov byte [gameSpeed], 00H
        mov byte [random], 10H               ; A Value of 10, when loaded into cx and given to the Delay subroutine, will yield ~ 0.5 seconds
        mov byte [not_port_c], 00H
        mov byte [bool_button_pressed], 00H
        mov byte [bool_skeet_inAir], 00H
        mov byte [bool_has_gunshot], 00H
        mov byte [bool_hit_rightLED], 00H
        mov byte [bool_game_over], 00H
        mov byte [score], 00H
        mov byte [shotsLeft], 00H
        mov byte [highScore], 00H

        ret                                  ; return
;------------------------------------------------------------------------------------------
; Get The Values On The DIP Switches - The Game Speed and Championship Mode
;------------------------------------------------------------------------------------------
getDIPs:
    cli
    ;Get the Championship Status
    ;---------------------------------------------------------------------------
    in al, portc
    mov ah, al
    and ah, 08H
    mov [theChamp], ah
    cmp byte [theChamp], 08H
    je champMode
    mov al, 19H
    mov [shotsLeft], al
    jmp doneSettingChamp
    champMode:
        mov al, 0BH
        mov [shotsLeft], al
        jmp doneSettingChamp
    doneSettingChamp:
    ;---------------------------------------------------------------------------
    ; Get The Game Speed - All Of The Shifts Are To Truncate
    ;---------------------------------------------------------------------------
    in al, portc
    shl al, 1
    shl al, 1
    shl al, 1
    shl al, 1
    shl al, 1
    shr al, 1
    shr al, 1
    shr al, 1
    shr al, 1
    shr al, 1
    mov [gameSpeed], al
    xor byte [gameSpeed], 00000111B
    add byte [gameSpeed], 01H
    ;---------------------------------------------------------------------------
    sti
    ret
;------------------------------------------------------------------------------------------
; The Game Loop
;------------------------------------------------------------------------------------------
game:
    ; cli                                     <--------- I May Want This Here ..... Apparently It Works Without It
    ;call getDIPs

    cmp byte [score], 0AH
    je callEndTune
    cmp byte [shotsLeft], 00H
    je callEndTune

    jmp dontCallEndTune
    callEndTune:
        call endTune

    dontCallEndTune:

    cmp byte [bool_game_over], 0FFH
    je gameOver

    test byte [bool_button_pressed], pushButton_bit
    jz continue
    jmp buttonPressed

    buttonPressed:
        mov byte [bool_button_pressed], 0     ; This Mov MUST be Here (for now)
        mov ch, 0H
        mov cl, [random]
        dec byte [shotsLeft]
        call delay
        call launchSkeet
    continue:

    mov cx, 01H
    call delay
    jmp game

    gameOver:
    ret
;------------------------------------------------------------------------------------------
; The End Game Subroutine
;------------------------------------------------------------------------------------------
endTune:

    cmp byte [score], 0AH
    je playVictory
    jmp playDefeat

    playVictory:
        call playG
        call playPauz
        call playG
        call playPauz
        call playG
        call playC5
        call playC5
        call playC5
        call playC5


    jmp donePlayingTune

    playDefeat:
        call playD
        call playD
        call playD
        call playSeeSh
        call playSeeSh
        call playSeeSh
        call playSee
        call playSee
        call playSee

    donePlayingTune:

    mov byte [bool_game_over], 0FFH

    mov al, PIT_ToSpeaker_Word
    out PIT_Command_Port, al

    ret
;------------------------------------------------------------------------------------------
; A Delay To Extend Musical Notes, Light Displays, etc - i.e. Slow Things Down For Us Dumb Humans
;------------------------------------------------------------------------------------------
delay:
    loop_delay:
    mov al, PIT_ToPPI_Word
    out PIT_Command_Port, al
    mov al, 0FFH
    out PIT_ToPPI_Port, al
    out PIT_ToPPI_Port, al

    monitor:
        in al, portc
        and al, 40H                          ; The Mask For The Timer On The PPI
        cmp al, 40H
        jne monitor                          ; Stay in this loop until the timer has finished
    loop loop_delay
    ret
;------------------------------------------------------------------------------------------
; The Interrupt Service Routine
;------------------------------------------------------------------------------------------
ISR:
    push ax
    push cx

    inc byte [random]
    cmp byte [random], 30H
    je resetRandom
    continueISR:
    in al, portc                             ; Get the button state
    mov ah, al
    not al                                   ; Need button closures to be 1s not 0s
    xchg al, [not_port_c]                    ; Update not_port_c, get old copy in al
    xor al, [not_port_c]                     ; al is now the changes
    and al, [not_port_c]                     ; al contains only the closures
    or [bool_button_pressed], al             ; set the button (closure) flag
    test byte [bool_button_pressed], pushButton_bit
    jz dontShoot
    jmp shootAtSkeet

    shootAtSkeet:
        cmp byte [bool_skeet_inAir], 0FFH
        jne dontShoot

        mov byte [bool_has_gunshot], 0FFH

        mov byte [bool_button_pressed], 00H ; This Mov MUST be Here (for now)
        mov byte [bool_skeet_inAir], 00H

    dontShoot:

    pop cx
    pop ax
    iret

resetRandom:
    mov byte [random], 10H                   ; Just Reseting The Random Variable To Be ~ 0.5 Seconds
    jmp continueISR
;------------------------------------------------------------------------------------------
; Gunshot Noise
;------------------------------------------------------------------------------------------
gunshot:
        mov cx, 0FFFH
        gunshotNoise:

            mov ax, 7980
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 5522
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 3377
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 2187
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 6217
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 8811
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 1234
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 4500
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 8187
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 2860
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 9817
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al
            mov ax, 4920
            out PIT_ToSpeaker_Port, al
            mov al, ah
            out PIT_ToSpeaker_Port, al

            loop gunshotNoise

            mov al, PIT_ToSpeaker_Word
            out PIT_Command_Port, al

    ret
;------------------------------------------------------------------------------------------
; Launch A Skeet
;------------------------------------------------------------------------------------------
launchSkeet:
    mov byte [bool_skeet_inAir], 0FFH

    mov byte [bool_hit_rightLED], 07H
    mov ax, See
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0DFFH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump
    mov ax, SeeSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0EFFH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump
    mov ax, D
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0F7FH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    jmp over
    mediaryGunShotJump:                      ; This is just shitty programming - and I am ashamed of myself.
        jmp gunHasShot                       ; The je 's are too short to reach the gunshot.
                                             ; So they jump here, and this is a 'launching' point to the gunshot.
                                             ; And I'm not really sure how to fix that any other way - but I know there must be a better way.
    over:

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump
    mov ax, DSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FBFH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump
    mov ax, E
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FDFH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx
    ;---------------------------------------------------------------------------

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump2
    mov ax, F
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FEFH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump2
    mov ax, FSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FF7H
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    jmp over2

    mediaryGunShotJump2:                     ; This is just shitty programming - and I am ashamed of myself.
        jmp gunHasShot                       ; The je 's are too short to reach the gunshot.
                                             ; So they jump here, and this is a 'launching' point to the gunshot.
                                             ; And I'm not really sure how to fix that any other way - but I know there must be a better way.
    over2:

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je mediaryGunShotJump2
    mov ax, G
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FFBH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx
    cmp byte[bool_has_gunshot], 0FFH
    je mediaryGunShotJump2

    mov byte [bool_hit_rightLED], 08H
    cmp byte[bool_has_gunshot], 0FFH
    je mediaryGunShotJump2
    mov ax, GSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FFDH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx
    ;---------------------------------------------------------------------------

    cmp byte [bool_has_gunshot], 0FFH
    je gunHasShot
    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je gunHasShot
    mov ax, A
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax,  0FFEH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    ;---------------------------------------------------------------------------

    mov byte [bool_hit_rightLED], 07H
    cmp byte [bool_has_gunshot], 0FFH
    je gunHasShot
    mov ax, ASh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ax, 0FFFH
    out porta, al
    mov al, ah
    mov ah, [score]
    shl ah,1
    shl ah,1
    shl ah,1
    shl ah,1
    or al, ah
    out portb, al
    mov ch, 00H
    mov cl, [gameSpeed]
    call delay
    inc bx
    inc bx

    mov al, PIT_ToSpeaker_Word
    out PIT_Command_Port, al
    mov byte [bool_has_gunshot], 00H
    mov byte [bool_skeet_inAir], 00H
    jmp gunHasNotShot

    ;---------------------------------------------------------------------------

    gunHasShot:

        call gunshot

        mov al, 0FFH
        out porta, al

        mov al, [bool_hit_rightLED]
        or al, 03H
        cmp byte [bool_hit_rightLED], 08H
        je incrementScore
        jmp outputShotResults

        incrementScore:
            inc byte [score]

        outputShotResults:
            mov ah, [score]
            shl ah,1
            shl ah,1
            shl ah,1
            shl ah,1
            or al, ah
            out portb, al

        mov byte [bool_has_gunshot], 00H

    gunHasNotShot:

    ret
;------------------------------------------------------------------------------------------
; Subroutines For Various Notes - This Could Have Been Implemented Better - But It Works
;------------------------------------------------------------------------------------------
playSee:
    mov ax, See
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playSeeSh:
    mov ax, SeeSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playD:
    mov ax, D
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playDSh:
    mov ax, DSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playE:
    mov ax, E
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playF:
    mov ax, F
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playFSh:
    mov ax, FSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playG:
    mov ax, G
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playGSh:
    mov ax, GSh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playA:
    mov ax, A
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playASh:
    mov ax, ASh
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playB:
    mov ax, B
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playC5:
    mov ax, C5
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playB5:
    mov ax, B5
    out PIT_ToSpeaker_Port, al
    mov al, ah
    out PIT_ToSpeaker_Port, al
    mov ch, 00H
    mov cl, 0FH
    call delay
    ret
playPauz:
    mov al, PIT_ToSpeaker_Word
    out PIT_Command_Port, al
    mov ch, 00H
    mov cl, 04H
    call delay
    ret

;------------------------------------------------------------------------------------------
; Some Reset Stuff
;------------------------------------------------------------------------------------------
times prog_size - 10H - ($-$$) db 0FFH

xor ax, ax
mov ds, ax
mov ss, ax
mov es, ax
mov sp, ram_size-2
jmp code_seg:startup

What I learned

Well, quite a lot! First of all, I had never built any electronics more complex than some simple logic-gate circuits on breadboards. Nor had I ever written any assembly, or any code that close to the metal. Nor had I ever used a logic analyzer! It was a lot to come up to speed on quickly!

But those weren’t the major engineering takeaways. The major takeaway, beyond a deeper understanding of microprocessor theory, was the importance and value of building complex systems one piece at a time. It’s important to decompose large, complex systems into smaller subsystems. These smaller subsystems can then be individually built, tested, validated… and, most importantly, debugged.

As you can see from the schematics, there were six distinct subsystems. Each one had to be designed and then built.

For each subsystem, I’d start by testing that every individual wire-wrap had a good connection. Then I’d write small test programs to exercise the subsystem, trying to hit every pin in some way, and validate all of the I/O and addressing signals with a logic analyzer.

Decomposing complex systems and validating subsystems individually is something I’ve carried forward throughout my career. In addition to being a fantastic way to simply maintain your sanity, it’s also one of the best ways to divide and conquer when it comes time to delegate across a multi-person team.

While this project was a long time ago, it’s one I’ll never forget!

The full source, with notes on how it was transcribed and checked, is on GitHub: davewkennedy/8088-duck-hunt (opens in a new tab).