Level 26: Dice Roll

Task

Connect the LFSR (random number generator) to the data bus via a second BusOR.

LFSR (Linear Feedback Shift Register) — pseudo-random number generator. Accessible via port 250 (0xFA).

Solution

Each tick, LFSR outputs a new 8-bit "random" number on the data bus, if: - IO_SEL = 1 (address in I/O range: 224–255) - DevAddr = 0x1A (26 = LFSR port, 250 & 0x1F)

Tasks: 1. BusConstant = 2 → PC.Inc. 2. ROM#1 → RAM.Addr. 3. Connect LFSR.Data to the data bus via the SECOND BusOR: - First BusOR already joins RAM (via BusAND) and Gamepad. - Second BusOR (pre:BusOR#1) needs connection: first BusOR output → BusOR#1.A, LFSR.Data → BusOR#1.B. - BusOR#1 output goes to BusMUX (then to ALU8.B).

Now all three sources (RAM, Gamepad, LFSR) are correctly multiplexed onto the data bus via AddrDecoder.

Assembler help →