Ml command set: Difference between revisions

From Color 64 BBS Wiki
No edit summary
Tags: Manual revert Reverted
No edit summary
 
(33 intermediate revisions by the same user not shown)
Line 8: Line 8:
Example: <strong>1000 .01:ifleft$(tx$,1)<>"*"then1000 </strong>
Example: <strong>1000 .01:ifleft$(tx$,1)<>"*"then1000 </strong>


In this example, the .01 command reads a line of input in from disk, then if the input line did not begin with an asterisk, it would loop back and read another line.  This is also an example of how some of the input commands use TX$ as a buffer for input. The table below provides a summarized listing of all the ML commands:   
In this example, the .01 command reads a line of input in from disk, then if the input line did not begin with an asterisk, it would loop back and read another line.  This is also an example of how some of the input commands use TX$ as a buffer for input.  
 
The table below provides a summarized listing of all the ML commands:   


{| class="wikitable
{| class="wikitable
Line 19: Line 21:
| <strong>Get a typed character. </strong>
| <strong>Get a typed character. </strong>


This command does not wait for a key to be pressed but looks to see if a character has been typed.  Input is accepted from the BBS system keyboard or from the user currently online. The ASCII value of the character is returned in !02, and the status is returned in !01.  The ASCII value will be 0 (nu$) if no character has been typed. All alphabetic characters are converted to uppercase (A through Z).  
Polls both the local keyboard and remote connection for a keypress.
 
The resulting character value is returned in ML Variable !02. If no key was pressed, !02 is zero. Alphabetic characters are converted to uppercase.
 
Input status is returned in ML Variable !01.


Example: <strong>.00:P=!01:A$=CHR$(!02) </strong>
Example: <strong>.00:P=!01:A$=CHR$(!02))</strong>
|-
|-
| .01  
| .01  
| <strong>Input a line of data from disk. </strong>
| <strong>Input a line or block of data from disk. </strong>
 
Reads data from the logical file number stored in !14 and places it in the resident TX$ buffer.
 
The maximum number of characters that may be returned is controlled by !08. The number of characters actually returned is stored in !40.
 
Use of !15:
* If !15 is nonzero, input ends when the character stored in !04 is encountered. The ending character is consumed from the file but is not included in TX$.
* If !15 is zero, the character stored in !04 is ignored. Input continues until the maximum number of characters specified by !08 is read or file status indicates the end of the file or another input condition.
 
The normal settings for reading carriage-return-delimited lines are: <strong>!04,13:!15,1</strong>
 
Example:
1000 !04,13:!15,1
1010 .01
1020 IF !40<5 THEN 1010
 
This reads carriage-return-delimited lines and repeats the read when fewer than five characters were returned.
 
To read a block of data without stopping at the end-of-line character: <strong>!15,0:.01:!15,1</strong>
 
This temporarily disables delimiter detection, performs the read, and then restores normal delimiter processing.
 
Setting !04 to zero does not disable delimiter processing. When !15 is nonzero, a zero byte becomes the ending character.


The file number in !14 used.  End of line (EOL) is reached if: 
If !40 is less than the maximum input length in !08, the read normally ended because the !04 delimiter was encountered or file status became nonzero before the maximum length was reached.
* Maximum number of characters (length of TX$) is read in or 
* The character stored in !04 is reached (usually set to a carriage return), unless !15 is set to non-zero, then !04 will not end input.


Data is stored in TX$ starting at the first character.  The number of characters input is stored in !40.  If EOL was reached at the !04 character, such character will not be included in TX$ (e.g. a carriage return will not be part of the input line). If !40 is less than the length of TX$, then the line was terminated with the !04 character or the end of file was reached before another !04 character.     
The returned data may be accessed through TX$ or the @0 function: <strong>.01=ST$=@0</strong>


You can access the information by using TX$, the @0 function, or you can use the @5 function if you want to assign disk data directly to a variable (and skip the .01 command).
The @5 function may also be used when disk data is to be assigned directly to a BASIC string variable without first executing .01.
Example: <strong> .01:SR=ST:A$=@0 </strong>
|-
|-
| .02  
| .02  
| <strong>Input a line of text from the user. </strong>
| <strong>Input a line of text from the user. </strong>


Input is accepted from the BBS system keyboard or from the user currently online. The maximum number of characters to input is the length of TX$.  Input is terminated with a carriage return, or by pressing CTRL/X or CTRL/P. The status is returned in !01.  The number of characters typed is returned in !40. The information is stored in TX$ starting at the first character.  If !40 is less than the length of TX$, then the line was terminated with a carriage return.  Otherwise, input was ended because the maximum number of characters was reached.  You can access the text by using TX$, the @0 function, or you can use the @8 function to skip the .02 command.  
Reads from keyboard or remote user. Input ends with CR, CTRL/X, or CTRL/P.
 
Returns:
* Status in !01
* Character count in !40
* Text stored in TX$.  


May also use @0 or skip with @8.
Example: <strong> .02:I$=@0 </strong>
Example: <strong> .02:I$=@0 </strong>
|-
|-
| .03  
| .03  
| Equivalent of the "$" command…
| <strong>Input a Fixed Number of Bytes from a File</strong>
 
Format: <strong>.03,<nowiki><count>[,<skip>]</nowiki> </strong>
Reads a fixed number of bytes from the logical file specified by !14 and stores them in TX$.
* <nowiki><count></nowiki> is the number of bytes to return and must be from 1 to 255.
* <nowiki><skip></nowiki> is optional. When specified, that number of bytes is read and discarded before the requested data is stored.
* !40 is set to <count>.
* The file remains open after the command.
* The current file status remains available through ST.
 
Unlike .01, this command is not line-oriented:
* .01 reads until the end-of-line character in !04, the maximum length in !08, or a file-status condition.
* .03 ignores !04, !08, and !15.
* .03 does not stop at a carriage return or any other character.
* .03 always returns the requested number of bytes.


… but the expression to be printed must follow the command after a " , " comma.   
If the file ends or another file-status condition occurs before all requested bytes are read, the remaining positions in TX$ are filled with CHR$(0). ST remains nonzero so the program can detect that the requested data was not completely available from the file.
 
Do not use a count of zero. A zero count causes the internal byte counter to wrap and may overwrite memory.
 
Example:
1000 !14,8
1010 .03,6
1020 A$=@0
 
This reads six bytes from logical file 8 into TX$ and places those six bytes in A$.
 
Example with skipped bytes:
  1000 .03,2,2
1010 A$=@0
 
This discards the first two bytes and returns the following two bytes.
 
|-
|-
| .04  
| .04 / .05
| <strong>Activate protected mode. </strong>
| <strong>Activate / Deactivate protected mode. </strong>
 
.04 disables the RUN/STOP Key


RUN/STOP will be disabled, and the program can only be stopped by holding down SHIFT/COMMODORE/CONTROL.  If the system crashes, a GOTO9991 will be initiated.  Line 9991 should contain the code to execute after a system crashThe .05 command disables protected mode.
When in this condition, the program can only be stopped by holding down SHIFT/COMMODORE/CONTROL on the local keyboardIn the event of a system crash, a GOTO9991 which contains the code to reinitialize.   
|-
| .05
| <strong>Deactivates protected mode. </strong>


See the .04 command for more information.  
The .05 command disables protected mode.  
|-
|-
| .06  
| .06  
| <strong>Equivalent of the "#" command… </strong>
| <strong>Unused</strong>


… but the expression to be printed must follow the command after a " , " comma.   
Non-functional.   
|-
|-
| .07  
| .07  
| <strong>Activate terminal mode. </strong>
| <strong>Unused</strong>


Terminal mode (or Term mode) is a basic terminal program which allows the Sysop to dial out to other systems. Term mode will end if the Sysop presses any of the function keys (F1 through F8).  The ASCII value of the function key pressed is return in !02.  The Plusterm program makes use of the built-in buffer functions (see .23, !27, !28, !29, and !30)Local mode (!12) must not be on, and DTR must be enabled.
Non-functional.   
|-
|-
| .08  
| .08  
| <strong>Equivalent of the "%" command…  </strong>
| <strong>Session/Input Poll </strong>
 
Polls for typed input (non-blocking, local or remote) and updates P status
It is typically used inside scrolling output or file-display loops and before slow operations.
 
Resulting P status can be:
    0 = OK
    1 = User Abort
    3 = Pause State
    4 = User Aborted with CTRL-X
    255 = Carrier Lost
 


… but the expression to be printed must follow the command after a " , " comma.
|-
|-
| .09  
| .09  
| <strong>Equivalent of the "&" command… </strong>
| <strong>Single-Key Command Input Poll</strong>
 
The .09 command polls for a single keypress and stores the result in the BASIC string variable A$.
 
Without an acceptance string, the command is nonblocking: <strong>.09</strong>


… but the expression to be printed must follow the command after a " , " comma.
If no character is available, A$ is set to a null string.
 
The command may also include a list of accepted characters: <strong>.09,"YN"</strong>
 
When an acceptance string is supplied, .09 continues polling until an accepted character is received or an abort, timeout, or carrier-loss condition occurs.
 
A$ contains the accepted character. !52 contains the one-based position of that character within the acceptance string.
 
For example, with: <strong>.09,"YN"</strong>
Y returns !52=1 and N returns !52=2.
 
The character stored in A$ is normally in high-bit PETSCII form. For example, pressing X may return ASC(A$)=216.
|-
|-
| .10  
| .10 / .11
| <strong>Activate carrier-detect checking interrupt.  </strong>
| <strong>Activate / Deactivate carrier-detect checking interrupt.  </strong>


This activates an interrupt (a program which is executed every 1/60 of a second), which performs the functions necessary to check the status of the modem's carrier detect line.  It also handles the Network file transfer timeout, the carrier detect timeout, and the inactivity timeout.  Related variables are !13, !22, !00, !11, !24, and !25. The .11 command disables the interrupt.
.10 activates an interrupt (a program which is executed every 1/60 of a second), which performs the functions necessary to check the status of the modem's carrier detect line.  It also handles the Network file transfer timeout, the carrier detect timeout, and the inactivity timeout.  Related variables are !13, !22, !00, !11, !24, and !25.  
|-
| .11
| <strong>Deactivate carrier interrupt.  </strong>


See the .10 command for more information.  
.11 deactivates the interrupt.
|-
|-
| .12  
| .12  
| <strong>Output a sequential file. </strong>
| <strong>Display an open sequential file. </strong>
Displays the contents of an already-open sequential file using the logical file number stored in !14. The file is sent through the normal Color 64 output system, including terminal translation, color and MCI processing, character velocity, and the page pauser controlled by !17.
 
The caller may abort the display by pressing the spacebar or CTRL/P. In either case, !01 returns a value of 1. Set !16 to a non-zero value before using .12 to prevent these keys from aborting the display. !16 automatically resets to zero when .12 finishes.
 
A negative value in !01, normally 255, indicates that the display ended because the carrier was lost or another terminal condition occurred. A value of zero indicates normal completion.
 
The file remains open after .12 returns. Programs should use !01, rather than ST, to determine the result of the display.


The file number is stored in !14 and the file must already be opened. If !16 is set to 1, the file cannot be aborted. If !17 is set to non-zero, then the page-pauser will be active and !17 is the number of linesThe file can be aborted by pressing the space bar or by typing CTRL/P.
Example:
  OPEN8,DV,8,DR$+F$
<nowiki>!14,8</nowiki>
.12
  P=!01
CLOSE8 
|-
|-
| .13  
| .13  
| <strong>Dump caller log buffer to disk. </strong>
| <strong>Dump caller log buffer to disk. </strong>


This will dump the temporary caller log buffer to disk file number 98 and clear the buffer.  This command is intended to be used only by the normal BBS caller log routines, and the system could crash if this command is used outside of this routine.  
Dumps the temporary caller log buffer to disk file number 98 and clears the buffer.  Intended to be used only by the normal BBS caller log routines.  
|-
|-
| .14  
| .14  
| <strong>Set level parameters for MCI commands. </strong>
| <strong>Set level parameters for MCI commands. </strong>


This command sets the levels for the use of the MCI commands. The system uses the value of LV for the current user's level, which is why LV must be one of the first variables defined.  The command is in the format .14,<number1>,<number2> where <number1> is the level for the message MCI's (£a0, £a1, etc.), and <number2> is the level for the variable MCI command (£[).  If <number1> has 128 added to it, then the DD$ message MCI (£a6) is disabled (i.e. will not print anything).
Format: .14,<msg level>,<variable level>
* Uses the value of LV (user access level) for the current user's level, which is why LV must be one of the first variables defined.   
* <msg level> = level for the message MCI's (£a0, £a1, etc.)
** Add a value of 128 to <msg level> to disable DD$ message MCI (£a6) printing
* <variable level> = level for the variable MCI command (£[) use
|-
|-
| .15  
| .15  
| <strong>Set the "Chat Begin" text.  </strong>  
| <strong>Install Relocatable ML Extension</strong>
BBS.TERM loads ºbbs.trmml at the address held in A, then executes:
 
.15A
 
There is no comma between the .15 command and the address expression.


This is not functional in versions 8.1 or 8.10a.
The .15 command does not load the extension file. It relocates and installs an extension that has already been loaded into memory.
 
For ºbbs.trmml, it installs:
* !27 through !30
* .42 through .45
 
It then transfers control to the extension’s initialization routine.
|-
|-
| .16  
| .16
| <strong>Set the "Chat End" text. </strong>
| <strong>Remove Extension Output Hook</strong>
 
Restores the normal Color 64 output path after the relocatable terminal extension has been used.
 
BBS.TERM calls .16 before reloading BBS.INIT.


This is not functional in versions 8.1 or 8.10a.
The command removes the active output hook but does not erase the loaded extension code or clear its command-table entries.
|-
|-
| .17  
| .17  
| <strong>Put text into caller log buffer.</strong>
| <strong>Append text into caller log buffer.</strong>
 
Format: .17,<string>
<string> = Text to be put in the temporary caller log buffer (usually the string is LG$). 
 
Used in conjunction with the variable !20 and the .13 command to handle caller log functions. 
Intended to be used only by the normal BBS caller log routines.
|- valign="top"
| .18 / .19
| <strong>Variable & Array Table Stack</strong>
 
.18 records the current sizes of the BASIC scalar-variable and array tables.
 
.19 removes variables and arrays created since the matching .18 and compacts the retained tables.
 
Existing variables that were modified after .18 keep their modified values. The commands do not save or restore complete copies of variable contents.


This command is in the form .17,<string>, where <string> is the text to be put in the temporary caller log buffer (usually the string is LG$).  This command is used in conjunction with the !20 variable and the .13 command to handle caller log functions. This command is intended to be used only by the normal BBS caller log routines, and the system could crash if this command is used outside of these routines.
The commands operate as a stack and support up to eight nested levels. Attempting a ninth consecutive .18 generates an OUT OF MEMORY error.
|-
| .18  
| <strong>Set up variable-killer. </strong>


This command causes the current variable memory configuration to be "memorized" by the system.  Later, when you use the .19 (Activate variable-killer) command, this information will be used to kill all new variables added to memory since the .18 command was used. If you use more than one .18 before another .19, then the memory configurations will be "stacked" so that an .18/.19 pair can be "nested" inside another .18/.19 pair. This allows a subroutine to use temporary variables and discard them without disrupting another routine's temporary variables. Up to eight .18 commands can be stacked, and an error will result if a 9th consecutive .18 command is issued.
Example:100
|-
A=1:B$="OLD":DIM C$(10)
| .19  
110 .18
| <strong>Activate variable-killer.</strong>
  120 D=4:E$="TEMP":DIM F$(20)
  130 A=99
  140 .19


Kills all the variables added since an .18 command.  See the .18 command description for information on how the variable killer works.  
After .19:
* A still equals 99
* B$ still exists
* C$() still exists
* D no longer exists
* E$ no longer exists
* F$() no longer exists
|-
|-
| .20  
| .20  
| <strong>Set BPS rate for computer to modem communications.</strong>
| <strong>Set BPS rate for computer to modem communications.</strong>


This command is in the format .20,<number> where <number> is a value from 0 to 2 for non-SwiftLink systems or 0 to 7 for SwiftLink systems. The values correspond to the BPS rates 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400 respectively. For non-SwiftLink systems, the BPS rate will be set to 2400 if any value above 2 is used.  For SwiftLink systems, the BPS rate will be set to 38400 if a value above 7 is used.  Once a BPS rate is set when a user is online, it should not be changed until the user disconnects.  
Managed by the Terminal overlay.
Format: .20,<value>
Values: 0–2 (non-SwiftLink) or 0–7 (SwiftLink)
Maps to 300–38400 baud.
Do not change during active session.
 
Notes:
For non-SwiftLink systems, the BPS rate will be set to 2400 if any value above 2 is used.   
For SwiftLink systems, the BPS rate will be set to 38400 if a value above 7 is used.   
Once a BPS rate is set when a user is online, it should not be changed until the user disconnects.
|-
|-
| .21  
| .21 / .22
| <strong>Activate DTR (Data Terminal Ready).</strong>
| <strong>Activate / Deactivate DTR (Data Terminal Ready).</strong>
 
Used by the Terminal overlay.
 
DTR, or Data Terminal Ready, is the modem-control line used by the computer to indicate that it is ready for communications.


DTR is a line to the modem which indicates the readiness of the computer to send and receive data.  If DTR is active, then all input/output functions are normal.  This is used in conjunction with .22 to control the DTR line.
.21 activates DTR.
|-
| .22
| <strong>Deactivate DTR.</strong>


Turning off DTR can have varying effects.  The most favorable effect is to cause the modem to hang up if on-line and return to command state (ready for AT commands).  In this case, it is best to have the DTR question in Setup set to YES.  Otherwise, the modem may just ignore the DTR signal, reset, or even something else depending on how the modem is set up.  99% of the time, though, the .22 command has a beneficial effect (there have not been any major problems).  Since disabling DTR on a SwiftLink system also disables all input and output, the DTR line is switched off momentarily.  
.22 deactivates DTR and clears related resident modem state.
|-
|-
| .23  
| .23  
| <strong>Dump buffer contents.</strong>
| <strong>Unused</strong>


This function dumps the contents of the Term mode buffer to file number 3.  The Sysop can press the space bar or CTRL/P to abort if output is directed to the screen.  See for more information.  This command is used by the Plusterm program.  
Non-operational.
|-
|-
| .24  
| .24  
| <strong>Wait for end of modem transmit.</strong>
| <strong>Wait for end of modem transmit.</strong>


On non-SwiftLink systems, there is an output buffer which stores characters waiting to be sent over the modem. This command will wait for the buffer to be completely emptied, thus ensuring that no data will be lost if some other type of modem command is to be issuedSwiftLink systems don't use an output buffer.
Waits until the currently active modem transmission has completed.
This command does not discard queued output and does not contain its own timeout. It is primarily used by non-SwiftLink communication routines.
   
|-
|-
| .25  
| .25  
| <strong>Cancel modem output. </strong>
| <strong>Cancel modem output. </strong>


Unlike the above command, which waits for the output buffer to clear, this will cancel the output immediately and clear the buffer.  
Discards modem output that is still waiting in the transmit queue.
 
After clearing the queued output, the command waits for any byte already being transmitted to finish.
 
Used by overlays when a user aborts an output operation.
|-
|-
| .26  
| .26  
| <strong>Clear input buffer.</strong>
| <strong>Clear input buffer.</strong>


Will clear all data holding in the modem input buffer. Ensures a clean slate for another input command.  
Will clear all data holding in the modem input buffer. Discard all characters currently waiting in the resident modem input buffer, used in the Terminal overlay after file-transfer cleanup.
|-
|-
| .27  
| .27 / .28
| <strong>Receive a file using current protocol.</strong>
| <strong>Receive / Transmit a file using current protocol.</strong>


Used by the BBS file transfer routines.  
Used by the BBS file transfer routines.  
|-
|-
| .28
| .29 / .30
| <strong>Transmit a file using current protocol.</strong>
| <strong>Receive / Transmit a header block (multi punter).</strong>


Used by the BBS file transfer routines.  
Used by the BBS file transfer routines.  
|-
|-
| .29
| .31 (& !55)
| <strong>Receive a header block (multi punter).</strong>
| <strong>Message-Record Line Reader and Delimiter Detector</strong>  
This routine is a wrapper around the .01 disk-input reader. It adds two message-oriented services:


Used by the BBS file transfer routines.  
* Detects a message-record divider consisting of a line whose only data byte is PETSCII $0E, Control-N.
|-
* Appends a carriage return to ordinary records when the input buffer has room.
| .30
* The file must already be open under the logical file number stored in !14.
| <strong>Transmit a header block (multi punter).</strong>


Used by the BBS file transfer routines.
For normal message record reading, expected inputs are !04,13 and !15,1
|-
| .31
| <strong>Used, but undocumented.</strong>


See “Undocumented / Unknown ML Variables, Commands and Basic Shortcuts” section in the Appendices.  
For .31 message scanning, !04 should normally remain carriage return.
Output result is recorded in !55.
|-
|-
| .32  
| .32  
| <strong>Set DATA statement line number. </strong>
| <strong>Set DATA Statement Line Number</strong>


Acts as a RESTORE command but allows you to set the line from which DATA statements will be read. If used by itself, the DATA pointer will be set to the current line.  If used in the form .32,<number> where <number> is a line number, then the DATA pointer will be set to that line. 
Functions similarly to the BASIC RESTORE command, but allows explicit control over the line number from which DATA statements will be read.


Example: <strong>.32,20000 </strong>
If used by itself (.32), the DATA pointer is set to the current line.
 
If used in the form .32,<number>, where <number> is a BASIC line number, the DATA pointer is set to begin reading DATA statements from that specified line.
 
Example: <strong>.32,20000</strong>
If the specified BASIC line does not exist, .32 returns without changing the current DATA pointer.
 
When .32 is used without a line number, place it at the end of the BASIC line rather than before a colon-separated statement.
|-
|-
| .33  
| .33  
| <strong>Activate extra variable memory mode.</strong>
| <strong>Activate Extra Variable Memory Mode</strong>
 
By default, BASIC variable memory begins immediately after the last byte of the "√bbs.init" overlay. This fixed location allows other overlays to be loaded without disturbing variables.
 
The .33 command relocates the start of BASIC variable memory to immediately after the last byte of the currently loaded overlay. This effectively increases available variable space by the size difference between the current overlay and "√bbs.init".
 
This command must be used carefully. It should be paired with the variable stack commands (.18 / .19). When .34 is later executed, the variable area is moved back to its original location. If insufficient free space exists at that time, system data or string variables may be overwritten.


Most of the time, system memory is set up so that BASIC variables always begin at the same place while the BBS program is running.  This place is located after the end of the last byte of the "√bbs.init" overlay, which allows other overlays to be loaded without overwriting variable memory.  The .33 command will cause the variables section to be moved to after the last byte of the current overlay in memory.  This means that if the current program is 10000 bytes smaller than "√bbs.init", there will be 10000 more bytes of free variable memory opened up after the .33 command.  This command should be used in conjunction with the variable-killer commands, because the .34 command will close this extra space and if there is not enough space free, a lot of system information could be overwritten.  See the .34 command for more information.  
See .34 for additional details.
|-
|-
| .34  
| .34  
| <strong>Deactivate extra variable memory mode.</strong>
| <strong>Deactivate Extra Variable Memory Mode</strong>
 
Restores the normal variable memory location established by "√bbs.init", reversing the effect of .33.
 
A .18 should precede each .33, and a corresponding .19 should precede each .34. This ensures variables are preserved and memory is safely returned to its original configuration.
 
If .34 is not executed before "√bbs.init" is reloaded, a LOAD OVERFLOW error will occur.


This closes the extra memory opened by the .33 command.  A .18 should precede every .33 command, and a .19 should precede every .34 command.  This will ensure that memory is returned to its original state.  If the .34 command is not issued before the "√bbs.init" overlay is loaded, then a LOAD OVERFLOW error will occur.  If there is not enough space free before the .34 command is issued, then string variables will be overwritten.  
If insufficient free memory exists when .34 is executed, string variables may be overwritten.
|-
|-
| .35  
| .35  
| <strong>Set system rainbow mode color list.</strong>
| <strong>Set System Rainbow Mode Color List</strong>
 
Defines the color sequence used by the system’s standard rainbow mode (such as the colors cycled by the F1 and F5 keys).
 
Format: .35,<string>
 
<string> must contain one to eight color control characters. These characters determine the rainbow color rotation order.
|-
| .36
| <strong>Reset Page Counters (from !17)</strong>
 
Used in the Messages overlay, this will reload the active pager counters from the configured !17 page length.
|-
| .37
| Clear resident TX$ length
 
Sets the active resident TX$ length to zero.
 
This also makes !40 equal zero and causes @0 to return a null string.
 
The old bytes in the resident TX$ memory area are not erased, but they are no longer considered part of the active string.
|-
| .38-.41 (high level)
| <strong>Generic Bound-Array Register Engine</strong>
 
These commands allow Color 64 BASIC to bind resident ML slots to ordinary BASIC arrays and access their elements without repeatedly calculating BASIC array subscripts.
 
Bound array elements are accessed with the semicolon syntax:
<nowiki>;0F</nowiki>
<nowiki>;1K</nowiki>
<nowiki>;4L</nowiki>
 
Assignment examples:
;0F=;0G
;1K=II
 
The syntax is: <strong>;<slot><field></strong>
 
The slot identifies the bound BASIC array. The field identifies a resident offset register and its expected array type.
|-
| .38
| <strong>Bind Basic Array to Resident Slot</strong>
Examples from BBS.MSGS include:
 
.38,0MN,1LK%,2MF%,3CA%,4MR%
 
and:
 
.38,0CA%,1NC%
 
The digit identifies the resident slot.
 
The following BASIC array name identifies the array to bind.
|-
| .39
| <strong>Set Typed Array Offset Registers</strong>
 
Format:
<strong>.39,<field><index expression>[,<field><index expression>...]</strong>
 
Examples:
.39,F1,G2,K1,L2
.39,K5
.39,KM
 
Each field letter identifies a resident offset register. The numeric expression following the letter identifies the desired array element index.
 
The ML converts that element index into a byte offset according to the field’s predefined element size:
 
A through E: string descriptors, 3 bytes
F through J: floating-point values, 5 bytes
K through O: integer values, 2 bytes
 
For example, <strong>.39,K5</strong> sets register K to the byte offset for integer-array element 5.
|-
| .40
| <strong>Advance Typed Array Offset Registers</strong>
Format: <strong>.40<field list></strong>
 
Example: <strong>.40FGKL</strong>
 
No commas are placed between the field letters.
 
Each field letter identifies a resident offset register. The letter also selects a predefined element size:
* A through E: 3 bytes
* F through J: 5 bytes
* K through O: 2 bytes
 
The values 3, 5, and 2 are stored in an internal ML table. They are not written in the .40 command.
 
For each listed field, .40 adds that field’s predefined element size to its current byte offset. This advances the field register by one array element.
 
Therefore:
* F advances by 5 bytes
* G advances by 5 bytes
* K advances by 2 bytes
* L advances by 2 bytes
 
Example:
.39,F1,G2,K1,L2
.40FGKL
 
After .40FGKL:
* F moves from element 1 to element 2
* G moves from element 2 to element 3
* K moves from element 1 to element 2
* L moves from element 2 to element 3
|-
| .41
| <strong>Retreat Typed Array Offset Registers</strong>
 
Format: <strong>.41<field list></strong>
 
Example: <strong>.41FGKL</strong>
 
No commas are placed between the field letters.
 
.41 uses the same internal element-size table as .40, but subtracts the selected field’s element size from its current byte offset.
 
Therefore:
* F retreats by 5 bytes
* G retreats by 5 bytes
* K retreats by 2 bytes
* L retreats by 2 bytes
 
This moves each selected field register backward by one array element.
 
.41 does not finalize or commit an array operation. Message-relinking routines use it when scanning backward through bound arrays, but the command itself is a generic typed-offset operation.
|-
| .42
| <strong>Terminal Mode</strong>
 
Extension command provided by ºbbs.trmml and installed through .15.
 
Runs the terminal extension’s interactive local and remote character loop.
|-
| .43
| <strong>Terminal-Buffer Dump</strong>
 
Extension command provided by ºbbs.trmml and installed through .15.
 
Writes the captured terminal buffer to the output file selected by BBS.TERM.
|-
| .44
| <strong>Reserved Extension Entry</strong>
 
Reserved command entry provided by ºbbs.trmml and installed through .15.
 
The supplied terminal extension directs this command to an RTS instruction.
|-
| .45
| <strong>Reserved Extension Entry</strong>
 
Reserved command entry provided by ºbbs.trmml and installed through .15.


This command sets the colors that the system will use for the standard rainbow colors (i.e. the ones used by the F1 and F5 characters).  The format of the command is .35,<string> where <string> is a string of 8 color control characters.  
The supplied terminal extension directs this command to an RTS instruction.
|}
|}



Latest revision as of 20:09, 30 July 2026

Programming Features - ML Command Set

The ML commands are a way for BASIC to access the faster and more powerful subroutines built into the Color 64 ML. Some of these commands do complex things and are very useful (such as getting a line of typed input), while others aren't used very often (enabling and disabling interrupts).

All ML commands begin with " . " period character, followed by two digits. Some commands require additional parameters, which follow the command after a " , " comma.

Example: 1000 .01:ifleft$(tx$,1)<>"*"then1000

In this example, the .01 command reads a line of input in from disk, then if the input line did not begin with an asterisk, it would loop back and read another line. This is also an example of how some of the input commands use TX$ as a buffer for input.

The table below provides a summarized listing of all the ML commands:

Color 64 v8.1.0a Overlays
CMD Details
.00 Get a typed character.

Polls both the local keyboard and remote connection for a keypress.

The resulting character value is returned in ML Variable !02. If no key was pressed, !02 is zero. Alphabetic characters are converted to uppercase.

Input status is returned in ML Variable !01.

Example: .00:P=!01:A$=CHR$(!02))

.01 Input a line or block of data from disk.

Reads data from the logical file number stored in !14 and places it in the resident TX$ buffer.

The maximum number of characters that may be returned is controlled by !08. The number of characters actually returned is stored in !40.

Use of !15:

  • If !15 is nonzero, input ends when the character stored in !04 is encountered. The ending character is consumed from the file but is not included in TX$.
  • If !15 is zero, the character stored in !04 is ignored. Input continues until the maximum number of characters specified by !08 is read or file status indicates the end of the file or another input condition.

The normal settings for reading carriage-return-delimited lines are: !04,13:!15,1

Example:

1000 !04,13:!15,1
1010 .01
1020 IF !40<5 THEN 1010

This reads carriage-return-delimited lines and repeats the read when fewer than five characters were returned.

To read a block of data without stopping at the end-of-line character: !15,0:.01:!15,1

This temporarily disables delimiter detection, performs the read, and then restores normal delimiter processing.

Setting !04 to zero does not disable delimiter processing. When !15 is nonzero, a zero byte becomes the ending character.

If !40 is less than the maximum input length in !08, the read normally ended because the !04 delimiter was encountered or file status became nonzero before the maximum length was reached.

The returned data may be accessed through TX$ or the @0 function: .01=ST$=@0

The @5 function may also be used when disk data is to be assigned directly to a BASIC string variable without first executing .01.

.02 Input a line of text from the user.

Reads from keyboard or remote user. Input ends with CR, CTRL/X, or CTRL/P.

Returns:

  • Status in !01
  • Character count in !40
  • Text stored in TX$.

May also use @0 or skip with @8. Example: .02:I$=@0

.03 Input a Fixed Number of Bytes from a File

Format: .03,<count>[,<skip>] Reads a fixed number of bytes from the logical file specified by !14 and stores them in TX$.

  • <count> is the number of bytes to return and must be from 1 to 255.
  • <skip> is optional. When specified, that number of bytes is read and discarded before the requested data is stored.
  • !40 is set to <count>.
  • The file remains open after the command.
  • The current file status remains available through ST.

Unlike .01, this command is not line-oriented:

  • .01 reads until the end-of-line character in !04, the maximum length in !08, or a file-status condition.
  • .03 ignores !04, !08, and !15.
  • .03 does not stop at a carriage return or any other character.
  • .03 always returns the requested number of bytes.

If the file ends or another file-status condition occurs before all requested bytes are read, the remaining positions in TX$ are filled with CHR$(0). ST remains nonzero so the program can detect that the requested data was not completely available from the file.

Do not use a count of zero. A zero count causes the internal byte counter to wrap and may overwrite memory.

Example:

1000 !14,8
1010 .03,6
1020 A$=@0

This reads six bytes from logical file 8 into TX$ and places those six bytes in A$.

Example with skipped bytes:

1000 .03,2,2
1010 A$=@0

This discards the first two bytes and returns the following two bytes.

.04 / .05 Activate / Deactivate protected mode.

.04 disables the RUN/STOP Key

When in this condition, the program can only be stopped by holding down SHIFT/COMMODORE/CONTROL on the local keyboard. In the event of a system crash, a GOTO9991 which contains the code to reinitialize.

The .05 command disables protected mode.

.06 Unused

Non-functional.

.07 Unused

Non-functional.

.08 Session/Input Poll

Polls for typed input (non-blocking, local or remote) and updates P status It is typically used inside scrolling output or file-display loops and before slow operations.

Resulting P status can be:

   0 = OK
   1 = User Abort
   3 = Pause State
   4 = User Aborted with CTRL-X
   255 = Carrier Lost


.09 Single-Key Command Input Poll

The .09 command polls for a single keypress and stores the result in the BASIC string variable A$.

Without an acceptance string, the command is nonblocking: .09

If no character is available, A$ is set to a null string.

The command may also include a list of accepted characters: .09,"YN"

When an acceptance string is supplied, .09 continues polling until an accepted character is received or an abort, timeout, or carrier-loss condition occurs.

A$ contains the accepted character. !52 contains the one-based position of that character within the acceptance string.

For example, with: .09,"YN" Y returns !52=1 and N returns !52=2.

The character stored in A$ is normally in high-bit PETSCII form. For example, pressing X may return ASC(A$)=216.

.10 / .11 Activate / Deactivate carrier-detect checking interrupt.

.10 activates an interrupt (a program which is executed every 1/60 of a second), which performs the functions necessary to check the status of the modem's carrier detect line. It also handles the Network file transfer timeout, the carrier detect timeout, and the inactivity timeout. Related variables are !13, !22, !00, !11, !24, and !25.

.11 deactivates the interrupt.

.12 Display an open sequential file.

Displays the contents of an already-open sequential file using the logical file number stored in !14. The file is sent through the normal Color 64 output system, including terminal translation, color and MCI processing, character velocity, and the page pauser controlled by !17.

The caller may abort the display by pressing the spacebar or CTRL/P. In either case, !01 returns a value of 1. Set !16 to a non-zero value before using .12 to prevent these keys from aborting the display. !16 automatically resets to zero when .12 finishes.

A negative value in !01, normally 255, indicates that the display ended because the carrier was lost or another terminal condition occurred. A value of zero indicates normal completion.

The file remains open after .12 returns. Programs should use !01, rather than ST, to determine the result of the display.

Example:

OPEN8,DV,8,DR$+F$
!14,8
.12
P=!01
CLOSE8  
.13 Dump caller log buffer to disk.

Dumps the temporary caller log buffer to disk file number 98 and clears the buffer. Intended to be used only by the normal BBS caller log routines.

.14 Set level parameters for MCI commands.

Format: .14,<msg level>,<variable level>

  • Uses the value of LV (user access level) for the current user's level, which is why LV must be one of the first variables defined.
  • <msg level> = level for the message MCI's (£a0, £a1, etc.)
    • Add a value of 128 to <msg level> to disable DD$ message MCI (£a6) printing
  • <variable level> = level for the variable MCI command (£[) use
.15 Install Relocatable ML Extension

BBS.TERM loads ºbbs.trmml at the address held in A, then executes:

.15A

There is no comma between the .15 command and the address expression.

The .15 command does not load the extension file. It relocates and installs an extension that has already been loaded into memory.

For ºbbs.trmml, it installs:

  • !27 through !30
  • .42 through .45

It then transfers control to the extension’s initialization routine.

.16 Remove Extension Output Hook

Restores the normal Color 64 output path after the relocatable terminal extension has been used.

BBS.TERM calls .16 before reloading BBS.INIT.

The command removes the active output hook but does not erase the loaded extension code or clear its command-table entries.

.17 Append text into caller log buffer.

Format: .17,<string> <string> = Text to be put in the temporary caller log buffer (usually the string is LG$).

Used in conjunction with the variable !20 and the .13 command to handle caller log functions. Intended to be used only by the normal BBS caller log routines.

.18 / .19 Variable & Array Table Stack

.18 records the current sizes of the BASIC scalar-variable and array tables.

.19 removes variables and arrays created since the matching .18 and compacts the retained tables.

Existing variables that were modified after .18 keep their modified values. The commands do not save or restore complete copies of variable contents.

The commands operate as a stack and support up to eight nested levels. Attempting a ninth consecutive .18 generates an OUT OF MEMORY error.

Example:100

A=1:B$="OLD":DIM C$(10)
110 .18
120 D=4:E$="TEMP":DIM F$(20)
130 A=99
140 .19

After .19:

  • A still equals 99
  • B$ still exists
  • C$() still exists
  • D no longer exists
  • E$ no longer exists
  • F$() no longer exists
.20 Set BPS rate for computer to modem communications.

Managed by the Terminal overlay. Format: .20,<value> Values: 0–2 (non-SwiftLink) or 0–7 (SwiftLink) Maps to 300–38400 baud. Do not change during active session.

Notes: • For non-SwiftLink systems, the BPS rate will be set to 2400 if any value above 2 is used. • For SwiftLink systems, the BPS rate will be set to 38400 if a value above 7 is used. • Once a BPS rate is set when a user is online, it should not be changed until the user disconnects.

.21 / .22 Activate / Deactivate DTR (Data Terminal Ready).

Used by the Terminal overlay.

DTR, or Data Terminal Ready, is the modem-control line used by the computer to indicate that it is ready for communications.

.21 activates DTR.

.22 deactivates DTR and clears related resident modem state.

.23 Unused

Non-operational.

.24 Wait for end of modem transmit.

Waits until the currently active modem transmission has completed. This command does not discard queued output and does not contain its own timeout. It is primarily used by non-SwiftLink communication routines.

.25 Cancel modem output.

Discards modem output that is still waiting in the transmit queue.

After clearing the queued output, the command waits for any byte already being transmitted to finish.

Used by overlays when a user aborts an output operation.

.26 Clear input buffer.

Will clear all data holding in the modem input buffer. Discard all characters currently waiting in the resident modem input buffer, used in the Terminal overlay after file-transfer cleanup.

.27 / .28 Receive / Transmit a file using current protocol.

Used by the BBS file transfer routines.

.29 / .30 Receive / Transmit a header block (multi punter).

Used by the BBS file transfer routines.

.31 (& !55) Message-Record Line Reader and Delimiter Detector

This routine is a wrapper around the .01 disk-input reader. It adds two message-oriented services:

  • Detects a message-record divider consisting of a line whose only data byte is PETSCII $0E, Control-N.
  • Appends a carriage return to ordinary records when the input buffer has room.
  • The file must already be open under the logical file number stored in !14.

For normal message record reading, expected inputs are !04,13 and !15,1

For .31 message scanning, !04 should normally remain carriage return. Output result is recorded in !55.

.32 Set DATA Statement Line Number

Functions similarly to the BASIC RESTORE command, but allows explicit control over the line number from which DATA statements will be read.

If used by itself (.32), the DATA pointer is set to the current line.

If used in the form .32,<number>, where <number> is a BASIC line number, the DATA pointer is set to begin reading DATA statements from that specified line.

Example: .32,20000 If the specified BASIC line does not exist, .32 returns without changing the current DATA pointer.

When .32 is used without a line number, place it at the end of the BASIC line rather than before a colon-separated statement.

.33 Activate Extra Variable Memory Mode

By default, BASIC variable memory begins immediately after the last byte of the "√bbs.init" overlay. This fixed location allows other overlays to be loaded without disturbing variables.

The .33 command relocates the start of BASIC variable memory to immediately after the last byte of the currently loaded overlay. This effectively increases available variable space by the size difference between the current overlay and "√bbs.init".

This command must be used carefully. It should be paired with the variable stack commands (.18 / .19). When .34 is later executed, the variable area is moved back to its original location. If insufficient free space exists at that time, system data or string variables may be overwritten.

See .34 for additional details.

.34 Deactivate Extra Variable Memory Mode

Restores the normal variable memory location established by "√bbs.init", reversing the effect of .33.

A .18 should precede each .33, and a corresponding .19 should precede each .34. This ensures variables are preserved and memory is safely returned to its original configuration.

If .34 is not executed before "√bbs.init" is reloaded, a LOAD OVERFLOW error will occur.

If insufficient free memory exists when .34 is executed, string variables may be overwritten.

.35 Set System Rainbow Mode Color List

Defines the color sequence used by the system’s standard rainbow mode (such as the colors cycled by the F1 and F5 keys).

Format: .35,<string>

<string> must contain one to eight color control characters. These characters determine the rainbow color rotation order.

.36 Reset Page Counters (from !17)

Used in the Messages overlay, this will reload the active pager counters from the configured !17 page length.

.37 Clear resident TX$ length

Sets the active resident TX$ length to zero.

This also makes !40 equal zero and causes @0 to return a null string.

The old bytes in the resident TX$ memory area are not erased, but they are no longer considered part of the active string.

.38-.41 (high level) Generic Bound-Array Register Engine

These commands allow Color 64 BASIC to bind resident ML slots to ordinary BASIC arrays and access their elements without repeatedly calculating BASIC array subscripts.

Bound array elements are accessed with the semicolon syntax: ;0F ;1K ;4L

Assignment examples:

;0F=;0G
;1K=II

The syntax is: ;<slot><field>

The slot identifies the bound BASIC array. The field identifies a resident offset register and its expected array type.

.38 Bind Basic Array to Resident Slot

Examples from BBS.MSGS include:

.38,0MN,1LK%,2MF%,3CA%,4MR%

and:

.38,0CA%,1NC%

The digit identifies the resident slot.

The following BASIC array name identifies the array to bind.

.39 Set Typed Array Offset Registers

Format: .39,<field><index expression>[,<field><index expression>...]

Examples:

.39,F1,G2,K1,L2
.39,K5
.39,KM

Each field letter identifies a resident offset register. The numeric expression following the letter identifies the desired array element index.

The ML converts that element index into a byte offset according to the field’s predefined element size:

A through E: string descriptors, 3 bytes F through J: floating-point values, 5 bytes K through O: integer values, 2 bytes

For example, .39,K5 sets register K to the byte offset for integer-array element 5.

.40 Advance Typed Array Offset Registers

Format: .40<field list>

Example: .40FGKL

No commas are placed between the field letters.

Each field letter identifies a resident offset register. The letter also selects a predefined element size:

  • A through E: 3 bytes
  • F through J: 5 bytes
  • K through O: 2 bytes

The values 3, 5, and 2 are stored in an internal ML table. They are not written in the .40 command.

For each listed field, .40 adds that field’s predefined element size to its current byte offset. This advances the field register by one array element.

Therefore:

  • F advances by 5 bytes
  • G advances by 5 bytes
  • K advances by 2 bytes
  • L advances by 2 bytes

Example:

.39,F1,G2,K1,L2
.40FGKL

After .40FGKL:

  • F moves from element 1 to element 2
  • G moves from element 2 to element 3
  • K moves from element 1 to element 2
  • L moves from element 2 to element 3
.41 Retreat Typed Array Offset Registers

Format: .41<field list>

Example: .41FGKL

No commas are placed between the field letters.

.41 uses the same internal element-size table as .40, but subtracts the selected field’s element size from its current byte offset.

Therefore:

  • F retreats by 5 bytes
  • G retreats by 5 bytes
  • K retreats by 2 bytes
  • L retreats by 2 bytes

This moves each selected field register backward by one array element.

.41 does not finalize or commit an array operation. Message-relinking routines use it when scanning backward through bound arrays, but the command itself is a generic typed-offset operation.

.42 Terminal Mode

Extension command provided by ºbbs.trmml and installed through .15.

Runs the terminal extension’s interactive local and remote character loop.

.43 Terminal-Buffer Dump

Extension command provided by ºbbs.trmml and installed through .15.

Writes the captured terminal buffer to the output file selected by BBS.TERM.

.44 Reserved Extension Entry

Reserved command entry provided by ºbbs.trmml and installed through .15.

The supplied terminal extension directs this command to an RTS instruction.

.45 Reserved Extension Entry

Reserved command entry provided by ºbbs.trmml and installed through .15.

The supplied terminal extension directs this command to an RTS instruction.

Next Section: ML Variables

Programming Features