Radio Shack TRS-80 Model 3 Computer Graphics Operation Manual

Radio Shack TRS-80 Model 3 Computer Graphics Operation Manual

Below you will find brief information for Computer Graphics TRS-80 Model 3. The TRS-80® Computer Graphics package revolutionizes your Model III by letting you draw intricate displays from simple program instructions. With the highly-defined Graphics Screen, the list of practical applications is nearly endless! The TRS-89 Computer Graphics package includes a: Computer Graphics Diskette Computer Graphics Operation Manual However, before you can use this package, your Model III must have 48K of RAM (Random Access Memory) and one disk drive. Your computer must also be modified by a qualified Radio Shack service technician.

advertisement

Assistant Bot

Need help? Our chatbot has already read the manual and is ready to assist you. Feel free to ask any questions about the device, but providing details will make the conversation more productive.

TRS-80 Model 3 Computer Graphics Operation Manual | Manualzz
Hillions of dollars
HIDGET [KDUSTR
SHARE OF HARKET REPORT
HIDGET Z
HIDSET Ÿ
ПОЛ
|
E
a
E
E E
To Es
be
Ac
Ea
Sa
Eo
NEC
.
we
E
e.
E
..
a
dé
Ч
E
Se
E
2.
a
i
ny
e dnde
Er й = te
Lu Е В ar
vs A й HE
ah В DINO. Е i
E
E
E
O
RA A
, a
E o a Gal
E
AO TN 35
pa
ie ;
ВЕ
5
a o
se
e
SE
аа о По
о
+:
EE
Satta
fe
a.
Sanh
Hie
A
ОНИ à
Rae de
UA O Nu.
ue y A
Std EAS
ete
FEEDBACK ELECTRONICS
UNIT SALES (THOUSANDS)
EN
SOUTHEAST
НЕ
CENTRAL
(E PROFITS
Ali Divisions
UFAGTURED IN THE USA BY]
Ен ES
+
TRS-80 °
A Special Note on Model III Computer Graphics...
Be sure to use the GCLS command ("clear the Graphics
Screen") at TRSDOS READY when you first turn on your
computer. Otherwise, random graphics may appear on the
Screen.
Thank You
Radio fhaek
A DIVISION OF TANDY CORPORATION
FORT WORTH, TEXAS 76102
8759223
- Radio Shaek
LL]
+...”
+. a
(TERRE)
TERMS AND CONDITIONS OF SALE AND LICENSE OF RADIO SHACK COMPUTER EQUIPMENT AND SOFTWARE
PURCHASED FROM A RADIO SHACK COMPANY-OWNED COMPUTER CENTER, RETAIL STORE OR FROM À
RADIO SHACK FRANCHISEE OR DEALER AT ITS AUTHORIZED LOCATION
LIMITED WARRANTY
CUSTOMER OBLIGATIONS
À.
CUSTOMER assumes fuil responsibility that this Radio Shack computer hardware purchased (the Equipment). and any copies of Radio
Shack software included with the Equipment or licensed separately (the “Software ) meets the specifications, capacity, capabilities,
versatility, and other requirements of CUSTOMER.
CUSTOMER assumes full responsibility for the condition and effectiveness of the operating environment in which the Equipment and Software
are to function, and for its installation.
RADIO SHACK LIMITED WARRANTIES AND CONDITIONS OF SALE
A.
C.
D.
E.
For a period of ninety (90) calendar days trom the date of the Radio Shack sales document received upon purchase of the Equipment, RADIO
SHACK warrants to the original CUSTOMER that the Equipment and the medium upon which the Software is stored is free from manufacturing
defects. THIS WARRANTY IS ONLY APPLICABLE TO PURCHASES OF RADIO SHACK EQUIPMENT BY THE ORIGINAL CUSTOMER FROM
RADIO SHACK COMPANY-OWNED COMPUTER CENTERS, RETAIL STORES AND FROM RADIO SHACK FRANCHISEES AND DEALERS AT ITS
AUTHORIZED LOCATION. The warranty is void if the Equipment's case or cabinet has been opened, or if the Equipment or Software has been
subjected to improper or abnormal use. If a manufacturing defect is discovered during the stated warranty period, the defective Equipment
must be returned to a Radio Shack Computer Center, a Radio Shack retail store, participating Radio Shack franchisee or Radio Shack dealer
for repair, along with a copy of the sales document or lease agreement. The original CUSTOMER'S sole and exclusive remedy in the event of
a defect is limited to the correction of the defect by repair, replacement, or refund of the purchase price, at RADIO SHACK'S election and sole
expense. RADIO SHACK has no obligation to replace or repair expendable items.
RADIO SHACK makes no warranty as to the design, capability, capacity, or suitability for use of the Software, except as provided in this
paragraph. Software is licensed on an “AS IS” basis, without warranty. The original CUSTOMER'S exclusive remedy, in the event of a
Software manufacturing defect, is its repair or replacement within thirty (30) calendar days of the date of the Radio Shack sales document
received upon license of the Software. The defective Software shail be returned to a Radio Shack Computer Center, a Radio Shack retail store,
participating Radio Shack franchisee or Radio Shack dealer along with the sales document.
Except as provided herein no employee, agent, franchisee, dealer or other person is authorized to give any warranties of any nature on behalf
of RADIO SHACK.
Except as provided herein, RADIO SHACK MAKES NO WARRANTIES, INCLUDING WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE.
Some states do not allow limitations on how long an impiied warranty lasts, so the above limitation(s) may not apply to CUSTOMER.
LIMITATION OF LIABILITY
A.
Ow
EXCEPT AS PROVIDED HEREIN, RADIO SHACK SHALL HAVE NO LIABILITY OR RESPONSIBILITY TO CUSTOMER OR ANY OTHER PERSON
OR ENTITY WITH RESPECT TO ANY LIABILITY, LOSS OR DAMAGE CAUSED OR ALLEGED TO BE CAUSED DIRECTLY OR INDIRECTLY BY
“EQUIPMENT” OR “SOFTWARE” SOLD, LEASED, LICENSED OR FURNISHED BY RADIO SHACK, INCLUDING, BUT NOT LIMITED TO, ANY
INTERRUPTION OF SERVICE, LOSS OF BUSINESS OR ANTICIPATORY PROFITS OR CONSEQUENTIAL DAMAGES RESULTING FROM THE
USE OR OPERATION OF THE “EQUIPMENT” OR “SOFTWARE”. IN NO EVENT SHALL RADIO SHACK BE LIABLE FOR LOSS OF PROFITS, OR
ANY INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY BREACH OF THIS WARRANTY OR IN ANY MANNER
ARISING OUT OF OR CONNECTED WITH THE SALE, LEASE, LICENSE, USE OR ANTICIPATED USE OF THE “EQUIPMENT” OR “SOFTWARE”.
NOTWITHSTANDING THE ABOVE LIMITATIONS AND WARRANTIES, RADIO SHACK'S LIABILITY HEREUNDER FOR DAMAGES INCURRED BY
OLE OR OTHERS SHALL NOT EXCEED THE AMOUNT PAID BY CUSTOMER FOR THE PARTICULAR “EQUIPMENT” OR “SOFTWARE”
INVOLVED.
RADIO SHACK shall not be liable for any damages caused by delay in delivering or furnishing Equipment and/or Software.
No action arising out of any claimed breach of this Warranty or transactions under this Warranty may be brought more than two (2) years
after the cause of action has accrued or more than four (4) years after the date of the Radio Shack sales document for the Equipment or
Software, whichever first occurs.
Some states do not allow the limitation or exclusion of incidental or consequential damages, so the above limitation(s) or exctusion(s) may
not apply to CUSTOMER.
RADIO SHACK SOFTWARE LICENSE
RADIO SHACK grants to CUSTOMER a non-exclusive, paid-up license to use the RADIO SHACK Software on one computer, subject to the following
provisions:
B.
С.
D.
G.
Except as otherwise provided in this Software License, applicable copyright laws shall apply to the Software.
Title to the medium on which the Software is recorded (cassette and/or diskette) or stored (ROM) is transferred to CUSTOMER, but not title to
the Software.
CUSTOMER may use Software on one host computer and access that Software through one or mare terminals if the Software permits this
function.
CUSTOMER shall not use, make, manufacture, or reproduce copies of Software except for use on one computer and as is specifically
provided in this Software License. Customer is expressly prohibited from disassembling the Software.
CUSTOMER is permitted to make additional copies of the Software only for backup or archival purposes or if additional copies are required in
the operation of one computer with the Software, but only to the extent the Software allows a backup copy to be made. However, for
TRSDOS Software, CUSTOMER is permitted to make a limited number of additional copies for CUSTOMER'S own use.
CUSTOMER may resell or distribute unmodified copies of the Software provided CUSTOMER has purchased one copy of the Software for each
one sot, or distributed. The provisions of this Software License shall also be applicable to third parties receiving copies of the Software from
U ER.
All copyright notices shall be retained on all copies of the Software.
APPLICABILITY OF WARRANTY
À.
The terms and conditions of this Warranty are applicable as between RADIO SHACK and CUSTOMER to either a sale of the Equipment and/or
Software License to CUSTOMER or to a transaction whereby RADIO SHACK sells or conveys such Equipment to a third party for lease to
CUSTOMER.
The limitations of liability and Warranty provisions herein shail inure to the benefit of RADIO SHACK, the author, owner and/or licensor of the
Software and any manufacturer of the Equipment sold by RADIO SHACK.
STATE LAW RIGHTS
The warranties granted herein give the original CUSTOMER specific legal rights, and the original CUSTOMER may have other rights which vary
from state to state.
NEL
Computer Graphics Operation Manual
TRS-80 ©
TN
TRS-89® Computer Graphics Operation Manual Copyright
1982, All Rights Reserved, Tandy Corporation.
Reproduction or use without express written permission from
Tandy Corporation, of any portion of this manual is
prohibited. While reasonable efforts have been taken in the
preparation of this manual to assure its accuracy, Tandy
Corporation assumes no liability resulting from any errors
or omissions in this manual, or from the use of the
information obtained herein.
TRSDOS* Operating System Copyright 1980, 1981, Tandy
Corporation, All Rights Reserved.
BASIC Software Copyright 19838, Microsoft, Inc., All Rights
Reserved, Licensed to Tandy Corporation.
BASICG Software Copyright 1982, Microsoft, Inc., All
Rights Reserved, Licensed to Tandy Corporation.
Radio Shaek
-2—
Computer Graphics Operation Manual
TRS-80°
Contents
To Our Customers............. .......... . soccaacorvoanvasccoe . 4
1/ Computer Graphics OvervieW.....coocoossrccocorcecsocorecooo 7
2/ Graphics BASIC (BASICG ) 00000000000 0000000000000 000000 12
BASICG CommandS....0.0.000000000 00000000008 es es es esses 13
Starting-ÜDeo00000000 0000000000 00000 0. ........ .‚.... 14
3/ Graphics UtilitieS...0000000000000000000000000 00000000 59
4/ Graphics Subroutine Library (FORTRAN)....... ..encoooo 91
5/ Programming the Graphics Board......00000000 000000008 114
Appendix A/ BASICG/Utilities Reference Summary......... 117
Appendix B/ BASICG Error MessageS.....eocoooooeccccoreoo 120
Appendix C/ Subroutine Language Reference Summary...... 125
Appendix D/ Sample Programs
BA STICGo00000000 0000000000000 000000000008 0.0.0... .. 127
Printing Graphics DisplayYS....0.0.0000000 000000000000 133
FORTRAN Sample ProgramS.e..00000 00000000002 00000008 135
Appendix E/ Base Conversion Chart.....cecesoscoccooo ...... 152
Appendix F/ Pixel Grid Reference..... 00000000 00000000 00 156
Appendix G/ Line Style ReferenCC....0.0.000000000 000000000 162
INndeX. 000000000 0000000000000 . 00 0.0.000000000.000.00000 00008 163
®
Radio Shaek
—3—
Computer Graphics Operation Manual
TRS-80 °
TN
To Our Customers . e. e.
The TRS-80% Computer Graphics package revolutionizes your
Model III by letting you draw intricate displays from simple
program instructions. With the highly-defined Graphics
Screen, the list of practical applications is nearly
endless!
The TRS-89 Computer Graphics package includes a:
. Computer Graphics Diskette
. Computer Graphics Operation Manual
However, before you can use this package, your Model III
must have 48K of RAM (Random Access Memory) and one disk
drive. Your computer must also be modified by a qualified
Radio Shack service technician. The only difference you'll
notice is a cable which protrudes from the bottom of the
Model III case. Do not attempt to disconnect this cable!
This cable is provided to allow you to attach peripheral
devices (such as a hard disk) to the I/O Bus Jack of the
Model III. The cable connector which is attached directly to
the I/O Bus Jack (see Point A in the figure below) must be ~~
firmly attached for the Computer Graphics package to work. |
Included on the Graphics diskette are:
+ TRSDOS 1.3
. Disk BASIC
. Graphics BASIC (BASICG)
. Graphics Subroutine Library (GRPLIB)
SERN
Radio Shaek
Computer Graphics Operation Manual
TRS-80 °
. Graphics Utilities
. Sample Programs in BASICG and FORTRAN.
To print graphic displays, you can use any Radio Shack
printer that has graphic capabilities such as Line Printer
VII (26-1167), Line Printer VIII (26-1168), DMP-199
(26-1253), DMP-28ÿ (26-1254), DMP-4ÿÿ (26-1251), or DMP-599
(26-1252).
You can also utilize the Graphics Subroutine Library with
several languages, including, but not limited to FORTRAN
(26-2200).
About This Manual . . .
For your convenience, we've divided this manual into five
sections plus appendixes:
. Computer Graphics Overview
. Graphics BASIC (BASICG) Language Description
. Graphics Utilities
. FORTRAN Description
. Programming the Graphics Board
. Appendixes
This package contains two separate (but similar) methods for
Graphics programming:
. Graphics BASIC (BASICG)
. Graphics Subroutine Library
If you're familiar with Model III TRSDOS” and BASIC, you
should have little trouble in adapting to Graphics BASIC.
If you want to review BASIC statements and syntax, see your
Model III Operation and BASIC Language Reference Manual
and Model III Disk System Owner's Manual. Then read
Chapters 1, 2 and 3, along with Appendixes A, B, E, and F of
this manual.
If it's Graphics applications in FORTRAN you're after, refer
to the TRS-89 FORTRAN manual. Then read Chapters 1, 2, 3,
and 4 as well as Appendixes C, D, E, and F of this manual.
Note: This manual is written as a reference manual for the
TRS-8ÿ Computer Graphics package. It is not intended as a
teaching guide for graphics programming.
Radio Shaek
—B-
Computer Graphics Operation Manual
TRS-80 ©
Notational Conventions
The following conventions are used to show syntax in this
manual:
CAPITALS Any words or characters which
are uppercase must be typed in
exactly as they appear.
lowercase underline Fields shown in lowercase
underline are variable
information that you must
substitute a value for.
<ENTER> Any word or character contained
within brackets represents a
keyboard key to be pressed.
... Ellipses indicate that a field
entry may be repeated.
filespec A field shown as filespec TN
indicates a standard TRSDOS
file specification of the form:
filename/ext.password:d
Note that with TRSDOS 1.3, d
(Drive) can be any number
from 9-3.
punctuation Punctuation other than ellipses
must be entered as shown.
delimiters Commands must be separated from
their operands by one or more
blank spaces. Multiple
operands, where allowed, may be
separated from each other by a
comma, a comma followed by one
or more blanks, or by one or
more blanks. Blanks and commas
may not appear within an
operand.
Radio паек
Computer Graphics Operation Manual
TRS-80°
1/ Computer Graphics Overview
Graphics is the presentation of dimensional artwork. With
TRS-88 Computer Graphics, the artwork is displayed on a
two-dimensional plane -- your computer screen. Like an
artist's easel or a teacher's blackboard, the screen is a
"drawing board" for your displays.
TRS-89 Computer Graphics has two colors:
. Black (OFF)
. White (ON)
Graphics programming is different from other types of
programming because your ultimate result is a pictorial
display (bar graph, pie chart, etc.) rather than textual
display ‘(sum, equation, etc.). This is an important
distinction. After working with graphics for a while, you'll
find yourself thinking "visually" as you write programs.
In computer-generated graphics, displays can include tables,
charts, graphs, illustrations and other types of artwork.
Once they're created, you can "paint" displays with a
variety of styles and shapes, or even simulate animation.
The Computer Graphics program uses a "high-resolution"
screen. The more addressable points or dots (called
"pixels") on a computer's screen, the higher the resolution.
A lower resolution screen has fewer addressable pixels.
Radio Shaek
7
Computer Graphics Operation Manual
TRS-80 *
PIXEL
PIXEL ==="
Lower resolution Higher resolution
Figure 1. Resolution
Since the TRS-8f has high-resolution -- 648 pixels on the
X-axis (fF to 639) and 243 pixels on the Y-axis (ÿ to 239) —-
you can draw displays that have excellent clarity and
detail.
How TRS-89 Computer Graphics Works
The concept of graphics is fairly simple. Each point on the
screen can be turned ON (white) or OFF (black).
When you clear the Graphics Screen, all graphic points are
turned OFF.
Therefore, by setting various combinations of the pixels
(usually with a single command) either ON or OFF, you can
generate lines, circles, geometric figures, pictures, etc.
The Graphics Subroutine Library, which is part of the
Computer Graphics package, contains subroutines which
provide the same capabilities, as well as similar names and
parameters, as the commands and functions in Graphics BASIC.
The main difference between the Subroutine Library and
BASICG is the manner in which coordinates are specified
(e.g., BASICG coordinates are specified as arguments for
each command while the Subroutine Library specifies
coordinates with a separate subroutine cail). Another
difference concerns the names of a few routines (e.g., LINE
vs. LINEB vs. LINEBF, etc.). All of these differences will
Radio Shaek
Computer Graphics Operation Manual
TRS-80 °
be described in detail in the appropriate sections of this
manual.
The Graphics Screen
TRS-89 Computer Graphics has two "screens" -- Text and
Graphics. (We'll call them screens, although they are really
modes.) Both screens can act independently of each other and
make use of the computer's entire display area.
The Text Screen, also referred to as the "Video Display," is
the "normal" screen where you type in your programs. The
Graphics Screen is where graphic results are displayed. Both
screens can be cleared independently. Note: The Graphics
Screen will not automatically be cleared when you return to
TRSDOS. It will be cleared when you re-enter BASICG.
The Graphics Screen cannot be displayed at the same time as
the Text Screen.
While working with Computer Graphics, it might be helpful to
imagine the screen as a large Cartesian coordinate plane
(with a horizontal X- and a vertical Y-axis). However,
unlike some coordinate systems, TRS-80 Computer Graphics’
coordinate numbering starts in the upper-left corner --
(9,8) -- and increases toward the lower-right corner --
(639,239). The lower-left corner is (8,239) and the
upper-right corner is (639,0).
Since the screen is divided into X-Y coordinates (like the
Cartesian system), each pixel is defined as a unique
position. In TRS-89ÿ Computer Graphics, you can directly
reference these coordinates as you draw.
About Ranges...
Some TRS-89 Computer Graphics commands accept values within
the Model III integer range (-32768 to 32767), instead of
just Y to 639 for X and Y to 239 for Y. Since most of the
points in the integer range are off the screen, these points
are part of what is called Graphics "imaginary" Cartesian
system.
Radio Shaek
Computer Graphics Operation Manual
TRS-80 °
(00 (639,0)
(0239) (639,239)
Figure 2. Graphics Visible Screen
Radio Shaek
-10-
TUN,
Computer Graphics Operation Manual
TRS-80 *
y (0, — 32768)
( Ty ) ( +,— )
x (—32768,0) (0,0) (+32767,0)
(-.+) (+,+)
(0, 32767)
Figure 3. Graphics "Imaginary" Cartesian System
Radio Shaek
-]1-
Computer Graphics Operation Manual
TRS-80 °
. TN
2/ Graphics BASIC
Graphics BASIC (BASICG) vs. BASIC
The Graphics BASIC file on the supplied diskette is named
BAS ICG.
Program files created under BASICG are not directly loadable
with BASIC files (and vice versa). If you attempt to load a
BASIC file in compressed format from BASICG (and vice
versa), an NB error may occur. See Appendix B for a list of
BASICG error messages.
If you want to load a file from one BASIC to the other to
the other, we recommend that you first save the file in
ASCII format (SAVE"filename/ext",A).
You can then load and run a BASIC file from either BASICG or
BASIC. You cannot run programs that contain BASICG
statements while in BASIC. EN
Important Note: Because of memory limitations, some programs
(i.e., some application programs) will not run in BASICG.
BASICG uses approximately 6.5K more memory than BASIC. When
you enter BASIC with Y files, there are 39,282 bytes free.
When you enter BASICG with Y files, there are 32,675 bytes
free. Some Graphics Commands use Free Memory. This means
that the larger your BASIC programs are, the more
limitations on your Graphics capabilities.
Each Graphics program statement has a specific syntax and
incorporates a Graphics BASIC command or function.
Table 1 gives a brief description of the BASICG commands; Table 2
lists the BASICG functions. This section of the manual will
describe each statement and function in detail.
Radio паек
-12—
Computer Graphics Operation Manual
TRS-80°
A SOE STS wall Tm EE TE EE SE SE SE SEE TS op TE Sr SE SE TE EE ST SE SE VEE SEY SE SEE ee re re
— — —s —
——— ——
NE am. pn
A oA ЧРИ wie PP EEE PU A N DE AN A VU ES A ZN AN ZN — QE — чи
mo — — — — — A ils ml dl AE A SA p— Al se. A A te —
Command Description
CIRCLE Draws a circle, arc, semicircle, etc.
A
: Te
D
3
are
ES
Au
GLOCATE Sets the Graphics Cursor and the direction
for putting characters on the Graphics
Screen.
LINE Draws a line from the startpoint to the
endpoint in the specified line style and
color. Also creates a box.
EEE
.
a
: da
== + HE я
и 2
а o
ON).
e
o
ПО
R о
ic o
OFF).
о
=
ale]
Ga a
.
о ОО
E CT
mm
.
Fey ane
.
; ;
.
CE Ne E Cra
— A 0 — A reall mull сыны сч a E
A muh abel mi — лай — —>—
Radio Shaek
-] 3 -
TRS-80 °
TT
BASICG Functions
Function Description
&POINT Returns the OFF/ON color value of a
pixel.
Table 2
Starting-Up
Before using the diskette included with this package, be
sure to make a "safe copy" of it. See your Model III Disk
System Owner's Manual for information on BACKUP.
To load BASICG:
1. Power up your System according to the start-up procedure
in your Model III Disk System Owner's Manual.
2. Insert the backup diskette into Drive @. —
3. Initialize the System as described in the "Operation"
section of the Model III Disk System Owner's Manual.
4. When TRSDOS Ready appears, type:
BASICG <ENTER>
The Graphics BASIC start-up prompts, followed by the READY
prompt (>), appear and you are in Graphics BASIC. You can
now begin BASICG programming.
Radio Shaek
—]l 4-
Computer Graphics Operation Manual
TRS-80 *
Remember that Model III numeric values are as follows:
TD НН wii SE a ET wel API TAD AN — e Se я ч— = — = == al — — a —
— er re rare — diol smn
Model III Numeric Values
Numeric Storage
Type Range Requirement Example
Integer -32768, 32767 2 bytes 240, 639, -18
OU
a
se
E
ER AREA RAS ERAS AE A AE E AA e
Double- -1*1938,-1x19-38 8 bytes 1230000 .98
Precision 1+1*1938,+1x19-38 3.1415926535897932
Up to 17 significant
digits (Prints l6)
Table 3
With each BASICG command or function, there are various
options which you may or may not include in a program
statement (depending on your needs). Each option is
separated from the previous option by a delimiter, usually a
comma. When you do not specify an available option (e.g.,
you use the default value) and you specify subsequent
options, you must still enter the delimiter or a Syntax
Error will result. (See your Model III Operation and BASIC
Language Reference Manual for more information).
Because you are dealing with two distinct screens, the
Graphics Screen and the Text Screen, we strongly urge you to
read the description of the SCREEN command before
continuing.
Radio Shaek
-15-
Computer Graphics Operation Manual
TRS-80
CIRCLE _
Draws Circle, Semicircle, Ellipse, Arc, Point
ана; зы reg at sobre arte es dE BN LB Hh Su
EE A NO AN ame Ey а Semmes a О E
E ad - = un e vn Emad . о о E
e Ea NE A E п o Ult ALEA HE ee ell a a Ne ES e HA ua
E о A Se o о о Sn В wn i i] В a E IE Е о о = a e о а оо НЕ в
CN ee se E : О № SEES Unid IN Ne ENE e SE eh
POR eue ae CE oh ua Lion ERA ae : Tf E a E UN
e on Ноа у = as se VL Ses с и о o a
un E. na E Ea gE ee ATA rE EE ep se RE Mme te A Ad a bie SRE DEE
Re Ва AA ue 1 Ma vi ON Ue A Mi su E
see ny Tus ERE + drenar dea Hero ea UA E E de Dn Pe tri ME ss
E Tas anna a Es AA il ной, id ra E E SN a
E e Z E un E 7 e ан Ea о о а а E Sana a
E alan se o me | = . te > Hi Me hin HEE Au Se 0e E SHG E . ba
alii As Ga о a ee : Sea es à!
Ht hh Норень Ramis oa PEE: E ALEA A E E E TE puede u_u fer Bur git Dh i 1 . . e
НН о + = mina fn E uu HARE EE a ENE
Ah UN Er Ang. ec E o ne a ee ue à CA В о EE e CA
e E E ве О 5 зе, ; a a
dn a . Pe en i Зе au i i st CN AE e TE
su pe ahaa EEE ss se OACI ES RT RA RE 126: bo ht hig Net ets
ЗЕ В НЙ EU de a Mid Ra yr 4 a Ce AE Eu ; ne. y а EE
a; Ae Tu Hh ei НО ee a A J ha E
A He i ALA oe TU E EN 5 mE .
. e Ce Ne E de A a e Go a : ue Sa NN ao
DE are HE о ANTE NES E: à E A Не я ar о о . A E uo Ne CAE uu 28 а
E E. Lu oo e A NE So E hi mam o
= Sn u LE ni # eut gp TE ne ra pen so ii un. Ue A E UN
. a | AT К о о о о
EE E. o ME $ о о 4 TN
о В i но fan 4 EN UA a UNO y o de uu ae | E i E
NE erat un Hm ti НЕЕ HE i SRE su 7 = 0 Re EL rar rar Ape
SE 3 a SE о По rn Ha MZA. Ma
ci E a i 4 . de of Hi thous i oe Gnd
Sian я В A co Sram р a EEE TEE ai Sian fre ies ap ae AE des
o E e e : hie E o EN
E о Cu © EC a e ; nd TEE о © i . ; E
ona ee E ? св Sri YEH $ с $ by + ; E 7 BEN à : НЕ aii a Sf dpe LEN dene я E: OE ny
TEE dn a e mc ms 5 HR 2.4 Ni... N 4 : 3 HE : + Tm E a Li a he eR a
se od Un LL E ED A си и : in RD о 3 о ea
a НЕВЕ E hi a Во i Ки il: - DA Se on ih wend e A SD
я Te La . = НЕ sue ul e A E E i E
HE Bo EER TA HR > EEE NE po ig PAT TEE e TU RIE
esa à! dre nm
LU + e a L are = ETE $2408; - e AT O Ney ne TA Fi EA AE ie
ns = i ELE SES DA y A Eve Eee de Loma HE A Es AE Ый
E en a po! FE e NDA. > —" Mh : : e mi TAT EEE 2 НЕ - : En E ME e Cn 5 e oo AR
CUALES o Ta CE. MU Be E a ee a : ; HER = a MUA 4 Et o. a e LT on NE
se et a ; E 5 BE e О
В nea Can se. pt 1 к, : : Es . es a : а Be Gg
EER ИОВ ann Ph i hii a i La ais Hea ti ENS A ETES
He here on sr NO a. Meta Ht i й ea PUES E E en IR
НЯ о E uN Ea on FU. HE à
ii ESA a e i EN rec Co: E NN eN ei
Hi, = De: su. AS pets > Tae aires ts PR at BE me ee НС?
ra 3 Shihan ie CNE a 0 НЕ MS SHR ; USA DE A NED SHR aR
SURE a ANNE heh Les 7 a a т En E Ë ae a den |
ER fuma UN e ER ERR 3 НН LD НЕ Ка q E ee sn RDA
CEE he mE a E Ма Nid ue
re Soy bu Tee o 1 E : Кое abt! HE a o Ha Mio eva ae
Fais SE a RE E HG oh Tdi a um A Han ПРО AE ae dense SPL SE EE
étés 0. e a EI ene a тн т sE E HE Ч E DU 344 dn a К В A
ee e a a Dhan iy Si a UU. : o Ln .
= EE an € de du, i о 1 E o
a в a > eu e Sim Ca MEL
в 4 Ke Le: 5 con o E a.
a о E EN а e 4 ….
= iho a dressage ee de Pd o E ETE. E REE
о ie a te ol (a PSE € Ad LA. ge o NEL
un a ; Sa À LL 1 Е 0. Soa в
A TE SL pa FEAL НЕ, REE Y: DE he Hei
a UTA 5. GH A
В UE а Pa HA He E sr
a uo sea Hao fre EE en
a CA … ba Hn
e e e я : : Pi - ; | a SE : sbi ИННо : о о e :
В О ЕЕ pere : ; : - ; i : PE 5 A о iti] de E.
.. = ; yc : Hid ee ER boa
FE SETE ESA Е bw g - E tner e : i
rn EA, de y : 2 ; й 3
ci
HE TE
НН
ERE
CE В area beni:
ul Sh E Е
+ = i > : 2
se HE, EEE on a Е ne ;
a : E eat Sa El TERA
a a
Le i
38
о
dise
>
se
rea Tire
Bini
=
ET
EE
E
e URETA
EE
uu
E
Я Зе
+
Hi
sie wa Е
<a CUE NE
The CIRCLE command lets you draw five types of figures:
Circle Ellipse Arc Pie-Slice Point
Figure 4. Types of Displays with CIRCLE
With CIRCLE, you can enter values for PI (and 2 x PI) up to
37 significant digits without getting an overflow error.
3.1415926535897932384626433832795028841
6.2831853071795864769252867665590057682
adie fhaek
-16-
Computer Graphics Operation Manual
TRS-80 *
However, you'll probably only be able to visually detect a
change in the circle's start and end when PI is accurate
to a few significant digits (e.g., 3.1, 6.28, etc.). The
start and end values can't be more than 2 x PI (e.g.,
6.2832 will not work) or an Illegal Function Call error will
occur.
(x,y)
Centerpoint
The (x,y) coordinates in the CIRCLE statement specify the
centerpoint of the figure. x and y are numeric
expressions in the integer number range.
Example
CIRCLE (x,y),r
CIRCLE (3289,129),r
Center
Figure 5. Center of Circle
r
Radius
The radius of a circle is measured in pixels and is a
numeric expression in the integer range. Radius is the
distance from the centerpoint to the edge of the figure.
Although a negative value will be accepted by BASICG, the
results of using a negative value are unpredictable.
The radius is either on the X-axis or Y-axis, depending on
the aspect ratio (see ar). If the aspect ratio is greater
than 1, the radius is measured on the Y-axis. If the aspect
ratio is less than or equal to 1, the radius is measured on
the X-axis.
Radio Shaek
—17-
Computer Graphics Operation Manual
TRS-80 ° )
Example
19 CIRCLE(328,12ÿ),180
This example draws a circle. The radius is 107 and the
centerpoint is (329,120).
<
Color
You can set the ON/OFF (white/black) color of a figure's
border and radius lines (see start/end) by specifying a
numeric value of 1 or £.
If you omit color, BASICG uses 1 (ON/white).
Border
—
Figure 6. Border of Circle
start/end
Startpoint/Endpoint of Circle
The range for start and end is % to 6.283185 (2 x PI).
If you do not enter start and end, the default values of
ÿ and 6.28 respectively, are used.
A negative start or end value will cause the respective
radius to be drawn in addition to the arc (i.e., it will
draw a "piece of the pie"). The actual start and endpoints
are determined by taking the absolute value of the specified
start and endpoints. These values are measured in radians.
Note: Radius will not be drawn if start or end is -4.
To draw a radius with start or end as ÿ, you must use
—9.098. . ‚61.
Radio Shaek
— 1 8-
Computer Graphics Operation Manual
TRS-80 °
12:00
9:00 - 3:00
6:00
Figure 7. Clock/Radian Equivalents
Degrees Radians Clock Equivalent
0 0 3:00
90 1.57 12:00
180 3.14 9.00
270 4.71 6:00
360 6.28 3:00
Table 4. Degree/Radians/Clock Equivalents
You can draw semicircles and arcs by varying start and
end. If start and end are the same, a point (one
pixel) will be displayed instead of a circle.
end
Radius
start
Center
Figure 8. CIRCLE's (-) start, (-) end
Radio Shaek
—-19—
Computer Graphics Operation Manual
TRS-80 *
TT,
You can have a positive start and a negative end (or
vice versa) as well as negative starts and ends. In
these cases, only one radius line is drawn.
Start Arc
end
Center Radius
Figure 9. CIRCLE's (+) start, (-) end
Hints and Tips about start and end:
. When using the default values for start and end,
you must use commas as delimiters if you wish to add
more parameters.
. If you use PI, it is not a reserved word in BASICG and
must be defined in your program.
STN
ar
Aspect Ratio
You can draw ellipses by varying the aspect ratio from the
default value (.5) for a circle (and semicircle).
Every ellipse has a "major axis" which is the ellipse's
longer, predominant axis. With an ellipse (as with a
circle), the two axes are at right angles to each other.
The mathematical equation for determining the aspect ratio
is:
ar = length of Y-axis/length of X-axis
. If the aspect ratio is .5, a circle is drawn.
. If the ratio is less than .5, an ellipse with a major
axis on the X-axis is drawn.
. If the ratio is greater than .5, an ellipse with a major
axis on the Y-axis is drawn.
~~ OX
Radio fhaek
-20-
A
Computer Graphics Operation Manual
TRS-80 ©
y
A
J X «©
Y
À
x ~~ |
— 1 ss
Y
X-Axis Ellipse (ar < .5) Y-Axis Ellipse (ar > .5)
Figure 19. CIRCLE's Ellipse
The range for aspect ratio is a single-precision,
floating-point number greater than 9.0 (to 1*19- ).
Although a negative value will be accepted by BASICG, the
results of using a negative value are unpredictable.
Hints and Tips about aspect ratio:
. Entering .5 as the ratio produces a circle.
. Numbers between # and .5 produce an ellipse with a
major axis on X.
. Numbers over .5 generate an ellipse with a major axis
on Y.
. Even though you can enter large aspect ratios, large
numbers may produce straight lines.
Examples
CIRCLE (328,129),99,1
This example draws a white bordered circle with the
centerpoint of (329,120) and radius of 94.
CIRCLE (329,129),909,1,,,.7
This statement draws a white-bordered ellipse with an origin
of (328,128) and radius of 9%. The major axis is the
Y-axis.
Radio Shaek
—2ji-
Computer Graphics Operation Manual
TRS-80 °
CIRCLE (320,126) , 98,1,-6.2,-5
This statement draws an arc with a vertex ("origin") of
(328,128) and radius of 938. start is 6.2 and end is 5.
Radius lines are drawn for start and end.
This example draws an arc with a vertex of (320,120) and
radius of 9%. start is Y and end is 4. A radius line is
drawn for end.
19 PI=3.1415926
20 CIRCLE (32¢,124),1¢4,1,P1,2*PI,.5
A semicircle is drawn.
1d CIRCLE (159,100) ,108,1,-5,-1
20 CIRCLE (2208,109),1009,1,5,1
Two arcs are drawn with the same start and end point. —
The arc with the negative start and end has two radius
lines drawn to the vertex. The arc with a positive start
and end has no radius lines.
This statement draws an arc with a vertex at (320,128) and a
radius of 149. Start is 4 and end is 6.1. A radius line
is drawn for start.
CIRCLE (328,129),149,1,8,1,.5
This example draws an arc with a vertex of (328,128) and
radius of 144.
Sample Program
Radio Shaek
—22—
Computer Graphics Operation Manual
TRS-80 *
4 SCREEN $
5 CLR
19 FOR X=1ÿ TO 2ÿÿ STEP 19
28 CIRCLE (3008,100),X,1,,,.9
30 NEXT X
АЙ FOR Y=10 TO 208 STEP 19
59 CIRCLE (309,108),Y,1,,,.1
60 NEXT Y
78 FOR 2=19 TO 208 STEP 10
8% CIRCLE (398,1808),2,1,,,.5
90 NEXT Z
108 GOTO 5
A set of 20 concentric ellipses is drawn with a major axis
on Y, a set of 20 concentric ellipses is drawn with a major
axis on X, and a set of 20 concentric circles is drawn. The
ellipses and circles in each of the three groups are
concentric and the radius varies from 19 to 200.
CLR
Clears the Graphics Screen
CLR clears the Graphics Screen.
Example
14 SCREEN $
209 CIRCLE(320,128),198,1
This program line will draw a circle. Now type:
CLR <ENTER>
and the Graphics Screen will be cleared but the Text Screen
will remain unchanged. This can be seen by typing:
SCREEN 1
Radio Shaek
-23-
Computer Graphics Operation Manual
TRS-80 ©
GET
Reads the Contents of Rectangular Pixel Area into Array
Ts
CN E
BERE REN
E 3
i
i
Е
..
à
a
Important Note: BASICG recognizes two syntaxes of the
command GET -- the syntax described in this manual and the
syntax described in the Model III Operation and BASIC
Language Reference Manual. BASIC recognizes only the GET
syntax described in the Model III Operation and BASIC —~
Language Reference Manual. |
GET reads the graphic contents of a rectangular pixel area
into a storage array for future use by PUT (see PUT).
A rectangular pixel area is a group of pixels which are
defined by the diagonal line coordinates in the GET
statement.
The first two bytes of array name are set to the
horizontal (X-axis) number of pixels in the pixel area; the
second two bytes are set to the vertical (Y-axis) number of
pixels in the pixel area. The remainder of array name
represents the status of each pixel, either ON or OFF, in
the pixel area. The data is stored in a row-by-row format.
The data is stored 8 pixels per byte and each row starts on
a byte boundary.
Array Limits
When the array is created, BASICG reserves space in memory
for each element of the array. The size of the array is
limited by the amount of memory available for use by your
TU
Radio Shaek
—24—
Computer Graphics Operation Manual
TRS-80 *
program -- each real number in your storage array uses four
memory locations (bytes).
The array must be large enough to hold your graphic display
and the rectangular area must include all the points you
want to store.
Your GET rectangular pixel area can include the entire
screen (i.e., GET(8,0)-(639,239),array name), if the array
is dimensioned large enough.
To determine the minimum array size:
1. Divide the number of X-axis pixels by 8 and round up to
the next higher integer.
2. Multiply the result by the number of Y-axis pixels.
When counting the X-Y axis pixels, be sure to include the
first and last pixel.
3. Add four to the total.
4. Divide by four (for real numbers) or two (for integers)
rounding up to the next higher integer.
The size of the rectangular pixel area is determined by the
(X,y) coordinates used in GET:
Position: upper-left corner = startpoint = (xl,yl)
lower-left corner = endpoint = (x2,y2)
Size (in pixels): width = x2-x1+1
length = y2-yl+l
Example
GET (189,109)-(89,59),V
This block is 71 pixels wide on the X-axis (19 through 88)
and 41 long on the Y-axis (19 through 59).
. For real: 71/8
. For integer: 71/8
9 * 4]
9 * 41
369 + 4
369 + 4
94
187
373/4
373/2
it
li
tu
lol
Depending on the type of array you use, you could set up
your minimum-size dimension statement this way:
. Real DIM V(93)
Radio Shaek
—25-
Computer Graphics Operation Manual
TRS-80 °
TN
or
. Integer DIM V$(186)
Examples
19 DIM V(249)
20 CIRCLE (65,45),24,1
An array is created, a circle is drawn and stored in the
array via the GET statement's rectangular pixel area's
parameters (i.e., (19,19)-(1289,89)).
Calculate the dimensions of the array this way:
Rectangular pixel area is 111 x 71. That equals:
111/8= 14 * 71 =994 + 4 = 998/4 = 250
(10,10) (120,10)
Rectangular
Pixel
Area
(10,80) (120,80)
Figure ll
14 DIM V(34,34)
29 CIRCLE (59,59),19
39 GET (19,19)-(89,89),V
A two-dimensional array is created, a circle is drawn and
stored in the array via the GET statement's rectangular
pixel area's parameters (i.e., (19,19)-(89,89)).
Radio Shaek
-26-
Computer Graphics Operation Manual
®
TRS-80
(10,10)
Rectangular
Pixel >
Area
(80,80)
Figure 12
14 DIM V%(564)
20 CIRCLE (65,45),54,1,1,3
398 GET(189,19)-(120,89),V%
A one-dimensional integer array is created, an arc is drawn
and stored in the array via the GET statement's rectangular
area's parameters.
GLOCATE
Sets the Graphics Cursor
Since the Text Screen and the Graphics Screen cannot be
displayed at the same time, you need an easy way to display
textual data on the Graphics Screen. GLOCATE provides part
of this function by allowing you to specify where on the
Graphics Screen to start displaying the data, (x,y), and
which direction to display it -- direction.
Radio fhaek
-27-
Computer Graphics Operation Manual
TRS-80 *
и
The allowable values for direction are:
9 - zero degree angle
1 - 98 degree angle
2 - 180 degree angle
3 —- 278 degree angle
Examples
19 GLOCATE (3209,1209),8
This program line will cause characters to be displayed
starting in the center of the screen in normal left-to-right
orientation.
199 GLOCATE (32¢,10),1
This program line will cause characters to be displayed
starting in the center of the top portion of the screen in a
vertical orientation, going from the top of the screen to
the bottom of the screen.
200 GLOCATE (638,120),2 ~~
This program line will cause characters to be displayed
upside down starting at the right of the screen and going
towards the left.
309 GLOCATE (32¢,230),3
This program line will cause the characters to be displayed
vertically, starting at the center of the lower portion of
the screen going towards the top of the screen.
“TN
Radio Shaek
-28-
MT "Ч
Computer Graphics Operation Manual
TRS-80 °
LINE
Draws a Line or Box
LINE draws a line from the starting point (xl,yl) to the
ending point (x2,y2).
If the starting point is omitted, either (9,9) is used if a
previous end coordinate has not been specified or the last
ending point of the previous command is used. If one or both
parameters are off the screen, only the part of the line
which is visible is displayed.
With over 65,50% line styles possible, each style is
slightly different. You'll find it's almost impossible to
detect some of the differences since they are so minute.
LINE with Box Option
The start and end coordinates are the diagonal
coordinates of the box (either a square or rectangle). When
you don't specify the B or BF options, the "diagonal"
line is drawn. When you specify the B option, the
perimeter is drawn but not the diagonal line. When you
specify the BF option, the perimeter is drawn, and the
Radio Shaek
—-29—
Computer Graphics Operation Manual
TRS-80 °
area bounded by the perimeter is shaded in the specified
color (c).
LINE(149,889)-(598,200),1,B
(140,80)
Figure 13 (500,200)
style
style sets the pixel arrangement in 16-bit groups.
For example, 9999 1111 0099 1111 (binary), 9FÿF (hex), or
3855 (decimal).
style can be any number in the integer range (negative or
positive). Using hexadecimal numbers, you can figure the
exact line style you want. There will always be four numbers
in the hexadecimal constant.
To use hexadecimal numbers for style:
1. Decide what pixels you want OFF (bit=0) and ON (bit=1).
2. Choose the respective hexadecimal numbers (from the Base
Conversion Chart, Appendix E).
Example
0997 1111 9099 1111 = &H9FGF
Creates a dashed line.
Radio Shaek
—30-
Computer Graphics Operation Manual
TRS-80°
Type Binary Numbers Hex Numbers
Long dash 00880 2008 1111 1111 SHOOFF
uu
E SR
+ о A
o т
SUE MA e
Examples
LINE - (109,40)
This example draws a line in white (ON) starting at the last
endpoint used and ending at (199,49).
LINE (ÿ,6)-(319,199)
This statement draws a white line starting at (9,7) and
ending at (319,199).
LINE(108,108)-(200,288),1,,45
This example draws a line from (199,199) to (299,290) using
line style 45 (&H@@2D).
LINE (100,1090)-(398,200),1,,sH00FF
This LINE statement draws a line with "long dashes." Each
dash is eight pixels long and there are eight blank pixels
between each dash.
Radio Shaek
—31-
Computer Graphics Operation Manual
O
TRS-80
LINE (199,190)-(3909,2099),1,,-1000
This statement draws a line from (196,190) to (399,200)
using line style -1009.
LINE (290,209)-(-199,197)
A line is drawn from the startpoint of (200,200) to
(-199,199).
19 LINE (38,39)-(189,126)
20 LINE -(12ÿ8,18ÿ)
38 LINE -(38,30)
This program draws a triangle.
19 LINE -(50,5ÿ)
39 LINE -(-199,-199)
49 LINE -(3909,1009)
This program draws four line segments using each endpoint as
the startpoint for the next segment.
TN,
Radio Shaek
—-32-
Computer Graphics Operation Manual
TRS-80°
PAINT
Paints Screen
PAINT shades the Graphics Screen with tiling starting at
the specified X-Y coordinates, proceeding upward and
downward.
х,у
Paint Startpoint
x,y is the coordinate where painting is to begin and
must:
. Be inside the area to be painted.
. Be on the working area of the screen.
For example:
19 CIRCLE(32ÿ,128),80
29 PAINT(32ÿ,120),1l,l
A circle with a centerpoint of (328,129) is drawn and
painted in white.
Radio Shaek
—3 3-
Computer Graphics Operation Manual
TRS-80 *
tiling
Paint Style
tiling is the pattern in a graphics display. By specifying
each pixel, you can produce a multitude of tiling styles
thereby simulating different shades of paint on the screen.
tiling is convenient to use in bar graphs, pie charts,
etc., or whenever you want to shade with a defined pattern.
There are two types of tiling:
. Numeric expressions
. Strings
Numeric Expressions. There are only two numeric
expressions that can be used for the paint style -- ÿ and 1.
1 paints all pixels ON (solid white) and 4 paints all pixels
OFF (solid black).
To use numeric expressions, enter either a Й ог 1. For
example:
PAINT (328,120),1,1
Strings (Point-by-Point Painting). You can paint precise
patterns using strings by defining a multi-pixel grid,
pixel-by-pixel, on your screen as one contiguous pattern.
String painting is called "pixel" painting because you are
literally painting the screen "pixel-by-pixel" in a
predetermined order.
You can define the tile length as being one to 64 vertical
tiles, depending on how long you want your pattern. Tile
width, however, is always eight horizontal pixels (8 pixels
representing one 8-bit byte). The dimensions of a tile
pattern are length by width. Tile patterns are repeated as
necessary to paint to the specified borders. Because of its
symmetry, you'll probably find equilateral pixel grids most
convenient,
Radio Shaek
—34-
. TT
Computer Graphics Operation Manual
TRS-80 °
Figure 14. Example of an 8-by-8 Pixel Grid
Strings allow numerous graphic variations because of the
many pixel combinations you can define.
Important Note: You cannot use more than two consecutive
rows of tiles which match the background or an Illegal
Function Call error will occur. For example:
PAINT (1,1),CHRS$(4HFF)+CHR$ (£HFF)+CHR$ (HOP )+CHR$ (£H989)
+СНЕ$ ( & НИЙ ) +СНЕ$ ( & НИЙ) ‚1, СНЕ$ (&НЙЙ)
returns an Illegal Function Call error.
Using Tiling
You may want to use a sheet of graph paper to draw a style
pattern. This way, you'll be able to visualize the pattern
and calculate the binary and hexadecimal numbers needed.
Note: Tiling should only be done on either a totally black
or white background; otherwise, results are unpredictable.
To draw an example of a tile on paper:
1. Take a sheet of paper and draw a grid according to the
size you want (8 x 8, 24 x 8, etc.). Each boxed area
on this grid, hypothetically, represents one pixel on
your screen.
2. Decide what type of pattern you want (zigzag, diagonal
lines, perpendicular lines, etc.).
3. Fill in each grid in each 8-pixel-wide row of the tile
if you want that pixel to be ON, according to your
pattern. If you want the pixel to be OFF, leave the
Radio Shaek
—-35-
Computer Graphics Operation Manual
TRS-80 *
grid representing the pixel blank.
On your paper grid, count each ON pixel as 1 and each
OFF pixel as Y. List the binary numbers for each row
to the side of the grid. For example, you might have
9991 19089 on the first row, 9111 ЙЙ11 оп the second
row, etc.
Using a hexadecimal conversion chart, convert the
binary numbers to hexadecimal numbers. (Each row
equates to a two-digit hexadecimal number.)
Insert the hexadecimal numbers in a tile string and
enter the string in your program.
Note: For a listing of commonly used tiling styles, see
Appendix F.
Example
For example, if you're working on an 8 x 8 grid and want to
draw a plus ("+") sign:
Radio Shaek
-36-
Computer Graphics Operation Manual
TRS-80°
8 x 8 grid Binary Hex
й g g 11 1108} 8] 8 0991 1999 18
== g g 11 118) 8) 2 0001 1999 18
€ g g {1 1 {8181} 8 0901 10099 18
1 1 1 | 1 1 1111 1111 1111 FF
1 1 111 1 {| 1 [1 | 1 1111 1111 FF
E g g 11 Lig} 842 0001 1908 18
й й g 11 1 | 9182 0991 1998 18
9 й 6 |1 |1 ЕЙ ой 0901 1999 18
Figure 15
Tile string:
AS=CHRS (&H18)+CHRS (&H18)+CHRS (&H18 )+CHRS (&HFF )+CHRS (&HFF)
+CHRS (&H18)+CHRS (§H18)+CHRS (&H18)
b
Border
Border is the OFF/ON color of the border of a graphics
design where painting is to stop and is a numeric expression
of either # or 1. If omitted, 1 (ON) is used and all the
pixels on the border are set (solid white).
background
Background Area
Background is a l-byte character which describes the
background of the area you are painting. CHR$(&H99)
specifies a black background and CHR$(&HFF) is a totally
white background. If background is not specified, BASICG
uses CHRS(&H@0).
Painting continues until a border is reached or until PAINT
does not alter the state of any pixels in a row. However, if
Radio Shaek
—-37—-
Computer Graphics | Operation Manual
TRS-80 ©
pixels in a given row are not altered and the tile that was
to be painted in that row matches the background tile,
painting will continue on to the next row.
Note: BASICG uses Free Memory for tiling.
Examples
19 CIRCLE (399,190),109
20 PAINT (399,1909),1,1
Paints the circle in solid white.
18 CIRCLE (199,199), 380
20 PAINT (199,109),1,1
Paints the circle. Only the visible portion of the circle
is painted on the screen.
5 A=l
6 SCREEN Y
19 CIRCLE (329,1209),100
29 CIRCLE (199,199) ,59
39 CIRCLE (498,200),690
40 CIRCLE (590,78),59
50 PAINT (32¢,128),A,1
69 PAINT (199,10909),A,1
70 PAINT (499,20) ‚А, 1
89 PAINT (599,78),A,1
The tiling style is assigned the value 1 in line 5 (A=1) for
all PAINT statements. Four circles are drawn and painted in
solid white.
10 LINE (149,809)-(599,2908),1,B
20 PAINT (269,129) ,CHRS (5HEE)+CHR$ (6H77)+CHRS (09),1
Paints box in specified tiling style using strings.
19 CIRCLE (30ÿ,190),100
20 PAINT (3¢9,10¢),"D",1
This example uses a character constant to paint the circle
in vertical black and white stripes. The character "D" (100
Radio Shaek
-38-
Computer Graphics Operation Manual
TRS-80 °
01909) sets this vertical pattern: one vertical row of pixels
ON, three rows OFF.
19 CIRCLE (329,129),299
20 PAINT (328,120),"332211",1
30 PAINT (109,70), "EFEF",l
This example draws and paints a circle, then paints the area
surrounding the circle with a different paint style (line
30). This PAINT statement's (line 39) startpoint must be
outside the border of the circle.
10 PAINT (329,120) ,CHR$ (6HFF),1
20 CIRCLE (329,120),1909,9
38 PAINT (328,120) ,CHRS$ (ÿ)+CHRS (&HFF ) ,Ÿ, CHR$ (&HFF)
Paints the screen white, draws a circle and paints the
circle with a pattern.
10 PAINT (329,120), CHR$(&HFF),1l
20 CIRCLE (329,128),1099,0
30 PAINT (328,128) ,CHRS (9)+CHRS (&HAA ),ÿ, CHRS (&HFF)
Paints the screen white, draws a circle and paints the
circle with a pattern.
19 CIRCLE(309,109),109
28 AS=CHRS (&HG9 )+CHRS (&H7E)+CHRS$ (&H18 ) +CHR$ (&H18 ) +CHR$ (&H18 )
+CHRS (&H18 ) +CHRS (&H18 ) +CHRS ( & НИЙ )
38 PAINT(300,100),AS,1
This draws the circle and paints with the letter T within
the parameters of the circle.
10 AS=CHRS (&H41 )+CHRS (&H22 )+CHRS (&H14 )+CHRS (&H@8)+CHRS (&H14)
+СНВ $ ( &Н22 ) +СНЕ$ ( &Н41 ) +СНЕ$ ( & НИЙ)
209 PAINT (30¢,100),AS, 1
This paints Xs over the entire screen.
Radio Shaek
-39—
Computer Graphics Operation Manual
TRS-80 *
1 CLEAR 100
5 SCREEN #
19 TILES (ÿ)=CHRS (&H22)+CHRS (&HGG )
20 TILES (1)=CHRS$ (&HFF)+CHRS (&HAF)
39 TILES(2)=CHRS (&H99)+CHRS (&H66)
44 TILES (3)=CHRS (&H99)
50 TILES (4)=CHRS (&HFF)
69 TILES (5 )=CHRS (&HFÿ)+CHRS (&HFÿ)+CHRS (&HÿF)+CHRS (&HGF)
78 TILES (6)=CHRS (&H3C)+CHRS (&H3C)+CHRS (&HFF )
88 TILES(7)=CHRS$ (&H03)+CHRS (&H9C)+CHRS (&H3ÿ ) +CHRS (&HCG )
9% AS=TILES (0)+TILES (1)+TILES (2)+TILES (3)+TILES (4)
+TILES (5)+TILES (6)+TILES (7)
100 PAINT(390,100),AS,1
This example paints the screen with a tiling pattern made up
of eight individually defined tile strings (9-7).
&POINT (function)
Returns Pixel Value
a
i:
£43
LN : i а о :
о
| Pi i
Hath
>:
+
E
The &POINT command lets you read the OFF/ON value of a pixel
from the screen.
Values for &POINT that are off the screen (i.e., PRINT
SPOINT (899,59%9)) return a -1, signifying the pixel is off
the screen.
Example
19 PSET(309,1099),1
20 PRINT £POINT(399,199)
Radio Shaek
—40-
Computer Graphics Operation Manual
TRS-80 * —
Reads and prints the value of the pixel at the point's
coordinates (300,108) and displays its value: 1.
PRINT &POINT (3009 ,1004)
Since the pixel is off the screen, a -1 is returned.
PRINT SPOINT(-3990,-1000)
Since the pixel is off the screen, a -1 is returned.
PSET (204,100) ,0
PRINT &POINT (280,100)
Reads and prints the value of the pixel at the point's
coordinates (200,100) and displays its value: f#.
10 PSET(300,100),1
20 IF £POINT(390,100)=1 THEN PRINT "GRAPHICS BASIC!"
Sets the point ON. Since the point's value is 1, line 20 is
executed and Graphics BASIC is displayed:
GRAPHICS BASIC!
5 SCREEN #
19 PSET(RND(64@),RND(24ÿ)),1
20 IF $£POINT(320,120)=1 THEN STOP
38 GOTO 19
Sets points randomly until (329,129) is set.
5 CLR
10 LINE(50,89)-(120,198),1,BF
20 PRINT £POINT(100,89)
30 PRINT £POINT(1109,89)
40 PRINT &POINT(115,94)
5¢ PRINT «POINT (59,49)
60 PRINT £POINT(1389,129)
The first three pixels are in the filled box, so the value 1
(one) is displayed for each of the statements in lines 20,
30, and 48. The pixels specified in lines 59 and 69 are not
in the shaded box and gs are returned.
Radio Shaek
—41-
Computer Graphics Operation Manual
PRESET
TRS-80 *
Sets Pixel OFF (or ON)
Y PE o
vues
о
о. |
Е
E
e nn
e
E
o
; 5
AEE TE
o
+
PRESET sets a pixel either OFF (0) or ON (1), depending on
switch. If switch is not specified, Y (OFF) is used.
Values for (x,y) that are larger than the parameters of
the screen (i.e., greater than 639 for X and 239 for y)
are accepted,
therefore are not PRESET.
but these points are off the screen and
Note: The only choice for switch is @ or 1. If you enter
any other number, an Illegal Function Call error will
result.
Examples
19
20
Turns ON the
line 18) and
19
29
30
40
59
69
78
89
PRESET (59,56),1
PRESET (59,50),8
pixel located at the specified coordinates (in
turns the pixel OFF (in line 28).
PRESET (328,120),1
PRESET (394,168),1
PRESET (344,148),1
FOR I=1 TO 19008: NEXT I
PRESET (328,128)
PRESET (399,100)
PRESET (344,144)
FOR I=1 TO 1900: NEXT I
и TTT
Radio Shaek
—42-—
Computer Graphics Operation Manual
TRS-80°
Sets the three specified pixels ON (through the three PRESET
statements), pauses, and then turns the three pixels OFF.
PRESET(3909,19098),1
The values for (x,y) are accepted, but since the
coordinates are beyond the parameters of the screen, the
point is not PRESET.
PRINT *-3 ’
Write Text Characters to the Graphics Screen
ae
E
tr Munt E
ae
o
PRINT #-3, is used to write text characters to the Graphics
Screen. This is the easiest way to display textual data on
the Graphics Screen. Characters are displayed starting at
the current Graphics Cursor and going in the direction
specified by the most recently executed GLOCATE command. If
a CLOCATE command was not executed prior to the PRINT 4-3,
command, a direction of Y is assumed.
PRINT #-3, will only print text characters (see Appendix C
of the Model III Operation and BASIC Language Reference
Manual). Each character displayed in the ÿ or 2 direction
uses an 8 X 8 pixel grid; each character displayed in the 1
or 3 direction uses a 16 X 8 grid. Executing this command
will position the Graphics Cursor to the end of the last
character that was displayed.
Displaying text in direction Й engages a wraparound feature.
If the end of a line is reached, BASICG will continue the
Radio Shaek
—43-
Computer Graphics Operation Manual
TRS-80 *
display on the next line. If the end of the screen is
reached, BASICG will continue the display at the beginning
of the screen without scrolling. If there is not enough room
to display at least one character at the current Graphics
Cursor, an Illegal Function Call error will result. When
displaying text in other directions, an attempt to display
text outside of the currently defined screen will cause an
Illegal Function Call error to be given.
PSET
Sets Pixel ON (or OFF)
PSET sets a pixel either OFF (8) or ON (1), depending on
switch. If switch is not specified, 1 (ON) is used.
The only choice for switch with PSET is Y and 1. If you
enter any other number, an Illegal Function Call will occur.
Values for (x,y) that are larger than the parameters of
the screen (i.e., greater than 639 for x and 239 for y)
are accepted, but these points are off the screen and
therefore are not PSET.
Note: The only distinction between PRESET and PSET in BASICG
is the default value for switch. The default value for
PRESET is Y, while the value for PSET is 1.
Examples
14 A=1
24 PSET (564,54) ,A
Turns the pixel located at the specified coordinates ON.
Radio Shaek
—4A4-
Computer Graphics Operation Manual
TRS-80 °
10 PSET (RND(6489),RND(2409)),1
20 GOTO 19
Pixels are randomly set to 1 (ON) over the defined area (the
entire screen).
PSET (-300,-208),1
The values for (x,y) are accepted, but since it is beyond
the parameters of the screen, the pixel is not set.
19 PSET (320,12ÿ),1l
20 AS=INKEYS: IF A$= "" THEN 29
39 PSET(32¢,124),8
Line 19 sets ("turns ON") a pixel; line 3§ resets ("turns
OFF") the same dot.
Radio Shaek
~45-
Computer Graphics Operation Manual
TRS-80 *
PUT
Puts Rectangular Pixel Area from Array onto Screen
Th
8
re ME A EE te ian Ae SE = EE EE E A ser
KH Е о E E. О а de saa E Bi a e E E
PUED A о ЕО, я Во E Ine A UE 55 su i he
Un Le e. o E an a 4 NE = . uu 2 : dem She
E E o a 2 а о во ses 2 o Ne о о
EE о . en SE tai a Ege a Eu E PO а Salt a NE а se a о Не С, a. :
e о В . о . Sv Hil a wa Tin o .. Hea . .. о С а
ga adit О Py ‘res à EN a E Tests
ee se ож ; eee O
SE as Am E e E а i В
В e EN e Ne A. uu CEC EE а т а He
О 2 5 ” О О о o à
. i = mu TE : о о E . o se a
Г о E о С 1 nae . . o а О я E
a ii de | Hien ae un Shin 0 e NE o on о e о а
a a mT a Era ean qe BEN Edge ES Cen
e e a ds О д а а
Нот г peas ies: Da a SEH OE a A: Era ciatE + 3 EA DE Ht a: LT faite Fite а ae
: o Ce Fay 1X A. a = Hi Ue oe а о С ia О а
ое 4 0 ts e AE EE a о В
Cn NO E EE Een 3 Bie {i STN TEC ой N A я aE ee eR His E SEL EI E
uN a i E X= FU E Le 3 E E e а Bh Lion oh an sad e Sug .
ne a] EE THIET i ora E En A Ac AA e NU A e re a enna | FR
=. . = > E A 4 pe pan o o o o 5 a
o Un . > e ue No E. Eu Xu. 4 E. un o su . i Loa : o
Eu 1 Leen ie E - e Ae Ea A 3 ee я a а e de eee ne RE
$ a о а На : a te o. So Sn а
prec e. a ЗН о ita ehh di A FT eE % a belt IE A Mb EA
TA a Tea San Si la = а haiti 55 i E Tae = us Cerna ee {rrr
Godan о О О | e ir ES 4 7: fini E se
Fo CN o A ihn LED, Sn on an
arom o bi uu о о в о | ние a
Lun EA + NEL A En ВА TEE ATTE Ne a £7 EE et otura НН НЕ Ноа
o a nar: 8 o o 1. MN
Tarea E Ar E as ste 8 Tg я: РН я ET déradgrer:
a. an al око © O. 4 4 A
e eee ee Taha CRE SR E E CANE E ee Pan a a Ë e a
Ht PR a ai EIA E e O CE "E CEL a THU. AUDE
Sea Er Нан EH E a5 sit Lome a Su 5 e o E Es
a o 1. He A : ua EEC Ne A ARE с о ue un un se
: о В o e y A i 7 A es . o ; su. о A
EE E E Ll ee EEE Nfs 2 Fe see es eus ETAGE SEE SENA AN Tia В
E ALA o 0 боль о о
E Er Но Соя Пе! EDS EE épi EE QE PURE TE HTT оо An LT nee a Te о ВВ Me Sn anne re ENS RE
EN ANAND det E ACE e 5 a : DE i о Ta E die ao За 4 one Е EERE ic Hu О ta CU
в В a un EE ВНЕ: о RE ih SRR HD va Ses as ue A UE ee E o i Ps à ОЕ a Mes a
EC a a AR Tr > ; pee hie 4 oe > Eva À in a E о а un E |
Зам: 3 e bit cif ПОКОЕ TA CY e UC
E o A Yı à É À : 7 md a EAN nN à E : E uu
i Ca ПОВ em т E Ps SE me a e aa E
ne 4 TEN ere ss ЗНА Rates SEE E Citi ng pe A ELA SER X=. NC
2 . a ee A Un ао 44 as _ E gC PC EN UE
E REE E {+ [ 8 Же Е a $ L à FE inti LEE E E Abe
Hn a Ar o TUE 3 E 8 nN IAS В A ; ta i faith Mis A E ee NIN ie
о . ju = о ESE uE о uu. i E E
E o e O Aa e o д 2 ih A da EE : ás us" a: a De e o
= i „en | in Ne *TanauiAa I i yo 1
ass he Pen у Bars e ¡DE Fished В nia CN Se E В.
Tec DEE EE я Sen HE Eee EE : - NA a cL ga E mee : eee Ea AN An
E e A TA ni EE i ar Е ; . E 3 sn Е 2 EE A EL I RENE tE se
ve i UT EE ; E E de Aa pe de Las AE 5 i a 4 A o uu
Ea ae ; FIST Wi -- 4 > = Es E Tun Vo M
à io! iu cs E 5 col . О
И о Tu = > E cel Wan Е . a NU E. So E
E a Samay + == © Go .
uu Case д В he ИЕ Ma 1: A НН Hc i Nte, ЕН
# à 3 Shi eb М 55 EN Ie ae =F uE НН te Ca
UE a Sinan a E Zu un Cli a . О a о = oe o e
MER т: ge ne paie 3 я НОНО EN a В E uu Ея MIO conte
aon ; € 3 В С С: 0 °° о о о .
5 e RTS AM : e EC О с п о
п ПЕ о о а
E a y Sage pe i A ВЫ Sinn ing tae ЕЕ
о о ов, o DC: soils E > +. E > a Aa
es =. Enns Ct ШО a ; a se SE а О
i . ооо О 0 Stn inal de E Tu = se ue. i e E
fe D Ка, 1 He Se pe CU Te
i és ¡E ОЫ us E Es RA Te uu E Men и . a
es = Е НН ans e i ea É E 4 Bodin dine Wr
oi was us ee SEE) ЖЕ
не о o Е № E br Lu EA se
i 3 UE # o de 8 uo SN
se a о О Sata RL a fp HE TT Ta De se Ee Tian NOE ECN ue
Вы IE E hE ë e ; DO ih Te o RE Re e E
SEBEL EN dit Mise 1 Fe OMA HERE me tia . EEN В 3
SHE Hi A ou i e SHG te Me
o Sha o Lis dit E 7 on Ho . o
т и ce fi
cta Te
mer Ha
a
E ue
CA.
A Eh
La < E
E
es e
SA
Ta.
PRES
Ea
В och
HEE
au
7
+:
ma i
aries
00 .
sa
LHR
so EET
E
i
ЗЕ
i
bi Tn
ER
2x
ny
SE
DEA
TES
o
2
3
A ETHER
Е
e Te.
Eid
BE
NEO
С,
SUS
Зет ЗЫ SEALER
vai SE
per
LE A
A
E ©
Sil =
¿e SUE.
e a
ens th jf de FET
En Si
A.
BET
fe
SEEN.
EHE ow Ti ad a
Ea EN mia
ve gy nh
ЗВ Loh ï HE ово x в
В 4 o de se
un о.
i
CE
Sn de
Te
E Ut
Er E
o i
ЗЕЕ
en +
TIE SE
So
=
i i SH Ra
ba Eo e. E. NENA
Important Note: BASICG recognizes two syntaxes of the
command PUT -- the syntax described in this manual and the
syntax described in the Model III Operation and BASIC
Language Reference Manual. BASIC recognizes only the PUT
syntax described in the Model III Operation and BASIC
Language Reference Manual.
The PUT function puts a rectangular pixel area stored in an
array, and defined by GET, onto the screen. GET and PUT work
Radio fhaek
-46—
Computer Graphics Operation Manual
TRS-80 *
jointly. Together, they allow you to "get" a rectangular
pixel area which contains a graphic display, store it in an
array, then "put" the array back on the screen later.
Remember that before you GET or PUT, you have to create an
array to store the bit contents of the display rectangular
pixel area. The size of the array must match that of the
display rectangular pixel area.
PUT moves your GET rectangular pixel area to the startpoint
in your PUT statement and the startpoint is the new upper-
left corner of the rectangular pixel area.
To illustrate:
5 DIM V(3)
18 GET (2,3)-(7,7),V
194 PUT (59,50),V,PSET
After GETting, PUT this rectangular pixel area to
The new coordinates are:
(59,59).
different.
59,59)
(59,51)
(59,52)
(59,53)
(59,54)
(51,59)
(51,51)
(51,52)
(51,53)
(51,54)
(52,50)
(52,51)
(52,52)
(52,53)
(52,54)
(53,59)
(53,51)
(53,52)
(53,53)
(53,54)
(54,59)
(54,51)
(54,52)
(54,53)
(54,54)
(55,59)
(55,51)
(55,52)
(55,53)
(55,54)
The rectangular pixel area ((59,509)-(55,54)) is exactly the
same pixel size as
(2,3)-(7,7); only the location is
Radio fhaek
-47-
Computer Graphics Operation Manual
TRS-80 *
(2,3) (7,3)
fo “чт
“че “чт
mme, Ban
—
“GET” — ~ - ~— -
RECTANGULAR ~| -
PIXEL ~ ~ _
~~ (50,50) ~~ _ (55,50)
(2,7) © ~~ _ (7,7) ~~
am ~ vo. _ "PUT"
oa ~~ RECTANGULAR
~~ ~d PIXEL
~~ ~~~ _AREA
> o
(50,54) (55,54)
Figure 16
With PUT, action can be PSET, PRESET, OR, AND, or XOR.
These operators are used in BASICG to test the OFF/ON (or
8/1) conditions of a pixel in the original pixel area and
the destination pixel area.
For example (using PSET), the pixel is set ON only if the
bit in the PUT array is set ON. If the bit is OFF, the pixel
is turned OFF (reset).
With PRESET, the pixel is set ON only if the bit in the PUT
array is set OFF. If the bit is ON, the pixel is turned OFF
(reset).
Using OR, the pixel is set ON if the bit in the PUT array is
ON or the corresponding pixel in the destination area is ON.
In all other cases, the pixel is turned OFF (reset). In
other words:
OR ON
OFF | OFF | ON
ON [ON | ON
With AND, the pixel is set ON if both the bit in the PUT
array and the corresponding pixel in the destination area
are ON. In all other cases, the pixel is turned OFF (reset).
In other words:
Radio Shaek
—48-
Computer Graphics Operation Manual
TRS-80°
AND | OFF | ON
OFF | OFF | OFF
ON OFF | ON
Using XOR, the pixel is set ON if either the bit in the PUT
array or the corresponding pixel in the destination area
(but not both) is ON. In all other cases, the pixel is
turned OFF (reset). In other words:
OFF | ON
OFF | ON
ON ON OFF
The following BASICG program will graphically illustrate the
differences between the various action options. Since the program
will give you a "hard-copy" printout of the action options, you'll
need to connect your TRS-8% to a graphic printer. See "Graphics
Utilities" later in this manual for more details on using the
Computer Graphics package with a printer.
Radio fhaek
— 4 9—
Computer Graphics
TRS-80°
19
29
30
49
59
69
70
89
99
180
119
128
138
149
158
169
165
178
175
189
198
209
218
220
238
240
259
269
278
DATA "OR", "AND", "PRESET", "PSET",
CLR : SCREEN $
FOR Y= 19 TO 21ÿ STEP 59
FOR X= 19 TO 490 STEP 2098
LINE (X+489,Y-5)-(X+199,Y+25),1,B
NEXT X
LINE (59,Y)-(98,Y+19),1,BF
FOR X= 209 TO 4098 STEP 2090
LINE (X+50,Y)-(X+78,Y+29),1,BF
NEXT X
NEXT Y
DIM V(1898)
GET (59,109)-(98,38),V
FOR N= 1 TO 5
R= (N-1)#5+1
READ AS
GLOCATE (136,R*109),9
PRINT #-3, AS;
GLOCATE (369,R*10),0
PRINT #-3, "= ";
ON N GOTO 288, 218, 220, 230, 240
PUT (459,19), V,OR: GOTO 2580
PUT (450,68), V,AND: GOTO 258
PUT (454,114), V,PRESET: GOTO 259
PUT (454,164), V,PSET: GOTO 254
PUT (458,219), V,XOR
NEXT N
CMD "I", "GPRINT"
SCREEN1
OR
AND
PRESET
PSET
XOR i
Figure 17
-50-
Operation Manual
|
"a [HE
n XOR "
Radio Shaek
Computer Graphics Operation Manual
TRS-80°
Hints and Tips about PUT:
. An Illegal
attempt to
the screen
parameters
Function Call error will result if you
PUT a rectangular pixel area to a section of
which is totally or partially beyond the
of the screen. For example:
GET (59,59)-(159,159),V
PUT (208 ,298),V,PSET
returns an
error because the rectangular pixel area
cannot be physically moved to the specified rectangular
pixel area (i.e., (200,299)-(399,399)).
. If you use PUT with a viewport (see VIEW), all
coordinates must be within the parameters of the
viewport or you'll get an Illegal Function Call error.
Examples
PUT with PSET
19 DIM V%*(63)
15 SCREEN $
20 CIRCLE (389,39),19
39 GET
(10,19) - (49, 4) , У%
40 FOR I=1 TO 500: NEXT I
59 CLR
698 PUT (110,110),V%,PSET
70 FOR
In this example,
I=1 TO 500: NEXT I
the circle is drawn, stored, moved and re-created.
First the white-bordered circle appears in the upper left corner of
the screen (position (39,39) -- program line 29). After a couple
of seconds (because of the delay loop), it disappears and then
reappears on the screen -- (119,119) -- program line 69.
What specifically happened is:
1. An array was created (line 19).
2. A circle was drawn (line 29).
3. GET -- The circle which was within the source
rectangular pixel area, as specified in the GET
Radio fhaek
-51-
Computer Graphics Operation Manual
TRS-80
statement 's parameters is stored in the array (line 309).
4. The screen is cleared (line 50).
5. PUT -- The circle from the array was PUT into the
destination rectangular pixel area as specified in the
PUT statement (line 69) with the PSET option.
19 DIM V$(780)
28 LINE (20,20)-(28,86)
30 LINE (889,0)-(88,80)
49 LINE (38,38)-(38,8/)
59 LINE (19,5)-(19,8G)
69 GET (9,0)-(109,1989),vs
79 FOR I=1 TO 19090: NEXT I
89 PUT (184,128),V%,PSET
99 FOR I=1 TO 1090908: NEXT I
Draws four lines. GET stores the lines in the rectangular
pixel area. PUT moves the lines to another rectangular
pixel area.
SCREEN
Selects Screen
SCREEN lets you set the proper screen. SCREEN BD selects the
Graphics Screen; SCREEN 1 selects the Text Screen. Any value
other than @ or 1 with SCREEN gives an error.
SCREEN is convenient to use when you want to display either
a Graphics Screen or a Text Screen. For example, you may
have run a program and then added to it. With SCREEN, you
can remove the graphics display, add to the program, and
then return to the Graphics Screen.
Whenever BASICG tries to display a character on the Text
Screen (like in an INPUT or PRINT statement), the screen is
Radio Shaek
—5 2-
Computer Graphics Operation Manual
TRS-80 *
automatically set to the Text Screen. If the program is
still running after executing the statement, BASICG will
revert to the screen that was in effect prior to executing
the statement.
Examples
19 SCREEN 1
20 LINE (150,150)-(200,200)
The computer executes the short program but the Graphics
Screen cannot display the graphics because of the SCREEN 1
command. To display the line, type: SCREEN ÿ <ENTER>.
10 CLR
20 SCREEN 1
30 LINE(19,19)-(255,191)
4 LINE(@,191)-(255,8)
50 AS=INKEYS: IF AS=""THEN 50
6% SCREEN fg
70 AS=INKEYS: IF AS=""THEN 79
80 GOTO 18
The computer executes the program (draws two intersecting
lines) but the screen cannot display the graphics because of
SCREEN 1. By pressing any key, the graphics are displayed
because of SCREEN JS.
19 CIRCLE (200,199),198
20 PAINT (200,190),"44",1
Now run the program and type:
SCREEN Y <ENTER>
This command turns the Graphics Screen ON.
By entering the SCREEN 1 and SCREEN # commands, you can
alternately turn the Graphics Screen OFF and ON without
losing the executed program display.
Radio Shaek
-53~-
Computer Graphics Operation Manual
TRS-80 *
VIEW (command)
Redefines the Screen (Creates a Viewport)
SAA AE:
E:
e
LA de de HO MEN
о
о
SIDE Are da
О
VIEW creates a "viewport" which redefines the screen TS
parameters (9-639 for X and @-239 for Y). This defined area
then becomes the only place you can draw graphics displays.
If you enter more than one viewport, you can only draw
displays in the last defined viewport.
Since VIEW redefines the SCREEN:
. CLR clears the interior of the viewport only.
. If you PSET or PRESET points, draw circles, etc.,
beyond the parameters of the currently defined
viewport, only the portions that are in the viewport
will be displayed.
. If you try to read a point beyond the viewport (with
POINT), it will return a -1.
. You can only GET and PUT arrays within the viewport.
. You can't PAINT outside the viewport.
The upper-left corner of the viewport is read as (g,ß) (the
"relative origin") when creating items inside the viewport.
All the other coordinates are read relative to this origin.
However, the "absolute coordinates" of the viewport, as they
are actually defined on the Graphics Cartesian system, are
retained in memory and can be read using VIEW as a function.
TUN
Radio Shaek
-5 4 —
Computer Graphics Operation Manual
TRS-80 *
Every viewport has absolute and relative coordinates and
graphic displays are drawn inside using the relative
coordinates. For example:
19 VIEW (199,199)-(298,2989),8.1
209 LINE (39,15)-(88,69),1
(199,199) A.C. (209,199) A.C.
(8,8) R.C. (39,15) (198,8) В.С.
R.C.
R.C.
(89,69)
(199,208) A.C. (209,209) A.C.
RES (199,149) В.С.
Figure 18
Note: After each of the following examples, you'll have to
redefine the entire screen to VIEW(ÿ,0)-(639,239) before
performing any other Graphics functions.
Examples
VIEW (198,199)-(208,288),9;1
Draws a black viewport (pixels OFF) that is outlined in
white (border pixels ON).
VIEW (199,189)-(200,208),1,1
Draws a white viewport (pixels ON) that is outlined in white
(border pixels ON).
VIEW (58,58)-(1908,188),1,9
Draws a white viewport (pixels ON) that is outlined in black
(border pixels OFF).
Radio Shaek
-55—
Computer Graphics Operation Manual
TRS-80 *
—
10 VIEW (19,19)-(6989,200),8,1
20 VIEW (59,59)-(199,1099),8,1
39 LINE (RND(599),RND(1989))-(RND(5908),RND(198))
40 GOTO 39
First you defined a large viewport that almost covered the
entire screen. Next you defined a smaller viewport. The
Random command draws lines within the specified parameters
but only the segments of the lines that are within the
parameters of the smaller viewport are visible since it was
specified last.
19 VIEW(89,89)-(498,298),8,1
20 VIEW(199,99)-(399,1789),6,1
39 VIEW(129,199)-1(298,200),0,1
49 VIEW(59,59)-(199,199),8,1
Draws four viewports. All further drawing takes place in the
last viewport specified,
10 VIEW(2109,889)-(4289,169),0,1
20 CIRCLE(390,129),188,1 —
39 LINE(15,15)-(69,68),1
48 CIRCLE(99,489),589,1
59 LINE(40,38)-(509,30),1
Draws a viewport. Draws a circle but only a portion is
within the parameters of the viewport. This circle's
centerpoint is relative to the upper left corner of the
viewport and not to the absolute coordinates of the graphics
Cartesian system. A line is drawn which is totally within
the parameters of the viewport. Another circle is drawn
which is totally within the parameters of the viewport.
Another line is drawn which is only partially within the
parameters of the viewport.
19 VIEW (1989,789)-(449,189),8,1
20 CIRCLE (399,148),179,1
39 CIRCLE (199,238),400,1
40 LINE (19,19)-(5989,2389),1
Draws a viewport. A circle is drawn but only a portion is
within the parameters of the viewport. Another circle is
drawn and a larger portion is within the parameters of the
и
Radio Shaek
—56-
Computer Graphics Operation Manual
TRS-80°
viewport. A line is drawn but only a segment is within the
parameters of the viewport.
&VIEW (function)
Returns Viewport Coordinates
«VIEW returns a corner coordinate of a viewport. It is
important to note the parentheses are not optional. If you
enter the &VIEW function without the parentheses, a Syntax
Error will result.
To display one of the four viewport coordinates, you must
enter one of the following values for p:
returns the upper left X-coordinate
returns the upper left Y-coordinate
returns the lower right X-coordinate
returns the lower right Y-coordinate
9
wn HS
Important Note: When you have defined several viewports,
&VIEW only returns the coordinates of the last-defined
viewport.
Examples
Set up the following viewport:
VIEW(198,80)-(220,158),0,1
Now type: PRINT £VIEW(Q) <ENTER>
Displays: 199
Type: PRINT £VIEW(1) <ENTER>
Displays: 80
®
Radio Shaek
-57—-
Computer Graphics Operation Manual
TRS-80 °
Enter: PRINT &VIEW(2) <ENTER>
Displays: 220
Type: PRINT &VIEW(3) <ENTER>
Displays: 159
set up the following viewports:
VIEW(1ÿÿ,88)-(228,158),6,1 <ENTER>
VIEW(258,170)-(358,220),0,1 <ENTER>
Now enter: PRINT &VIEW(ÿ) <ENTER>
Displays: 250
Type: PRINT £VIEW(1) <ENTER>
Displays: 178
Now type: PRINT &VIEW(2) <ENTER>
Displays: 359
Type: PRINT &VIEW(3) <ENTER>
Displays: 220
Radio Shaek
—-58-
Computer Graphics Operation Manual
TRS-80 *
3/ Graphics Utilities
There are six utilities included with the TRS-80 Computer
Graphics package which are intended to be used as
stand-alone programs. However, if you are an experienced
programmer, you can use these with BASICG and FORTRAN. The
source-code for each utility, that illustrate Graphics
programming techniques, is listed later in this section.
The Graphics Utilities let you:
. Save graphic displays to diskette.
. Load graphic displays from diskette.
. Print graphic displays on a graphics printer.
. Turn graphics display OFF or ON.
. Clear graphics memory.
To use these utilities from BASICG, use the CMD"I" command
followed by a comma and the name of the utility in quotation
marks (e.g., CMD"I","GCLS" <ENTER> ) and control returns to
TRSDOS Ready. From TRSDOS, enter the utility directly,
without quotation marks (e.g., GCLS <ENTER> ).
To call these routines from FORTRAN, see the Subprogram
Linkage section of your TRS-89 Model III FORTRAN Manual
(26-2200).
Note: These utilities load into high memory starting at Fgggd
(hex); therefore, they cannot be used with DEBUG, DO, or any
communication drivers that use high memory.
Radio Shaek
- 5 Q—
Operation Manual
— em EA Sm a Sk EE
tH
mu
GPRIN
sue
Prints graphic displa
printer without 9
y on
degree
UE
я : i
E 2 с Gad ide dia SAH: ERED SHR TE 5
op: ADS io NS a SI UU ai a SAE EEE SY AI is i SME Sl FE i a el kl wi SY SE EE SE A A a E i
Table 6
8 ten
UN “o PE
GCLS
Clears Graphics Screen
GCLS clears the Graphics Screen by erasing the contents of
graphics memory corresponding to the visible Graphics
Screen. GCLS erases graphics memory by writing zeroes (OFF)
to every bit in memory. GCLS does not clear the Text Screen
(video memory).
Examples
When TRSDOS Ready is displayed, type:
GCLS <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD"I" , "GCLS" <ENTER>
Or
198 CMD"I","GCLS"
Radio Shaek
-60-
Computer Graphics Operation Manual
TRS-80 °
GLOAD
Loads Graphics Memory from Diskette
po
i
des
o
о Danan о
SEE
Note: There cannot be spaces within a file specification.
TRSDOS terminates the file specification at the first space.
With GLOAD, you can load TRSDOS files that have graphic
contents into graphics memory. These files must have been
previously saved to diskette using GSAVE.
Examples
When TRSDOS Ready is displayed, type:
GLOAD PROGRAM/DAT.PASSWORD:f <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD"I","GLOAD PROGRAM" <ENTER>
or
1998 CMD"I", "GLOAD PROGRAM"
Radio Shaek
—61-
Computer Graphics Operation Manual
TRS-80 *
GPRINT
Lists Graphic Display to Printer
E
HEE,
se dC NA A
SIN Re TEE ANNE
GPRINT lets you print graphics memory on a graphics
(dot-addressable) printer, such as Radio Shack's DMP- 199
(26-1253) or DMP-208 (26-1254). Both of these printers have
a 9 1/2" carriage. However, distortion will occur when
Graphic routines are printed with GPRINT. This is because
GPRINT is not a true pixel-by-pixel "Screen Dump" since the
pixel size and spacing on the screen is different from the
pixel size and spacing on the Printer. GPRINT is a point of
departure for you to obtain hard-copy representations of
graphics.
To print graphic displays, GPRINT turns the contents of the
Graphic Screen clockwise 99 degrees and then prints.
However, FORMS must be used to set printing parameters.
Most uses will require that you set FORMS when TRSDOS Ready
is displayed:
FORMS (LINES=6ÿ,WIDTH=ÿ) <ENTER>
See your Model III Operation and BASIC Language Reference
and printer owner's manual for more details on setting
printing parameters.
Important Note! Do not press <BREAK> while GPRINT is
executing.
Examples
When TRSDOS Ready is displayed, type:
GPRINT <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD"I","GPRINT" <ENTER>
or
108 CMD"I", "GPRINT"
For a complete GPRINT sample session, see Appendix D.
Radio Shaek
—-62-
Computer Graphics Operation Manual
TRS-80 °
GPRT2
Print Graphics
= to
|
than SS
al
GPRT2 is similar to GPRINT but is designed for use with
wide-carriage (15") printers such as the DMP-4039 and
GPRT2 is different from GPRINT in that the image is not
rotated 99 degrees and a different aspect ratio is used.
If GPRT2 does not produce the quality of print out you
desire, try GPRT3 or GPRINT.
Important Note! Do not press <BREAK> while GPRT2 is
executing.
Examples
When TRSDOS Ready is displayed, type:
GPRT2 <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD" I" , "GPRT2" <ENTER>
or
19% CMD"I","GPRT2"
GPRT3
Print Graphics (Double on the Y-Axis)
ikea
ed
Ta dire
ЗН
AI
=
ae
—63-
Computer Graphics Operation Manual
TRS-80 *
GPRT3 is similar to GPRINT but is designed for use with
wide-carriage (15") printers such as the DMP-489 and
DMP-5@4.
GPRT3 is different from GPRINT in that the image is not
rotated 9% degrees and a different aspect ratio is used.
If GPRT3 does not produce the quality of print-out you
desire, try GPRT2 or GPRINT.
Important Note! Do not press <BREAK> while GPRT3 is
executing.
Examples
When TRSDOS Ready is displayed, type:
GPRT3 <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD"I" , "GPRT3" <ENTER>
or
198 CMD"I","GPRT3"
GROFF
GROFF turns the Graphics Screen OFF. GROFF is different from
GCLS since GROFF simply removes the Graphics display without
erasing the contents of graphic memory. GCLS completely
clears graphics memory by writing zeroes (OFF) to every bit
in memory.
Examples
When TRSDOS Ready is displayed, type:
GROFF <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
Radio Shaek
—6 4-
Computer Graphics Operation Manual
TRS-80 °
CMD"I", "GROFF" <ENTER>
Or
190 CMD"I", "GROFF"
GRON
Turns Graphics Display ON
GRON turns the Graphics Screen ON.
Examples
When TRSDOS Ready is displayed, type:
GRON <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD"I","GRON" <ENTER>
or
199 CMD"I","GRON"
Radio Shaek
-65—
Computer Graphics Operation Manual
TRS-80 *
GSAVE
Saves Graphics Memory to Diskette
Note: There cannot be spaces within a file specification.
TRSDOS terminates the file specification at the first space.
With GSAVE, the contents in graphics memory is saved under a
specified filename which follows the standard TRSDOS
format. To load the file back into memory, use GLOAD.
Examples
When TRSDOS Ready is displayed, type:
GSAVE PROGRAM/DAT.PASSWORD:ÿ <ENTER>
or when the BASICG READY prompt (>) is displayed, type:
CMD"I","GSAVE PROGRAM" <ENTER>
or
194 CMD"I","GSAVE PROGRAM"
Radio Shaek
—66-
Computer Graphics Operation Manual
TRS-80 *
4/ Graphics Subroutine Library (FORTRAN)
The Graphics Subroutine Library included on the Computer
Graphics diskette lets you use the functions of TRS-89
Computer Graphics while programming in Model III FORTRAN
(26-2280). This library (GRPLIB/REL) must be linked to any
FORTRAN program that accesses the Graphics Subroutines.
BASICG vs. the Graphics Subroutine Library
The Graphics Subroutine Library contains subroutines which
provide the same capabilities as the Graphics commands and
functions in BASICG. The Graphics subroutines have basically the
same names and parameters as the BASICG commands. The major
differences between the Library subroutines and the BASICG
commands are:
. The BASICG command LINE has three corresponding library
subroutines: LINE, LINEB, and LINEBF. LINEB and LINEBF
provide the functions of the BASICG command LINE with the
parameters B and BF respectively.
. The BASICG command PAINT has two corresponding library
subroutines: PAINT and PAINTT. PAINT is for painting solid
black or white, and PAINTT is for painting with tiling.
. The Library subroutines that correspond to BASICG commands
that use (x,y) coordinates (except for VIEW) use (x,y)
coordinates that have been previously set. The subroutines
used to set the coordinates are SETXY and SETXYR.
Setting Points Using SETXY and SETXYR
The coordinates specified by SETXY or SETXYR will be called the
"current" and "previous" coordinates. Subroutines that use one
(x,y) coordinate pair use the "current" coordinates and
subroutines that use two (x,y) pairs use both the "current" and
the "previous" coordinates. Each call to SETXY or SETXYR sets
the coordinates as follows:
1. Assign the values of the "current" (x,y) coordinates to the
"previous" (x,y) coordinates, (discarding the old "previous"
coordinates).
Radio Shaek
-91]-
Computer Graphics Operation Manual
— TRS-80 ©
2. Assign new values for the "current" (x,y) coordinates as
specified by the arguments supplied. SETXY simply sets the
"current" coordinates to the values of its arguments.
SETXYR adds the values of its arguments to the "current"
coordinates to obtain the new coordinates.
Initialization
Before any calls are made to Graphics, the Graphics library
and board must be initialized. A special initialization
routine (GRPINI) is included in the library. A call to
GRPINI must be made as the first access to the Graphics
library.
Example
00108 Сс SAMPLE INITIALIZATION
00150 DIMENSION V(38,38)
002090 CALL GRPINI ($)
Linking
TN,
The Library (GRPLIB/REL) must be linked to any programs that
access the Graphics Subroutines. You must use the linker
(L80) to generate the load module.
Example
L89 <ENTER>
* SAMPLE:1-—N
*GRPHSAM, GRPLIB-S,FORLIB-S,-U
*-E
This example links both the Graphics Library and the FORTRAN
Subroutine Library to the relocatable file GRPHSAM/REL. In
this example, SAMPLE:1-N is the file name, drive
specification, and switch, respectively; GRPHSAM, GRPLIB-S,
FORLIB-S, and -U are the names of the relocatable modules to
be linked and their respective switches. -E ends the routine
and creates the executable program SAMPLE. The *'s in the
example are prompts for the user -- not data to be entered.
Note: If there are unresolved external references, the
FORTRAN Library may need to be scanned a second time.
Radio fhaek
-92-
Computer Graphics Operation Manual
TRS-80 °
Errors
If you enter incorrect parameters for any of the Graphics
Subroutines, your screen will display:
GRAPHICS ERROR
and return program control to TRSDOS Ready. This is the
only error message you'll get when executing the
Subroutines.
Important Note: Free memory is utilized by the Graphic
Routine for temporary storage. Extreme care should be
exercised if your program accesses this memory.
Routines/Functions
Most of the FORTRAN Subroutines and functions described in
this section have a corresponding command in the Graphics
BASIC Language Reference section of this manual.
Radio Shaek
-93-
Computer Graphics
TRS-80°
FORTRAN Routines
Operation Manual
ov me GA ES TE VER URE Sp EE TU CES E SE EE SEN EEE EEN Te A AN GWE SMUD GI MEE EEE WE me wil AAR ER Se ded EG GED AID NES А mm vis AR SI SEL mmm fm WEL SI SEN SE Sm Gm WS SE GA GEL SEE SED ME md SS
Radio Shaek
Routine Action
CIRCLE Draws a circle, arc,
semicircle, or ellipse.
CLS Clears the Graphics Screen.
GET Reads the contents of a rectangular
pixel area into an array.
GPRINT Displays textual data on the
Graphics Screen.
GRPINI Graphics initialization routine.
LINE Draws a line.
LINEB Draws a box.
LINEBF Draws a filled box.
LOCATE Sets the direction for displaying
textual data on the Graphics
Screen.
PAINT Paints the screen in specified
OFF/ON color. |
PAINTT Paints the screen in a specified
pattern.
PRESET Sets pixel OFF/ON.
PSET Sets pixel OFF/ON.
PUT Puts the stored array on the
screen.
SCREEN Selects the screen.
SETXY Sets (x,y) coordinates (absolute).
SETXYR Sets (x,y) coordinates (relative).
VIEW Sets up a viewport where graphics
is displayed.
Table 7
FORTRAN Functions
Function Action
POINT Reads a pixel 's value at a
specified coordinate.
FVIEW
Reads a viewport's parameters.
Table 8
—-94-
Computer Graphics Operation Manual
TRS-80 ©
CIRCLE
Draws a Circle, Arc, Semicircle, Point or Ellipse
: 8
Ha
a:
.
2
; i Sl Le
CIRCLE draws a circle. By varying start, end, and aspect
ratio, you can draw arcs, semicircles, or ellipses using
current X- and Y-coordinates as the centerpoint (set by
SETXY or SETXYR).
If start and end are ÿ.0, a circle is drawn starting
from the center right side of the circle. Notes In the
CIRCLE statement, end is read as 2 x PI even though you
have entered 9.8. If you enter #.8 for aspect ratio, a
symmetric circle is drawn.
Example
CALL CIRCLE(199,1,9.0,0.8,90.89)
Radio Shaek
— 95 —
Computer Graphics Operation Manual
TRS-80°
Sample Program
This example draws and paints a circle.
P9010 Сс SAMPLE PROGRAM FOR CIRCLE
990929 LOGICAL COLOR,OPTION
09038 COLOR=1
goagag OPTION=0
09058 CALL GRPINI (OPTION)
gages CALL CLS
09978 CALL SETXY (309,108)
90989 CALL CIRCLE(18989,COLOR, 0.0,0.8,89.0)
0098 CALL PAINT (COLOR , COLOR )
09199 END
CLS
Clears Graphics Screen
Example —
CALL CLS
Sample Program (see CIRCLE)
GET
Reads Contents of a Rectangular Pixel Area into an Array
GET reads the contents of a rectangular pixel area into an
array for future use by PUT. The pixel area is a group of
pixels which are defined by the current x and y, and the
previous X- and Y-coordinates specified by the SETXY call.
Radio fhaek
-96-
Computer Graphics Operation Manual
TRS-80 *
The first two bytes of array are set to the horizontal
(X-axis) number of pixels in the pixel area; the second two
bytes are set to the vertical (Y-axis) number of pixels in
the pixel area. The remainder of array represents the
status of each pixel (either ON or OFF) in the pixel area.
The data is stored in a row-by-row format. The data is
stored eight pixels per byte and each row starts on a byte
boundary.
Array Limits
When the array is defined, space is reserved in memory for
each element of the array. The size of the array is
limited by the amount of memory available for use by your
program -- each real number in your storage array uses
four memory locations (bytes).
The array must be large enough to hold your graphic
display and the rectangular area defined must include all
the points you want to store.
To determine the minimum array size:
l. Divide the number of X-axis pixels by 8 and round
up to the next higher integer.
2. Multiply the result by the number of Y-axis pixels.
When counting the X-Y axis pixels, be sure to include
the first and last pixel.
3. Add four to the total.
4. Divide by four (for real numbers) and two (for integers)
rounding up to the next higher integer. (Note: If
you're using a LOGICAL array, the result of Step #3
above will produce the desired array size.)
When using arrays, the position and size of the
rectangular pixel area is determined by the current and
previous (x,y) coordinates.
Position: upper left corner
lower left corner
startpoint = (xl,yl)
endpoint = (x2,y2)
Size (in pixels): width = x2-x1+1
length = y2-yl+l
Radio Shaek
-97-
Computer Graphics Operation Manual
TRS-80 °
Example
CALL GET(A, 40089)
Sample Program
This example draws a circle, saves the circle into an
array, then restores the array to the graphics video.
gggsg с SAMPLE FOR GET AND PUT
201 0й LOGICAL V(128),ACTION
00159 ACTION=1
00209 CALL GRPINI(Q)
00308 CALL CLS
08358 С DRAW A CIRCLE
00408 CALL SETXY (38,30)
09500 CALL CIRCLE (18,1,0.0,90.0,9.09)
88558 C SET COORDINATES FOR GET ARRAY
BUENA CALL SETXY (18,10)
00708 CALL SETXY (40,40)
007508 Сс STORE GRAPHICS INTO ARRAY WITH GET
00890 CALL GET(V,128)
90900 DO 19 I=1,5008
100 19 CONTINUE
1058 Сс CLEAR SCREEN AND RESTORE GRPH FROM ARRAY
1190 CALL CLS
01209 CALL SETXY (110,119)
01309 CALL PUT(V,ACTION)
91490 DO 28 I=1,5990
01508 29 CONTINUE
01600 END
Write Text Characters to the Graphics Screen
—-98-
Computer Graphics Operation Manual
TRS-80 °
GPRINT is used to write text characters to the Graphics
Screen. This is the easiest way to display textual data on
the Graphics Screen. Characters are displayed starting at
the current (X,y) coordinates and going in the direction
specified by the most recently executed LOCATE call. If no
LOCATE call was executed prior to the GPRINT call, a
direction of Y is assumed.
GPRINT will only print text characters (see Appendix C of
the Model III Operation and BASIC Language Reference
Manual). Each character displayed in the ÿ or 2 direction
uses an 8 X 8 pixel grid; each character displayed in the 1
or 3 direction uses a 16 X 8 grid. Executing this command
will set the current (x,y) coordinates to the end of the
last character that was displayed.
Displaying text in direction f# engages a wraparound feature.
If the end of a line is reached, the display will be
continued on the next line. If the end of the screen is
reached, the display will be continued at the beginning of
the screen without scrolling. If there is not enough room to
display at least one character at the current (x,y)
coordinates, a GRAPHICS ERROR will result. When displaying
text in other directions, an attempt to display text outside
the currently defined screen will cause a GRAPHICS ERROR to
be given.
GRPINI
Graphics Initialization Routine
GRPINI is the graphics initialization routine. This function
must be called before any other graphics calls are made in
FORTRAN.
Example
CALL GRPINI(1l)
Radio Shaek
—-99-
Computer Graphics Operation Manual
TRS-80 *
Sample Program (see CIRCLE)
LINE
Draws Line
LINE draws a line between the previous and current
coordinates. These coordinates are set by the SETXY or
SETXYR subroutines.
Example
CALL LINE (1,-1)
Sample Program
This example draws a diagonal line connected to a box, which
is connected to a filled box.
00018 с SAMPLE FOR LINE LINEB LINEBF
09028 LOGICAL COLOR
00038 COLOR=1
90040 CALL GRPINI(g)
000580 CALL CLS
goaded CALL SETXY (1,1)
00070 CALL SETXY (218,80)
00080 CALL LINE(COLOR,-1)
10890 CALL SETXY (428,166)
00108 Сс COORDINATES ARE NOW (218,89) (420,160)
00118 CALL LINEB(COLOR,-1)
09128 CALL SETXY (639,239)
80138 Сс COORDINATES ARE NOW (420,169) (639,239)
09149 CALL LINEBF (COLOR)
00158 END
TN
®
Radio Shaek
—100-
Computer Graphics Operation Manual
TRS-80 *
LINEB
Draws Box
LINEB is the same as LINE except LINEB draws a box between
the two sets of coordinates set by the SETXY or SETXYR
subroutines.
Example
CALL LINEB (1,-1)
Sample Program (see LINE)
LINEBF
Draws Painted Box
et + AE 2 Sm ten sa fan denen = smn В ee ;
. E i © а 3 E о o о
т i SHE ace sers ; bi
a :
oo
о + nn
Te
НЯ
НЕ
E
LINEBF is the same as LINEB except LINEBF fills the box
(colors in the box) and the argument style is not used.
Example
CALL LINEBF (1)
Sample Program (see LINE)
Radio Shaek -
-1@1-
Computer Graphics Operation Manual
TRS-80 * —
LOCATE
Sets the Direction for Displaying Text on the Graphics
Screen
LOCATE sets “the direction that GPRINT will use to display
textual data. The allowable values for direction are:
Y - zero degree angle
1 - 98 degree angle
2 - 189 degree angle
3 - 278 degree angle
Examples
—
CALL LOCATE ($)
This program line will cause characters to be displayed at
the current (x,y) coordinates in normal left to right
orientation.
CALL LOCATE (1)
This program line will cause characters to be displayed at
the current (x,y) coordinates in a vertical orientation
going from the top of the screen to the bottom of the
screen.
CALL LOCATE (2)
This program line will cause characters to be displayed
upside down starting at the right of the screen and going
towards the left.
CALL LOCATE (3)
This program line will cause the characters to be displayed
vertically starting at the lower portion of the screen going
towards the top of the screen.
Radio Shaek
-102-
Computer Graphics
0 Operation Manual
TRS-80
и
PAINT
Paints Screen in Specified Color
PAINT paints the screen in the specified OFF/ON color
(black or white). It uses the current X- and Y-coordinates
(see SETXY) as its startpoint.
Example
—
CALL PAINT(1,1)
Sample Program (see CIRCLE)
Radio Shaek
-103-
Computer Graphics Operation Manual
TRS-80 *
PAINTT
Paints Screen in Specified Pattern
PAINTT lets you paint a precisely defined pattern using a
graphics technique called "tiling." You can paint with
tiling by defining a multi-pixel grid in an array and then и
using that array as the paint pattern.
Example
CALL PAINTT (A,1,V)
Radio Shaek
—-194-
Computer Graphics
Operation Manual
Sample Program
TRS-80 *
00108 Сс EXAMPLE FOR PAINT WITH TILE
00158 LOGICAL A,B,BORDER
09200 DIMENSION A(9)
88388 DIMENSION B(2)
88350 DEFINE TILE ARRAY HERE
00400 DATA A(1), A(2), A(3) / 8, X'81', X'42'/
00508 DATA A(4),A(5),A(6)/X'24',X'18',X'18'/
00608 DATA A(7),A(8),A(9)/X'24',X'42',X'81'/
99659 DEFINE BACKGROUND ARRAY HERE
00780 DATA B(1),B(2)/1,8/
00800 CALL GRPINI(O)
98900 CALL CLS
g1999 CALL SETXY (300,109)
01100 CALL CIRCLE(150,1,0.80,0.90,0.9)
91200 BORDER=1
013899 CALL PAINTT(A,BORDER,B)
91400 END
PRESET
Sets Pixel ON/OFF
PRESET sets the pixel defined by the current (x,y)
coordinates either ON or OFF.
Example
CALL PRESET(Q)
Radio Shaek
-195-
Computer Graphics
Operation Manual
Sample Program
09199
09298
09309
#04
00599
#0600
00609
99899
99999
01900
91199
91299
01399
PSET
Sets Pixel ON/OFF
nuera
Eat
E
ооо в с
о |
=
EER SL: LIRA
39
35
TRS-80 *
PRESET EXAMPLE
LOGICAL COLOR
COLOR=1
CALL GRPINI(G)
CALL CLS
SET PIXEL TO ON
CALL SETXY (300,120)
CALL PRESET(COLOR)
TEST PIXEL WHETHER ON OR OFF
K=POINT(M)
WRITE (3,35)K
FORMAT ('2','PIXEL VALUE IS',I4)
END
PSET sets the pixel defined by the current (x,y)
coordinates either ON or OFF.
Example
CALL PSET($)
Radio Shaek
-106-
Computer Graphics
Sample Program
99198
09209
09399
99499
00599
00600
09799
00800
00999
91999
91199
01299
91399
91499
PUT
35
PSET EXAMPLE
LOGICAL COLOR
LOGICAL POINT
COLOR=1
CALL GRPINI(f)
CALL CLS
SET PIXEL TO ON
CALL SETXY (304,128)
TRS-80°
CALL PSET(COLOR)
TEST PIXEL WHETHER ON OR OFF
K=POINT(M)
WRITE (3,35)K
Operation Manual
FORMAT ('2','PIXEL VALUE IS',I4)
END
Puts Stored Array onto Screen
PUT takes a rectangular pixel area that
GET and puts it on the screen at current x and y coordinates
set by calling SETXY.
Example
CALL PUT (V,1)
Sample Program (see GET)
-107-
e
a
se
o
un
Sa
ie
i:
a
E
Sy
TUE
.
Tan
has been stored by
o
о
+ Е: Не В Не
о а
с о au aan
o
Sra
E E ihe
=
Te
EA:
states
Computer Graphics Operation Manual
TRS-80 ©
SCREEN
Selects Screen
Sms
ma
a
i
о
о
.
ge
qu:
5
SCREEN lets you select the proper screen.
Example
CALL SCREEN(Q)
Sample Program
This example turns off the graphics display, draws a circle,
then turns on the graphics display. The circle is then
visible.
gaglg Сс EXAMPLE FOR SCREEN
99920 LOGICAL CMD
09749 CMD=1
99959 CALL GRPINI(S)
99969 CALL CLS
000790 CALL SCREEN (CMD)
09089 CALL SETXY (300,120)
00090 CALL CIRCLE(190,1,0.0,9.0,0.0)
00100 CALL PAINT(1,1)
99118 Do 20 I=1,19000
00128 28 — CONTINUE
99139 CMD=§
00148 CALL SCREEN (CMD)
00159 END
Radio Shaek
-1ÿ8-
Computer Graphics Operation Manual
TRS-80 ©
SETXY
Sets Coordinates
ZA
i
TA
SETXY sets and holds both current and previous X- and
Y-coordinates. When a new coordinate is given, it is
designated as the "current coordinate" and the last
coordinate is designated as the "previous coordinate." If a
new coordinate is specified, the "previous coordinate" is
lost and the "current coordinate" becomes the "previous
coordinate."
Example
CALL SETXY (190,109)
Sample Program (see LINE)
SETXYR
Sets Relative Coordinates
SETXYR sets the current (x,y) coordinates relative to
the previously set (x,y) coordinates. For example, if
the "current" coordinates are (190,198), CALL SETXYR(189,19)
will set the "current" coordinates to (118,110); the
"previous" coordinates will then be (199,190).
Example
CALL SETXYR(38,30)
Radio Shaek
-109-
Computer Graphics Operation Manual
TRS-80 *
TS
Sample Program
99018 C DRAW TWO INTERSECTING CIRCLES
00929 CALL GRPINI(1)
99930 CALL CLS
8948 CALL SETXY (109,108)
88950 CALL CIRCLE (58,1,0.9,0.90,80.89)
goged С DRAW SECOND CIRCLE WITH CENTER 20
00078 с PIXELS TO THE RIGHT OF FIRST CIRCLE
09988 CALL SETXYR (28,0)
00090 CALL CIRCLE(58,1,8.8,8.8,8.8)
901909 END
VIEW
Sets Viewport
DB Девка
о
PSE GEAR AS:
VIEW draws viewports on your screen. Graphics is displayed
only in the last defined viewport.
The upper-left corner of viewport is read as (ÿ,ÿ) (the
"relative origin") when creating items inside the viewport.
All the other coordinates are read relative to this origin.
However, the "absolute coordinates" of the viewport, as they
are actually defined on the Graphics Cartesian system, are
retained in memory and can be read using VIEW as a function.
Radio Shaek
-11g-
Computer Graphics
Operation Manual
TRS-80 °
Example
CALL VIEW(1@d,100,200,208,8,1)
Sample Program
B0108 C SAMPLE VIEW PROGRAM
90298 LOGICAL COLOR, BORDER, K
00300 INTEGER FVIEW
90400 CALL GRPINI(1)
09590 CALL CLS
99500 C SET UP VIEW PORT
89780 COLOR=J
090800 BORDER=1
99980 CALL VIEW(219,80,420,16%,COLOR, BORDER)
B1008 C DRAW MULTIPLE CIRCLES
81199 CALL SETXY (195,40)
01290 DO 29 I=108,150,109
01380 CALL CIRCLE(I,1,8.0,8.0,0)
91498 20 CONTINUE
9150909 C DISPLAY VIEWPORT COORDINATES
01600 DO 48 I=1,4
01700 K=I-1
91809 J=FVIEW(K)
91908 WRITE (3,35)1,J
02998 35 FORMAT ('2','VIEW PORT COORDINATE ',I4,' IS AT',I4)
02199 49 CONTINUE
92208 C PRINT EMPTY LINES
92490 WRITE (3,50)
92588 59 FORMAT (1H1)
92688 68 CONTINUE
02700 END
The following two descriptions are functions in the Graphics
Subroutine Library and must be declared as LOGICAL and
INTEGER, respectively, in any routine that uses them.
Radio fhaek
-111-
Computer Graphics Operation Manual
®
TRS-80 _
Functions
POINT
Reads Pixel Value at Current Coordinates
1
POINT returns the OFF/ON pixel value at current x and y
coordinate as specified by SETXY or SETXYR. If the point is
not in the current viewport, POINT returns -1.
Example
K=POINT (M)
Sample Program (see PSET) —
FVIEW
Reads Viewport's Parameters
FVIEW returns the specified viewport parameter:
ÿ = returns the left X-coordinate
1 = returns the left Y-coordinate
2 = returns the right X-coordinate
3 = returns the right Y-coordinate
Example
I=FVIEW(Q)
TN
-112-
Computer Graphics Operation Manual
TRS-80 °
Sample Program (see VIEW)
Radio Shaek
-113-
Computer Graphics Operation Manual
TRS-80°
5/ Programming the Graphics Board
The Graphics Board provides 640 X 24f byte addressable
pixels on a TRS-89 Model III. The Graphics Board contains
32K of screen RAM to store video data consisting of four
64K RAMs which are double accessed for 8 bytes of data.
Regular alphanumeric data is stored in the static RAM on
the Video Board. The Graphics Board uses separate hardware
to generate a 640 X 243 display, so only one screen may be
displayed at a time. If the video is switched from Text to
Graphics Screen very rapidly, the Video display may lose
horizontal/vertical synchronization.
I/O port mapping is used to read and write data to the
board. The Board is addressable at 89-83 Hex.
There are four internal registers which can be written to
or read on the board. They are as follows:
1. X-Position - X-address (8 to 127) for data write
only. (8 to 79 for display.)
Y-address (8 to 255) for data write
only. (8 to 238 for display.)
3. Data — Graphics data in "byte" form. Each
byte turns on or off 8 consecutive
horizontal dots.
4, Options - 8 flags which turn on or off the user
programmable options (Write only).
2. Y-Position
The I/O port mapping of the board is:
xf - X-Register Write. (89)
X1 - Y-Register Write. (81)
x2 - Video data read or write. (82)
x3 —- Options write. (83)
where x denotes the upper nibble of the I/O boundary as
set by the DIP Switches. They are set by the factory at
80H.
The Graphics Board uses X-Y addressing to locate the start
of a Graphics data byte. The upper-left of the screen is
(8,0) while the lower-right is (079,239). If the bit is a
1, the dot will be ON. For example, if you wanted to turn
Radio Shaek
-114-
Computer Graphics Operation Manual
TRS-80 *
on the 5th dot on the top row, the registers would contain:
X POSITION=9, Y POSITION=89, DATA=(90001000)=08H. Note that
in calculating points to plot, the Y-position is correct
for a single dot. Only the X-position must be corrected to
compensate for the byte addressing. This can be
accomplished in a simple subroutine.
Line Drawing Options
There are two 8-bit counters which act as latches for the
X- and Y-address. You may select, through the options
register, if they are to automatically count after a read
or write to graphic memory. Also, the counters may
increment or decrement independently. These counters do not
count to their respective endpoints and reset. Instead,
they will overflow past displayable video addresses.
Therefore, the software should not allow the counters to go
past 79 and 239. However, these extra memory locations may
be used for data storage.
Examples
The following are brief examples on how to use the Graphics
Board.
Read the video byte at X=0, y=ÿ
XOR A ¿CLEAR A
OUT (89H),A ; OUTPUT X ADDRESS
OUT (81H),A ; OUTPUT Y ADDRESS
IN A, (82H) ; READ VIDEO BYTE
Draw a line from X=0,Y=ÿ to X=639, Y=0 using the hardware
line drawing
LD B,79 ‚ В HAS CHARACTER COUNT
LD A, UB1H ; OPTIONS : INCREMENT X AFTER WRITE
¡101100091 Binary
OUT (83H),A
XOR A
OUT (80H),A sOUT X ADDRESS STARTING
OUT (81H),A ;OUTPUT Y ADDRESS
LD A, JFFH ; LOAD A WITH ALL DOTS ON
LOOP OUT (82H),A ; OUTPUT DOTS
DJNZ LOOP ; OUTPUT NUMBER IN B REGISTER
®
Radio fhaek
-115-
Computer Graphics Operation Manual
TRS-80°
Eran BN
Options Programming
2 — — ew mh vad mm ml Gey AE Em ms ml AD WE UVP CINE GINS ER EET SS Em WD ASD AMS Em AD Am MEE GED WWD TE Sm awl WM ER Gm Gm Wm SEE SUE SEI SIN Sl AS SAE LER GEM SE WER WED GW TE UD VER mmm mi Gus mew =
— —]! == цю ши SE AD GD VER EE GED SEE WEN Er MS MASE dmb Mal GE MED AEE GUE WED EE WN mar Tee MA Mmm Sm mi MLE AR SEN SE == Ge чу me SnD RA WPI RN GE WE Ge TAR анны = SD WS Sm em == dd ink
g GRAPHICS/ALPHA* Turns graphics ON and OFF.
"1" turns graphics ON.
1 NOT USED
2 XREG DEC/INC* Selects whether X decrements
or increments. "7" selects
decrement.
3 YREG DEC/INC* Selects whether Y decrements
or increments. "7" selects
decrement.
4 X CLK RD* If address clocking is
desired, a "8" clocks the X
address up or down AFTER a
Read depending on the status
of BIT 2. TN
5 Y CLK RD* If address clocking is
desired, a "@" clocks the ¥
address up or down AFTER a
Read depending on the status
of BIT 3.
6 X CLK WR* A "8" clocks AFTER a Write.
7 Y CLK WR* A "g" clocks AFTER a Write.
Table 9. Options Programming
Radio Shaek
—-l116-
SERVICE POLICY
Radio Shack’s nationwide network of service facilities provides quick, convenient,
and reliable repair services for all of its computer products, in most instances.
Warranty service will be performed in accordance with Radio Shack's Limited
Warranty. Non-warranty service will be provided at reasonable parts and labor
costs.
Because of the sensitivity of computer equipment, and the problems which can
result from improper servicing, the following limitations also apply to the services
offered by Radio Shack:
1.
If any of the warranty seals on any Radio Shack computer products are broken,
Radio Shack reserves the right to refuse to service the equipment or to void
any remaining warranty on the equipment.
. If any Radio Shack computer equipment has been modified so that it is not
within manufacturer's specifications, including, but not limited to, the installation
of any non-Radio Shack parts, components, or replacement boards, then
Radio Shack reserves the right to refuse to service the equipment, void any
remaining warranty, remove and replace any non-Radio Shack part found in
the equipment, and perform whatever modifications are necessary to return
the equipment to original factory manufacturer's specifications.
The cost for the labor and parts required to return the Radio Shack computer
equipment to original manufacturer's specifications will be charged to the
customer in addition to the normal repair charge.
RADIO SHACK, A DIVISION OF TANDY CORPORATION
U.S.A.: FORT WORTH, TEXAS 76102
CANADA: BARRIE, ONTARIO L4M 4W5
TANDY CORPORATION
AUSTRALIA BELGIUM U. K.
91 KURRAJONG ROAD PARC INDUSTRIEL DE NANINNE BILSTON ROAD WEDNESBURY
MOUNT DRUITT, N.S.W. 2770 5140 NANINNE WEST MIDLANDS WS10 7JN
8749382-03/83-SP | Printed in U.S.A.

advertisement

Key Features

  • High-resolution graphics
  • Two-color display (black and white)
  • Graphics BASIC (BASICG) language
  • Graphics Subroutine Library
  • Support for various printers
  • Text and Graphics Screen modes

Frequently Answers and Questions

What are the system requirements for using the TRS-80 Computer Graphics package?
You'll need a Model III with 48K of RAM, one disk drive, and the computer must be modified by a qualified Radio Shack service technician.
What is the difference between the Graphics BASIC language and the Graphics Subroutine Library?
Both provide similar capabilities for graphics programming, but they differ in the way coordinates are specified and the names of some routines.
What types of printers can I use with the TRS-80 Computer Graphics package?
You can use any Radio Shack printer with graphic capabilities, such as Line Printer VII (26-1167), Line Printer VIII (26-1168), DMP-199 (26-1253), DMP-28ÿ (26-1254), DMP-4ÿÿ (26-1251), or DMP-599 (26-1252).

Related manuals

Download PDF

advertisement