Commodore‎ > ‎BASIC‎ > ‎Keywords‎ > ‎

BANK

Keyword Abbreviation Token (hex) Version(s) Classification
BANK B{Shift+A} DC 4.7 Command and Statement
AUTO A{Shift+U}  DC  3.5, 7.0  Command and Statement 
BANK B{Shift+A}  FE 02  7.0  Command and Statement 

 
Syntax  
BANK configuration 
 
Parameters Type Legal Value(s) Default Value Note(s)
configuration Integer
0 to 15
 
 
 
 
Purpose  
Set a machine-specific configuration for memory-related commands, statments, and functions.
 
 
Remarks  
This statement selects a BANK of RAM and/or ROMs and/or I/O registers that will be accessible to the CPU for various memory-related tasks of BASIC (see end of this topic for a list).  Generally, BANKs 0 to 3 are pure RAM, while BANK 15 is the "system configuration" which has access to some RAM, the ROM containing the KERNAL, and the I/O registers.  Other BANKs are machine-dependant.
 
The disk-based commands allow a B parameter, however if one isn't supplied, the last-used BANK configuration will be used.  The USR function uses a machine-specific configuration; it is not affected by BANK.  For everything else, the last-used configuration will apply.  On power-up, BASIC sets the default configuration to BANK 15.  Unfortunately when a program is RUN, BASIC does not set a default configuration!  So if you need to use any of the related commands (on a machine which has BANK) be sure to include a BANK statement.  Otherwise the last-used BANK (in either a program or direct mode) will apply, with a good chance of disasterous results.
 
This statement updates a secret variable.  It is secret because BASIC provides no way to read the value (except for machine-specific PEEK).
 
If the configuration is a string, a TYPE MISMATCH ERROR occurs.  A floating-point configuration will be converted if needed (see INT), and if the integer is not legal (see table above) then ILLEGAL QUANTITY ERROR is generated.
 
The useful set of configuration(s) is program and machine-specific; this statement is non-portable.  As such, there are no examples.
 
 
See Also  

© H2Obsession, 2014
Comments