{"id":29656240,"url":"https://github.com/pozsarzs/alanz80","last_synced_at":"2026-01-20T16:26:54.142Z","repository":{"id":302785075,"uuid":"1009835809","full_name":"pozsarzs/alanz80","owner":"pozsarzs","description":"Turing machine implementation for CP/M and DOS","archived":false,"fork":false,"pushed_at":"2025-08-22T16:45:26.000Z","size":349,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-14T14:44:35.125Z","etag":null,"topics":["cpm","dos","turbopascal3","turing-machine"],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pozsarzs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-27T19:52:32.000Z","updated_at":"2025-08-22T16:45:29.000Z","dependencies_parsed_at":"2025-07-04T08:32:26.893Z","dependency_job_id":"68b166fc-1d3c-415b-abe8-1f8b9b8d9fc1","html_url":"https://github.com/pozsarzs/alanz80","commit_stats":null,"previous_names":["pozsarzs/alanz80"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pozsarzs/alanz80","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozsarzs%2Falanz80","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozsarzs%2Falanz80/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozsarzs%2Falanz80/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozsarzs%2Falanz80/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pozsarzs","download_url":"https://codeload.github.com/pozsarzs/alanz80/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozsarzs%2Falanz80/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpm","dos","turbopascal3","turing-machine"],"created_at":"2025-07-22T08:34:16.221Z","updated_at":"2026-01-20T16:26:54.128Z","avatar_url":"https://github.com/pozsarzs.png","language":"Pascal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlanZ80\r\n\r\n**A Turing machine implementation**  \r\n\r\n## About Turing machine\r\n\r\nA Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer algorithm.\r\n\r\nThe machine operates on an infinite memory tape divided into discrete cells, each of which can hold a single symbol drawn from a finite set of symbols called the alphabet of the machine. It has a \"head\" that, at any point in the machine's operation, is positioned over one of these cells, and a \"state\" selected from a finite set of states. At each step of its operation, the head reads the symbol in its cell. Then, based on the symbol and the machine's own present state, the machine writes a symbol into the same cell, and moves the head one step to the left or the right, or halts the computation. The choice of which replacement symbol to write, which direction to move the head, and whether to halt is based on a finite table that specifies what to do for each combination of the current state and the symbol that is read. As with a real computer program, it is possible for a Turing machine to go into an infinite loop which will never halt.\r\n\r\nThe Turing machine was invented in 1936 by Alan Turing, who called it an \"a-machine\" (automatic machine). [^1]\r\n\r\n(Source: Wikipedia – Turing machine, CC BY-SA 4.0) [^2]\r\n\r\n\r\n## About this implementation\r\n\r\nLike Turing's original model, this implementation can only work in three ways. What is different is the physical limitations of the implementation, as it cannot be infinite. The number of states and tape symbols is limited, which is still enough to write a sufficiently complex algorithm. The length of the virtual tape is not infinite and the starting position, where processing starts by default, is halfway along the entire length. The starting position can be changed.\r\n\r\nThe machine reads the program from the t36 file. The program has both mandatory and optional sections. In the mandatory section, the number of states, symbols, and algorithm are defined. In the optional section, the initial contents of the tape can be specified; if there is none, the machine prompts for it. In addition, simple commands can be specified that affect the machine's operation during runtime.\r\n\r\nCopyright (C) 2025 Pozsár Zsolt \u003cpozsarzs@gmail.com\u003e  \r\n\r\n\r\n### Features\r\n\r\n|features                |                                                     |\r\n|------------------------|-----------------------------------------------------|\r\n|version                 |v0.1                                                 |\r\n|licence                 |EUPL v1.2                                            |\r\n|language                |en                                                   |\r\n|user interface          |CLI                                                  |\r\n|programming language    |Borland Turbo Pascal 3.x                             |\r\n|architecture            |ix86, Z80                                            |\r\n|OS                      |CP/M and DOS (and others, see comments in the source.|\r\n|symbol set              |up to 40 characters                                  |\r\n|state set               |up to 50 states                                      |\r\n|virtual tape length     |255 cell                                             |\r\n|tape input data length  |50 cell                                              |\r\n|example program         |4 scripts                                            |\r\n|load from file          |program code (*.t36)                                 |\r\n|built-in commands       |15 (can also be used in a program file)              |\r\n\r\n### Screenshots\r\n\r\nStartup screen\r\n![CLI](startup.png)\r\n\r\nOperation with tracking\r\n![CLI](numswap.png)\r\n\r\n\r\n### Configuration and operation\r\n\r\n#### Program file format\r\n\r\nThis is an example program that demonstrates inputting data into a Turing machine. Explanations are included in the comments.\r\n\r\n```\r\n; It is an example input datafile for AlanZ80\r\n\r\nPROG BEGIN\r\nNAME EXAMPLE1\r\n; program description\r\nDESC Swapping numbers back and forth                                           \r\n; symbol set without blank symbol\r\nSYMB 0123456789\r\n; number of the states with q00\r\nSTAT 3\r\n\r\n; Section program card, this is mandatory\r\nCARD BEGIN\r\n     ; qi SjSkDqm SjSkDqm SjSkDqm SjSkDqm ...\r\n     ST01 01R01 12R01 23R01 34R01 45R01 56R01 67R01 78R01 89R01 90R01 __S02\r\n     ST02 09L02 10L02 21L02 32L02 43L02 54L02 65L02 76L02 87L02 98L02 __S00\r\nCARD END\r\n\r\n; Section tape content, this is optional.\r\nTAPE BEGIN\r\n     ; The asterisk indicates the start position (SPOS):\r\n     ;    *\r\n     SYMB 0123456789\r\n     SPOS 1\r\nTAPE END\r\n                                                                                \r\n; Section commands, this is optional.\r\n; These commands affect the program running and can be specified \r\n; from the command line.\r\n; There can be a maximum of 16 lines and a maximum of 255 characters per line.\r\nCOMM BEGIN\r\n     ; show all operation\r\n     TRACE ON\r\n     ; run step-by-step\r\n     STEP\r\n     RESTORE\r\nCOMM END\r\n\r\nPROG END\r\n```\r\n\r\nThe CONF section specifies the number of states and the symbol set used by the machine. The algorithm in the CARD section will be checked against these.\r\n\r\n#### State set\r\n\r\nThe state is called an m-configuration in Turing terminology. The finite set of states is as follows:\r\n\r\nQ = {q00..q49}, where the\r\n\r\n- q00 is the mandatory final state,\r\n- q01 is the mandatory start state,\r\n- q02-q49 are optional additional states.\r\n\r\nThe cardinality of the set is at least two, even if less is specified in the CONF section.\r\n\r\n#### Tape symbols\r\n\r\nFinite set of tape symbols is as follows:\r\n\r\nS = {s00..s39}, where the\r\n\r\n- s00 is the mandatory blank (_) character.\r\n- s01-s39 is are optional symbols.\r\n\r\nThe set has cardinality at least one, and its first element is always the blank\r\nsymbol. If the first symbol specified in the CONF section is not blank, then it\r\nwill be inserted.\r\n\r\n#### Head movement directions\r\n\r\nFinite set of head movement directions is as follows:\r\n\r\nD = {'L', 'S', 'R'}, where the\r\n\r\n- L is the left direction,\r\n- S is the stay here, and\r\n- R is the right direction.\r\n\r\n#### Operation\r\n\r\n|   |initial state|read|write|move |final state|      5-tuple      |\r\n|:-:|:-----------:|:--:|:---:|:---:|:---------:|:-----------------:|\r\n|N1 |      qi     | sj | sk  |left |    qm     |(qi, sj, sk, l, qm)|\t\r\n|N2 |      qi     | sj | sk  |right|    qm     |(qi, sj, sk, r, qm)|\t\r\n|N3 |      qi     | sj | sk  |none |    qm     |(qi, sj, sk, n, qm)|\t\r\n\r\nNote:\r\n- D is the head moving direction, D = {r, n, l}.\r\n- qi is the actual state, qi ∈ Q.\r\n- qm is the next state, qm ∈ Q.\r\n- sj is the actual symbol read from the tape, sj ∈ S.\r\n- sk is the symbol to be written to the tape, sk ∈ S.\r\n\r\nIn the CARD section of the program, the 5-tuples must be specified in the\r\nfollowing form `ST01 abL01 __N00`, where the:\r\n- `ST01` is the initial state (qi),\r\n- `a` and `_` in the groups are read symbols,\r\n- `b` and `_` in the groups are symbols to be written,\r\n- `L` and `N` in the groups are head moving directions,\r\n- `01` and `00` in the groups are final states.\r\n\r\n#### Command line commands\r\n\r\nThe program can be controlled with the following command line commands.\r\n\r\n|   |command                     |description                                 |\r\n|--:|----------------------------|--------------------------------------------|\r\n|  1|`break [01..49\\|-]`         |set, get and reset breakpoint state (qb)    |\r\n|  2|`help [command]`            |help with using the program                 |\r\n|  3|`info`                      |show all information about this machine     |\r\n|  4|`limit [10..32767\\|-]`      |set, get and reset number of steps          |\r\n|  5|`load filename.t36`         |load program file                           |\r\n|  6|`prog`                      |show program data                           |\r\n|  7|`quit`                      |exit the AlanZ80 program                    |\r\n|  8|`reset`                     |reset program                               |\r\n|  9|`restore`                   |restore Turing-machine to original state    |\r\n| 10|`run [head pos.: -50..+50]` |run program from head position              |\r\n| 11|`state [2..49]`             |set and get number of state (\\|Q\\|)         |\r\n| 12|`step [head pos.: -50..+50]`|run program step-by-step from head position |\r\n| 13|`symbol [symbols\\|-]`       |set, get and reset symbol set (S)           |\r\n| 14|`tape [content\\|-]`         |set, get and reset tape content             |\r\n| 15|`trace [on\\|off]`           |turn tracking on and off                    |\r\n\r\n[^1]: [\"On Computable Numbers, with an Application to the Entscheidungsproblem\"](https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf)\r\n\r\n[^2]: [Wikipedia – Turing machine, CC BY-SA 4.0](https://en.wikipedia.org/wiki/Turing_machine)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpozsarzs%2Falanz80","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpozsarzs%2Falanz80","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpozsarzs%2Falanz80/lists"}