Opentopia Directory Encyclopedia Tools

SAM76

Encyclopedia : S : SA : SAM : SAM76


SAM76 is a macro programming language from the late 1970s to early 1980s that ran on CP/M. More information is found in the following links, including how to obtain distributions and source code.

The SAM76 language is a list and string processor that is uniquely suited for a variety of interactive and user-directed applications, including artificial intelligence programming, and permits a high portability from machine to machine. The SAM76 language shares certain features in common with the LISP and Forth programming languages and, pointing to the future of multiuser or concurrent systems operation, with the SHELL programming language of the UNIX operating system.

Claude Kagan, the language's developer, sought to combine within a single interpretive processor, the characteristics of two different string and general-purpose macro generators and the provisions to embed multiple infix operator mathematical systems.

SAM76 language was designed to;

Macro generators provide one of the keys to understanding the principles behind the development of the SAM76 language. A user will define a macro (a code word that can be defined by the user to invoke a specific set of instructions to perform a routine within the program) to execute a set of instructions, usually in either machine or assembly language, and insert the macro in the program. In this way, a user need only define a routine once and then when that particular operation, or string is required, the user can substitute the macro.

Since then the language has been written in C and compiles quite well on Windows, Unix. Linux and similar operating systems. The source code obtained from the link below is still valid in 2006.

External links


----------------------------------------------------------------

______________________________________________________________ || || || The SAM76 language || || || || Claude A. R. Kagan and Karl Nicholas || || || || || ______________________________________________________________

______________________________________________________________ || || || Box 257, RR1, Pennington, NJ, 08534 || || || ______________________________________________________________

August 1985

Manuscript as corrected for revised MC GRAW HILL printing

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || Introduction || || || ______________________________________________________________

The SAM76 language is a list and string processor that is uniquely suited for a variety of interactive and user-directed applications, including artificial intelligence programming, and permits a high portability from machine to machine. The SAM76 language shares certain features in common with the LISP and Forth programming languages and, pointing to the future of multiuser or concurrent systems operation, with the SHELL programming language of the UNIX operating system.

The SAM76 language was primarily inspired by the "M6 MACRO PROCESSOR" designed by M. D. Mc Ilroy and R. Morris of the Bell Telephone Laboratories. (1971 - Ref. 2). The second source of inspiration came from the syntax of "GPM - a GENERAL PURPOSE MACRO GENERATOR" - C. Strachey. (1965 - Ref. 1).

Claude Kagan, the language's developer, sought to combine within a single interpretive processor, the characteristics of two different string and general-purpose macro generators and the provisions to embed multiple infix operator mathematical systems.

Motivation for the development of the SAM76 language was the desire to have a language that would (1) be very pure syntactically and semantically, (2) require a minimum of user keyboarding to achieve powerful results, (3) fit in a very small computer system, (4) permit editing, testing, and executing modules interactively, and (5) not prevent the user from doing strange things with the syntax of the language yielding, however, predictable results.

Macro generators provide one of the keys to understanding the principles behind the development of the SAM76 language. A macro is a code word that can be defined by the user to invoke a specific set of instructions to perform a routine within the program. A user will define a macro to execute a set of instructions, usually in either machine or assembly language, and insert the macro in the program. In this way, a user need only define a routine once and then when that particular operation - or string - is required, the user can substitute the macro.

Most personal computer users are familiar with the macro-like capabilites of LOGO or comonly used word processors that enable typists to define an entire procedure or body of text with one or two characters.

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || Characteristics of the SAM76 language || || || ______________________________________________________________

The SAM76 language follows a well defined syntax which is easy to learn and to read. It relies heavily, however, on a system of symbols to replace the pseudo English words of BASIC and Pascal.

The SAM76 interpreter also provides for a highly reactive and interactive language that can almost converse with the user from task to task. Consequently, the language has the capability of performing complex operations in program control, text editing and manipulation, gaming, simulation, and mathematics.

Because it has features similar to LISP, Forth and other list processors, SAM76 also has the capability of functioning as a query language, providing powerful human machine interaction that uses keyboard data from an interaction to modify and shape future responses.

The language is also capable of growing by entension. Because, like LISP and Logo, there is almost no difference between procedures and data structures, procedures can be treated as data and be acted upon by other procedures, even procedures defined by different users. The new procedures that are mapped or created behave as if they were language primitives or inherent functions of the language. Like Logo, this means that new users can create their own separate vocabularies which can be saved and executed, adding to the language vocabulary and providing for individual customization.

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || Notation and Syntax || || || ______________________________________________________________

An expression may be characterised as being "active," that is to say its value string is subject to rescanning, "neutral" the value will not be rescanned or "protected" meaning "quoted" or immune from evaluation. Typically these are:

%active expression/ &neutral expression/ !protected string/

Like LISP, all commands and data objects in SAM76 are represented by lists, or strings of characters. However, in the latter language, syntax plays a vital role in identifying those characters which, because of their position in a given expression, have an additional meaning. The characters are called warning characters and represent the following concepts:

% start symbol for active expression & start symbol for neutral expression ! start symbol for protected string / end symbol for all types of expressions

# alternate start of expression : end of active alternate expression ; end of neutral alternate expression

, argument separator symbol ( ) string protection pair < > alternate protection pair @ protect or quote next single character ` ignore next single character [ ] reserved as boundaries for special expressions

Expressions may reach the scanner from various sources such as a keyboard or a file or a communications channel. This type of input stream is commonly terminated by an activating character. Initially this activating character is set to be the "=" sign, although it may be changed using the "change activator" function.

Other means of terminating the input stream includes an explicit character count, the encounter of one or more specified patterns of characters, or a user-specified timing function.

When characters which are also used as warning characters are to be part of the data, they must be protected, either by being enclosed in one of the allowable protection pairs or preceded by the single character protection code.

� The SAM76 language ----------------------------------------------------------------

A legal SAM76 expression is a string bounded at its left end by a start symbol, and at its right end by the appropriate end symbol. Elements of the expression are separated from each other by the argument separator (,). The first argument is always a command, or the name of a user-defined string, expression or procedure. Subsequent arguments (1, 2, 3, ... N) are treated as required by the command or as macros which will be plugged into the proper places of the named user-defined string. For example:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %ad,%mu,2,3/,%di,20,5//= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The foregoing example consists of an expression which will add the values resulting from the multiplication of 2 and 3, with the division of 20 by 5. Note that expressions are scanned and evaluated from left to right and inside out.

It is also possible to create user defined functions. First the user will define a "text" named "square" to be a procedure which will multiply some value "x" by "x":

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %dt,square,!%mu,x,x///= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that in the foregoing step the multiplication expression has been protected by the pair of warning characters ! .../ and the act of defining with the function "dt" simply creates a data object called "square" but returns no value.

The next step is to convert the characters "x" into partitions (parameter positions) of value 1 using the "partition text" command:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %pt,square,x/= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

� The SAM76 language ----------------------------------------------------------------

If we now examine the object named square with the function "view text" whose mnemonic is "vt" we will see:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %vt,square/= o %mu,[1],[1]/ o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We can make use of this new function to square numbers. For example:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %square,5/= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Or, using the mnemonic "ad" for addition:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %square,%ad,3,2//= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || Descriptive examples || || || ______________________________________________________________

When the SAM76 language is initially started the following expression is loaded:

&os,%is//

This is known as the RESTART expression and consists of an "input string" command nested inside an "output string" expression. In effect this says "Output that which results from evaluating that which is input". When all evaluation is completed the expression is reloaded and the process is repeated. The restart expression is invisible to the user. Initially, the requirement for user input is the result of the execution by the scanner of the "is" command. The output of the material entered by the user is dictated by the "os" command, for example:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %ad,1,9/= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The user enters "%ad,1,9/" followed by an "=" sign to signify end of input. The entered epression replaces the %is/ in the restart expression:

&os,%ad,1,9//

This results in

&os,10/

which is in turn evaluated to output the value 10.

The four ways in which user-defined functions or texts may be fetched or invoked are:

%name, ... / active value implied fetch &name, ... / active value neutral implied fetch %ft,name, ... / active value, explicit fetch text &ft,name, ... / neutral value, explicit fetch.

In the first three modes shown above the value string will be rescanned and evaluated. The fourth expression will return the object called "name" as if it had been quoted.

� The SAM76 language ----------------------------------------------------------------

The first example illustrates the use of partitions to translate text by parametrizing the positions of the different English words by replacing them with an internal marker which identifies the position value. Strings that remain between these partitions are referred to as "elements."

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %dt,text, o the dog and the cat and the horse/= o %pt,text,the,dog,and,cat,horse/= o %text,le,chien,et,chat,cheval/= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The first line of the example shows the definition of a text named "text" to contain the phrase "the dog ... horse." The second line uses the "partition text" function to convert each of the words in "text" to partitions whose value will correspond to the position in the "pt" expression of the words being matched.

The last line in the example shows the invocation of the partitioned text using a list of French words as the source of data to fill the partitions with words whose positions correspond to the value of the partitions.

Use of the "view text" function to examine the text "text" would reveal the partitions in the following manner:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %vt,text/= o [1] [2] [3] [1] [4] [3] [1] [5] o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Notice that this is not an "intelligent" translation of the English into the French because any words can be inserted into the partition frames for the conversion process to work. All that is happening here is that in input string is partitioned and a new string, corresponding to the existing partitions, is imposed upon the script.

It is evident from the examples that syntax plays a vital role in the SAM76 language, defining the sequence of operations within each string. Use of mnemonics reduces the overhead which, unlike BASIC, allows complicated programs to be written without an overabundance of code. For example, the followin example illustrates the construction of a password checking system with an automatic exit if either an incorrect password is intered or there is no action after a given time.

� The SAM76 language ----------------------------------------------------------------

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %dt,password,!%ca,%xc,0D//%os, o Enter password followed by "return" ?- /%iw,100/` o %dt,x,&is//%ig,%crd,x/,,!%gotinput//,` o !%os, TIME OUT/%ex///////= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let us now read the first step, noting that bold face letters form the mnemonics of the commands. The passage below illustrates the SAM76 stream of consciousness method of writing the language and is best understood if read aloud.

"Define a Text named 'password' to be a procedure (indicated by the first exclamation point) ... this procedure will first Change the Activator to be that character which results from the 'X' base to Character conversion of HEX 0D (namely a carriage return code) ...

next this procedure will Output the String: '(CR LF codes) Enter password ... ?- ' ...

following this, the procedure will set the Input Wait timing function for 100 time units ... the ignore symbol that follows is to permit the use of a (CR LF code) here that is not to be evaluated ...

the procedure will then Define a Text named 'x' which will contain any material that is entered from the keyboard ... input termination will then be either the return code specified by the initial 'change activator' command, or with time out after time set by the 'input wait' function ...

subsequent to input or time out, the procedure tests to see If Greater the number of Characters to the Right of the Divider in 'x' than zero (indicated by the null string between the two adjacent commas) ... if 'x' contains one or more characters then control is transferred to a procedure 'gotinput' to be defined, else we will Output the String ' TIME OUT' and EXit to the operating system."

However, if the procedure finds that there are characters in the set (x), then the following routine applies:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %dt,gotinput,!%ii,&ft,x/,SAM76,!%os, o You got it right/%ri//,!%os, o Wrong - Try again/%password//////= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Translated, this second procedure reads:

� The SAM76 language ----------------------------------------------------------------

"Define a Text named "gotinput" to be a procedure that will test to determine if the content of 'x' is Identical to the string 'SAM76' ... if it is identical then Output the String '(CR LF code)You got it right' and Return the user to the Initialized condition ... if not identical then Output the String 'CR LF code)Wrong ...' and invoke the procedure named 'password' again."

� The SAM76 language ----------------------------------------------------------------

The next example illustrates the use of the multi-partition capability of the SAM76 language. A multi-partition is a special type of partition which is filled by all arguments of a list whose positions, counting from the left, are equal to or greater than the value of the multi-partition. Each term from the list which is placed in the multi-partition is preceded by the "argument separator" character.

This permits the processing of lists of undefined and arbitrary lengths. The elements of the list may be text strings, or procedures. The multi-partition also provides tools to manipulate matrices and other types of arrays.

The procedure which is defined below is designed to tabulate the names of the files on a disk giving their size.

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %dt,tabulate,!%loop%lf,@,////= o %dt,loop,!%ii,q1,,,!%os, o q1 - %qfs,q1//%loopmp2//////= o %pt,loop,q1/%mt,loop,,mp2/= o %vt,loop/= o %ii,[1],,,!%os, o [1] - %qfs,[1]//%loop[#2]/// o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A procedure named "tabulate" is defined as an invocation to a procedure named "loop" ... arguments to this procedure come from the evaluation of the "lf" function which returns a list of file names ... each file name is preceded by a comma.

A procedure named "loop" is defined which through a dummy argument q1, to be parametrized, tests for the end of the list. If the end of the list is not reached, then an "output string" function is executed with the name of the current file name being plugged into the two other q1 positions. The first will merely display the file name, and the second is an argument to a "query file size" function. At the completion of the "os" function the procedure "loop" is reinvoked with arguments being the second term of this list to its end.

� The SAM76 language ----------------------------------------------------------------

The "partition text" and "multi-partition text" expressions are used to convert the dummy entries in loop to appropriate values.

In order to execute the foregoing program we merely enter:

%tabulate/=

and the tabulation will follow.

� The SAM76 language ----------------------------------------------------------------

Two examples of the use of SAM76 in the solution of problems using recursion are shown below.

The first procedure calculates the integer factorial of any number. The procedure name is 'FAC' and a View Text of FAC would display:

%ii,[1],1,1,!%mu,[1],%FAC,%su,[1],1/////

For example the factorial of 30 would be determined thus:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %FAC,30/= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The second example illustrates a recursive way to solve the problem of the towers of Hanoi, a favorite with afficionadoes of this type of language; Viewing Text named "HANOI" we see:

%ii,[1],0,,!%HANOI,%su,[1],1/,[2],[4],[3]/! Move Ring [1] from [2] to [3]/%HANOI,%su,[1],1/,[4],[3],[2]///

Assuming three towers named "here", "middle" and "there" the moves required to move 4 rings from "here" to "there" using "middle" as a way station would be determined as follows:

o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o %HANOI,4,here,there,middle/= o ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These examples indicate that the SAM76 language offers interesting possibilities to programmers because its structure resembles the structure of logical or procedural thought very closely, and its system of ready-to-hand mnemonics can eliminate much of the coding overhead associated with BASIC.

� The SAM76 language ----------------------------------------------------------------

Currently, the SAM76 language enjoys implementation on most CP/M systems including the Apple II and IIe, as well as under MSX-DOS and on the very much larger DEC System 10.

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || Resident Functions || || || ______________________________________________________________

All resident functions consist of not less than two and not more than three alphabetic characters. In general the mnemonic assigned consists, in the case of single word commands, of the first two letters of the command. In the case of multiple word commands, the mnemonic consists of the first letter of each of the several words which form the command.

Each resident function in a standard system has assigned to it an abitrary serial number. This number is used to precisely identify the formal definition of each function. This method of correlation serves several purposes, namely, ...

(1) An implementation of the SAM76 language may be defined in terms of the available function numbers and initial selection of function mnemonics. The user can then safely assume correct operation of functions if the implementation definition matches the one being used.

(2) A more important use for this identification scheme relates to the international usage of SAM76. Commands and their associated mnemonics may be clear in one user's language such as "English," but be obscure in some other language as "French." The provision of a function in the SAM76 language that changes the mnemonics in the resident function tables permits the most effective use of command words in a variety of languages.

(3) Portability of user scripts across international language boundaries is simplified since it is not necessary to translate the command arguments in the programs from one language to another. Instead the state of the machine may be readily switched from one mode to the other at any time.

The list of functions in the following table is arranged by functional category. The first argument is the function mnemonic. Subsequent arguments are identified by abbreviations as defined below. The active form for each function is shown. The neutral form of a function is shown only in those cases where a different action is performed from its active form. This is the case only for those functions which have a null value.

Note that the functions listed in this description form only the minimal set of a standard implementation of the SAM76 language. Some of these functions have sub functions; other functions exist in specialized system implementations.

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || ABBREVIATIONS USED IN THE LIST OF FUNCTIONS || || || ______________________________________________________________

%function,arguments,......./ Active expression &function,arguments,........../ Neutral expression

x,x1,... "x" base (binary, octal, hex) numbers d,d1,... Decimal base numbers n,n1,... "n" base (arithmetic) numbers s0 Prefixing string (as in lists) s,s1,... character strings f file name t text name vz default value v-,v+,v0 conditional value vt,vf true/false value sub indicates sub-functions - using "lf,s0" as subfunction gives list.

A hyphen following the function number signifies that this function has been added to th list since the original publication in the "Mc Graw Hill Personal Computer Programming Encyclopedia" in 1985.

TEXT FUNCTIONS

TEXT MANIPULATION

103 %dt,t,s,d1,d2/ ;Define Text 104 %et,t1,t2,...,t/ ;Erase Text 105 %lt,s0/ ;List Text 106 %ft,t,s1,s2,...,s/ ;Fetch Text 114 %ht,t/ ;Hide Text 118 %vt,t1,t1,...,t/ ;View Texts 132 %ct,t1,t2,t3,...t/ ;Combine Texts 206 %ea/ ;Erase All

TEXT DIVISION

137 %fc,t,vz/ ;Fetch Character 138 %fdc,t,d,vz/ ;Fetch "D" Characters 139 %fde,t,d,vz/ ;Fetch "D" Elements 140 %fdm,t,d,s,vz/ ;Fetch "D" Matches 141 %fe,t,vz/ ;Fetch Element 142 %ff,t,d,vz/ ;Fetch Field 143 %fl,t,s,vz/ ;Fetch Left match 144 %fr,t,s,vz/ ;Fetch Right match 145 %fp,t,x1,x2,...,x/ ;Fetch Partition 146 %md,t,d/ ;Move Divider to pos. "d" &md,t,d/ ;Move Divider "d" positions � The SAM76 language ----------------------------------------------------------------

147 %crd,t/ ;Characters right of divider 148 %cld,t/ ;Characters Left of Divider 197 %qld,t/ ;Query Left of Divider 198 %qrd,t/ ;Query Right of Divider 207 %ed,t,d1,d2,vz/ ;Extract "D" characters 210 %ftb,t,s,vz/ ;Fetch To Break character 211 %fts,t,s,vz/ ;Fetch To Span character

STRING FUNCTIONS

150 %hm,t,s/ ;How many Matches 160 %ai,s0,s1,s2,...,s/ ;Alphabetic Insertion 161 %as,s0,s1,s2,...,s/ ;Alphabetic Sort 162 %ps,d,s1,s2/ ;Pad String 163 %rs,s/ ;Reverse String 164 %ds,d,s/ ;Duplicate String 168 %tr,t,s/ ;Trim 209 %nu,s1,s2,...,s/ ;Null 212 %hc,s/ ;How many Characters 214 %lw,s0,s1,s2,...,s/ ;List Where 215 %ra,d,s1,s2,s3,...,s/ ;Return Argument 247 %rj,d,s1/ ;Return Justified lines 248 %rp,c,d,s1/ ;Return Padded lines

BRANCH FUNCTIONS

111 %ni,vt,vf/ ;Neutral Implied 126 %yt,t,s,vt,vf/ ;Ys There 127 %tb,t,vt,vf/ ;Text Branch 135 %ii,s1,s2,vt,vf,.../ ;If Identical 136 %ig,d1,d2,vt,vf,.../ ;If Greater 159 %ab,s1,s2,vt,vf/ ;Alphabetic Branch 226 %fb,f,vt,vf/ ;File Branch 900 %gel,d1,d2,v+,v0,v-/ ;Greater Equal or Less

MATHEMATICAL FUNCTIONS

ARITHMETIC

128 %ad,n1,n2,n3,...,n/ ;Add 129 %su,n1,n2,...,n/ ;Subtract 130 %di,n1,n2,vz/ ;Divide 131 %mu,n1,n2/ ;Multiply

LOGICAL

186 %or,x1,x2/ ;Or the bits 187 %and,x1,x2/ ;And the bits 188 %not,x/ ;Not (complement) the bits 189 %rot,d,x/ ;Rotate the bits 190 %sh,d,x/ ;Shift the bits� The SAM76 language ----------------------------------------------------------------

PARTITION FUNCTIONS

107 %pt,t,s1,s2,...,s/ ;Partition Text 108 %pc,d/ ;Partition Character 109 %mt,t,s1,s2,...,s/ ;Multi-part Text 110 %mc,d/ ;Multi-part Character 149 %hp,t,d/ ;How many Partitions 151 %ep,t,p1,p2,...,p/ ;Erase Partitions 167 %qp,t/ ;Query Partition

I/O FUNCTIONS

101 %os,s/ ;Output String 102 %is/ ;Input String 115 %ic/ ;Input Character 116 %id,d/ ;Input "D" Characters 117 %im,s1,s2,...,s/ ;Input to Match 213 %iw,n/ ;Input Wait 241 %lic,s0/ ;List Input Channels 242 %loc,s0/ ;List Output Channels 245 %sic,sym/ ;Select Input Channel 246 %soc,sym/ ;Select Output Channel 264 %qio/ ;Query I/O assignments 265 %sio,iobyte/ ;Set I/O byte

STORAGE FUNCTIONS

216 %lf,s0/ ;List Files 217 %qfs,filename/ ;Query File Size 219 %qfe/ ;Query File Extension 220 %bf,f/ ;Bring File 221 %sfe,extension/ ;Set File Extension 222 %sf,f/ ;Store File 223 %sdu,dir/ ;Select Directory Unit 224 %ef,f/ ;Erase File 225 %qdu/ ;Query Directory Unit 233 %dif,filename/ ;Designate Input Filename 234 %dof,filename/ ;Designate Output Filename 235 %rfr/ ;Read File Record 236 %wfr,s/ ;Write File Record 243 %rf,filename/ ;Read File 244 %wf,filename,s/ ;Write File

RANDOM NUMBER

252 %rn,n/ ;Random Number 253 %srn,n/ ;Seed Random Number

� The SAM76 language ----------------------------------------------------------------

CONVERSION

170 %xc,x1,x2,...,x/ ;X to Character 171 %cx,s0,s/ ;Character to X 172 %xd,x/ ;X to Decimal 173 %dx,d/ ;Decimal to X

GRAPHICS

174 %pl,sub,s1,...,s/ ;Plot 175 %wi,xn1,yn1/ ;Write Initialize 176 %wx/ ;Write X displacement 177 %wy/ ;Write Y displacement 178 %wr/ ;Width Right 179 %wl/ ;Width Left 180 %ws,xn1,yn1,...,xn,yn/ ;Write Straight lines

SOFTWARE "Z" COUNTERS

182 %zd,r,v-,v0,v+/ ;"Z" reg. Decrement and branch 183 %zi,r,v-,v0,v+/ ;"Z" reg. Increment and branch 184 %zq,r/ ;"Z" reg. Query 185 %zs,r,n/ ;"Z" reg. Set

TRACE MODES

124 %tma/ ;Trace Mode All deactivated &tma/ ;Trace Mode All activated 125 %tm,d/ ;Trace Mode activated &tm/ ;Trace Mode deactivated

CONTROL FUNCTIONS

113 %ca,s/ ;Change Activator 133 %cnb,d/ ;Change Number Base 134 %qnb/ ;Query Number Base 157 %sfd,fun,dev/ ;Specify Function Device 158 %sar/ ;Set Auto Return on line feed 169 %ut,cc/ ;User Trap 191 %cll,d/ ;Change Line Length 192 %qll/ ;Query Line Length 193 %cin,t1,d1,...,t,d/ ;Change Id Number 194 %qin/ ;Query Id Number 195 %cfc,d1,s/ ;Change Fill Character schema 196 %qfc,s0/ ;Query Fill Character schema 199 %sem,dev/ ;Set "Echoplex" Mode 200 %cxb,d/ ;Change X base 201 %qxb/ ;Query X base 202 %qof/ ;Query Overflow Functions 203 %cro,s1/ ;Change Rub Out character schema� The SAM76 language ----------------------------------------------------------------

204 %qro/ ;Query Rub Out character schema 205 %qta/ ;Query Text Area 227 %qcs/ ;Query Command String 237 %@t/ ;wh@ is processor Title 238 %@f,s0/ ;wh@ are Functions 239 %@n/ ;wh@ is processor ver. Number 240 %@cn,current,new/ ;Change Name of function 250 %cwc,s1/ ;Change Warning Characters 251 %qwc/ ;Query Warning Characters 261 %cws,d/ ;Change Work Space 262 %qws/ ;Query Work Space 266 %cpc,x1,t1,...,tn/ ;Change Protection Class 267 %qpc,s0,t1,t2,...,t/ ;Query Protection Class

MISC. FUNCTIONS

112 %ex,f/ ;Exit 155 %xll,s0/ ;Xamine Label List 156 %xal,label,x/ ;Xamine Address of Label 165 %rr,s1/ ;Return to Restart 166 %ri/ ;Restart Initialized 228 %lff,s0/ ;List File Functions 231 %sw,s1,s2,s3,...,s/ ;Switches 232 %sy,s1,s2,...,s/ ;System Functions 257 %ti,s0/ ;Time 258 %sti,hh,mm,ss/ ;Set Time 259 %da,s0/ ;Date 260 %sda,da,mo,yr/ ;Set Date 268 %nud,func,arguments/ ;Null Display mode 289 - %rgc,d/ ;Read Game Controller 290 - %ipb,d,t,f/ ;If Push Button 291 - %san,d,x/ ;Set Annunciator 301 - %dow/ ;Day Of Week 303 - %bsr,subfun,arg2,..../ ;BSR controller functions 304 - %lef,s0/ ;List Extended Functions

EXPERIMENTATION FUNCTIONS

119 %xr,x/ ;eXamine Register 120 %xw,x1,x2/ ;eXperimental Write in reg. 121 %xrp,x/ ;eXamine Register Pair 122 %xwp,x1,x2/ ;eXperimental Write in reg. Pair 123 %xj,x/ ;eXperimental Jump 254 %xqs,s0/ ;X Query work Space 255 %xi,port/ ;eXperimental Input 256 %xo,x,port/ ;eXperimental Output 269 %xrs,unit,trk,sec,s0/ ;X Read Sector 270 %xws,unit,trk,sec,X/ ;X Write Sector 271 %xu,sub,arguments/ ;Xperimental User 272 %xqf,s/ ;eXperimental Query Function 273 %xcf,s,x/ ;eXperimental Change Function

� The SAM76 language ----------------------------------------------------------------

SYSTEM OR MACHINE DEPENDENT FUNCTIONS

274 - %trs,subf,a1,a2,../ ;TRS 80 Model 1 288 - %son,subf,a1,a2,../ ;SONY SMC70 302 - %pcc,subf,a1,a2,../ ;PC Compatibles 305 - %msx,subf,a1,a2,../ ;MSX machines

GRAPHICS PRINTER FUNCTIONS

287 - %eps,subf,a1,a2,../ ;EPSON MX, FX &c. 295 - %ips,subf,a1,a2,../ ;Itoh Print System

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || References || || || ______________________________________________________________

1. Strachey, C. - "A general purpose macrogenerator", Computer Journal, Vol. 8, No. 3, Oct. 1965 p. 225;

2. Hall, Andrew D. - "The M6 macroprocessor", Bell Telephone Labs; Computer Science Report No. 2; 1971;

3. Roichel, Ancelme & al. "SAM76 Language System", DECUS (Digital Equipment User's Group) library, Maynard, Mass., No. 10-342, 1982.

4. Kagan, Claude A. R. - "A string language Processor for small machines", Proceedings of the ACM SIGPLAN Symposium on the Pedagogical Applications of small Computers, University of Kansas, Lawrence, Kansas , Nov 18, 1971.

5. Kagan, Claude A. R., "The SAM76 Language", IEEE Computer Society Repository, R76-301, August 1976.

6. Roichel, Ancelme, and Nicholas, Karl, "SAM76 - The First Language Manual", SAM76 Inc., Pennington, N.J., Second Edition, 1978.

7. Various - "SAM76 Language - descriptions and updates", Dr. Dobb's Jounal, Volume 3 for the year 1977.

8. Kagan, Claude A. R. and Nicholas, Karl, "The SAM76 Language", in "Mc Graw Hill Personal Computer Language Encyclopedia", NYC, 1985.

9. Kagan, Claude A. R. and Nicholas, Karl, "Exotic Language of the Month - The SAM76 language", Computer Language Magazine, November 1985.

10. Kagan, Claude A. R. and Nicholas, Karl, "SAM76 and TRAC", in Computer Language, January 1986, page 10.

� The SAM76 language ----------------------------------------------------------------

______________________________________________________________ || || || ACKNOWLEDGEMENTS || || || ______________________________________________________________

The following people contributed in various ways to the development of the SAM76 language and its implementations: Roger Amidon, Neil Colvin, Carl Galletti, Barry Lubowsky, Karl Nicholas, L. G. Schear. Among the many others who contributed are the following members of a former (1967-1971) group of high school students in New Jersey known as the R.E.S.I.S.T.O.R.S.: Chuck Ehrlich, J. N. B. King, Gnat Kuhn, Barry Klein, Bob Evans, David Theriault, John Levine, Gifford Marzoni, Peter Eichenberger, Jordan Young, Johnny Gorman, and Joseph Tulloch.

Further credit should be given to the following who assisted in many ways in promoting and implementing the SAM76 language on a variety of machines: Larry Stein of PRODIGY computers of N. J., Mark Wolinsky - Jim and Dave Hair of Floppy Disk Services of Princeton, N. J., Dr. Al Katz at Trenton State College of N. J., Hank Beechold also of Trenton State College who was instrumental in polishing up the material for the Mc Graw Hill publication.

In addition thanks to the numerous "pioneers" who acquired the SAM76 language and who through their comments and feed back helped to support continuing effort for the last ten years.

Claude A. R. Kagan - 1986

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: