MAVILERA SAP-1 Laboratory

MAVILERA SAP-1 Laboratory: documentation

Interactive Microprocessor Architecture Laboratory: Visualize. Execute. Understand.

About SAP-1

SAP-1 is the first of the simple-as-possible (SAP) computers, teaching designs by Albert Paul Malvino in his textbook Digital Computer Electronics (McGraw-Hill, first edition 1977; third edition with Jerald A. Brown, Glencoe/McGraw-Hill, 1993). The book presents SAP-1, SAP-2 and SAP-3 in turn as computers a student can build from digital components; its preface describes their instruction set as a subset of the Intel 8085's. SAP-1 is a textbook design, not a commercial product.

SAP-1 has five instructions (LDA, ADD, SUB, OUT and HLT), sixteen bytes of memory, an accumulator, a B register, an adder-subtracter and an output register on one 8-bit bus, the W bus. A controller-sequencer steps every instruction through six timing states.

Why it matters: SAP-1 shows the whole of a stored-program computer, fetch and execute, bus transfers and the control word, in parts few enough to follow one clock at a time. It prepares for the larger SAP-2 and for real 8-bit microprocessors.

Where it is seen today: Ben Eater has said that the programmable 8-bit computer he built on breadboards follows, roughly, the SAP-1 architecture of this book.

The detailed description of SAP-1 is chapter 10 of the book. The book has no DOI.

Getting started

  1. Open the application. The editor holds a short example program; Templates in the toolbar offers others, each showing one idea, with a note at the top on what to try.
  2. Press Assemble (Ctrl+Enter). The listing shows each byte with its address in hexadecimal and binary; errors are underlined in the editor and explained in the console.
  3. Press Step (F10) a few times. The current instruction is marked in the editor and the listing, and the registers A, B, OUT and PC change.
  4. Press Step back (Shift+F10) to undo a step, or Run (F5) to run to HLT or to a breakpoint.
  5. Choose Bus at the top. The same program now runs one timing state per step on the drawing of the computer.

The example program of a new session:

        LDA first     ; A <- M[first]
        ADD second    ; A <- A + M[second]
        SUB third     ; A <- A - M[third]
        OUT           ; OUT <- A
        HLT           ; stop the clock

        ORG 0DH       ; the data at the end of the memory
first:  DB 28
second: DB 17
third:  DB 5

The workspace

The page is a workspace of panes, as in a code editor.

Drag a divider to resize panes; the sizes are kept in this browser for each view.

Assembly language

One instruction or directive per line, with an optional label (ending in :) and an optional comment (starting with ;). Mnemonics are not case-sensitive.

FormWhat the assembler accepts
LDA a, ADD a, SUB aAn address a from 0 to 15, or a label
OUT, HLTNo operand
DB v, …Bytes, −128 to 255
ORG aThe address of what follows
NumbersDecimal (28), hexadecimal (0x1C, or 1CH starting with a digit) or binary (0b00011100)

What each instruction does is shown when you point at it in the editor; the full description of the computer is in the book listed under About SAP-1.

Running and debugging

The Bus view

The drawing shows the W bus and the units on it: program counter, MAR, memory, instruction register, controller-sequencer, accumulator A, adder-subtracter, register B, output register and its binary display, and the clock. Each step is one clock, one timing state.

Exercises

File ▸ Exercise… lists practice exercises written for MAVILERA, each with a task and a starter program. Run the tests runs your program from its start with each test's bytes in memory and shows expected against actual. No solutions are included. A teacher's exercise file (JSON, with "arch": "sap-1") opens with File ▸ Open.

Files, sharing and exports

ExportContents
.hex, .binThe memory image: one byte per line for $readmemh, or raw bytes. Import .hex/.bin… loads one.
ListingAddresses, bytes and source lines
Trace (JSON lines, CSV)One record per instruction from reset to HLT
Golden dump (Bus view)The values loaded into OUT, one byte per line in hexadecimal
Waveform, VCD (Bus view)The signals of the drawing, one clock per timing state

The run exports replay the program from reset to its halt; the session you are in is not changed.

Offline use and privacy

Keyboard reference

KeysAction
Ctrl+EnterAssemble
F5Run or pause
F10 / Shift+F10Step / step back (one timing state in the Bus view)
Ctrl+F10Run to the editor's line
Ctrl+FFind in the editor
Esc, then TabLeave the editor (inside it, Tab indents)
↑ ↓, Enter, BIn the listing: move, show the fields, set or clear a breakpoint
↑ ↓, WIn the registers: move, watch
Arrow keys on a dividerResize panes (Shift for larger steps; Enter restores)
Enter on a drawn elementOpen its details

Limits of the model

Licence and notices

© 2026 Sajid Muhaimin Choudhury. MAVILERA and its content (drawings, help texts, this documentation, example programs and exercises) are licensed under the Apache License, Version 2.0. The names and the logo are not licensed as trademarks.

SAP-1 is described in Digital Computer Electronics by Albert Paul Malvino and Jerald A. Brown, © 1977, 1983 McGraw-Hill, Inc. and © 1983, 1993 Glencoe/McGraw-Hill. MAVILERA reproduces no text or figure of the book; its simulator, drawings, help and programs are its own. It is not affiliated with or endorsed by the authors, the publisher or Ben Eater. Intel is a trademark of Intel Corporation or its subsidiaries.