view TL1/tl1.html @ 175:c83545730d6c

openm
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 14 Apr 2019 17:17:34 +0900
parents ce695e5e38d8
children 63de06ad7a49
line wrap: on
line source

<html xmlns='http://www.w3.org/1999/xhtml'>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<head>
<title>TL/1 language specification</title>
<link rel='stylesheet' type='text/css' href='tl1.css' />
</head>
<body>
<h1>TL/1 language specification</h1>
<h2>Introduction</h2>
<p>TL/1 is a pascal like one pass compiler for 8bit cpu, which is implented by Hiroshi Ohnishi in 1980.
It has very fast compilation speed, but only supports 8bit variable and array. 16bit addressed memory can be accessed by MEM variable.

<h2> example TL/1 source </h2>

<a href="test/t1.tl1"> t1.tl1 </a>
<pre>
% TEST PROGRAM **
PROC WAIT,TIME
%--- MAIN ---
VAR I
BEGIN
  WRITE(1:"Do ")
  FOR I:=1 TO 10 DO [
    WRITE(1:I,CRLF)
    TIME
    ]
  WAIT
END
%-- PROCEDURE WAIT --
WAIT
VAR I,J,K
BEGIN
  FOR I:=0 TO 1 DO [
    FOR J:=0 TO 255 DO [
      FOR K:=0 TO 255 DO []]]
END
%-- PROCEDURE TIME --
TIME
VAR I,J
BEGIN
  FOR I:=0 TO 10 DO [
    FOR J:=0 TO 150 DO []]
END
</pre>

<a href="test/t2.tl1"> t2.tl1 </a>

<a href="test/t3.tl1"> t3.tl1 </a>

<p>This document is a summary of the language specification of the programming language TL/1. Based on the explanation in magazines and the web etc., it is what I reorganized into the format of the specification with the addition of my interpretation and the indication of ambiguous parts.</p>
<p>We may use terms that are not in the original document for the purpose of explanation.</p>
<p>The places in this text that are referred to as "undefined" are explicit indications that the original source material can not be judged.</p>
<p>Although <a href="tl1-syntax-diagram.xhtml">syntax diagrams </a> are prepared, it is better to read the sentences first and then refer to the syntax diagrams because there is a unique part in the interpretation of identifiers.
</p>

<h2>Token</h2>

<h3>Comment</h3>
<p>The percent sign (%) to the next newline is ignored, and it is treated as whitespace. Use it to describe the program description etc.</p>

<h3 id='identifier'>Identifier</h3>
<p>It consists of zero or more alphanumeric characters, beginning with an alphabetic character. The word continues up to just before a character (space or symbol) that does not form an identifier. Uppercase and lowercase letters are not distinguished.
  There is no upper limit on the identifier length.</p>
<p>Reserved words, procedure names, function names, global single variable names, global array names, small area single variables, and small area array names may have the same spelling. It is not checked at the time of declaration if it is identical to the existing name. Except where in the declaration, the implementation tries the name search in the following order and interprets it as the identifier of the first attribute found.</p>
<ol>
<li> Local array name </li>
<li> Local single variable name </li>
<li> Global array name </li>
<li> Global single variable name </li>
<li> function name </li>
<li> Procedure name </li>
<li> reserved words </li>
</ol>

<h3 id='number'>Number</h3>
<p> There are 4 types of expressions. </p>
<p> The numbers that can be handled directly with TL/1 are byte sizes, so the numeric representations that appear in a program are always in the range of 0-255. </p>
<p> In places where a boolean value is required in the syntax, 255 is interpreted as true, and other values are interpreted as false. A function that returns a boolean value returns 255 as true and 0 as false. </p>

<h4> decimal constant </h4>
<p> One or more of the characters 0-9 can be numbers in the range 0-255. </p>
<p> Behavior is not defined if you add an extra 0 at the beginning (such as 02). </p>

<h4> Hexadecimal constant </h4>
<p> Symbols beginning '$' which follows 0 to 9 or a to f represent 0 to 255 in hexadecimal notation. The letters a to f have the same meaning even if they use uppercase letters (A to F). </p>
<p> Do not put a space character after the symbol $. </p>
<p> It is permissible to add an extra 0 (for example $0A) to make two digits in hexadecimal, but if you add more 0 (for example $002) The behavior of) is undefined. </p>

<h4> Character literal constant </h4>
<p> Expressed by a single character between quotes. It is considered that the same numerical value as the one-letter ASCII code is written. </p>
<pre class = 'example'> 'A' has the same meaning as 65.</pre>

<h4> Logical constant </h4>
<p> represented by <span class = 'reserved'> TRUE </span> or <span class = 'reserved'> FALSE </span>. <span class = 'reserved'> TRUE </span> is equivalent to $FF and <span class = 'reserved'> FALSE </span> is equal to 0. </p>

<h3> symbol </h3>
<p> Others, symbols are used for operators and syntax, but they will be covered in the syntax description below. </p>

<h3> Space character </h3>
<p> It can be inserted between words. One word is sufficient for word separation, but the meaning does not change even if it continues several times. Please use it to adjust the appearance. The following characters are interpreted as whitespace characters. </p>
<ul>
<li> Character code less than $1F (control character) </li>
<li> Blank </li>
<li> Period (.) </li>
<li> Semicolon (;) </li>
</ul>
<p> There are also habitual meanings to how to use, which will be described later. </p>

<h2> Program configuration </h2>
<p> Programs are organized in the following order. </p>

<ol>
   <li> Procedure name declaration </li>
   <li> Function name declaration </li>
   <li> Global single variable name declaration </li>
   <li> Global array name / array size declaration </li>
   <li> Main program definition </li>
   <li> Procedure or function definition group </li>
</ol>

<p> The contents of each are as follows. </p>

<h3> Procedure Name Declaration </h3>
<p> Comma separated list of the procedure names to be used in the program following the reserved word <span class = 'reserved'> PROC </span>. 
</p>
<pre class = 'form'>
<span class = 'reserved'> PROC </span> <span class = 'metavar'> procedure 1 </span>, <span class = 'metavar'> procedure 2 </span>, <span class = 'metavar' > Procedure 3 </span> ...
</pre>
<p> The declaration can be ommited if there are zero procedures. </p>

<h3> Function name declaration </h3>
<p> Comma separated list of the function name to be used in the program following the reserved word <span class = 'reserved'> FUNC </span>. 
</p>
<pre class = 'form'>
<span class = 'reserved'> FUNC </span> <span class = 'metavar'> function 1 </span>, <span class = 'metavar'> function 2 </span>, <span class = 'metavar' > Function 3 </span> ...
</pre>
<p>If the number of functions is zero, the declaration is omitted. </p>

<h3> Global scalar variable name declaration </h3>
<p> Comma separated list of scalar variable names used throughout the program following the reserved word <span class = 'reserved'> VAR </span>. 
</p>
<pre class = 'form'>
<span class = 'reserved'> VAR </span> <span class = 'metavar'> single variable 1 </span>, <span class = 'metavar'> single variable 2 </span>, <span class = ' metavar '> single variable 3 </span> ...
</pre>
<p> The declaration can be ommited if there are zero global scalar variables. </p>
<p> The variables must be within 256 bytes in total with the global array described below. 
Furthermore, if you call <a href='#subprogram'> subprogram </a>, you need room for 2 bytes 
(the sum of global single variable and global array needs to be less than 254 bytes) . </p>

<h3> Global array name / array size declaration </h3>
<p> Camma separated list of an array name and its size to be used throughout the program following the reserved word <span class = 'reserved'> ARRAY </span>. 
The size of the array is indicated by the numerical value enclosed by square brackets after the array name.  </p>
<pre class = 'form'>

<span class='reserved'>ARRAY</span> <span class='metavar'>array1</span> [ <span class='metavar'>size of array1</span> ] ,
      <span class='metavar'>array2</span> [ <span class='metavar'>size of array2</span> ] ,
      <span class='metavar'>array3</span> [ <span class='metavar'>size of array3</span> ] ...
</pre>

<p> The size of the array is the maximum value of array subscripts. For example, for arrays declared as A[10], 
it means that they can be safely referenced with an index of 0-10. It is not the number of elements of the array such as C.
</p>
<h3> Main program definition </h3>
<p> 0 or more <a href='#statement'> statements </a> between <span class = 'reserved'> BEGIN </span> and <span class = 'reserved'> END </span> . </p>

<h3 id = 'subprogram'> Subprogram definitions </h3>
<p> A subprogram is a procedure or a function. It is organized in the following order: </p>
<ol>
<li> Sub-program name </li>
<li> formal argument list </li>
<li> Sub-area single variable name declaration </li>
<li> Small-area array name / array size declaration </li>
<li> Reserved words <span class = 'reserved'> BEGIN </span> </li>
<li> 0 or more statements </li>
<li> Reserved words <span class = 'reserved'> END </span> </li>
</ol>

<p> This is repeated by the number of subprograms. </p>
<p> The definition of a subprogram does not have to match the order of declaration. </p>

<h4> Sub program name </h4>

<p> The name must be delcared in the procedure or the function name declaration part of the program. </p>

<h4> Formal argument list </h4>
<p> Multiple identifiers enclosed in parentheses. Separate multiple identifiers with commas. </p>
<pre class = 'form'>
(<span class = 'metavar'> argument 1 </span>, <span class = 'metavar'> argument 2 </span>, <span class = 'metavar'> argument 3 </span> .. .)
</pre>
<p> Arguments are passed by values. These are local sacalar variables which are initialized with the actual argument at the time of invocation. 
(Implicit local scalar variable declaration) </p>
<p> If there are no arguments, you can omit the parentheses. </p>

<h4> Local scalar variable name declaration </h4>
<p> Declare single variables that can be referenced only in the relevant subprogram. The format is the same as a global single variable. </p>
<p> Omit the declaration if there are zero subregion single variables. </p>
<p> Similar to global single variables and global arrays, the combined size of the subregion single variables and the subregion array must be 256 bytes or less. </p>

<h4> Local array name declaration </h4>
<p> Declare an array that can be referenced only in the subprogram. The format is the same as for a global array. </p>


<h2 id='statement'>statements</h2>

<h3> compound statements </h3>
<p> You can combine 0 or more statements with one or more statements into one statement. </p >
<pre class = 'form'> <span class = 'reserved'> BEGIN </span> <span class = 'metavar'> statement list </span> <span class = 'reserved'> END </span> </pre>
<pre class = 'form'> {<span class = 'metavar'> statement list </span>} </pre>
<pre class = 'form'> [<span class = 'metavar'> statement list </span>] </pre>
<pre class = 'form'> (<span class = 'metavar'> statement list </span>) </pre>
<p> Compound sentences behave as if they were one statement, 
so they can appear anywhere the statement can appear in the following explanation. 
A compound statement with 0 enclosed execution statements is called a blank statement. </p>
<p> Any parenthesis means the same thing, but it must be closed with the corresponding closing parenthesis. 
For example, it is not possible to start with "{" and close it with "]". </p>
<p> It is customary to write a semicolon (;) which is ignored as a space character to separate each statement in a compound statement. </p>
<p> The main program and sub program text is also a kind of compound sentence, but as shown above, there must be in
<span class = 'reserved'> BEGIN </span> and <span class = 'reserved'> END </span>. 
You can not use other parentheses. </p>

<h3> STOP </h3>
<p> Stop the execution and jump to the monitor. </p>
<p> It is inserted automatically at the end of the main program, so it does not have to be written, but it can be written anywhere in the main program / subprogram. </p>
<h3> RETURN </h3>
<p> Returns from a procedure or function. </p>
<pre class='form'>
<span class='reserved'>RETURN</span>
</pre>
<pre class='form'>
<span class='reserved'>RETURN</span> <span class='metavar'>expression</span>
</pre>

<p> When returning from a procedure, write in a format without an expression, and when returning from a function, write in a format followed by one expression. </p>
<p> It is inserted automatically at the end of the procedure, so it does not have to be written, but it can be used anywhere in the procedure. (Do not use it in <span class = 'reserved'> FOR </span> loop in some implementations). </P>
<p> At least one must be used in the function definition. (Note that it is not checked at compile time. Also, 
should not be used in a <span class = 'reserved'> FOR </span> loop) </p>
The behavior when hit is undefined when it reached
to the end (<span class = 'reserved'> END </span>, which represents the end of the function definition) 
without passing <span class = 'reserved'> RETURN </span> statement in a function </p>

<h3> FOR </h3>
<p> Repeats statements while changing the value of a single variable. </p>
<pre class = 'form'>
<span class = 'reserved'> FOR </span> <span class = 'metavar'> variable </span>: = <span class = 'metavar'> expression </span> <span class = 'reserved'> TO </span> <span class = 'metavar'> expression </span> <span class = 'reserved'> DO </span> <span class = 'metavar'> statements </span>
</pre>
<pre class = 'form'>
<span class = 'reserved'> FOR </span> <span class = 'metavar'> variable </span>: = <span class = 'metavar'> expression 1 </span> <span class = 'reserved' > DOWNTO </span> <span class = 'metavar'> expression 2 </span> <span class = 'reserved'> DO </span> <span class = 'metavar'> statements </span> </pre> >
Assign the value of the expression to <span class = 'metavar'> the scalar variable </span> for <p> counting, and increment or decrease <span class = 'metavar'> scalar variable </span> by 1 at a time,  repeat executing the statements. </p>
The increment of <p> <span class = 'metavar'> variable </span> is +1 when <span class = 'reserved'> TO </span> is used, <span class = 'reserved'> DOWNTO When using </span> it is -1. (<span class='reserved'>  DOWNTO </span>can not use <span class = 'reserved'> DOWNTO </span> on some implementations.) </P>

<h3> REPEAT </h3>
<pre class = 'form'> <span class = 'reserved'> REPEAT </span> <span class = 'metavar'> statement list </span> <span class = 'reserved'> UNTIL </span> <span class = 'metavar'> expression </span> </pre>
<span class = 'metavar'> statement list </span> is repeated until the value of <p> <span class = 'metavar'> expression </span> becomes true. <span class = 'metavar'> statement list </span> is a sequence of zero or more execution statements. </p>

<h3> WHILE </h3>
<pre class = 'form'> <span class = 'reserved'> WHILE </span> <span class = 'metavar'> expression </span> <span class = 'reserved'> DO </span> <span class = 'metavar'> statement </span> </pre>
If the value of <p> <span class = 'metavar'> expression </span> is false, it will move to the next processing without executing <span class = 'metavar'> statement </span>. </p>
<p> If the value of the expression is true, execute <span class = 'metavar'> execution statement </span> to return to the evaluation of <span class = 'metavar'> expression </span> again. </p>

<h3> IF </h3>
<pre class = 'form'> <span class = 'reserved'> IF </span> <span class = 'metavar'> expression </span> <span class = 'reserved'> THEN </span> <span class = 'metavar'> statement 1 </span> </pre>
<pre class = 'form'> <span class = 'reserved'> IF </span> <span class = 'metavar'> expression </span> <span class = 'reserved'> THEN </span> <span class = 'metavar'> statement 1 </span> <span class = 'reserved'> ELSE </span> <span class = 'metavar'> statement 2 </span> </pre>
If the value of <p> <span class = 'metavar'> expression </span> is true, <span class = 'metavar'> execute statement 1 </span> is executed. </p>
<p> <span class = 'metavar'> if the value of the expression </span> is false and the <span class = 'reserved'> ELSE </span> clause is not omitted <span class = 'metavar' Execute> statement 2 </span>. </p>
If the value of the <p> expression is false and the <span class = 'reserved'> ELSE </span> clause is omitted, the process proceeds to the next process without doing anything. (In some implementations, <span class = 'reserved'> ELSE </span> clause
Can not be used. ) </p>

<h3> CASE </h3>
<pre class = 'form'>

<span class = 'reserved'> CASE </span> <span class = 'metavar'> expression 0 </span> <span class = 'reserved'> OF </span>
     <span class = 'metavar'> expression 1 </span> <span class = 'metavar'> statement 1 </span>
     ...
     <span class = 'metavar'> expression k-1 </span> <span class = 'metavar'> statement k-1 </span>
     <span class = 'reserved'> ELSE </span> <span class = 'metavar'> statement k </span>
</pre>
If the value of <p> <span class = 'metavar'> expression 0 </span> is compared with the value of <span class = 'metavar'> expression 1 </span> and it matches <span class = 'metavar' Execute> Execution statement 1 </span>. After that, it moves on to the next processing of <span class = 'metavar'> statement k </span>. </p>
<p> If it does not match, it compares with the expression one after another until it matches in the same way, and executes the execution statement corresponding to the matched expression. </p>
If there is a reserved word <span class = 'reserved'> ELSE </span> in the <p> part of the expression, it is regarded as unconditional and <span class = 'metavar'> statement k </Run span> </p>
The <span class = 'reserved'> ELSE </span> clause in the <p> <span class = 'reserved'> CASE </span> statement is the end of the <span class = 'reserved'> CASE </span> statement There is also a marker indicating that it is a condition, so it can not be omitted. If there is no statement to be executed in the <span class = 'reserved'> ELSE </span> clause, write a blank statement. </p>

<h3> WRITE </h3>
<pre class = 'form'>
<span class = 'reserved'> WRITE </span> (<span class = 'metavar'> expression </span>: <span class = 'metavar'> output list </span>)
</pre>
Outputs the contents of the output list to the output device represented by the value of <p> expression. Although the correspondence between numbers and output devices is undefined, it is generally assumed that 0 is the console screen. </p>
<p> The output list consists of the following output elements, separated by commas if more than one. </p>
<h4> expression </h4>
<p> Write an expression. Output with decimal number left justified. </p>
<h4> right justified </h4>
<pre class = 'form'>
# (<span class = 'metavar'> expression 1 </span>, <span class = 'metavar'> expression 2 </span>)
</pre>
Outputs the value of <p> <span class = 'metavar'> expression 2 </span> with the number of digits of <span class = 'metavar'> expression 1 </span> with decimal right justification. </p>
<h4> string </h4>
<pre class = 'form'>
&quot; <span class = 'metavar'> string </span> &quot;
</pre>
<p> Output a string enclosed in double quotes. </p>
<h4> ASCII code </h4>
<pre class = 'form'>
<span class = 'reserved'> ASCII </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> <span class = 'metavar'> Outputs the character equivalent to the ASCII code given by the expression </span>. </p>

<h4> blank </h4>
<pre class = 'form'>
<span class = 'reserved'> SPACE </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> <span class = 'metavar'> Outputs the number of blanks given by the expression </span>. If the value of <span class = 'metavar'> expression </span> is 0, nothing is output. </p>
<h4> Line feed </h4>
<pre class = 'form'>
<span class = 'reserved'> CRLF </span> (<span class = 'metavar'> expression </span>)
</pre>
<pre class = 'form'>
<span class = 'reserved'> CRLF </span>
</pre>
<p> <span class = 'metavar'> Outputs the number of line breaks given by the expression </span>. If the value of <span class = 'metavar'> expression </span> is 0, nothing is output. </p>
<p> <span class = 'metavar'> expression </span> is omitted form 1 newline output. </p>
<h4> Hex </h4>
<pre class = 'form'>
<span class = 'reserved'> HEX </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> <span class = 'metavar'> output the value given by the expression </span> in 2 hexadecimal digits. </p>
<p> Not available on some implementations. </p>

<h3> Assignment </h3>
<pre class = 'form'> <span class = 'metavar'> variable </span>: = <span class = 'metavar'> expression </span> </pre>
<pre class = 'form'> <span class = 'metavar'> variable 1 </span>, <span class = 'metavar'> variable 2 </span>, ..., <span class = 'metavar'> Variable k </span>: = <span class = 'metavar'> expression </span> </pre>
Assign the value of <p> <span class = 'metavar'> expression </span> to <span class = 'metavar'> variable </span>. </p>
<p> If the variable is a comma separated list, assign the value of <span class = 'metavar'> expression </span> to all variables on the left side. </p>
<p> Because the assignment symbol consists of two words, colon and equal, even if there is a space character between colon and equal, it is recognized as an assignment symbol, but in general it writes without a space. </p>

<h3> Procedure call </h3>
<p> Call a procedure. </p>
<pre class = 'form'>
<span class = 'metavar'> procedure name </span> (<span class = 'metavar'> expression </span>, <span class = 'metavar'> expression </span>, ... <span class = 'metavar'> expression </span>)
</pre>
<pre class = 'form'>
<span class = 'metavar'> procedure name </span>
</pre>
<p> A procedure with arguments is called with an actual argument. When calling a procedure that does not have an argument, you can call it with parentheses omitted, but it is an error if you write a procedure without an argument without omitting the parentheses. </p>
<pre class = 'example'>
FOO ()% such a call is an error
</pre>
<p> Since the method of passing actual arguments is limited to so-called value passing, even if the actual argument is a variable, the value does not change when returning from the procedure. </p>

<h3> CALL </h3>
<p> Call a machine language subroutine. </p>
<pre class = 'form'>
<span class = 'reserved'> CALL </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>, <span class = 'metavar'> A </span>, <span class = 'metavar'> H </span>, <span class = 'metavar'> L </span>)
</pre>
<pre class = 'form'>
<span class = 'reserved'> CALL </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>, <span class = 'metavar'> A </span>, <span class = 'metavar'> H </span>)
</pre>
<pre class = 'form'>
<span class = 'reserved'> CALL </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>, <span class = 'metavar'> A </span>)
</pre>
<pre class = 'form'>
<span class = 'reserved'> CALL </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>)
</pre>
<p> Each parameter has the following meaning. </p>
<table>
<tr> <td> <span class = 'metavar'> AH </span> </td> <td> upper 8 bits of address </td> </tr>
<tr> <td> <span class = 'metavar'> AL </span> </td> <td> lower 8 bits of address </td> </tr>
<tr> <td> <span class = 'metavar'> A </span> </td> <td> value given to accumulator </td> </tr>
<tr> <td> <span class = 'metavar'> H </span> </td> The value given to the H register in the 80th series CPU and the value given to the X register in the 6502 series CPU / tr>
<tr> <td> <span class = 'metavar'> L </span> </td> Value given to L register in 80 series CPUs, Value given to Y register in 6502 series CPUs </td>
</tr>
</table>
<p> <span class = 'metavar'> A </span>, <span class = 'metavar'> H </span>, <span class = 'metavar'> L </span> may be abbreviated However, if omitted, each value will be undefined. </p>
<p> This procedure can not be used on some implementations. </p>

<h3> SENSE </h3>
<p> The PC detects whether the STOP key has been pressed, and APPLE has detected whether the cont-C has been pressed. If the key has been pressed, it returns to the monitor mode. </p>

<h2> Variables </h2>
<p> Variables are all 1 byte long. There are 4 types below. </p>
<h3> Single variable </h3>
<p> <span class = 'reserved'> VAR </span> An alphanumeric string that begins with a declared letter. </p>
<p> There is a distinction between global and small areas. </p>

<h3> Array variable </h3>
<pre class = 'form'> <span class = 'metavar'> array variable name </span> [<span class = 'metavar'> expression </span>] </pre>
<p> <span class = 'reserved'> ARRAY </span> The <span class = 'metavar'> expression </span> 's element of a declared array. </p>
<p> There is a distinction between global and small areas. </p>

<h3> MEM variable </h3>
<pre class = 'form'> <span class = 'reserved'> MEM </span> (<span class = 'metavar'> formula 1 </span>, <span class = 'metavar'> formula 2 </span >) </pre>
<p> <span class = 'metavar'> 1 byte in memory with the value of <span class = 'metavar'> expression 2 </span> as the lower address. </p>

<h3> PORT </h3>
<pre class = 'form'> <span class = 'reserved'> PORT </span> (<span class = 'metavar'> expression </span>) </pre>
<p> PC version only. </p>
<p> Corresponds to INP and OUT of N-BASIC. If it is on the left side of the assignment statement, it acts the same as OUT. If it is on the right side, it acts the same as INP. </p>

<h2> expression </h2>
<h3> Constant </h3>
Represents a constant in one of the four formats shown in <p> <a href='#number'> Numbers </a>. </p>
<h3> Function call </h3>
<pre class = 'form'> <span class = 'metavar'> function name </span> (<span class = 'metavar'> formula 1 </span>, <span class = 'metavar'> formula 2 </span>, ..., <span class = 'metavar'> expression k </span>) </pre>
<pre class = 'form'> <span class = 'metavar'> function name </span> </pre>
<p> <span class = 'reserved'> Calls a function declared by a <span> declaration or a system function (described later) provided by the processing system. When calling a function without arguments only the function name
You can call It is an error if you try to call a function without arguments in parenthesized form. </p>
<pre class = 'example'>
FOO: = BAR ()% Such a call is an error
</pre>
<h4> MHIGH </h4>
<p> The result of multiplication by 1 byte can be 2 bytes, but only the lower 1 byte is represented in the expression. The upper one byte is stored in a dedicated location, and can be fetched with the <span class = 'reserved'> MHIGH </span> function. </p>
<h4> MOD </h4>
<p> The division returns the quotient, but at the same time the remainder is calculated and stored in a dedicated location, and can be retrieved using the <span class = 'reserved'> MOD </span> function. </p>
<h4> RND </h4>
<pre class = 'form'>
<span class = 'reserved'> RND </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> 1 or more <span class = 'metavar'> expression </span> Returns a uniform random number below. </p>

<h4> GET </h4>
<pre class = 'form'>
<span class = 'reserved'> GET </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> <span class = 'metavar'> Enters one character from the input device represented by the expression </span> and returns the value of its ASCII code. </p>
<p> The correspondence between numbers and input devices is undefined, but in general 0 seems to be a keyboard. </p>
<h4> READ </h4>
<pre class = 'form'>
<span class = 'reserved'> READ </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> <span class = 'metavar'> Enter a decimal number from the input device that corresponds to the value of the expression </span> and return that value. The RUBOUT code is considered as a delimiter. </p>
<h4> NOT </h4>
<pre class = 'form'>
<span class = 'reserved'> NOT </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Returns 1's complement. Same as COM below. </p>
<h4> NEG </h4>
<pre class = 'form'>
<span class = 'reserved'> NEG </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Returns 2's complement. </p>
<h4> COM </h4>
<pre class = 'form'>
<span class = 'reserved'> COM </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Returns 1's complement. </p>

<h4> LSR </h4>
<pre class = 'form'>
<span class = 'reserved'> LSR </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Shift right by 1 bit. The most significant bit contains 0 and the least significant bit enters the carry. </p>
<h4> ASR </h4>
<pre class = 'form'>
<span class = 'reserved'> ASR </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Shift right by 1 bit. The most significant bit does not change and the least significant bit goes into carry. </p>
<h4> ASL </h4>
<pre class = 'form'>
<span class = 'reserved'> ASL </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Shift left by 1 bit. The least significant bit contains 0 and the most significant bit enters the carry. </p>
<h4> ROR </h4>
<pre class = 'form'>
<span class = 'reserved'> ROR </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Shift right by 1 bit. The carry is in the most significant bit and the least significant bit is in the carry. </p>
<h4> ROL </h4>
<pre class = 'form'>
<span class = 'reserved'> ROL </span> (<span class = 'metavar'> expression </span>)
</pre>
<p> Shift left by 1 bit. The carry is in the least significant bit and the most significant bit is in the carry. </p>

<h4> USR </h4>
<pre class = 'form'> <span class = 'reserved'> USR </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>, <span class = 'metavar'> A </span>, <span class = 'metavar'> AH </span>, <span class = 'metavar'> L </span>) </pre>
<pre class = 'form'> <span class = 'reserved'> USR </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>, <span class = 'metavar'> A </span>, <span class = 'metavar'> AH </span>) </pre>
<pre class = 'form'> <span class = 'reserved'> USR </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>, <span class = 'metavar'> A </span>) </pre>
<pre class = 'form'> <span class = 'reserved'> USR </span> (<span class = 'metavar'> AH </span>, <span class = 'metavar'> AL </span>) </pre>
<p> The function is the same as the CALL statement, but the value of the accumulator after the execution of the machine language subroutine is returned as the return value. </p>
<p> It can not be used depending on the processing system. </p>
<h4> RDHEX </h4>
<pre class = 'form'> <span class = 'reserved'> RDHEX </span> (<span class = 'metavar'> expression </span>) </pre>
<p> Enter one hexadecimal digit from the input device. </p>
<p> It can not be used depending on the processing system. </p>
<h4> RRC </h4
> <pre class = 'form'> <span class = 'reserved'> RRC </span> (<span class = 'metavar'> expression </span>) </pre>
<p> Shifts the value of the expression one bit to the right without going through carry. The least significant bit is the most significant. </p>
<p> It can not be used depending on the processing system. </p>
<h4> RLC </h4>
<pre class = 'form'> <span class = 'reserved'> RLC </span> (<span class = 'metavar'> expression </span>) </pre>
<p> Shifts the value of the expression one bit to the left without going through carry. The most significant bit is in the least significant bit. </p>
<p> It can not be used depending on the processing system. </p>

<h3> Binary operator </h3>
<p> This is an operator that calculates two terms on the left and right. </p>
<pre class = 'form'> <span class = 'metavar'> term 1 </span> <span class = 'metavar'> operator </span> <span class = 'metavar'> term 2 </span> </pre>
The precedence of <p> operators is as shown in the table. Operators with the same precedence are left coupled. </p>
<table>
<tr> <td> 1 </td> <td> multiplication and division operator </td> </tr>
<tr> <td> 2 </td> <td> addition-subtraction operator </td> </tr>
<tr> <td> 3 </td> <td> relational operators </td> </tr>
<tr> <td> 4 </td> <td> logical operators </td> </tr>
<tr> <td> 5 </td> <td> carry with addition / subtraction operator </td> </tr>
</table>
<p> Use expression brackets if you want to change the priority. The following three types of parentheses can be used as expression brackets, but in the standard case we will use parentheses. </p>
<pre class = 'form'> {<span class = 'metavar'> expression </span>} </pre>
<pre class = 'form'> [<span class = 'metavar'> expression </span>] </pre>
<pre class = 'form'> (<span class = 'metavar'> expression </span>) </pre>
It is customary to put periods on both sides that are interpreted as whitespace for the operator of the identifier rather than the <p> symbol. In my opinion, it is thought to be a device that makes it easier to distinguish from function calls. </p>
<pre class = 'example'>. <span class = 'reserved'> AND </span>. </pre>

<h4> Multiplication division operator </h4>
<table>
<tr> <td> * </td> <td> multiplication </td> </tr>
<tr> <td> / </td> <td> quotient of division </td> </tr>
</table>

<h4> Addition-subtraction operator </h4>
<table>
<tr> <td> + </td> <td> addition </td> </tr>
<tr> <td>-</td> <td> subtraction </td> </tr>
</table>

<h4> Relational operator </h4>
<p> Compares two values ​​and returns a boolean value. <span class = 'reserved'> GT </span> and <span class = 'reserved'> LT </span> compare and compare left and right numbers as signed binary numbers in 2's complement representation. Other operators interpret numbers as unsigned binary. </p>
<table>
<tr> <td> &gt; </td> <td> large </td> </tr>
<tr> <td> &lt; </td> <td> small </td> </tr>
<tr> <td> # </td> <td> not equal </td> </tr>
<tr> <td> = </td> <td> equal </td> </tr>
<tr> <td> <span class = 'reserved'> GT </span> </td> <td> large </td> </tr>
<tr> <td> <span class = 'reserved'> LT </span> </td> <td> large </td> </tr>
</table>

<h4> Logical operator </h4>
<table>
<tr> <td class = 'reserved'> AND </td> <td> logical product </td> </tr>
<tr> <td class = 'reserved'> OR </td> <td> disjunction </td> </tr>
<tr> <td class = 'reserved'> EOR </td> <td> exclusive OR </td> </tr>
</table>

<h4> Carry with addition and subtraction operator </h4>
<p> An operator that adds two terms and adds the carry value, or subtracts two terms and subtracts the carry value. </p>
<table>
<tr> <td class = 'reserved'> ADC </td> <td> Add with Carry </td> </tr>
<tr> <td class = 'reserved'> SBC </td> <td> subtraction with borrow </td> </tr>
</table>
<p> While it is specified that part of the system function changes the flag, it is undefined which process changes the flag. In general, addition and subtraction seem to change the flag, but depending on the processing system, it may be changed when accessing an array element. It is considered safe to use carry addition / subtraction only immediately after addition / subtraction. </p>
</body>

</html>