Two implementations of the same microprocessor-lab project on an Intel 8086 (minimum mode): read digits from a 3×4 matrix keypad, store them in external RAM, and play them back on a 7-segment display (via a BCD→7-seg table kept in external ROM) using an 8255A PPI. Simulated in Proteus, assembled with emu8086.
Type digits → appended into RAM. Press
*→ shows the next stored digit (cycles through them in order). Press#→ clears everything.
| Demo (GIF) | Schematic |
|---|---|
![]() |
![]() |
| Demo (GIF) | Schematic |
|---|---|
![]() |
![]() |
Version 1 — version-1/ |
Version 2 — version-2/ |
|
|---|---|---|
| Goal | Simplified proof-of-concept | Full assignment-compliant design |
| RAM | 1× 6116 (2K×8) | 8× 6116 → 8K×16, even/odd banks, 40000H–43FFFH |
| ROM | 1× 2764 (8K×8) | 8× 2764 → 32K×16, even/odd banks, F0000H–FFFFFH |
| Address latch | 74LS373 | 74273 |
| Chip-select decode | 8-input NAND + inverters | 74LS139 read/write bank decoders + NAND |
| Program loading | #MAKE_BIN#, ORG 0000h, boots from external ROM |
Proteus Cheat Mode (Internal Memory = 0x10000), #MAKE_COM#, ORG 100h (CS=0x10, IP=0) |
| CPU clock | 5 MHz | 1 MHz |
| Segment setup | ES = RAM/ROM as needed |
DS = SS = 0, SP = 0FFFEh |
| Key fixes | latched address to decoder; first-write-lost → priming / write-verify; even-bank ×2 | stack-segment crash (use SS=0); keypad pull-up logic contention |
Shared by both: 8086 minimum mode · 8255A PPI · 3×4 keypad (rows → Port A, columns → Port C, active-low) · 7-seg → Port B · Control Word 81h · same 7-seg table · same behavior (store digits, * shows next cyclically, # clears).
| Part | Role |
|---|---|
| Intel 8086 (min mode) | CPU |
| 8255A PPI | Keypad + display I/O |
| 6116 SRAM | Stores entered digits |
| 2764 EPROM | BCD→7-seg lookup table |
| Address latches (74LS373 / 74273) | De-multiplex the address bus |
| 74LS245 | Data bus transceiver |
| NAND / inverters / 74LS139 | Address decoding |
| 3×4 matrix keypad + 10k pull-ups | Digit input (1–9, *, 0, #) |
| Common-cathode 7-segment + resistors | Display |
| Clock generator | 5 MHz (v1) / 1 MHz (v2) |
8255 ports (both versions)
| Port | Address | Direction | Use |
|---|---|---|---|
| Port A | 80h |
Output | Keypad rows (PA0–PA3), active-low scan |
| Port B | 82h |
Output | 7-segment segments |
| Port C | 84h |
Input (low 3 bits) | Keypad columns (PC0–PC2), pull-ups |
| CWR | 86h |
— | Control word = 81h |
Memory (Version 2, full spec)
| Device | Range | Capacity | Chips |
|---|---|---|---|
| RAM | 40000H–43FFFH |
8K×16 | 8× 6116 (4 even + 4 odd) |
| ROM | F0000H–FFFFFH |
32K×16 | 8× 2764 (4 even + 4 odd) |
(Version 1 uses a single 6116 at segment 4000h and a single 2764 at segment F000h.)
7-segment table (common cathode) — stored in ROM cells 0–9:
3F 06 5B 4F 66 6D 7D 07 7F 6F ; 0 1 2 3 4 5 6 7 8 9
- Init – configure the 8255 (
81h) and set up segments/pointers. - Keypad scan (
GET_KEY) – drive one row low at a time on Port A, read the 3 columns on Port C (active-low with pull-ups), map (row,col) → key value via aKEYMAPtable, with debounce and wait-for-release so each press registers once. - Store – a digit is appended to RAM at
index×2(even bank). - Show next (
*) – read the next stored digit, look up its 7-seg pattern in ROM (digit×2), drive it to Port B; the read index wraps back to the start after the last digit. - Clear (
#) – reset the counters and blank the display.
Device A0 ← CPU A1, so every cell sits at an even CPU offset → multiply each index by 2 (SHL BX,1).
- emu8086: assemble
main.asm(#MAKE_BIN#,ORG 0000h) →main.bin; build the ROM table →seg_table.bin. - Proteus: 8086 → Program File =
main.bin; EPROM (U20) → Image File =seg_table.bin. - Clock = 5 MHz → Play.
- emu8086: assemble
main.asm(#MAKE_COM#,ORG 100h). - Proteus Cheat Mode: set the 8086's Internal Memory Size =
0x10000; the program loads at physical0x100(CS=0x10, IP=0). - Build
rom.bin(#MAKE_BIN#, non-interleaved) and load it into the ROM chips with File Address Shift = 0 (same content in all 8 chips). - Clock = 1 MHz → Play.
Quick test: type 7, 2, 5 (nothing shows — stored only); press * → 7, * → 2, * → 5, * → back to 7 …; # clears and blanks the display.
.
├── version-1/ # simplified single-chip prototype
│ ├── src/ # main.asm (#MAKE_BIN#), seg_table.asm
│ ├── bin/ # main.bin, seg_table.bin
│ ├── proteus/ # .pdsprj
│ └── docs/ # schematic + demo
├── version-2/ # full 8K×16 RAM + 32K×16 ROM (Cheat Mode)
│ ├── src/ # main.asm (#MAKE_COM#), rom.asm (#MAKE_BIN#)
│ ├── bin/ # main.com/.bin, rom.bin
│ ├── proteus/ # .pdsprj
│ └── docs/ # schematic + demo
├── README.md # English (this file)
├── README.fa.md # فارسی
├── LICENSE
└── .gitignore
Both versions
- Keypad polarity: rows = Port A (output), columns = Port C (input) with 10k pull-ups → active-low (idle columns read
111, a pressed key reads0). Wrong pull wiring causes logic contention on key press and a stuck wait-for-release loop (nothing displays). - Even-bank addressing: multiply every RAM/ROM index by 2.
Version 1 specifics
- Chip-select decoders must use the latched upper address bits (
AA16–AA19), not the raw multiplexed pins, or RAM writes silently fail. - The first memory write in Proteus is dropped → use a priming dummy write and/or a write-and-verify loop so no digit is lost.
Version 2 specifics
- Cheat-Mode stack crash: do not set
SS = CS(CS=0x10puts the stack outside the internal 64K). UseXOR AX,AX / MOV DS,AX / MOV SS,AX / MOV SP,0FFFEhsoDS = SS = 0. - Undriven clock (
UNDRIVEN: U1,CLK) → attach a 1 MHz clock to pin 19. - Startup messages like
CTRLW SET TO 9BandWARNING: VDD connected to VCCare harmless.
- Multi-digit multiplexed display instead of a single 7-segment.
- Show the whole stored sequence with auto-scroll.
- Add a backspace key and RAM-buffer overflow protection.
Released under the MIT License — free to use for learning. See LICENSE.
Mohsen Norouzi
- GitHub: @mohsen-norouzi237
- Email: [email protected]
- LinkedIn: mohsen-norouzi
Built as a microprocessors course project (8086 + Proteus + emu8086).



