home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 #32
/
q32side2.d64
/
t.control80-c
< prev
next >
Wrap
Text File
|
2022-08-30
|
13KB
|
279 lines
C O N T R O L 8 0 - C
Program and Text by Jon Mattson
CONTROL80 is an extension of the BASIC 7.0 which adds many new keywords
to the language. These new functions and commands are specifically designed
to make using the 80-column screen easier. Those who have tried to work
with 80-columns in BASIC 7.0 will realize just what a boon this is: you
can't even PEEK or POKE to the VDC with normal BASIC! CONTROL80 solves
that problem and many others, as well.
Using C80-C is simple. First, set aside a section of memory to hold
it by opening up the area normally used for hires graphics. GRAPHIC1,1
will accomplish this, although it should be followed by GRAPHIC0,1 to get
out of hires mode and GRAPHIC5 to return the screen editor controls to the
80-column screen. Then, just BLOAD C80-C into memory and SYS 4864, either
in direct mode or early on in your program. Generally a simple BLOAD will
suffice, but, if you have been playing around with BANKs and the like, you
might want to use the full syntax. To summarize:
GRAPHIC1,1:GRAPHIC0,1:GRAPHIC5:BLOAD"C80-C",B0,P4864:SYS4864
NOTE: For card games with a mouse use "c80c-mouse.2300".
C80-C comes with a built-in, card-oriented font, which can be moved to
VDC memory with a simply FCOPY 6880,0,1. This command will cause the new
font to replace the existing alternate (upper/lower case) font, so that you
can use the CARD command. The FCOPY should come very shortly after the
set-up commands previously mentioned; however, it should not be on the same
line as those commands. The reason for this is that the computer deciphers
keywords a line at a time, and, until the SYS 4864 has actually been acted
upon, the FCOPY command will be translated as gibberish, resulting in a
syntax error when that point in the line is reached.
Once C80-C is installed, the new keywords can be used just like any
other BASIC commands. You can even abbreviate them by shifting the second
letter, as usual. Remember that C80-C must be active (not just resident)
while you type in a program using its keywords, or they will not be
tokenized correctly. Note, also, that C80-C uses memory from 4864 to 6879
(once the font has been moved), so avoid POKEing around this area.
Hitting the beloved STOP/RESTORE combination will not deactivate C80-
C. The QUIT command (previously unimplemented on the 128) will turn it
off, although SYS 4864 will bring it back to life. Resetting the computer
will also turn it off; however, due to its location, C80-C will still be
resident for later use, as long as you haven't POKEd over its memory space.
In this case, however, the font will likely be lost.
Now let's look at your new resources. Certain conventions have been
followed in this listing. Memory addresses are 0-65535, as usual, to allow
use with both 16K and 64K VDCs. Note, however, that addresses above 16383
wrap around on the 16K chip, i.e. 16384 = 0. Remember that the basic 8563
chip is set up as follows:
$0000 - 07FF 0 - 2047 Screen
$0800 - 0FFF 2048 - 4095 Attributes
$1000 - 1FFF 4096 - 8191 Unused
$2000 - 2FFF 8192 - 12287 Upper Case/Graphic (normal) Font
$3000 - 3FFF 12288 - 16383 Upper/Lower Case (alternate) Font
VDC register numbers range from 0-36. It is not within the scope of
this article to explain the use of every register, but a simplified listing
is given in the previous Control80 article, and a complete description can
be found in the C-128 Programmer's Reference Guide. When in doubt,
experiment with the WVD command, but be sure that you check the register's
normal value first with the RVD function to set things back to normal!
FUNCTIONS
---------
PEER (VDC address)
This function allows you to check the contents of VDC memory. It
operates just like BASIC's PEEK. For example, to find the character in the
top left corner of the screen, PRINT PEER(0). Note that PEER is the
counterpart of POST, below.
RVD (reg#)
This function (Read ViDeo register) allows you to check the contents
of any of the 37 VDC registers. For example, A=RVD(12) would put the
contents of register 12 into the variable A. Note that RVD is the
counterpart of WVD, below.
COMMANDS
--------
BLOCK VDC address, number, value
This command allows you to fill any small section of VDC memory with a
single value. "Address" indicates the starting position of the fill, and
"number" (2-255) indicates how many consecutive locations to fill with the
specified "value" (0-255), from that point on. One of the best uses of
BLOCK is to highlight a line on the screen by filling attribute memory with
a different color value and/or reverse. For example, BLOCK 2048,80,72
would highlight the entire first line of the screen by coloring it red and
using reverse characters. See FILL for more information on attribute
memory.
CARD top left corner address, card number
This command draws the specified card on the screen with its top left
corner positioned over the indicated address. Card numbers are from 0-51
for the basic deck and 52+ for Jokers. The basic deck is divided into four
groups of thirteen cards, in the following order: Clubs (0-12), Spades
(13-25), Hearts (26-38) and Diamonds (39-51). Thus, 0 is the Ace of Clubs,
12 is the King of Clubs, 13 is the Ace of Spades, and so on. The command
CARD 0,2 would draw a three of Clubs in the top left corner of the screen.
For this command to work properly, the C80-C font must be installed, the
screen should be white (VCOL 16,1) and the background should be filled with
a non-space character. Due to the restrictions of the 80-column screen
(i.e. no multicolor or extended color) and the fact that I wanted the cards
to look as realistic and colorful as possible, I was forced to do without
any sort of outlining. This may sound like a restriction, but, after
playing with the Tiles feature in SLIDE POKER for a few seconds, I'm sure
you'll agree that it is a fairly trivial one.
DICE type, number
This command effectively rolls the indicated "type" of dice the
specified "number" of times and puts the total in memory location 250. For
example, DICE 8,3:A=PEEK(250) would roll three eight-sided dice, for a
result of 3 to 24, and put the total in the variable A. A "type" of less
than 2 returns a roll of 0-255, regardless of the "number". A "type" of
greater than 128, returns one roll of the appropriate type, regardless of
the "number". Since only one byte is used to store the result, the roll
cannot exceed 255; thus, a DICE 50,50 command (with a maximum possible
result of 2500) would return a pretty meaningless result most of the time.
The best thing about this command, aside from its convenience, is that it
does not use the random function of the SID chip and, thus, will never
conflict with voice 3. Like the RND function, this command should be re-
seeded the first time it is called upon (only), as follows:
I=RND(-TI):FORI=.TO15:POKE6025+I,INT(RND(1)*256):NEXT
FCOPY address, bank, character set (0 or 1)
This command allows you to convert and copy a standard 40-column font
already in normal memory, at the "address" and "bank" specified, to the
8563 chip. Since the 8563 allows two character sets to be displayed on the
screen simultaneously, you must specify which one to replace: 0 for upper
case/graphics (normal) or 1 for lower/upper case (alternate). The font
used with CARD should always be copied to the alternate set.
FILL top left corner address, width, length, value
This command fills a rectangular section of memory of the indicated
"width" and "length" (height) with the specified "value", starting with the
"top left corner address". For example FILL 0,80,25,33 would fill the
whole screen with exclamation marks (screen code 33); FILL 2048,40,10,154
would cause a rectangular 40 by 10 area in the top left corner of the
screen to be "painted" with purple, flashing, alternate characters. When
using FILL and similar commands, remember that the attribute codes are as
follows:
Bit 7 (128) Alternate