Skip to content

sanzaru/ibm-1401

Repository files navigation

Swift

IBM 1401 Emulator in Swift

This project is some very early and incomplete version of an IBM 1401 emulator written in Swift.

While studying the machine and finishing a simple hello world punch card code, it was hard for me to test my code as there are not many emulators for the machine and I was not able to make simh run at this time.

With the help of the amazing emulator of https://rolffson.de I was finally able to punch and run my code virtually on his software. Unfortunately, the project is only available for Microsoft Windows and more a 3D simulation than a convenient emulator, so I decided to write my own...

> Image: https://upload.wikimedia.org/wikipedia/commons/c/cb/BRL61-IBM_1401.jpg

More information about the machine itself: http://ibm-1401.info


Important

The whole emulator is incomplete. For now, not all opcodes and almost no validity and parity checks are implemented, yet.



Table of contents

Requirements

The code should run on any system that supports Swift 5.7 and higher.

The emulator depends on lib1401

Manual

Inside the project directory run: swift run to start the emulator. You will be welcomed with a prompt where you can enter your commands.

Emulator commands

Name Command Description Example
Load program l / load You can load external files with punch card code when providing an absolute path to the load command.

Without any file name a default hello world program will be loaded.
l /some/absolute/path/to/a/file.cd
Start / Step s / start This command emulates pressing the IBM 1401 start button in single step mode.
Run r / run This command emulates pressing the IBM 1401 start button in run mode.
Dump storage d / dump This command dumps the complete storage. Note that the output is in BCD mode.
Monitor m / monitor This command dumps all registers and contents.
Reset rst / reset Terminate execution cycle, reset core storage and registers. This command allows you to load and run another program.
Quit q / quit Quit the emulator

Features

  • Load arbitrary program from external file

  • Parity and validity checks for registers

  • Normal 1401 opcodes:

    • Set Word Mark (,)
    • Clear Storage (/)
    • Move (M)
    • Move Digit (D)
    • Move Zone (Y)
    • Halt (.)
    • Halt and branch (.)
    • No Operation (N)
    • Load (L)
    • Write a line (2) - Partially implemented
    • Clear word mark ())
    • Zero and add (&)
    • Add (A)
    • Branch or branch on indicator (B)
    • Compare (C)
    • Move numerical / digit (D)
    • Move characters and edit (E)
    • UNDOCUMENTED / UNCLEAR (G)
    • Zero and subtract (-)
    • Subtract (S)
    • Branch if word mark and/or zone (V)
    • Move characters and suppress zeros (Z)
    • Read a card (1)
    • Read a card and branch (1)
    • Write and read (3)
    • Punch a card (4)
    • Read and punch (5)
    • Write and punch (6)
    • Write, read and punch (7)
    • Move zone (Z)
  • Special:

    • Divide (()
    • Select stacker and other device controls (K)
    • Modify address (=)
    • Multiply ( )
    • Store B-Address register (H)
    • Move characters to record or group (P)
    • Store A-Address register (Q)
    • Branch if bit equal (W)
    • Move and insert zeros (X)
    • Start read feed (8)
    • Start punch feed (9)
  • Tape:

    • Control unit (U)
  • Printer:

    • Control carriage (F)
  • 1460-Features:

    • Translate (T)

Releases

No releases published

Packages

No packages published

Languages