home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
starlet
/
genienec
/
draw.doc
< prev
next >
Wrap
Text File
|
1979-12-31
|
13KB
|
335 lines
Graphics Drawing on the NEC Starlet
William H. Ball
71735,505
Introduction
The DRAW.COM Interpreter
DRAW.CO═ i≤ ß graphic≤ drawinτ prograφ fo≥ thσ NE├ Starlet« Yo⌡ ì
caε usσ thσ prograφ t∩ dra≈ picture≤ oε thσ Starlet'≤ screeε anΣ ì
theε dum≡ thσ picturσ t∩ you≥ printer« DRAW.CO═ i≤ no⌠ ì
interactive¼ bu⌠ i≤ ß "file-drawó prograφ tha⌠ load≤ you≥ ASCI╔ ì
tex⌠ filσ oµ command≤ anΣ draw≤ thσ picturσ oε you≥ screen« Yo⌡ ì
caε savσ you≥ picture≤ fo≥ late≥ use« DRAW.CO═ feature≤ ove≥ 2░ ì
command≤ fo≥ movinτ arounΣ thσ Starlet'≤ screeε anΣ creatinτ anΣ ì
printinτ images« Thσ synta° i≤ simila≥ t∩ Microsof⌠ BASIC'≤ ì
drawinτ commands.
With DRAW.COM you can:
- addres≤ anΣ turε oε o≥ ofµ an∙ oµ thσ Starlet'≤ 61,44░ ì
pixels
- draw lines between any two points on the screen
- dra≈ boxes¼ circles¼ anΣ filleΣ boxe≤ o≥ circle≤ oµ an∙ ì
size
- design your own character fonts for drawing
- dump your picture to your Tandy or IBM graphic printer
Iµ yo⌡ can'⌠ wait¼ anΣ wan⌠ t∩ tr∙ thi≤ program¼ usσ thi≤ ì
command:
DRAW DEMO.DRW or DRAW DRAWME.DRW
anΣ hi⌠ thσ Returε key« You'l∞ seσ tha⌠ thσ Starle⌠ caε d∩ ì
graphics just as well as its bigger brothers!
Thi≤ prograφ i≤ ß mini-interprete≥ tha⌠ take≤ you≥ ASCI╔ filσ oµ ì
UPPERCAS┼ command≤ anΣ draw≤ picture≤ oε thσ Starlet'≤ screen« Iµ ì
yo⌡ havσ ß Tand∙ o≥ IB═ graphiπ printer¼ yo⌡ caε dum≡ the screen ì
t∩ you≥ printe≥ a⌠ an∙ poin⌠ iε thσ file« I'vσ limiteΣ thσ sizσ ì
oµ thσ ASCI╔ filσ t∩ 500░ characters¼ bu⌠ yo⌡ caε changσ thi≤ ì
defaul⌠ b∙ recompilinτ thσ program.
Your draw file must be specified on the command. For example,
DRAW MYFILE.DRW
wil∞ loaΣ DRAW¼ theε loaΣ thσ specifieΣ ASCI╔ tex⌠ file« Iµ yo⌡ ì
d∩ no⌠ specif∙ "MYFILE.DRW,ó DRA╫ wil∞ exi⌠ witΦ ß "filσ no⌠ ì
specifiedó error« Iµ DRA╫ canno⌠ finΣ "MYFILE.DRW,ó i⌠ wil∞ exi⌠ ìèwitΦ ß "filσ no⌠ foundó error.
Screen Size
Thσ Starlet'≤ LC─ resolutioε i≤ 48░ dot≤ widσ (X-axis⌐ b∙ 12╕ ì
dot≤ higΦ (Y-axis)¼ s∩ X'≤ valuσ caε bσ betweeε ░ anΣ 480« ┘ caε ì
havσ ß valuσ oµ ░ t∩ 128« Aε x,∙ positioε oµ 0,░ i≤ thσ uppe≥ ì
lef⌠ oµ thσ screen.
0,0 ----------------------------------------- 480,0
| |
| The NEC's screen is a liquid- |
| crystal display of 480 dots |
| by 128 dots. The screen corners |
| are x,y positions. |
| |
| |
0,128 ----------------------------------------- 480,128
Design Your Own Fonts
I'vσ als∩ includeΣ ß commanΣ yo⌡ caε usσ t∩ desigε you≥ owε ì
characte≥ font≤ o≥ icons« Yo⌡ caε usσ ß matri° oµ u≡ t∩ 1╡ dot≤ ì
widσ anΣ 1╡ dot≤ high« Thi≤ mean≤ yo⌡ caε fi⌠ abou⌠ 3▓ character≤ ì
o≥ icon≤ iε thσ maximuφ sizσ acros≤ thσ screen¼ morσ iµ yo⌡ ì
overla≡ them« Abou⌠ ninσ character≤ o≥ icon≤ wil∞ bσ a≤ higΦ a≤ ì
thσ screen« Again¼ yo⌡ caε changσ thi≤ b∙ recompilinτ thσ ì
program« Thesσ limit≤ arσ becausσ Small-├ caε onl∙ handlσ ì
integers as large as 32,768.
Index of Commands
Here's a quick list of the commands and their syntax:
Abx,b1,b2,b3,...bx - draw a user-defined character or icon
Bx,y - draw a box to x,y
Cn - set color to n
Dn - move down n units
Fn,x,y - draw box to x,y and fill with color n
Gn - move north east n units while plotting
Hn - move south east n units while plotting
In - move south west n units while plotting
Jn - move north west n units while plotting
K - wait for a keypress before proceeding
Ln - move left n units while plotting
Mx,y - move to x,y
Nx,y - draw line to x,y
Pn - dump screen to printer
Rn - move right n units while plotting
Sx,y str" - move to approx x,y cursor pos and print str
Tx,y,r - draw a circle of radius r around x,y
Un - move up n units while plotting
Vx,y,r - draw a filled circle of radius r around x,y
X - XOR screen
; - ignore rest of line (used for comments)è $ - end of program, wait for keypress, quit
Thσ dra≈ filσ mus⌠ bσ aε ASCI╔ filσ createΣ b∙ you≥ edito≥ o≥ ì
WordStar'≤ non-documen⌠ mode« Al∞ command≤ mus⌠ bσ iε uppercase« ì
Excep⌠ fo≥ thσ single-lette≥ commands¼ al∞ command≤ mus⌠ bσ ì
followeΣ b∙ aε integer« Yo⌡ ma∙ usσ an∙ characte≥ t∩ separatσ thσ ì
x,∙ integers« ╔ usuall∙ usσ ß comma« Thσ ╙ command'≤ strinτ mus⌠ ì
bσ separateΣ froφ thσ ∙ intege≥ b∙ ß space¼ anΣ mus⌠ bσ delimiteΣ ì
by a quote mark. See the S command description.
Thσ Starle⌠ mus⌠ bσ iε thσ VT-10░ mode¼ becausσ somσ of thσ ì
commands use that terminal's escape sequences.
Fo≥ specifiπ detail≤ concerninτ thσ commands¼ refe≥ t∩ thσ ì
following information.
Command Syntax
$
Thi≤ characte≥ tell≤ DRAW.CO═ t∩ wai⌠ fo≥ ß keypress¼ clea≥ thσ ì
screen, then quit and return to the MENU command line.
;
Ignorσ thσ line¼ becausσ thσ tex⌠ i≤ ß comment« Yo⌡ caε usσ thi≤ ì
commanΣ a≤ ß reminde≥ anΣ t∩ documen⌠ you≥ picture« Thi≤ commanΣ ì
shoulΣ bσ thσ firs⌠ characte≥ oε ß line« Iµ yo⌡ havσ thi≤ commanΣ ì
followinτ ß strinτ oµ drawinτ commands¼ don'⌠ usσ an∙ uppercasσ ì
letters¼ o≥ DRAW.CO═ wil∞ interpre⌠ thσ comment≤ a≤ commands« Fo≥ ì
example,
; THIS IS A COMMENT AND DRAW.COM WILL IGNORE THIS LINE
M240,128 ; move to the middle of the screen
Abx,b1,b2,b3,...bx
Dra≈ ß characte≥ a⌠ thσ curren⌠ x,∙ positioε usinτ thσ specifieΣ ì
characte≥ definition« The b° equal≤ thσ numbe≥ oµ binar∙ digit≤ ì
anΣ y-axi≤ line≤ oµ thσ character¼ anΣ b▒ througΦ b° equal≤ thσ ì
decima∞ valuσ oµ eacΦ oµ thσ y-axi≤ lines« Thi≤ commanΣ update≤ ì
thσ curren⌠ x,∙ position« Iµ thi≤ sound≤ complicated¼ don'⌠ ì
worry« Here'≤ aε examplσ t∩ hel≡ you« Fo≥ example¼
A9,0,0,0,0,60,6,62,70,59
wil∞ dra≈ aε "aó oε thσ screen« Iµ yo⌡ looδ closely¼ you'l∞ seσ ì
the "a" is not like the Starlet's. Here's what the command means.
000000000 A - start definition of 9 lines, 0 for line 1
000000000 0 for line 2
000000000 the character is 9 dots wide 0 for line 3
000000000 0 for line 4
000111100 1111 <-- 60 for line 5
000000110 11 | 6 for line 6è000111110 11111 |-- Look familiar? 62 for line 7
001000110 1 11 | 70 for line 8
000111011 111 11 <-- 59 for line 9
Usinτ thi≤ approach¼ yo⌡ caε desigε you≥ owε font≤ o≥ characters« ì
Iµ you omi⌠ ß movσ (Mx,y⌐ commanΣ beforσ defininτ anΣ printinτ ì
thσ letter¼ thσ letter≤ wil∞ bσ printeΣ alonτ ß vertica∞ axis« ì
Doe≤ anyonσ ou⌠ therσ wan⌠ t∩ desigε ß cursor-controlleΣ fon⌠ ì
editor┐ Usinτ binar∙ number≤ drive≤ mσ crazy.
Bx,y
Dra≈ ß box¼ usinτ ß diagona∞ froφ thσ curren⌠ x,∙ positioε t∩ ì
x,y« Iµ thσ curren⌠ x,∙ positioε were 0,0 the command
B480,128
woulΣ dra≈ ß bo° thσ sizσ oµ thσ screen« Nicσ fo≥ borders« Thi≤ ì
command does not update the current x,y position.
Cn
Dra≈ usinτ thσ specifieΣ color¼ wherσ ε equa∞ ▒ fo≥ oε o≥ ░ fo≥ ì
off« Iµ you'rσ jus⌠ starting¼ includσ "C1ó a≤ thσ firs⌠ commanΣ ì
iε you≥ file« Thi≤ commanΣ doe≤ no⌠ affec⌠ thσ curren⌠ x,∙ ì
position.
Dn
Move≤ dowε ε times¼ plottinτ ß do⌠ eacΦ time« Yo⌡ caε usσ thi≤ ì
command¼ alonτ witΦ I¼ G¼ H¼ J¼ L¼ R¼ anΣ U¼ t∩ dra≈ character≤ ì
too¼ bu⌠ ╔ prefe≥ thσ ┴ command« Thi≤ commanΣ update≤ thσ curren⌠ ì
x,∙ position.
Fn,x,y
Dra≈ ß bo° froφ thσ curren⌠ x,∙ positioε oε ß diagona∞ t∩ thσ ì
specifieΣ x,∙ position¼ anΣ usσ thσ specifieΣ colo≥ t∩ fil∞ thσ ì
box« Thσ color¼ n¼ caε bσ ß ░ o≥ ß 1« Thi≤ commanΣ doe≤ no⌠ ì
update the current x,y position.
Gn
Movσ north east ε units¼ plottinτ ß do⌠ alonτ thσ way« Thi≤ ì
command updates the current x,y position.
Hn
Move south east n units, plottinτ ß do⌠ alonτ thσ way« Thi≤ ì
command updates the current x,y position.
In
Move south west n units, plottinτ ß do⌠ alonτ thσ way« Thi≤ ì
command updates the current x,y position.è
Jn
Move north west n units, plottinτ ß do⌠ alonτ thσ way« Thi≤ ì
command updates the current x,y position.
K
Wai⌠ fo≥ ß keypres≤ beforσ proceeding« Don'⌠ usσ thi≤ commanΣ iµ ì
yo⌡ havσ XOR'Σ thσ screen« Thσ keypres≤ wil∞ bσ echoeΣ t∩ thσ ì
screeε a⌠ thσ curren⌠ curso≥ (no⌠ x,y⌐ position¼ creatinτ ß holσ ì
iε you≥ picture« Thi≤ commanΣ i≤ helpfu∞ iµ yo⌡ arσ testinτ ì
portion≤ oµ you≥ dra≈ file« DRAW.CO═ wil∞ wai⌠ fo≥ ß keypres≤ a⌠ ì
thσ enΣ oµ filσ a≤ ß default.
Ln
Movσ lef⌠ ε units¼ plottinτ ß do⌠ alonτ thσ way« Thi≤ commanΣ ì
updates the current x,y position.
Mx,y
Movσ t∩ specifieΣ do⌠ position« Thi≤ commanΣ update≤ thσ curren⌠ ì
x,∙ position¼ bu⌠ doe≤ no⌠ dra≈ ß linσ froφ thσ previou≤ x,∙ ì
positioε o≥ plo⌠ ß do⌠ a⌠ thσ specifieΣ position« Usσ thi≤ ì
commanΣ t∩ movσ arounΣ thσ screeε anΣ positioε fo≥ ß draw.
Nx,y
Dra≈ ß linσ froφ thσ curren⌠ x,∙ positioε t∩ thσ specifieΣ x,∙ ì
position. This command does not update the current x,y position.
Pn
Dum≡ thσ screeε t∩ you≥ printer« Iµ ε equal≤ 1¼ thσ printe≥ i≤ ß ì
Tand∙ printer« Iµ ε equal≤ 2¼ thσ printe≥ i≤ aε IB═ graphiπ ì
printer.
Rn
Movσ righ⌠ ε units¼ plottinτ ß do⌠ alonτ thσ way« Thi≤ commanΣ ì
update the current x,y position.
Sx,y str"
Movσ t∩ specifieΣ x,∙ positioε anΣ prin⌠ thσ string« Thi≤ commanΣ ì
calculate≤ thσ curso≥ positioε b∙ dividinτ ° b∙ ╢ anΣ ∙ b∙ 8« Fo≥ ì
example,
S240,64 At center"
wil∞ movσ thσ curso≥ t∩ characte≥ 40¼ (24░ divideΣ b∙ ╢ equal≤ ì
40)¼ anΣ linσ ╕ (6┤ divideΣ b∙ ╕ equal≤ 8)« Thi≤ commanΣ i≤ no⌠ ì
a≤ flexiblσ a≤ thσ ┴ command¼ bu⌠ i≤ faste≥ becausσ i⌠ use≤ thσ ì
Starlet'≤ VT-10░ curso≥ positioninτ sequence« Thσ curso≥ positioε ìèi≤ calculateΣ b∙ intege≥ division¼ s∩ thσ ° anΣ ∙ value≤ wil∞ bσ ì
roundeΣ down« Iµ yo⌡ omi⌠ thσ enΣ quote¼ thσ screeε wil∞ bσ ì
cleareΣ anΣ you'l∞ receivσ aε erro≥ message« Thi≤ commanΣ doe≤ ì
no⌠ updatσ thσ curren⌠ x,∙ position¼ bu⌠ i⌠ doe≤ updatσ thσ ì
current cursor position.
Tx,y,r
Dra≈ ß circlσ oµ radiu≤ ≥ arounΣ thσ specifieΣ x,∙ position« Thi≤ ì
command updates the current x,y position.
Un
Movσ u≡ ε units¼ plottinτ ß do⌠ alonτ thσ way« Thi≤ commanΣ ì
updates the current x,y position.
Vx,y,r
Dra≈ ß filleΣ circlσ oµ radiu≤ ≥ arounΣ thσ specifieΣ x,∙ ì
position. This command updates the current x,y position.
X
Thi≤ commanΣ XOR≤ thσ screen« Thi≤ mean≤ thσ blacδ dot≤ wil∞ ì
becomσ whitσ anΣ thσ whitσ dot≤ wil∞ becomσ black« Thi≤ commanΣ ì
does not affect the current x,y position.
A Note About DRAW.COM
Thσ prograφ doe≤ littlσ error-checking¼ s∩ bσ careful¼ o≥ yo⌡ ma∙ ì
enΣ u≡ drawinτ picture≤ ofµ thσ Starlet'≤ screen.
You≥ picturσ filσ i≤ limiteΣ t∩ abou⌠ 5,00░ characters« WordSta≥ ì
wil∞ tel∞ yo⌡ exactl∙ ho≈ largσ you≥ ASCI╔ filσ i≤ iµ yo⌡ d∩ ß ì
^Q├ t∩ g∩ t∩ thσ enΣ oµ thσ filσ iε thσ non-documen⌠ mode« ì
DRAW.CO═ wil∞ exi⌠ witΦ aε erro≥ messagσ iµ you≥ filσ i≤ to∩ ì
large« ╔ kep⌠ thi≤ sizσ smal∞ s∩ peoplσ withou⌠ NODE'≤ grea⌠ ì
Datapaπ caε ruε thσ program« (Iµ yo⌡ tr∙ t∩ ruε ß prograφ large≥ ì
thaε 31╦ oε thσ Starle⌠ wheε iε thσ 32╦ CP═ mode¼ you'l∞ ge⌠ ß ì
"BaΣ Filσ Loadó error.⌐ Iµ yo⌡ ruε ou⌠ oµ room¼ tr∙ deletinτ thσ ì
comments« Yo⌡ caε als∩ strinτ severa∞ command≤ oε eacΦ line« ì
DRAW.CO═ see≤ you≥ prograφ a≤ onσ lonτ string¼ anΣ load≤ i⌠ int∩ ì
memor∙ first¼ s∩ you≥ commanΣ linσ caε a≤ widσ a≤ 256 characters.
Don'⌠ forge⌠ t∩ placσ thσ Starle⌠ iε thσ VT-10░ modσ viß thσ ì
OPTIO╬ commanΣ froφ thσ MENU« Otherwise¼ thσ screeε wil∞ no⌠ bσ ì
cleareΣ wheε DRAW.CO═ starts¼ anΣ escapσ sequence≤ wil∞ bσ echoeΣ ì
t∩ thσ screen« DRAW.CO═ wil∞ reaΣ you≥ file¼ dra≈ thσ picturσ ì
froφ you≥ commands¼ theε wai⌠ fo≥ ß keypress¼ clea≥ thσ screeε ì
and quit.
Strangσ thing≤ ma∙ happeε iµ yo⌡ tr∙ t∩ definσ character≤ large≥ ì
thaε 1╡ dot≤ widσ witΦ thσ ┴ command¼ or forge⌠ t∩ inser⌠ space≤ o≥ ì
delimiter≤ wherσ the∙ shoulΣ bσ fo≥ eacΦ command« I'vσ kep⌠ ì
error-checkinτ t∩ ß minimuφ t∩ kee≡ thσ prograφ small« Don'⌠ bσ ìèafraid to experiment though, and have fun!
Iµ yo⌡ woulΣ likσ thσ sourcσ codσ t∩ DRAW¼ anΣ ß dozeε othe≥ ì
utilitie≤ written just for the Starlet, send $10 to:
William H. Ball
4255 Ancona Court
Indianapolis, IN 46236