Clone
5
Architecture
Jali edited this page 2026-10-31 18:56:13 +01:00

Architecture

Introduction

To get the PDP-10 to solve sudokus and learn how to code in PDP-10 assembly, we should first consider, what functions we need, and how to structure the code, so we can build small, fast and reusable functions. Since organising code in assembly is a lot harder than in high-level programming languages such as LISP and C, we should first plan how the program should look like, before we start writing the actual code. This way, we can encapsulate the code and make it reusable. The program will follow a simple flow:

---
title: Program-Flow
---
flowchart TD
    start((Start))
    print1["Print Welcome Message"]
    cmdline["Read file name from command line"]
    fileexists{"File Exists?"}
    loadfile["Load grid from file"]
    print2["Print board"]
    solve[["Solve the puzzle"]]
    print3["Print solved board"]    
    stop((Stop))

    start --> print1
    print1 --> fileexists
    fileexists -->|Yes| cmdline
    fileexists -->|No| stop
    cmdline --> loadfile
    loadfile --> print2
    print2 --> solve
    solve --> print3
    print3 --> stop

The program can be split into multiple parts. The above diagram showing the general flow, but putting the solve puzzle part into a black box. This subroutine contains the actual algorithm, and will be analysed later. The other functions a more trivial, but nonetheless necessary. We need:

  • A routine that prints text on the terminal
  • We need a routine, that can grab the parameters a user passed to the command line, and read the command line parameters. since ITS does not have a built-in mechanism for this, we need to write our own.
  • We need to be able to open the file, that was passed to us, and open it, as well as reading the data from it.
  • We need a data structure to store the playing field in.
  • We need a routine, that clears the screen and shows the current state of the playing grid on the screen.