TITLE PRINT
A=1 ;Symbolic AC names are defined
CHTTYO==1 ;Channel for output
;== means don't use this symbol
;for symbolic typeout in DDT.
START: ;Open TTY channel.
.CALL [SETZ ? SIXBIT/OPEN/
[.UAO,,CHTTYO] ? [SIXBIT/TTY/] ((SETZ))]
.LOSE %LSFIL
.IOT CHTTYO,["F] ;Print F.
.IOT CHTTYO,["O] ;Print O.
.IOT CHTTYO,["O] ;Print O.
.VALUE ;Halt program.
END START ;Tell MIDAS this is the end of the text
;and specify the address to start execution.
.CALL [SETZ ? SIXBIT/callname/ ? arguments ((SETZ))]
(Note that the value of SETZ is a word with just the sign bit set).
The [ ... ] construct is a literal, and "?" is equivalent to a line
separator. Thus, the .CALL instruction is assembled with an address
field that points at a block of words containing a SETZ, a
SIXBIT/OPEN/, and finally the arguments. ((SETZ)) is a magic
assembler incantation which sets the sign bit of the last argument
word.The arguments are simply addresses of words containing data for the system call. There are other kinds of arguments, but we won't get into that. See .INFO.;.CALLS > for more information on symbolic system calls.
A symbolic system call skips if it is successful.
Most OPENs will also specify two filenames and a directory name as additional arguments, but for device TTY they are not necessary.