MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues. 2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)

Advanced Color BASIC Documentation: Difference between revisions

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search
(3 intermediate revisions by the same user not shown)
Line 27: Line 27:
PRINT #-3, "HELLO WORLD"
PRINT #-3, "HELLO WORLD"


=== New device number: #-4 - tbd ===
=== RESTORE enhancement ===
The RESTORE command by itself (as before) will reset the READ/DATA ptr to the first DATA line in the current BASIC program. A new option of specifying the line number of the DATA statement that the next READ should come from has been added.
  RESTORE 1000:'This sets the next READ to get data from line 1000.


=== RAM Disk ===
=== RAM Disk ===
Line 71: Line 73:


Line number can be a variable.
Line number can be a variable.
If no COMMON command has been issued before CHAIN, then all variables are initialized in the called program (same as RUN). However, any numeric variables or arrays defined in a COMMON command will be passed intact to the called program.


=== COMMON ===
=== COMMON ===
Restrictive comment. For Example:
This defines variables to pass along to a CHAIN'ed program. From what I can tell, these can only be be numeric (either straight variables or arrays), but not strings. For regular variables, specify the 1 or 2 character variable name. For arrays, specify the array name with open and closes parenthesis, but with no number to designate how many elements (the chained program will inherit the size used by the calling program).
10 COMMON This is a comment : PRINT “HELLO WORLD”
COMMON A,B,C,SC()
The text after the COMMON command will not be executed, but the command after the colon will. This is different from REM
10 REM This is a comment : PRINT “HELLO WORLD”
The REM command will cause everything to be ignored on the whole line.


=== TERM ===
=== TERM ===
Line 145: Line 146:


=== TIME ===
=== TIME ===
Returns the current value for the 24 bit timer (the old Extended BASIC "TIMER" still works as a 16 bit timer).<br>
Returns the current number of 1/60th clock ticks that the current TIME$ value represents (including hours, minutes and seconds).
This counter increments 60 times per second and rolls over at 24 hours.
<br>Please note that it rolls over at 24 hours.


=== TIME$ ===
=== TIME$ ===

Revision as of 17:02, 23 March 2024

Advanced Color BASIC - New and updated features explained

Introduction

This document explains the version 0.0.7 of Advanced Color BASIC ROM found late in 2023.
It is from Robert Killgus' collection.
This is a very early version of the software and eventually became Deluxe Color BASIC.

Allows lowercase characters in keywords.

Key repeat is built in.

Full screen editor is always available.

  • Hold alternate and arrow keys to move the cursor around.
  • Alternate and 'I' will insert a space and move the characters after the cursor to the right one space.
  • Alternate and 'D' will delete the character under the cursor and shift the remaining characters to the left.
  • Alternate and 'E' will delete the characters after the cursor to the end of the line.
  • Alternate and ‘H” will move the cursor to the top left corner of the screen.
  • Right Arrow (without the alternate key, Control-I) will move the cursor right 8 spaces.
  • Left Arrow (without the alternate key, Control-H) will move the cursor one space to the left, and clear the character.
  • Control and 'U', Shift-Left Arrow will clear the line and move the cursor to the left.
  • The break key will abort editing and put the cursor at the bottom left of the screen.
  • CLEAR (Control-L) will abort editing and clear the screen.

Press the enter key to commit an edited line. You do not have to be at the end of a line.

New device number: #-3.

Sends and receives data to/from the new serial port. Uses: PRINT #-3, "HELLO WORLD"

RESTORE enhancement

The RESTORE command by itself (as before) will reset the READ/DATA ptr to the first DATA line in the current BASIC program. A new option of specifying the line number of the DATA statement that the next READ should come from has been added.

 RESTORE 1000:'This sets the next READ to get data from line 1000.

RAM Disk

Drive 4 is a RAM Disk. It has 12 granules available. It is available even if there is no disk cartridge inserted.

If a disk cartridge is inserted on cold boot, you are presented with a menu option to go to BASIC or "Disk". If you choose "Disk" the equivalent of a DOS command is executed.

New commands

ERROR <value>

Will cause the computer to stop the program and issue the respective error.

RESUME <line number>

Resumes a program at line number from the error handler.

WHILE <boolean expression> / WEND

This is a loop construct that will execute the statements between WHILE and WEND repeatedly until the boolean expression is false.

TONE channel, toneperiod, amplitude

  • channel: 1-3
  • toneperiod: 0-4095
  • amplitude: 0-15

NOISE channel,noiseperiod,amplitude

  • channel: 1-3
  • noiseperiod: 0-31
  • amplitude 0-15

ENV param1,param2,param3,param4,param5

  • 5 numeric parameters 0-65535 allowed (TBD)
 TONE 1,2048,15 ' start tone 2048 on channel 1 at max volume
 NOISE 2,31,15 ' start noise 31 on channel 2 at max volume
 NOISE 2,0 ' stop noise on channel 2
 TONE 1,0,0 ' stop tone on channel 1
 SOUND command unaltered

TBD determine if PLAY command supports 3-voice like N60 BASIC (also by Microsoft) does

CHAIN - Chains to another BASIC program. Optional line number to start 2nd program running from.

CHAIN "PROGRAM[.BAS][,<line number>]

Line number can be a variable.

If no COMMON command has been issued before CHAIN, then all variables are initialized in the called program (same as RUN). However, any numeric variables or arrays defined in a COMMON command will be passed intact to the called program.

COMMON

This defines variables to pass along to a CHAIN'ed program. From what I can tell, these can only be be numeric (either straight variables or arrays), but not strings. For regular variables, specify the 1 or 2 character variable name. For arrays, specify the array name with open and closes parenthesis, but with no number to designate how many elements (the chained program will inherit the size used by the calling program).

COMMON A,B,C,SC()

TERM

Executes the ROM based terminal program (the cursor changes from a blinking black one to a blinking blue one to let the user know that they are in terminal mode). Further details on commands and Escape sequences within the terminal programming coming soon.

ALT-BREAK = Exit terminal
F1 = toggle CR / CR LF
F2 = toggle Local Echo on/off

CONFIG

Configures the UART Serial port:
CONFIG #-3,[1-15],[1-5],[5-8],[1-2]

First parameter:

BAUD

  • 1 = 50
  • 2 = 75
  • 3 = 109.92
  • 4 = 135.56
  • 5 = 150
  • 6 = 300
  • 7 = 600
  • 8 = 1,200
  • 9 = 1,800
  • 10 = 2,400
  • 11 = 3,600
  • 12 = 4,800
  • 13 = 7,200
  • 14 = 9,600
  • 15 = 19,200

Default: 6

Second Parameter:

Sent to 6551 command register

  • 1: $09 00001001 - No Parity
  • 2: $29 00101001 - Odd Parity
  • 3: $69 01101001 - Even Parity
  • 4: $A9 10101001 - Mark Parity
  • 5: $E9 11101001 - Space Parity
  • Transmit interrupt disabled

Default: 1

Third parameter:

Data word length, 5 to 8.

  • Default: 8

Fourth parameter:

Stop Bits

  • 1 = 1 stop bit
  • 2 = 2 stop bits

Default: 1

MAPMODE <value>

If the value is 0, the Color Computer is set to 0.89 MHz for the entire address space. If the value is 1, the Color Computer is set to 1.78 MHz speed when reading from ROM, and 0.89 MHz when reading or writing to RAM.

XOR

The exclusive or operator is true if 1 (and only 1) input is true, otherwise it is false.
This is used in the same sense as AND and OR in if/then statements:

 IF A XOR B THEN 40

It is also use like AND and OR in bit wise expressions:

 C = A XOR B

ERR

Variable that contains the last error number.

ERL

Variable that contains the line number where the last error occurred.

TIME

Returns the current number of 1/60th clock ticks that the current TIME$ value represents (including hours, minutes and seconds).
Please note that it rolls over at 24 hours.

TIME$

Will either return the current 24 hour clock value, or set the 24 hour clock value, using a string format. The string format is "HH:MM:SS", in 24 hour time format, so HH can be 0 to 23, MM can be 0 to 59, and SS can be 0 to 59. Examples:

 A$=TIME$
 TIME$="13:25:00"

STRIG(button)

This function returns the state of one of the four joystick buttons. Negative 1 if pressed, zero if not pressed.
Button numbers 1, 3, 5, 7 return the real time value of the button state. This allows rapid fire with the button held down.

  • 1 - Left joystick button 1
  • 3 - Left joystick button 2
  • 5 - Right joystick button 1
  • 7 - Right joystick button 2

Button numbers 0, 2, 4, 6 return -1 if the button was pressed since the last time this function was called.
It will then return 0 as long as the button is held down. A new button press will be required to get another -1. This is for single shot fire - the user needs to let go and press the button again in order to fire again.

  • 0 - Left joystick button 1
  • 2 - Left joystick button 2
  • 4 - Right joystick button 1
  • 6 - Right joystick button 2

INPUT$(count, device)

Used to scan an input device and accumulate a string:

 10 A$=INPUT$(3,#0)
 20 ? A$

Will pause the program and wait for three key presses. They are put into A$. This will support cassette, serial and disk file I/O.

ON ERROR GOTO <line number>

BASIC will jump to line number when an error is encountered. ERL and ERR will contain the line number with the error and the numeric error code, respectively.

Changed Commands:

The EDIT will now accept a single line number or a range. The command will clear the screen, list the program line/lines and put the cursor at the start of the screen.

A CLS value of 9 to 255 will cold start the computer. We suspect that this is a bug that should eventually be fixed.

A CLS value greater than 255 will cause an ?FC error.


Advanced Color BASIC - added ROM vector calls =

Like Color BASIC and Disk BASIC, which used Extended indirect addresses to call functions within the ROM’s (like JOYIN, DSKCON, etc.), Advanced Color BASIC seems to reserve from $8000-$8015 for additional calls as well. This allows the routines themselves to move around as the ROM was updated, but calling programs would have a set point to enter them.

[$8000] - Calls $FB00, which is a 3 entry table of LBRA instructions:

   LBRA  $FD32  (executes the TERM (terminal program) command, I believe)
   LBRA  $FB1A
   LBRA  $FD92

[$8002] - Calls $FB09, which is a 1 entry table of LBRA instructions (I assume more would have been added later) LBRA $FE16

[$8004] - ??? (points to $09D4, which is in BASIC’s data area)

[$8006] - ??? (points to $E968)

[$8008] - ??? (points to $0ABE, which is in BASIC’s data area)

[$800A] - ??? (points to $AD15)

[$800C] - Call $9254, which checks the 6551 initialized flag (>$0A04). If it is 0 (not initialized), it will initialize the 6551 & it’s related variables including 128 byte receive buffer. If not, it just returns.

[$800E] - ??? (points to $929D)

[$8010] - ??? (points to $DE28)

[$8012] - Calls $92E7, which will return a character from the 128 byte RS232 receive buffer, OR wait for an RS232 character to be received if the buffer is empty.

[$8014] - Calls $92BD, which will transmit a character through the RS232.