2022-09-11 16:44:53 +00:00
|
|
|
|
Thingamajig v1.1-dev
|
|
|
|
|
====================
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
2022-09-12 21:05:37 +00:00
|
|
|
|
Thingamajig v1.1 is a RISC/MISC homebrew computer architecture. Its git
|
2022-09-08 20:50:13 +00:00
|
|
|
|
repository can be found at
|
2022-08-18 21:14:06 +00:00
|
|
|
|
https://ahti.space/git/crazyettin/Thingamajig.
|
|
|
|
|
|
|
|
|
|
Included Software
|
|
|
|
|
-----------------
|
|
|
|
|
|
2022-08-23 15:37:59 +00:00
|
|
|
|
The repository includes an emulator implementation of Thingamajig with a
|
2022-09-18 13:34:36 +00:00
|
|
|
|
control program for the emulated paper tape reader and punch, and an
|
2022-08-18 21:14:06 +00:00
|
|
|
|
assembler and a disassembler, all written in FreePascal. It also
|
|
|
|
|
includes couple of simple example programs for Thingamajig written in
|
2022-09-08 20:11:24 +00:00
|
|
|
|
assembly.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
|
|
|
|
Registers and Memory
|
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
* 24-bit instruction register IR
|
|
|
|
|
* 16-bit instruction and return pointers IP and RP
|
|
|
|
|
* 8-bit general-purpose registers R0-R3
|
|
|
|
|
* 8-bit memory locations 0-FFFF
|
|
|
|
|
|
2022-08-26 11:36:42 +00:00
|
|
|
|
Multi-byte values are big-endian. Memory locations 0-FFEF are used for
|
2022-09-15 17:54:29 +00:00
|
|
|
|
RAM while FFF0-FFFF are reserved for memory mapped devices.
|
|
|
|
|
|
|
|
|
|
Input and output are mapped to address FFFF, while arbitrary devices can
|
|
|
|
|
be mapped to the other reserved addresses. When interacting with memory
|
|
|
|
|
mapped devices Thingamajig will stop processing to wait for the device
|
|
|
|
|
to be ready if needed.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
|
|
|
|
Instructions
|
|
|
|
|
------------
|
|
|
|
|
|
2022-08-25 14:19:32 +00:00
|
|
|
|
Instructions without an immediate or address argument are 8-bit, those
|
|
|
|
|
with an immediate one 16-bit, and those with an address one 24-bit. The
|
|
|
|
|
instruction pointer is incremented before being accessed or modified.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
|
|
|
|
0 HALT
|
|
|
|
|
1 RET IP = *RP; RP += 2
|
|
|
|
|
|
2022-09-11 16:44:53 +00:00
|
|
|
|
2 SHL RX, N RX <<= N (logical) Shifts of 1-4 steps,
|
|
|
|
|
3 SHR RX, N RX >>= N (logical) with 4 encoded as 0
|
|
|
|
|
4 ROL RX, N RX <<= N (rotating) in machine code.
|
|
|
|
|
5 ROR RX, N RX >>= N (rotating)
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
|
|
|
|
6 NAND RX, RY RX = ~(RX & RY)
|
|
|
|
|
7 AND RX, RY RX &= RY
|
|
|
|
|
8 OR RX, RY RX |= RY
|
|
|
|
|
9 XOR RX, RY RX ^= RY
|
|
|
|
|
|
2022-08-25 14:19:32 +00:00
|
|
|
|
A LOAD RX, ~0, IMM RX = IMM Written as "LOAD RX, #IMM"
|
|
|
|
|
0, ADDR RX = *ADDR Written as "LOAD RX, ADDR"
|
|
|
|
|
B STORE RY, ADDR *ADDR = RY Written as "STORE ADDR, RY"
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
|
|
|
|
C BREQ RX, RY, ADDR if (RX == RY) IP = ADDR
|
|
|
|
|
D BRNEQ RX, RY, ADDR if (RX != RY) IP = ADDR
|
|
|
|
|
E CLEQ RX, RY, ADDR if (RX == RY) {RP -= 2; *RP = IP; IP = ADDR}
|
|
|
|
|
F CLNEQ RX, RY, ADDR if (RX != RY) {RP -= 2; *RP = IP; IP = ADDR}
|
|
|
|
|
|
|
|
|
|
Assembly Language
|
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
|
|
Lines of assembly are of the following form:
|
|
|
|
|
|
|
|
|
|
LABEL: OPER ARG1, ARG2, ARG3 ;Comment
|
|
|
|
|
|
|
|
|
|
The language is case-insensitive and uses hexadecimal numbers. A label
|
|
|
|
|
can consist of any alphanumeric characters as long as it is not
|
|
|
|
|
interpretable as a hexadecimal number. The label, instruction, and
|
|
|
|
|
comment elements are all optional, as is spacing between the arguments.
|
|
|
|
|
For the arguments of each instruction see the previous section.
|
|
|
|
|
|
|
|
|
|
Address arguments can be either absolute addresses or references to or
|
2022-09-08 20:11:24 +00:00
|
|
|
|
relative to a label. Relative references are of the form LABEL +/- N;
|
|
|
|
|
the spacing is optional.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
|
|
|
|
In addition to the true instructions there are three
|
2022-09-15 17:54:29 +00:00
|
|
|
|
pseudo-instructions. ORG sets the location of the following code and
|
|
|
|
|
data; as it has no direct equivalent in machine code it cannot have a
|
|
|
|
|
label. The default starting address of 0 does not need to be indicated
|
|
|
|
|
with ORG. DATA introduces a byte of data. ADDR introduces two bytes of
|
|
|
|
|
data containing the address of a reference to or relative to a label.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
2022-08-26 11:36:42 +00:00
|
|
|
|
Boot
|
|
|
|
|
----
|
|
|
|
|
|
2022-08-29 21:48:37 +00:00
|
|
|
|
At boot the initial program loader (IPL) loads a program to RAM starting
|
|
|
|
|
at address 0 after which is cedes control to the CPU. If an
|
|
|
|
|
implementation has a front panel the IPL is optional. The instruction
|
|
|
|
|
and return pointers are initialised as 0 and the first address after RAM
|
|
|
|
|
respectively, while other registers and RAM are uninitialised.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
2022-09-16 12:04:05 +00:00
|
|
|
|
Emulator and Tapectl
|
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
* emulator (-v) program (2> verbose_output)
|
|
|
|
|
* tapectl (-r reader_file) (-p punch_file)
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
2022-09-18 13:34:36 +00:00
|
|
|
|
By default the emulator runs at roughly 500 KIPS and has 2 KiB of RAM.
|
|
|
|
|
The arguments -dRAM4, -dRAM8, -dRAM16, -dRAM32, and -dRAM64 can be used
|
|
|
|
|
to compile the emulator with 4, 8, 16, 32, or 64 KiB (minus the reserved
|
|
|
|
|
addresses) of RAM respectively instead and the speed limitations can be
|
|
|
|
|
removed with the argument -dfast. When run with the argument -v the
|
|
|
|
|
current state of the registers is output to stderr before each
|
|
|
|
|
instruction.
|
|
|
|
|
|
|
|
|
|
Input and output are handled by an emulated roughly 1000 CPS
|
|
|
|
|
ASCII-compatible glass teletype terminal with local echo on by default.
|
|
|
|
|
Of the control characters bell (^G), backspace (^H), line feed (^J),
|
|
|
|
|
carriage return (^M), and device control characters two (^R) and four
|
|
|
|
|
(^T) are used by the terminal: the device control characters are used to
|
|
|
|
|
turn the local echo on and off respectively while the rest have their
|
|
|
|
|
standard uses. The backspace and delete keys input their respective
|
|
|
|
|
characters and non-character keys null.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
2022-08-24 11:40:41 +00:00
|
|
|
|
In Linux the emulator can be compiled with support for a character
|
2022-09-18 22:08:12 +00:00
|
|
|
|
printer and an emulated high speed (roughly 500 CPS in and 50 CPS out)
|
|
|
|
|
paper tape reader and punch with the arguments -dprinter and -dtape
|
|
|
|
|
respectively. The printer is mapped to address FFFE and the tape reader
|
|
|
|
|
and punch to FFFD. The printer prints into /dev/usb/lp0 and the tape
|
|
|
|
|
files read from and punched to are (re)set using the program tapectl
|
|
|
|
|
with the arguments -r and -p respectively.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|
2022-09-16 12:04:05 +00:00
|
|
|
|
The IPL loads the program specified as an argument when running the
|
2022-08-26 11:36:42 +00:00
|
|
|
|
emulator.
|
2022-09-16 12:04:05 +00:00
|
|
|
|
|
|
|
|
|
Assembler and Disassembler
|
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
* assembler program (< input)
|
|
|
|
|
* disassembler program (> output)
|
|
|
|
|
|
|
|
|
|
Both the assembler and the disassembler are run with a program as their
|
|
|
|
|
sole argument: they take their input from and print their output to
|
|
|
|
|
stdin and stdout respectively.
|
|
|
|
|
|
|
|
|
|
An initial gap created with ORG is not included in an assembled program.
|
|
|
|
|
All possible interpretations of a disassembled program are included in
|
|
|
|
|
its listing, resulting in overlapping information.
|
2022-08-18 21:14:06 +00:00
|
|
|
|
|