Basic for Dummies - 5.
music by DNK
(C) D. Rudovsky
________________________________
This article, I open a new
a large section of the course. in
This section will focus on programs called extensions
Language Basic. But in reality it is
virtually independent programming languages. Each extension (in
what language.) has its own characteristics, which
it specializes in a particular area of application. In
describing the language, I'll point the most user-friendly
application of the language. Attention! All languages do not
work in 128 mode, before booting Do not forget to go to 48 mode.
Given the large amount of information
today's article, I will devote Beta-Basic'u.
BETA-BASIC.
Attention! During its operation, the explosive use of
alternative trap mode, because of what can not be direct access
to the TR-DOS. Before work to read the section
WORKING WITH TR-DOS.
Introduction.
Beta-Basic (later BB)
is probably the most powerful
including extensions. It offers
tremendous opportunity in the editing and programming
BASIC. It is almost
complete analog GW-BASIC for
IBM-compatible machines. Given that a program written in
BASIC should not take
more than 20K (or otherwise go to IBM, or assembler)
so I'm going to describe BB 3.0
which itself is 20K.
So first, some explanations about the recruitment program
in the BB: Depending on the set mode, which is set command
KEYWORDS operators are introduced as either a normal BASIC
(tokens), where the explosives are introduced from the regime
Cursor G, or are introduced by the characters, as in Basic128.
In addition there is an opportunity to vary program's output to
the screen. More on this in the description of the operator
KEYWORDS.
Modified procedure for the operator
FOR - NEXT, as a result,
it works much faster
with whole numbers to 65535 and
slow for large rooms
lines. Supplemented by an operator
PRINT, what you may read
in Section IO.
Getting Started.
Once you've downloaded the BB
bootstrap self-destructs from
It only remains zero
line. Try to remove it is not
stands, it contains information
required for explosives, so the same, leaving their program
Wednesday explosive load it is necessary not
for LOAD, but by MERGE. Since
program is written from the midst of explosive
already has a zero row,
there is no need to use MERGE.
Editor.
Now it is time to examine in detail the changes and additions
to built-in editor of BASIC programs.
# NEW command clears the program
but leaves the zero line, so if you need to reset
BB, or press RESET, or
give the command RANDOMIZE USR 0.
Change the action team
LIST, there are new commands:
EDIT, RENUM and KEYWORDS.
Well, now all in order:
LIST [n, TO m] - Text output
BASIC program (hereinafter - the listing) with the line n to
line m inclusive. Example:
LIST 100 - listing with 100 rows
to the end;
LIST 100 TO ---""---""---""---;
LIST TO 100 - Listing to 100'y
line;
LIST 10 TO 100 - output rows
10 to 100 inclusive.
LIST FORMAT n - Set the output format of the listing. n - number
regime.
0 - Standard output listing.
1 - Lines are displayed one at a time
operator in the on-screen prompt and
indented statements FOR, GO
SUB, DEF FN and DEF PROC for 1 symbol. In this mode, during
input when pressed: "should
automatic shift and symbol
":" Is not printed.
2 - Same as format 1, but
indentation is taken 2 characters.
3 - Standard output listing,
but the row numbers are not displayed.
4 - Same as format 1, but without
display line numbers.
5 - Same format, 2
----""----""----""----""--- LIST DATA | Output Variables
LIST VAL | programs and their
LIST VAL $ | values in alphabetical order. DATA - all
variables; VAL - numeric variables, arrays, and variables
cycle; VAL $ - output string variables and arrays. For cycle
variables have an extra STEP n - a step change and LN n -
number of lines from which there is a return to the head of the
cycle. LIST DEF KEY - Displays a list of user-defined keys.
LIST PROC name - a listing
procedure called name.
LIST REF - Issuance numbers marked lines.
Example:
10 FOR N = 0 TO 10: PRINT N
20 NEXT N
The command LIST REF N gives:
10
10
20
EDIT n - Calling for editing
line n. Similarly LIST n and
.
RENUM [#] [n TO m LINE k STEP l]
- This command set fuktsy:
rename, copy, move. This changes everything
links to renumber
line. Assigning Parameters:
# - Indicates that the block
should be copied, not moved;
n - number of lines which starts the command, by default - 1;
m - number of lines on which team finishes work on
Default - 9999;
k - a new number which will be
assigned to line n, default
- 10;
l - a step which would go
renumbering of rows, by default - 10.
Examples:
'& AmpRENUM - renumber all
program by assigning the first
line number 10 in increments of 10;
RENUM 100 - 100 renumbers
string by assigning it the number 10;
RENUM 100 TO - renumbers
program starting with 100 lines
which is assigned number 10 with
step 10;
RENUM TO 100 - renumbered the program up to 100 lines, with
This first line is assigned
Number 10 and renumbering goes with
step 10;
RENUM LINE 1000 - renumbered the entire program in 10,
while the first line is assigned the number 1000;
RENUM STEP 1 - the whole program is renumbered in increments of
1, This line is assigned to perovskite
Number 10.
NB. The team uses as a buffer screen, so in
while her work appears on the screen dirty. If the team comes
across instruction type GO TO ln * 100 teams are not fix it,
and displays a message: Failed at n: m, where n - number of
rows, and m - number of the operator in line.
KEYWORDS n - Setting
I program the keypad, n
- Mode.
0 - In cursor mode G is introduced
UDG. 1 - In the Cursor mode G introduced the team of
explosives. Modes 0 and 1 does not affect the remaining
regimes.
2 - All of the keywords entered
a single keystroke, and
commands are entered via the BB mode
G.
3 - Same as mode 2, but allows you to type commands, and Spell
NB. To move the cursor K, L to the cursor press the space bar.
4 - All the commands are entered on the characters.
NB. The team is not in tokeniziruetsya
if it faces
letter or "_".
Working with TR-DOS.
Built in the BB clock uses 2 trap mode, which leads to a
conflict of explosives with TR-DOS When using it, so before
going out in TR-DOS, type RANDOMIZE USR 63237 vsstanovleniya
for a break mode, but at the end of Set 2 second interrupt mode
command RANDOMIZE USR 61369.
So how to work with the disk
usually have quite often, I recommend to insert a
program the following snippet:
9998 RANDOMIZE USR 63237: RANDOMIZE USR 15616
9999 RANDOMIZE USR 61369
To the disk you can run GO TO 9998. When you return to
BASIC everything will be restored.
If you are not planning to watch BB, I recommend
immediately turn off their RANDOMIZE USR
63237 and you will be relieved of
the above troubles.
Output to screen.
In BB significantly enhanced
capabilities of the standard BASIC
on display. In addition to the empowerment of teams PRINT
and type the command PLOT WINDOW, and
well as a range of teams working with a graphic screen.
Rssmotrim everything in order:
PRINT: USING "format" - so-called formatted output,
where the "format" - a character string, according to which
is the output of numbers on the screen.
CSIZE n, m - Installation rasmera
character (in pixels) horizontally and vertically. Examples:
PRINT USING "####.##%"; 989.275 -
The result would be: 989.28%
PRINT USING "0000.000"; 989.2751
- Result: 0989.275
PRINT CSIZE 16,16; "HELLO" - displays the word "HELLO"
size 2 * 2 familiarity.
CSIZE command can be used
and apart from the PRINT and then she
will set the common mode output to the screen.
PLOT x, y; a $ - Output line for a $
screen with pixel accuracy. x
and y are calculated as usual
command PLOT.
'& AmpWINDOW n, x, y, len, hgt - Definition window. n - number
of windows 1-127; x, y - coordinates of the left
upper corner of the window as a PLOT;
len, hgt - length and height of windows in
pixels. After determining the window
you can make it current, giving
command:
WINDOW n - where n - number of windows
(The window must be defined before it.). The main screen is a
window 0. Each window has its own
parameters such as: position
print character size, INVERSE, BRIGHT, INK, PAPER. For
cleaning windows to give the command:
CLS n - where n - number of windows. For
destruction box is necessary to give
command: ERASE WINDOW n.
GET a $, x, y, len, hgt, type - This
function saves the screen area with coordinates x, y and size
len, hgt in the variable a $. (all specified in pixels.)
The type parameter indicates how
save the image:
0 - no attributes;
1 - with the attributes.
OVER n - this team is complemented by BASIC mode 2: the
imposition of images on screen without inversion.
To be continued.