0% found this document useful (0 votes)
21 views

OSI 6502 BASICv1.0 UsersManual

Uploaded by

Sergio Ricardo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

OSI 6502 BASICv1.0 UsersManual

Uploaded by

Sergio Ricardo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

,.

I I _____...............___

\
\,
,\ ~•'""• .Ca - •· S •0
OSI 6502 8K BASIC VERSION l .0

INTRO DU CTI ON:


OSI BASIC was written by Microsoft, Inc., the company which wrote
Altair 8080 and 6800 BASIC. BASIC is written in an interpretive
marco code, which is then installed on each microprocessor of
interest. The result is that 6502 BK BASIC is identical to 8080
8K BASIC except where deliberate changes were made to the macro-
code. Thus 6502 8K BASIC benefits from years of debugging of 8080
BASIC.
OSI 6502 BASIC runs faster than 8080 BASIC because of the 6502 1 s
superior instruction set and due to higher clock speed operation
of 6502 systems.
The following manual simply provides reference material for those
familiar with BASIC. It is not intended to be a teaching aid, o~
to even fully characterize the language.
OS 6502 BASIC is a full ANSI Standard BASIC wi;tb additj_onal featu,t.es.
Th ;, BASIC wi 11 run programs written for Al ta i~ IMSA~, and S~!T~
BASIC without modification. Speed improvements from 4 to 100 times
can be expected over these machines.
PDP-d@, PDP-1,®, and NOVA@ BASIC programs will al so run with very
little modification.
Persons unfamiliar with BASIC can study any of the tutorial books
on BASIC available at any college or university book store, hobby
computer store, and through most of the hobby computer magazines.
Schaum's outline series Programing with BASIC , published by
McGraw-Hill, is an excellent tutorial book which is compatible with
OSI BASIC.
Additional specific ~nformation about OSI 8K BASIC can be obtained
from the MITS Altai~ BASIC Reference Manual. The BASIC has been
tested extens11ely with popular BASIC programs and is believed to
be reasonably bug free. However, no warranty is made for its
accuracy. If you think you have found a bug, please send a
documented example to Ohio Scientific~ Inc.
License Terms:
OSI 6502 8K BASIC is copyright by Microsoft. 8K BASIC's I/0 hand-
lers and DOS are copyright by Ohio Scientific Inc.
The purchase of 8K BASIC by itself or as part of a package with an
OSI Challenger gives the purchaser a single user license for BASIC.
The user may make back up copies for his own use but cannot sell,
lend, or otherwise redistribute BASIC in any form.

l
The single user license is for one version of BASIC., i.e., if the
user has BK BASIC for cassette, he will still have to pay full price
for BK Disk BASIC.

The cost of the 11 1 icense 11 is $30.00. The additional charges are


for the media and copying. Licensed users can purchase adcitional
back up copies or updated copies of BASIC at the current retail
price minus $30.00.

Each copy of BASIC carries the copyright label as well as internal


labels and serial numbers.
Persons, dealers, and companies who violate the copyright laws will
be prosecuted!

2
SPECIAL CHARACTERS
Character Use
@ Erases line being typed
(shift 0) Erases last character being typed
Carriage return Must be used after each line typed
Control C Interrupts program execution or listing
returns to command mode.
: (colon) Allows multiple statements per line
Contol 0 Typing a control O once surpresses output
until another control O is typed.
? ? can be used instead of print.

OSI 8K BASIC is a standard BASIC with additional string handling


11 11

capability and I/0 commands, as well as the following features.


OSI BASIC allows multiple statements per line via Next with- 11 : 11 •

out a variable can be used when FOR-NEXT statements are not nested.
ENO statements are not necessary. Question marks can be used
instead of PRlNI 11LET is optional. No spaces are required in
11 • 11 11

BASIC. These features allow highly efficient memory usage when


necessary.
Variables can be two characters long. Longer variables can be used
but only the first two characters will be utilized. The first
character must be alphabetic, the second can be alphabetic or
numeric. Long variables can not contain words used by BASIC such
as NEW, SIN, and so·on. Since spaces are not necessary BASIC would
interpert a variable such as ANEW" as a variable A and the command
11

NEW and would erase the program.


11 11

EXAMPLES:
LEGAL ILLEGAL
A IA
Al #8
AZ TOO
BEQ RGOTO
APPLE NEW l
TUESDAY FREQUENCY
Note: that variables AZl and AZ2 would be treated the same since
BASIC looks only at the first two characters .

• 3
COMMANDS

• NAME
LIST
EXAMPLE
LIST
LIST 100
COMMENTS
Lists program
Lists program from line 100. Control
C stops program listing at end of
current line.
NULL NULL 3 Inserts 3 nulls at the start of each
line to eliminate change return
bounce problems. Null should be O lfi\
when entering paper tapes from Teletyp~
readers. When punching tapes Nu1~=3.
Higher settings are required on faster
mechanical terminals.
RUN RUN Starts program execution at first line.
All variables are reset. Use an
immediate GOTO to start execution at
a desired 1ine.
RUN 200 GOTO 200 with variables reset.
NEW NEW Deletes current program.
CONT CONT Continues program after Control C or
4t STOP if the program has not been modified.
For instance a STOB followed by manually
printing out variables and then a CONT:
is a useful procedure in program debugg-
ing.
LOAD LOAD Used in cassette and Disk BASIC only.

OPERATORS
SYMBOL EXAMPLE COMMENTS
= A=lO LET is optional
LET 8=10

C=-B Negation
1' (Shift/n) X-t4 X to the 4th power
CtD with C negative and D not an integer
gives an FC error.
* C=A*B Multiplication
I D=L/M Division
+ Z=L+M Addition

4
J=255.l-X Subtraction

• <>
>
<
10 IF A<>B THEN 5
B>A
B<A
Not equal
B greater than A
B less than A
< =, =< B<,,A B less than or equal to A
=>,::>= B=>A B greater than or equal to A
AND IF B>A AND A>C
THEN 7 If both expressions are true then--.
OR IF B>A OR A>C
THEN 7 If either expression is true then--.
NOT IF NOT B'>A THEN 7 If B<=A then--.
AND, OR, and NOT can also be used in Bit manipulation mode for per-
formin9 Boolean operations of 16 bit 2s complement numbers (-32768 to
+32767)
EXAMPLES
EXPRESSION RESULT
63 AND 16 16
-1 AND 8 8
4 OR 2 6
l O OR l 0 10
NOT 0 -1
NOT l -2
OPERATOR EVALUATION RULES: Math statements evaluated from left to
right with* and/ evaluated before+ and -
Parentheses explicitly determine order of
evaluation.
Precedence for evaluation
l ) By pa renthese
2) 1'
3) Negation
4) * I
5) + -
6) =,<>, <,>, <=, >=
7) NOT
8) AND
9) OR


5

-
STATEMENTS
In the fa 11 owing examples
V or Wis "a numeric variable, X is a numeric expression,
X$ is a string expression, I or J is a truncated integer.
NAME EXAMPLE COMMENTS
DATA 10 DATA 1,3, 7 Data for READ statements must
be in order to be ~ad. Strings
may be read in DATA statements.
DEF 10 DEF FNA (V)=V*B User defined function of one
argument.
DIM 110DIMA(l2) Allocates space for Matrices
and sets all matrix variables
to zero. Non dimensioned
variables default to 10.
END 999 END Terminates program (optional)
FOR, NEXT l O FOR x= . l to l O STEP ol STtP is needed only if Xis
2v----- not incremented by l. NEXT X
30 NEXT X is needed only if FOR NEXT
loops are nested if not NEXT
alone can be used variables
and functions can be used in
FOR statements.
GOTO 50 GOTO l 00 Jumps to line 100
GOSUB, RETURN 100 GOSUB 500 Goes to subroutine, RETURN
500 . . . . goes back to next line number
600 RETURN after the GO SUB
IF .•. THEN
10 If X=5 THEN 5 If the statement is true
10 If x=5 THEN PRINT X
10 If X=5 THEN PRINT X:Y=Z Then the following will be
executed including multiple
statements of that line.
IF ... GOTO
10 I Ir X=5 GOT05 Same as if THEN with line
number )
ON ... GOTO
100 ON I GOTO 10, 20, 30 Computed GOTO
If I=l then 10
If 1=2 then 20
If 1=3 then 30

6
PRINT 10 PRINT X Prints value of expression
20 PRINT Test
11 11 Standard BASIC syntax with
, ; formats
11

READ 490 READ V, W Reads data consecutivel,y ·from


DATA statements in program
REM 10 REM This is a comment for non-
executed comments.
RESTORE 500 RESTORE Restores Intial values of
all DATA statements
STOP l 00 STOP Stops program execution re-
ports a BREAK. Program can
be restarted via CONT.
FUNCTIONS
Function Comment
ABS (X) For X=>O ABS(X)=X
For X<O ABS(X)=-X
INT (X) INT (X) = largest integer less than X
RND (X) Generates a random number between O and l
R~D (0) generates the same number always
RND (X) with the same X always generates
the same sequence of random numbers
NOTE (B-A)* RND (l)+A generates a random
number between Band A
SGN (X) IF x,-0 SGN{X)=l
IF x=<o SGN(X)=O
SIN ( X) Sine of X where Xis in radians
COS (X) Same for COS, TAN, and ATN (ARC TAN)
TAN (X)
ATN (X)
SQR (X) Square root
TAB (I) Spaces the print head I.
USR (I) See I/0 section
EXP ( X) E1'X where E is 2. 71828
FRE (X) Gives number of Bytes left in the workspace.
LOG {X) Natural LOG to obtain base 10 logs use
LOG( X)/LOG {10)

7
POS ( I) Gives current location of terminal print
head .

• SPC (I)

STRINGS
Prints I spaces, can only be used in print
statements.

Strings can be from Oto 255 characters long. All string variables
end in$ ex. A$,B9t HELLO$.
Strings can be dimensioned equated, printed,. r.ead from Data statements,
etc.
STRING FUNCTIONS
ASC (X$) Returns ASCll value of first character in
string.
CHR$ ( I) returns a I character string equivalent
the ASCII value above.
LEFT$ (X$,I) Gives left most I characters of string X$
RIGH1$ (X$, I) Gives right most I character of string X$
. MID $ (X$,I ,J) Gives string subset of string X$ starting
at 1th character for J characters. If J is omitted,
goes to end of string.
LEN (X$) Gives length of string in bytes.
STR$ (X) Gives a string which is the character
representation of the numeric expression
of X. Example X=3.l
X$=STR$(X)
X$= 3.1
11 11

VAL (X$) Returns string variable converted to


number. Opposite of STR$(X)

a
8
1/0
The following features of OSI BK BASIC are usefull primarily for
I/0 control. The user should be extremely careful with these state-
ments and functions since they manipulate the memory of the computer
directly. An improper operation with any of these commands can
cause a system crash, wiping out BASIC and the users program, thus
requiring a complete reload of the computer .
.
STATEMENT/FUNCTI'ON COMMENT
PEEK (I) Returns the decimal value of the
specified memory or 1/0 location.
(Decimal)
Example:
X=PEEK (64256)
Loads variable X with the 430 Board's
A/D converter output. (FBOOhex)
POKE I ,J Loads memory location I (decimal) with
J (Decimal) I must be between O and
65536 and J must be between O and 255
Example: 10 Poke 64256, 255 loads FBOO
with FF (Hex) thus loads the 430 Board's
D/A port Osuch that its output is +2
volts.
WAIT I,J,K Reads status of memory location I
(Decimal) exclusive OR's with K then
AND's the result with J until a non
zero result is obtained. If K is omit-
ted, it is zero.
Wait is used for fast service of input
status flags.
Example: Wait X,l will wait until Bit
zero of memory location X goes low then
BASIC will continue.
The high speed servicing of flags via the WAIT command allows the
programmer to service medium speed devices such as line printers .or
industrial equipment directly in BASIC.
USR: The USR function allows linkage to machine language routines
such as ultra-fast device handlers, etc. The USR function calls
only one machine language routine and can pass one integer value to the
machine language routine so that 65,000 actual user routines are possible.
The beginning of the user subroutine must be poked into 23Ehex (low)
and 23Fhe~ {high). The USR routine can use up to 8 levels of sub-
routines ll6 stack locations) without page swapping.
The USR function can obtain the argument of the function by cal ling
the routine pointed to by 6 (low) and 7 (high). This routine will

9
place the value of the argument in AE(hex) (high part) and AF(hex)

• (low part). To pass a value back to BASIC, the high part is placed
in A and the low part is placed in Y and the subroutine pointed to
by 8 and 9 should be called. If this function is not called USR
(X) will equal X. An RTS returns from USR to BASIC. All registers
can be modified by the user routine without affecting BASIC, however,
no page zero locations can be modified! The POKE instruction can
also be used to change the USR function call.
INTERRUPTS
For Interrupting routines of any significant length, page zero and
page one should be swapped out to higher memory, or memory partition-
ing (A16 and A17 on late model OSI memory-boards) should be used.

CONVERTING OTHER BASICS TO RUN


ON OSI 6502 BK BASIC
MATRIX subscripts: Some BASICS use []
OSI BASIC used ( ).
Strings:
OTHER OSI
DIM A$(I,J) DIM A$ (J)
A$ (I) MID$ (A$, I, 1 )
AS (I ,J) MID$ (A$,I,J-l+l)
Multiple assignments: B=C=O must be rewritten as B=O:C=O. Some
BASICs use/to delimit multiple statements per line.Use Some
11 : 11 •

BASICs have MAT functions which will have to be rewritten with FOR-
NEXT loops.

10
OSI 6502 8K BASIC ERROR MESSAGES
ERROR CODE MEANING
BS Bad Subscript: Matrix outside DIM
statement range, etc.
DD Double Dimension: Variable dimensioned twice.
Remember subscripted variables default to
dimension 10.
FC Function Call error: Parameter passed to
function out of range.
ID Illegal Direct: Input or DEFIN statements can
not be used in direct mode.
NF NEXT without FOR:
OD Out of Data: More reads than DATA
OM Out of Memory: Program too big or too many GOSUBs,
FOR NEXT loops or variables. ·
ov Overflow: Result of calculation too large for .
BASIC

• SN
RG
us
Syntax error: Typo, etc.
RETURN without GOSUB.
Undefined Statement: Attempt to junp to non-
existant line number.
/0 Division by Zero.
CN Continue errors: Attempt to inappropriately
continue from BREAK or STOP.
LS Long String: String longer than 255 characters.
OS Out of String Space: Sarne as OM
ST String Temporaries: String expresssion too complex.
TM Type Mismatch: String variable mismatched to
numeric variable.
Uf Undefined Function.

11
OPERATING INSTRUCTIONS: AUDIO CASSETTE VERSION

• Minimum support Configuration: 6502 CPU, 65V PROM monitor, 12K


RAM, 440 video board, 430 cassette interface.
Turn on Procedure: OSI 8K BASIC for cassette is in standard OSI
Auto-Load Lm format and takes approximately 15 minutes to 1oad.
1. Turn on computer, monitor.
2. Reset computer, turn on the cassette.
3. As soon as the tape advances past the white leader,
type 11 LII on the keyboard.
4. The Auto-Loadtm_loader will now start loading in 65V
format at 2130.
5. After a few seconds, a full checksum load will start.
(15 minutes load time)
6. If an ERR is outputed at any time, immediately stop
11 11

the tape, back it up for a few seconds, start it and


type a G 11 11 •

7. At the end of the load BASIC will auto execute and


output MEMORY SIZE
11 If machine language routines
11 •

are not anticipated, simply type RETURN and BASIC


11 11

will utilize all available memory.


8. BASIC will then ask terminal width. Answer with three
times your actual width -3. Example; displayable width
is 25 answer 72 11 then return.
11

BASIC will now return its prompter 11 0K 11 and can be used as any stand-
ard on-line BASIC.
The display width can be adjusted by poking a new constant into the
CRT output routine. Example: "POKE 8745, 22 reduces the 1 ine
11

width to 22 characters. 8745 is the decimal location of the constant.


Dumping a Program to Cassette:
Everything you see on the screen will be outputed to the cassette
if it is turned on. To store a program on cassette type LIST 11 11

but do not return. Turn the cassette on to generate some leader


then type return. The program will be outputed to cassette as well
as the screen.
Inputing a Program from Cassette:
First cl ear the workspace with a 11 NEW 11 • Then advance the cassette
to the leader just before the program of interest. Type LOAD 11 11 ,

turn the tape on and return. Typing any key will now transfer
command back to the keyboard, so when the load is complete type
return. BASIC wi 11 report an SN error when it reads the 11 0K 11 at
the end of the tape, so just ignore it.

12
OPERATING INSTRUCTIONS: PAPER TAPE VERSION

• Minimum support configuration: 6502 CPU 65A monitor 12K or more


RAM and an ASR33 teletype or equivalent.
Turn on Procedure:
The 8K BASIC paper tape has a checksum loader dumper program at
the beginning followed by 8K BASIC in checksum format.
l. Turn on and reset the computer.
2. Place the beginning of the loader in the reader.
3. Type an L and turn the reader on.
11 11

4. A checksum loader starting at 2E70 similar to the 4K


KIM load dump of 12S-l should load in in 65A format.
5. After this load is complete, type R then L 0129 11 11 11

00 00 00 00 28 2EE3 then R then G 11 11 11 11 11 •

6. Advance the tape to the beginning of 8K BASIC and


turn the reader on.
7. You should see a checksum load occur. The records
are so long that the checksum over strikes at the
end of each line.
8. Watch carefully for an occurrence of ERR if an ERR 11 11

occurs, stop the reader. Immediately back up the tape


at least two full lines. Type G and start the reader 11 11

again. If ERR s occur often, the serial interface


11 11

baud rate is misadjusted or the teletype is in need


of repairs.
9. After BASIC loads (in about 45 minutes) Type R 11 11

to verify that you are in the monitor then type L 11

Ol 2E l F3F" then G 11 11 •

10. BASIC will ask memory size. If you do not require any
memory reserved for machine language routines simply type
return and BASIC will use all available memory. On
teletypes type return when BASIC asks "TERMINAL WIDTH".
BASIC will now return its prompter 11 0K 11 and can be used as any stand-
ard on-line BASIC.
Punching out a Program!
When you are ready to punch a program, set null for 3 using the
immediate mode by typing "Null 3 then return. Then generate some
11

leader off line. With the punch off and the terminal on line type
LIST then turn the punch on, then type return. BASIC will list
11 11 ,

out to paper tape. --


Reading In a Program:
First Type NEW" to clear the workspace, then set Null to O by "Null
11

0 Then place the BASIC program tape in the reader and turn it on.
11 •

13
You can optionally type control O just before turning on the
reader to surpress output. BASIC will report an 11 SN error 11 when
it reads the OK at the end of the tape. Simply ignore this.
If a reset occurs from BASIC you may be able to re-enter it by
11 L Ol2E0000 11 then 11 R11 then 11 G11 • If the stack has been disturbed
by another program or extensive use of the monitor, this will not
be possible and BASIC may be damaged by attempting to warm start
it. It is always safe to cold start BASIC from the monitor at
1F3F by 11 L 012E 1F3F 11 , then 11 R11 , then 11 G11 • However, any program in
BASIC will be lost.

,.

14

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy