Overview
A single lit LED bounces left and right across the 8 breadboard LEDs, like the scanner on KITT from Knight Rider. Each step advances about 100 ms, sweeping 14 steps per full cycle. Runs forever — press ESC to stop and return to the KC Monitor.
Program Details
| Load address | $0800 — Program RAM |
| Run address | $0800 — press ▲ there |
| Program size | 38 bytes (24 code + 14 table) |
| LED register | $9400 — 74HC373 latch |
| Scan table | $0818 — 14 one-hot patterns |
| Step delay | ~100 ms via SysDelay at $A075 |
Type-In Bytes — Load at $0800
| ADDR |
+0 |
+1 |
+2 |
+3 |
+4 |
+5 |
+6 |
+7 |
| $0800 |
A0 | 00 |
B9 | 18 |
08 | 8D |
00 | 94 |
| $0808 |
5A | A9 |
0A | A2 |
00 | 20 |
75 | A0 |
| $0810 |
7A | C8 |
C0 | 0E |
D0 | EC |
80 | E8 |
| $0818 |
01 | 02 |
04 | 08 |
10 | 20 |
40 | 80 |
| $0820 |
40 | 20 |
10 | 08 |
04 | 02 |
— | — |
Rows $0818–$0825 (shown lighter) are the scan table — 14 one-hot bit patterns, not executable code.
How To Run
| 1 |
Press Reset — KC Monitor starts; the LCD shows the current address and byte. |
| 2 |
Key in 0 8 0 0 on the hex pad to navigate to address $0800. |
| 3 |
Press INS to enter data-edit mode. |
| 4 |
Key each byte as two hex digits (e.g., A 0 for $A0), then press ► to step to the next address. Repeat for all 38 bytes. |
| 5 |
Press INS to exit data-edit mode. |
| 6 |
Key in 0 8 0 0 to return to the start address. |
| 7 |
Press ▲ to run — the LED begins scanning back and forth! |
| 8 |
Press ESC to stop and return to the monitor. |
Assembly Source
; KIM LED Demo — KITT Scanner
; Assemble at $0800 · Run: press ▲ at $0800
;
; Equates ─────────────────────────────────
LED = $9400 ; 74HC373 LED latch
;
; Code ───────────────────────────────────
Start:
ldy #0 ; $A0 00 — table index = 0
Loop:
lda Table,y ; $B9 18 08 — load LED pattern
sta LED ; $8D 00 94 — display on LEDs
phy ; $5A — save Y (SysDelay clobbers)
lda #10 ; $A9 0A — 10 centiseconds
ldx #0 ; $A2 00 — SysDelay high byte
jsr $A075 ; $20 75 A0 — wait ~100 ms
ply ; $7A — restore Y
iny ; $C8 — next step
cpy #14 ; $C0 0E — 14 steps per cycle?
bne Loop ; $D0 EC — no: loop
bra Start ; $80 E8 — yes: restart sweep
;
; Scan table — 14 one-hot bit patterns
Table:
; sweep LED left → right (8 steps)
.byte $01,$02,$04,$08,$10,$20,$40,$80
; sweep LED right → left (6 steps)
.byte $40,$20,$10,$08,$04,$02
Notes
SysDelay — Kernal routine at $A075. It clobbers the Y register, so the code saves and restores Y with PHY / PLY around each call.
The scan table at $0818 holds 14 one-hot bytes — one bit set per byte, stepping from bit 0 (rightmost LED) to bit 7 (leftmost), then back to bit 1, skipping the endpoints to create a smooth bounce.
Scan cycle — 8 steps right, 6 steps left (no double-tap at either end), totaling 14 steps × 100 ms = 1.4 s per full sweep.
LDA Table,y uses absolute indexed Y addressing. The 16-bit table address ($0818) is embedded in the instruction bytes B9 18 08.