Skip to content

Latest commit

 

History

History
108 lines (88 loc) · 3.28 KB

README.md

File metadata and controls

108 lines (88 loc) · 3.28 KB

Sim-CPU

CPU Simulations written in Ada

This is spun off of the Pi-Mainframe repository. Moving simulation into a separate repository will allow simulators to be developed more independently as well as used in other applications.

[Alire] (https://alire.ada.dev/crates/bbs_simcpu.html)

[Alire] (https://alire.ada.dev/crates/simcpucli.html)

[Alire] (https://alire.ada.dev/crates/loadcpm.html)

Implementation

The root of the simulators is the abstract object "simulator" defined in the BBS.Sim_CPU package. It defined the external interface that all simulators must implement. It is expected to evolve as some actual CPU simulators get implemented.

Simulators

The following simulators are implemented.

Simple Example

This is not really a CPU simulator. Its main purpose is to blink the lights in the Pi-Mainframe in interesting patterns.

Intel 8080

More information

All 8080/8085 and Z-80 instructions have been implemented.

Motorola 68000

More information

All the 68000 CPU instructions have been implemented.

MOS Technologies 6502

More information

All of the instructions have been implemented and tested. I/O and interrupts also have been implemented and tested.

CLI

A command line interface is provided for development of both the simulators and software that runs on the simulator.

The following commands are currently provided:

  • BREAK
    • Set a breakpoint (currently only one can be active at a time)
  • CONTINUE
    • Continue execution
  • DEP
    • Deposit value to a memory location
  • DISK
    • Assorted commands for disk images
  • DUMP
    • Display a region of memory
  • EXIT or QUIT
    • EXIT the program
  • GO
    • Start execution at a specified address
  • LISP
    • Enter Lisp interpreter
  • LIST
    • List attached I/O devices
  • LOAD
    • Load data from a file into memory
  • REG
    • Display register values
  • RUN
    • Execute instructions until halt or breakpoint
  • STEP
    • Execute one instruction
  • TRACE
    • Print information for each instruction executed
  • UNBREAK
    • Remove a breakpoint

Lisp

For more information on the embedded tiny-Lisp interpreter.

The following additional Lisp words are implemented for controlling the simulation. With use, more words may be added.

  • Execute one instruction
    • (sim-step)
  • Get/set memory (byte/word/long)
    • (memb addr value)
    • (memb addr)
    • (memw addr value)
    • (memw addr)
    • (meml addr value)
    • (meml addr)
  • Set execution address
    • (go address)
  • Read register value (index is simulator dependent)
    • (reg-val index)
  • Return number of registers
    • (num-reg)
  • Return or set simulator halted state
    • (halted state)
    • (halted)