Output commands: Difference between revisions

From Color 64 BBS Wiki
Created page with "Programming Features - <strong>Output Commands</strong> The Color 64 output commands differ from the BASIC PRINT statement because they not only print the information to the screen, but they also print the output to the user that is online. If you use a regular PRINT statement while a user is online, then the text will only be printed on your own screen. Another thing that the output commands do is automatically convert the output to ASCII or..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[programming features|Programming Features]] - <strong>Output Commands</strong>
[[programming features|Programming Features]] - <strong>Output Commands</strong>


The Color 64 output commands differ from the BASIC PRINT statement because they not only print the information to the screen, but they also print the output to the user that is online. If you use a regular PRINT statement while a user is online, then the text will only be printed on your own screen.  Another thing that the output commands do is automatically convert the output to ASCII or ANSI, if the user online is using one of those two text modes.
The Color 64 output commands differ from the standard BASIC PRINT statement. These commands send output both to the local screen and to the remote user. A regular PRINT statement only displays text on the Sysop’s screen when a caller is online.


{| class="wikitable
Additionally, the Color 64 output commands automatically convert output to ASCII or ANSI when the remote user is operating in those text modes.
 
{| class="wikitable"
|-
|-
|+Text Output Commands  
|+ Text Output Commands
! Cmd
! Cmd
! Details
! Details
|-
|-
| #
| #
| Format: #[<expression list>]  
| Format: #[<expression list>]
Example:  
 
[[File:poundsign.jpeg|center|260px]]              
Example:
[[File:poundsign.jpeg|center|260px]]


Output:
Output:
[[File:poundsignoutput.jpeg|center|260px]]  
[[File:poundsignoutput.jpeg|center|260px]]
 
<expression list>: A single or list of expressions that may be separated by semicolons (just like the PRINT statement). If you do not include anything after the "#" command, then the contents of A$ will be printed. This shortcut is often used in routines where A$ is read in from disk or from the keyboard and must be used if you wish to put the information in the caller log as well. The "#" command will print a carriage return at the end of the line unless you put a ";" semicolon at the end of the command.  
<expression list> may be a single expression or multiple expressions separated by semicolons (similar to PRINT).
 
If nothing follows the "#" command, the contents of A$ will be printed. This shortcut is commonly used when A$ contains data read from disk or keyboard input and must also be recorded in the caller log.
 
The "#" command automatically appends a carriage return unless a trailing semicolon is included.
|-
|-
| $  
| $
| Same rules as above, only the output will not include a carriage return. Useful for prompts.  
| Same usage rules as "#", except no carriage return is appended. This makes it suitable for prompts.


Example:                        
Example:
[[File:dollarsignoutput.jpeg|center|260px]]  
[[File:dollarsignoutput.jpeg|center|260px]]
|-
|-
| % and &  
| % and &
| The "%" and "&" commands are substitutes for the "#" and "$" commands, respectively.  Their difference is that they will automatically adjust alphabetic text (A through Z) so that it will always be readable in the case that Uppercase/Graphics mode has been turned on. If the computer is in Uppercase/Graphics mode and the text line to be printed contains shifted letters, then the line will "unshift" them so that they will be letters (and not Commodore graphics characters) when printed. These commands are used in the text editor routines, where the uppercase and lowercase modes can be changed at will.  
| "%" and "&" function like "#" and "$" respectively, but automatically adjust alphabetic characters (A–Z) to remain readable if Uppercase/Graphics mode is enabled.
 
If the system is in Uppercase/Graphics mode and shifted letters are present, these commands automatically convert them back to readable letters instead of Commodore graphic symbols.
 
These commands are commonly used in text editor routines where uppercase and lowercase modes may be switched dynamically.
|-
|-
| and (  
| ' and (
| Similar to #and $output commands, except that these would go out to the modem only and would not be visible on the local screen of the Sysop.
| These commands operate similarly to "#" and "$", but output is sent only to the modem and not displayed on the Sysop’s local screen.


Primarily used when "AT" commands are to be sent or information needs to be transmitted "unformatted" by the regular output commands. The CTRL/Y character does NOT work with these two commands.
They are primarily used when sending AT modem commands or when transmitting data that must not be processed by the normal output formatting routines. The CTRL/Y character does not function with these commands.


The " ' " apostrophe command follows the same format as the '#' command. This command outputs the text directly to the modem, without doing any conversion and without printing anything to the screen. A carriage return will be printed at the end of the output line, unless a ";" semicolon is included at the end of the command.  
The apostrophe (') command:
* Uses the same format as "#".
* Sends output directly to the modem.
* Performs no ASCII/ANSI conversion.
* Appends a carriage return unless a trailing semicolon is included.


The " ( " open parenthesis command works much the same as the " ' " command, except that a carriage return will never be printed at the end of the output line.  
The open parenthesis "(" command:
* Functions like the apostrophe command.
* Never appends a carriage return.
|}
|}
Important Note on Logging
When output must also be recorded in the caller log, you must use the format:
A$=<text>:#
If you do not assign the text to A$ first, incorrect information may be written to the caller log because these output commands do not modify A$.
This caution applies to any situation where printed data is later reused elsewhere in the program.
<strong>Control-Y Command in Quotes</strong>
A special control character, CTRL/Y, has been added to the output routines. It functions like a carriage return but may be embedded directly inside quoted text.
In BASIC, CTRL/Y can be typed within quotation marks. On the BBS, it may be entered without terminating the current input line.
Key characteristics:
* Behaves like a carriage return.
* Can be recorded within text.
* Does not cancel the velocity MCI command (£v), allowing long formatted output without interruption.


A warning about using the single character commands: If the text to be printed is also intended to be put in the caller log, then you must make sure that you use the A$=<text>:# version.  Otherwise, the wrong information may be put in the caller log because A$ will never be changed to the correct string.  The above commands do not alter A$.  This same warning also applies to any other situation where the information to be printed may be used elsewhere.
Restrictions:


* CTRL/Y cannot replace CR$ when writing structured data to disk (such as message headers or system parameter files).
* It should only be used when output is intended strictly for screen display and not later read by BASIC’s INPUT routine.
* BASIC’s INPUT command does not recognize CTRL/Y as a valid end-of-line character.


<strong>Control-Y Command in Quotes </strong>
An exception exists when CTRL/Y is intended to be stored as part of the data itself. In that case, it must still be followed by a standard carriage return.


A special control character has been added to the output routines that allows you to print carriage returns without using the CR$ and C2$ variables.  CTRL/Y behaves exactly like a carriage return, except it can be “recorded".  This means that in BASIC you can type it inside quotes, and on the BBS, you type it without ending the current input line.  CTRL/Y does not cancel the velocity MCI command (£v) either, which enables you to type a long message without having the carriage return cancel the velocity command.  Please note that CTRL/Y CANNOT replace CR$ when data is being printed to disk files (data such as a message header or system parms).  The only times CTRL/Y should be used is if you know that the output is going to be printed only to the screen, and not read in from a file as data.  The reason for this is that CTRL/Y is not recognized by BASIC's INPUT routine as a valid end-of-line character.  An exception to this restriction is if the CTRL/Y is intended to be read in as part of the data, in which case it would still have to be followed by a normal carriage return.  See the section on customizable message headers for an example of this.  
See the customizable message headers section for an example of proper usage.


Next Section: [[enhanced if statement|The Enhanced If/Then Statement]]
Next Section: [[enhanced if statement|The Enhanced If/Then Statement]]


[[programming features|Programming Features]]
[[programming features|Programming Features]]

Latest revision as of 23:03, 27 February 2026

Programming Features - Output Commands

The Color 64 output commands differ from the standard BASIC PRINT statement. These commands send output both to the local screen and to the remote user. A regular PRINT statement only displays text on the Sysop’s screen when a caller is online.

Additionally, the Color 64 output commands automatically convert output to ASCII or ANSI when the remote user is operating in those text modes.

Text Output Commands
Cmd Details
# Format: #[<expression list>]

Example:

Output:

<expression list> may be a single expression or multiple expressions separated by semicolons (similar to PRINT).

If nothing follows the "#" command, the contents of A$ will be printed. This shortcut is commonly used when A$ contains data read from disk or keyboard input and must also be recorded in the caller log.

The "#" command automatically appends a carriage return unless a trailing semicolon is included.

$ Same usage rules as "#", except no carriage return is appended. This makes it suitable for prompts.

Example:

% and & "%" and "&" function like "#" and "$" respectively, but automatically adjust alphabetic characters (A–Z) to remain readable if Uppercase/Graphics mode is enabled.

If the system is in Uppercase/Graphics mode and shifted letters are present, these commands automatically convert them back to readable letters instead of Commodore graphic symbols.

These commands are commonly used in text editor routines where uppercase and lowercase modes may be switched dynamically.

' and ( These commands operate similarly to "#" and "$", but output is sent only to the modem and not displayed on the Sysop’s local screen.

They are primarily used when sending AT modem commands or when transmitting data that must not be processed by the normal output formatting routines. The CTRL/Y character does not function with these commands.

The apostrophe (') command:

  • Uses the same format as "#".
  • Sends output directly to the modem.
  • Performs no ASCII/ANSI conversion.
  • Appends a carriage return unless a trailing semicolon is included.

The open parenthesis "(" command:

  • Functions like the apostrophe command.
  • Never appends a carriage return.

Important Note on Logging

When output must also be recorded in the caller log, you must use the format:

A$=<text>:#

If you do not assign the text to A$ first, incorrect information may be written to the caller log because these output commands do not modify A$.

This caution applies to any situation where printed data is later reused elsewhere in the program.

Control-Y Command in Quotes

A special control character, CTRL/Y, has been added to the output routines. It functions like a carriage return but may be embedded directly inside quoted text.

In BASIC, CTRL/Y can be typed within quotation marks. On the BBS, it may be entered without terminating the current input line.

Key characteristics:

  • Behaves like a carriage return.
  • Can be recorded within text.
  • Does not cancel the velocity MCI command (£v), allowing long formatted output without interruption.

Restrictions:

  • CTRL/Y cannot replace CR$ when writing structured data to disk (such as message headers or system parameter files).
  • It should only be used when output is intended strictly for screen display and not later read by BASIC’s INPUT routine.
  • BASIC’s INPUT command does not recognize CTRL/Y as a valid end-of-line character.

An exception exists when CTRL/Y is intended to be stored as part of the data itself. In that case, it must still be followed by a standard carriage return.

See the customizable message headers section for an example of proper usage.

Next Section: The Enhanced If/Then Statement

Programming Features