New load command: Difference between revisions

From Color 64 BBS Wiki
Created page with "Programming Features - <strong>The New Load Command</strong> The Color 64 ML adds a new LOAD command that is very much like the original BASIC LOAD command, except it adds a couple new features. The format for the new command is: : <strong>↑<filename>, <device> [, <load address> ] </strong> :: <filename>: the name of the file to be loaded (in Color 64, its common to use dr$+"filename"). :: <device>: the device number. :: <load address>..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[programming features|Programming Features]] - <strong>The New Load Command</strong>
[[programming features|Programming Features]] - <strong>The New Load Command</strong>


The Color 64 ML adds a new LOAD command that is very much like the original BASIC LOAD command, except it adds a couple new features. The format for the new command is:
The Color 64 ML provides an enhanced LOAD command that extends the functionality of the standard BASIC LOAD. The syntax is:
: <strong>↑<filename>, <device> [, <load address> ] </strong>
:: <filename>: the name of the file to be loaded (in Color 64, its common to use dr$+"filename"). 
:: <device>: the device number. 
:: <load address>: the load address at which you wish the program to load.  If you do not include <load address>, then the computer assumes that you are loading a BASIC program.  This means that the program will auto-run when it loads.  If you use a load address less than 256, then the computer assumes you are loading a file directly into memory at the address specified in the file (either an ML file or memory table).  This type of load will not cause the BASIC program in memory to auto-run.  If the load address is greater than 255 then the file is loaded directly into memory at the specified address.


Again, loading files without a loading address will load and runs BASIC files.  Loading files with a loading address does not affect BASIC (unless of course a program is loading directly into the program or variable memory sections).  Here are a few examples of the command: 
: <strong>↑&lt;filename&gt;, &lt;device&gt; [, &lt;load address&gt; ]</strong>


{| class="wikitable
Parameters:
 
:: <filename> – The name of the file to load. In Color 64 it is common to use dr$+"filename".
:: <device> – The device number.
:: <load address> – Optional. Specifies the memory address where the file will be loaded.
 
Load behavior depends on whether a load address is supplied:
 
* If no load address is specified, the system assumes a BASIC program. The file loads and automatically runs.
* If a load address less than 256 is specified, the file loads into memory at the address defined internally within the file (typical for ML files or memory tables). The BASIC program in memory will not auto-run.
* If a load address greater than 255 is specified, the file loads directly into memory at the address you provide. This also does not auto-run BASIC.
 
In summary:
 
* No load address → Loads and runs BASIC programs.
* Load address specified → Loads directly into memory without auto-running BASIC (unless loading directly into BASIC program or variable memory areas).
 
Examples:
 
{| class="wikitable"
|-
|-
| ↑dr$+"√bbs.ini*",8
| ↑dr$+"√bbs.ini*",8
| Loads and runs "√bbs.ini*" from device 8, drive dr$  
| Loads and runs "√bbs.ini*" from device 8 using drive dr$.
|-
|-
| ↑dr$+"√bbs.ans*",8,0
| ↑dr$+"√bbs.ans*",8,0
| Loads into memory "√bbs.ans*" from device 8, drive dr$ into the location specified in the file  
| Loads "√bbs.ans*" from device 8 into memory at the address specified within the file itself.
|-
|-
| ↑dr$+"√some file",8,58000  
| ↑dr$+"√some file",8,58000
| Loads the program file "√some file" into memory from device 8, drive dr$ into memory at address 58000  
| Loads "√some file" from device 8 into memory starting at address 58000.
|}
|}


Another feature of the new LOAD command is that it checks if a BASIC program has overflowed memory and overwritten variables.  If this does occur, then the BBS program automatically shuts down and displays an error message indicating a LOAD overflow. All variables will be lost, and the message index will have to be regenerated. This error occurs when an overlay you are loading is larger in size than √bbs.init. If it were permitted, it would overwrite variable memory which would wreak havoc on the system. If you encounter this, you must reduce the size of the overlay to something smaller than √bbs.init.  
Overflow Protection
 
The enhanced LOAD command includes protection against BASIC memory overflow. If a BASIC overlay being loaded exceeds the allocated program space and overwrites variable memory, the BBS automatically shuts down and displays a LOAD overflow error.
 
When this occurs:
 
* All variables are lost.
* The message index must be regenerated.
 
This situation typically happens when an overlay file is larger than √bbs.init. Allowing it to load would overwrite variable memory and destabilize the system.
 
If you encounter a LOAD overflow error, reduce the size of the overlay so that it is smaller than √bbs.init before attempting to load it again.


Next Section: [[output commands|Output Commands]]
Next Section: [[output commands|Output Commands]]


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

Latest revision as of 22:56, 27 February 2026

Programming Features - The New Load Command

The Color 64 ML provides an enhanced LOAD command that extends the functionality of the standard BASIC LOAD. The syntax is:

↑<filename>, <device> [, <load address> ]

Parameters:

<filename> – The name of the file to load. In Color 64 it is common to use dr$+"filename".
<device> – The device number.
<load address> – Optional. Specifies the memory address where the file will be loaded.

Load behavior depends on whether a load address is supplied:

  • If no load address is specified, the system assumes a BASIC program. The file loads and automatically runs.
  • If a load address less than 256 is specified, the file loads into memory at the address defined internally within the file (typical for ML files or memory tables). The BASIC program in memory will not auto-run.
  • If a load address greater than 255 is specified, the file loads directly into memory at the address you provide. This also does not auto-run BASIC.

In summary:

  • No load address → Loads and runs BASIC programs.
  • Load address specified → Loads directly into memory without auto-running BASIC (unless loading directly into BASIC program or variable memory areas).

Examples:

↑dr$+"√bbs.ini*",8 Loads and runs "√bbs.ini*" from device 8 using drive dr$.
↑dr$+"√bbs.ans*",8,0 Loads "√bbs.ans*" from device 8 into memory at the address specified within the file itself.
↑dr$+"√some file",8,58000 Loads "√some file" from device 8 into memory starting at address 58000.

Overflow Protection

The enhanced LOAD command includes protection against BASIC memory overflow. If a BASIC overlay being loaded exceeds the allocated program space and overwrites variable memory, the BBS automatically shuts down and displays a LOAD overflow error.

When this occurs:

  • All variables are lost.
  • The message index must be regenerated.

This situation typically happens when an overlay file is larger than √bbs.init. Allowing it to load would overwrite variable memory and destabilize the system.

If you encounter a LOAD overflow error, reduce the size of the overlay so that it is smaller than √bbs.init before attempting to load it again.

Next Section: Output Commands

Programming Features