ML Variables
Programming Features - ML Variables
The ML Variables provide an interface between BASIC and the internal Color 64 machine language environment. They allow BASIC programs to read system status information and control various aspects of BBS operation.
All ML variables begin with an exclamation point (!) followed by two digits (for example, !04). They may be used in numeric expressions just like BASIC variables.
Values are assigned using the format:
!XX,value
This syntax is similar to the BASIC POKE command. All ML variables accept values in the range 0–255. Attempting to assign a value outside this range will generate an error.
Some ML variables are read-only, as indicated in the table below. Others are structured as multi-element variables and are accessed using array-style indexing (for example, !23(0)). An out-of-range index will generate an error.
Example:
1000 !04,0:.01:!04,13:if!40<5then1000
In this example:
- !04 is set to 0, changing the disk input end-of-line character.
- .01 reads a line from disk.
- !04 is restored to 13 (carriage return).
- !40 (number of characters read) is tested. If fewer than 5 characters were read, the loop repeats.
All ML variable references invoke ML processing at address $4E21.
The table below summarizes the ML Variables:
| Var | Description |
|---|---|
| !00 | Carrier detect mode
If less than 128, carrier timeout is enabled. If 128 or greater, carrier timeout is disabled. See !11. |
| !01 | Status variable (Read-Only)
Status after input commands (.00, .02, @8). 0 = OK 1 = Aborted (CTRL/P) 3 = Pause (CTRL/S) 4 = Aborted (CTRL/X) 255 = Carrier lost |
| !02 | General input/output character
Holds character returned by .00 or .07. Otherwise contains undefined data. |
| !03 | Maximum column for word wrap
When input exceeds this column and word wrap mode is enabled, wrapping occurs. Wrapped word (up to 15 characters) is buffered and reinserted at next input. |
| !04 | End-of-line character
The .01 command or the @5 function will read in a line of data until this character is reached, unless the maximum line length is reached, or !15 is set. See also .01 and !15 |
| !05 | Translation mode
0 = ASCII translation 1 = Graphics mode (Commodore/ANSI) 2 = Simulated ASCII (graphics input restricted) See also !18. |
| !06 | Uppercase input constraint
If non-zero, alphabetic input (.02 or @8) is forced to uppercase. |
| !07 | Word wrap mode
If non-zero, word wrap is enabled. See !03. |
| !08 | Wrap/Width Threshold |
| !09 | Character output mask
If not 0, this character will be printed instead of what is typed when inputting a line (the .02 command or the @8 function). This is used when the password is entered (asterisks are printed). |
| !10 | Line feed mode
Active only in ASCII translation mode. If non-zero, ASCII 10 follows ASCII 13. See !05. |
| !11 | Carrier timeout flag
0 = Timer suspended 1 = Timer active (counts to 255 if no carrier) Carrier is checked at 1/60 second intervals (~4.25 seconds timeout). Will hold value of 255 if timed out. |
| !12 | Local mode
1 = disables modem I/O (local mode - no information is outputted to modem) 0 = enables modem I/O. |
| !13 | Inactivity timeout flag
Non-zero value indicates inactivity timeout has occurred (~2 minutes of inactivity). |
| !14 | Disk input file number
Used by .01, @5, .12 and other disk routines. |
| !15 | End-of-line override mode
If non-zero, then the disk input routine will ignore the !04 end of line character and will fill the input buffer until the end of the file is reached, or until the maximum number of characters (length of TX$) has been reached. |
| !16 | SEQ file abort disable
If non-zero, then the next sequential file read (with the .12 command) cannot be aborted by either the spacebar or CTRL/P keys. Resets to zero after completion of file read. |
| !17 | Pager line count
0 disables pager. Non-zero sets pause interval (lines) during .12 sequential reads. |
| !18 | ANSI mode
Active only in Graphics translation mode. If non-zero, ANSI translation is enabled. See !05. |
| !19 | MCI disable flag
If non-zero, MCI processing is disabled for one output line. Automatically resets after output. |
| !20 | Caller log buffer status (Read-Only)
0 = Empty 1 = Contains data >1 = Full (requires disk write) |
| !21 | Variable Stack Number (Read-Only)
Current .18 stack level. 0 if no active stacks. |
| !22 | Network transfer timeout
Set to 128 + minutes when network file transfer initiated (starts timer). 0 disables timer. Transfer aborts if timer expires. |
| !23 | Non-SwiftLink BPS timer table
Table of 18 bytes; holds the timer values used by the Non-SwiftLink systems when sending and receiving the individual bits of data.
The table is as follows: 300 BPS output bit time, 300 BPS input bit time, 300 BPS half-bit time, 1200 BPS output bit time, etc. To access any individual byte of the table, just index !23 like an array (i.e. !23(0) would be byte 0 of the table). |
| !24 | Carrier type
Hardware comparison value for carrier detection (set by Setup). |
| !25 | Carrier status (Read-Only)
Non-zero if carrier detected. |
| !26 | SwiftLink flag (Read-Only)
0 = Non-SwiftLink 1 = SwiftLink system |
| !27 | Term buffer mode
If this is not zero, then all characters printed to the screen will also be put into the term buffer. • Parameters of the buffers are established by the !28, !29, and !30 variables. • Output is diverted to file number 3 (normally screen output). • Used by the Plusterm program. |
| !28 | Term buffer pointer
This is a 16-bit address in low byte, high byte format which points to the next open character in the term buffer. • !28(0) is the low byte, and !28(1) is the high byte. • Used by the Plusterm program. |
| !29 | Term buffer bottom pointer
16-bit address of first byte of buffer. Used by the Plusterm program. |
| !30 | Term buffer top pointer
16-bit address of last valid byte. Used by the Plusterm program. |
| !31 | Current BPS rate (Read-Only)
0=300, 1=1200, 2=2400, 3=4800, 4=9600, 5=14400, 6=19200, 7=38400 |
| !32 | Modem Input buffer empty flag (Read-Only)
0 = Empty Non-zero = Characters pending |
| !33 | X-Modem ASCII conversion mode
If non-zero, converts ASCII to PETSCII during transfer. |
| !34 | X-Modem CRC retry count
Sets the number of times that the system will attempt to engage CRC (Cyclical Redundancy Check) at the beginning of an X-Modem file transfer. |
| !35 | Punter block size
Sets the Block size in bytes for Punter protocol. |
| !36 | Transfer file type
1 or 3 = PRG 2 = SEQ |
| !37 | Current protocol (Read-Only)
0 = Punter 1 = X-Modem |
| !38 | Transfer timeout flag
Non-zero after transfer complete indicates carrier or network timeout during transfer. |
| !39 | Transfer abort status
Non-zero indicates aborted transfer. |
| !40 | Input character count
For keyboard input (.02 or @8) or disk input (.01 or @5), this value is the number of characters read in during input. |
| !41 | Alternate output mode
If non-zero, BBS output is diverted to file #3.
|
| !42 | Day of month (Read-Only)
Updated by @16 function. |
| !43 | Month of year (Read-Only)
Updated by @16 function. |
| !44 | AM/PM flag (Read-Only)
0 = AM Non-zero = PM |
| !45 | Current hour (Read-Only)
Holds values 1–12, updated by @11. |
| !46 | Scratch register
General-purpose read/write variable. See Undocumented features: !46. |
| !47 | Character output delay
May be used to slow output of the system for slower systems. 0 = No delay 255 = Maximum delay |
| !48 | Fast garbage collect mode
If non-zero, enables fast string garbage collection. Triggered automatically when free string space < 256 bytes. Supports up to 2048 strings; disables if exceeded. Screen blanks during execution. Recommended for string-intensive routines. |
| !49 | Boot device numbers (Read-Only)
A table of 3 values, !49(0) to !49(2), which holds the device numbers for the Boot drive, Program drive, and External drive, respectively. See also !50, !51, and the function @30. |
| !50 | Boot drive numbers (Read-Only)
A table of 3 values, !50(0) to !50(2), which holds the drive numbers for the Boot drive, Program drive, and External drive, respectively. See also !49, !51, and the function @30. |
| !51 | Disk swapping flag (Read-Only)
Defined by BOOTMAKER program. 0 = No swap required Non-zero = Disk swap required See also !49, !50, and the function @30. |
| !52 | Most recent find location (Read-Only)
Holds location result of @2 or @25 find functions. |
| !53 | 2 MHz FGC flag
If 1, C128 attempts 2 MHz mode during fast garbage collect. No effect on C64. Automatically set for C128 users. |
| !55 | Message record delimiter flag |
| !56 | Message editor command state
Indicates editor command mode. See Undocumented features: !56. |
| !57 | Editor prefix trigger
Defines key entering editor command mode. See Undocumented features: !57. |
| !58 | Editor variable (Undocumented)
Under investigation. See Undocumented features: !58. |
| !59 | Text-entry mode flag (Editor)
Non-zero indicates text-entry-only state. See Undocumented features: !59. |
| !60 | Editor menu selection
Stores selected editor menu item. See Undocumented features: !60. |
Next Section: ML Functions