SPAM/1

SPAM/1 is a computer language highly derivative of Ham created by User:Johnnie. There are three versions of SPAM (none currently are implemented): SPAM/1, SPAM/2 and SPAM/3. SPAM/1 and SPAM/2 are the most portable out of the three versions by making use of a very simple User Interface to transmit code to a SPAM server (colloquially known as a SPAM Generator).

User Terminal
A user terminal is roughly the same size as a tin of Spam and typically consists of four keys, one power button, a power LED, a set of headphones, and a link to the SPAM Generator. The user terminal is unique in that the output generated is sound-based rather than visual-based.

The four keys on the user terminal are:

[.] (Dot) [-] (Dash) [ ] (Space) SEND

The Spam link may be any one of the following:
 * Telephone (RJ14)
 * Cable modem (Coaxial)
 * Network (CAT6)
 * Wireless (802.11)
 * Shortwave Transmitter connection
 * Telegraph wire

Input
The input of SPAM/1 and SPAM/2 is typed in using Morse Code using dots and dashes, with the space to separate each character. The input is then processed by the SPAM Generator, which then processes the code and transmits the reply through the headset. It is usually recommended to have the code written down first before transmitting, especially for lengthy programs.

The input of SPAM/3 is typed in using a computer terminal without using any Morse Code.

Syntax
The syntax of SPAM is borrowed directly from Morse code prosigns.


 * Each character is represented by a series of dashes ("-") and dots (".")
 * Each word is represented by characters separated by a single space (" ")
 * Each sentence is represented by words separated by three spaces ("  ")

Typically, a statement or command in SPAM/1 has four characters or less. A user defined variable in SPAM/1 has more than four characters.

In SPAM/1 and SPAM/2, if a program enters an infinite loop, there is no way a user can exit the program unless the user waits for over ten minutes or breaks the connection by powering off. Either way, the SPAM Generator will be immobile for ten minutes. After which, it will reset and any unsaved work will be lost. If a User were to transmit anything to the SPAM Generator during the time it is in an infinite loop, the SPAM Generator will reply with:

... .-. ..  --.- .-. .-.. which means SRI QRL translated as Sorry. This frequency is busy

"Calling" a SPAM Generator
Before doing any SPAM programming, the User must issue a call for a SPAM Generator in order to gain it's attention. Therefore the following command line must be sent first:

CQ DE (user-1) K

On SPAM/1 and SPAM/2, the command line is transmitted as:

-.-. --.-  -.. .   ..-. -.--. ..- ... . .-. -....- .   -.--.- -.-

This translates to:

CQ = Calling any SPAM Generator DE = This is (user-1) = user name K = Over

The user must then wait for a response. One response may be:

-.--. ..- ... . .-. -....- . -.--.-  -.. .   -.--. ... - .- - .. --- -. -....- . -.--.-   -.- -.

This translates to:

(user-1) = user name DE = This is (Station-1) = SPAM Generator KN = Go Ahead

For SPAM/1 and SPAM/2, once the user receives this response, there was a successful connection made to the SPAM Generator (in this case, to Station-1). The user now has up to 10 minutes to communicate with the SPAM Generator. If the user makes no further transmissions, the SPAM Generator will terminate the connection. In the case the user has been keying a lengthy line of code past the ten minute mark, then sends the code, the SPAM Generator may respond with:

... .-. ..  ... -.-

This translates to:

SRI = Sorry. SK = End of contact.

List of commands
CQ - Calling any SPAM Generator SK - Sign off from SPAM Generator TXT - start TEXT mode SPAM/1 and SPAM/2 only RST - Check status on current SPAM Generator (Readability - Strength - Tone) SPAM/1 and SPAM/2 only QRV - User intends to begin a new program QRU - publish a listing of the program QSW filename - save the program filename to the current SPAM Generator's storage QTA filename - removes the program filename from the current SPAM Generator's storage QSG - publish a list of the names of the programs on the current SPAM Generator RUN - Execute the current program STP - Interrupt the current program

List of functions
ABS -- Absolute value ATAN -- Arctangent value (result in radians) COS -- Cosine value (argument in radians) EPWR -- Exponential value INT -- Integer value LOG -- Natural Logarithmic value RNDV -- Random value SIN -- Sine value (argument in radians) SQRT -- Square root value TAN -- Tangent value (argument in radians)

TEXT mode
With SPAM/1 and SPAM/2, there is a TEXT mode which acts as a text editor capable of sending out messages to other users. Since both versions of SPAM is audio-based output, any messages sent out to other users are received in one of two ways:
 * using a valid email address, the message can be simply forwarded by the SPAM Generator
 * using a physical address of another SPAM User, the message is printed out at the SPAM Generator's central office and delivered to the User by post.

TEXT commands
* for messages sent to users with valid email address TO username@domain.com * for messages sent to other SPAM Users TO [street address],[city],[state],[post code],[country] BEGIN start of the message STOP carriage return FULL-STOP end message END ''send message. Exit TEXT''

List of program statements
CX - Define single line function AX - Define the size of an array SK - Define the end of a program DSW - Stop a program before the textural end FER / BN / ST - Define loop PLS - Mark the end of the loop CTL - transfer control to a subroutine BTU - return control from a subroutine GA - transfer control to another statement CK / TH - decision making SIG / = - assign formula results to a variable TX - output results RX - store static data within the program XMTR - input data stored in RX statements WB / WA - comment

Hello, World!
(Presumably, the user has called a SPAM Generator)

SPAM/1 and SPAM/2 syntax User (Station-1) DE (User-1) QRV (Station-1) DE (User-1) KN Generator (User-1) DE (Station-1) QRV (User-1) DE (Station-1) KN User (Station-1) DE (User-1) TX HELLO, WORLD! (Station-1) DE (User-1) KN Generator (User-1) DE (Station-1) HELLO, WORLD! (User-1) DE (Station-1) KN User (Station-1) DE (User-1) 73 (Station-1) DE (User-1) SK

SPAM/3 syntax TX HELLO, WORLD!

The following is another version of the same Hello, World program:

SPAM/1 and SPAM/2 syntax User (Station-1) DE (User-1) QRV (Station-1) DE (User-1) KN Generator (User-1) DE (Station-1) QRV (User-1) DE (Station-1) KN User (Station-1) DE (User-1) 1 WA HELLO WORLD PROGRAM WB (Station-1) DE (User-1) KN Generator R User (Station-1) DE (User-1) 2 TX HELLO, WORLD! (Station-1) DE (User-1) KN Generator R User (Station-1) DE (User-1) 3 SK (Station-1) DE (User-1) KN Generator R

SPAM/3 syntax 1 WA HELLO WORLD PROGRAM WB 2 TX HELLO, WORLD! 3 SK

In SPAM/3, the user would simply type RUN to execute the program. In SPAM/1 and SPAM/2, the user would execute the above program, thus:

SPAM/1 and SPAM/2 syntax User (Station-1) DE (User-1) RUN (Station-1) DE (User-1) KN Generator (User-1) DE (Station-1) HELLO, WORLD! (User-1) DE (Station-1) KN

QSG
if sent to a valid email address QSG [FM valid-account] FER username@domain.com if sent to a SPAM/1 user QSG [FM valid-account] FER street address,city,state,post code,county

By default, QSG will send a list of programs on the user's account of the current SPAM Generator either by email, or through postal delivery. Using the FM option will send a list of programs from another user's account (in this case, from valid-account) provided the user has prior permission.

QRU
if sent to a valid email address QRU filename [FM valid-account] FER username@domain.com if sent to a SPAM/1 user QRU filename [FM valid-account] FER street address,city,state,post code,county

By default, QRU will send program listing of filename from the user's account of the current SPAM Generator either by email, or through postal delivery. Using the FM option will send a list of program listing from another user's account (in this case, from valid-account) provided the user has prior permission.

List of Operators
using the command line

The first example reads: "TR 5+10 ZAP", or "Transmit 5 + 10 Acknowledge Please", to which the SPAM Generator would reply: .- -.-. -.-  . ..... which reads "ACK 15", or "Acknowledged; 15"

written in programming code

The SPAM Generator typically is able to calculate all mathematical statements that it's given, as long as the CPU of the SPAM Generator is capable. If in the event that an operation generates an error from the CPU, such as a number that's far too large, or a division by zero, the user might receive the following:

-. -..  -..-.   - translated as Nothing Doing; Division by Zero

-. -..  ...- -.--   .-.. -. --.   -. .-. translated as Nothing Doing; Very long number

Output Representation
Because SPAM/1 and SPAM/2 uses audio output, numerical representation is somewhat unique.

In the case of irrational decimal numbers, such as e or π cannot be fully broadcast as output. By default (for the case of decimal numbers) up to 4 decimal places are broadcasted back to the User. In addition, the User needs to define the mathematical constants of e or π for SPAM/1. In SPAM/2, the constants are implemented into the SPAM Generator.

In the case of large numbers exceeding 9,999,999, by default are broadcast as such:

12,345,678 would be broadcasted to the User as .- -... -   . ..---   -- translated as About 12 million

87,654,321 would be broadcasted to the User as .- -... -   ---.. ---..   -- translated as About 88 million

Note the use of the "Rounding to the nearest" rule. The same is true for the case of finite or repeating decimal numbers. By default are broadcasted as such:

1.2345678 would be broadcasted to the User as .- -... -  . .-. ..--- ...-- ....- -.... translated as About 1.2346

1.1111111...(repeating) would be broadcast to the User as .- -... -  . .-. . . . . translated as About 1.1111