From 370135ddbd7d0bc7090afefb0e6239d3220f4968 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Fri, 26 Jan 2018 20:37:53 +0100 Subject: [PATCH] Hello world in MIDAS. --- README.md | 1 + doc/hello-midas.md | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 doc/hello-midas.md diff --git a/README.md b/README.md index aca6324c..8d74bb51 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ There are some short introductions for beginners: - [DDT cheat sheet for Unix users](doc/DDT.md) - [TECO survival guide](doc/TECO.md) - [DDT debugging newbie guide](doc/debugging.md) +- [Hello MIDAS](doc/hello-midas.md) A list of [known ITS machines](doc/machines.md). diff --git a/doc/hello-midas.md b/doc/hello-midas.md new file mode 100644 index 00000000..218ab3a6 --- /dev/null +++ b/doc/hello-midas.md @@ -0,0 +1,39 @@ +# Hello world in MIDAS + +Step by step guide on how to create a hello world in MIDAS. + +1. Login. + +2. Start EMACS and enter this program. You can skip the comments. + + ``` + title hello + + a==1 ;Define two accumulators, + b==2 ;A and B. + ch==1 ;Output chanel number. + + start: .open ch,[.uao,,'tty] ;Open channel to TTY, for ASCII output. + .lose + move a,[440700,,hello] ;Load A with byte poiter to string. + loop: ildb b,a ;Load B from string. + jumpe b,[.logout 2,] ;End on zero byte. + .iot ch,b ;Print byte. + jrst loop + + hello: asciz /hello world/ + + end start ;Specify entry point. + ``` + +3. Save it as `hello 1` (^X^S) and exit (^X^C). + +4. Assemble it with MIDAS. + + :midas ts hello_hello + +5. Go back to EMACS with $P if you need to do edits. + +6. Run the program. + + :hello