-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path06-04-graphics.html
644 lines (508 loc) · 25.1 KB
/
06-04-graphics.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
<!doctype html>
<html lang="en">
<head>
<!--
This Amos Professional Manual is written by asymetrix for the Amiga community and should stay completely FREE FOREVER.
Created 2008. :)
It was created from the original AMOS Professional Manual by Europress Software Ltd.
It has been updated by Fredrik Rambris.
-->
<title>Graphics - AMOS Professional Manual</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content="Amos Professional, Amiga, Programming, Basic, Francois Lionet, Europress Software Ltd, Amos, computing, code, AmigaDOS">
<meta name="author" content="asymetrix,Fredrik Rambris">
<link rel="GitHub" href="https://github.com/fredrik-rambris/amospromanual">
<meta property="og:site_name" content="AMOS Professional Manual">
<meta property="og:image" content="https://amospromanual.dev/images/cover.jpg">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="canonical" href="https://amospromanual.dev/06-04-graphics.html">
</head>
<body>
<section>
<h1>Graphics</h1>
<p>In this Chapter, you will learn how to master the arts of form and colour.</p>
<p>
AMOS Professional allows the programmer to harness the Amiga's full graphic potential, and all
aspects of design can be controlled simply, accurately and almost instantaneously. The
computer-graphics artist is provided with a standard electronic canvas 320 pixels wide and 200
pixels high, and there are potentially 4096 different colours to exploit. In order to apply the
chosen colour to the correct point, you will need to know the coordinates of each available pixel,
and as long as these graphic coordinates are not confused with the broader scale of text
coordinates, all will be well.</p>
</section>
<section id="01-graphic-coordinates">
<h2>Graphic coordinates</h2>
<h3 class="command" id="i-plot">PLOT</h3>
<p><i>instruction: plot a single point</i><br>
<b>Plot</b> x,y<br>
<b>Plot</b> x,y,colour</p>
<p>
This is the simplest drawing command of all, and plots a single pixel of ink colour between
graphic coordinates 0,0 and 319,199. When followed by specific x,y-coordinates, the current ink
colour will be plotted at this new position. You are allowed to omit either the x or the y-
coordinate, provided the comma is left in the correct position. If an optional colour index
number is added the new colour will be used for this and all subsequent drawing operations.
For example:</p>
<code class="prefix edit">Cls: Curs Off
Do
Plot Rnd(319),Rnd(199),Rnd(15)
Loop
</code>
<h3 class="command" id="fn-point">POINT</h3>
<p><i>function: return the colour of a point</i><br>
c=<b>Point</b>(x,y)</p>
<p>
Use this function to find the index number of the colour occupying your chosen coordinates,
like this:</p>
<pre>
Cls : Plot 160,100
Print "The colour is ";Point(160,100)
</pre>
</section>
<section id="02-setting-the-graphics-cursor">
<h2>Setting the graphics cursor</h2>
<h3 class="command" id="i-gr-locate">GR LOCATE</h3>
<p><i>instruction: position the graphics cursor</i><br>
<b>Gr Locate</b> x,y</>
<p>
The graphics cursor sets the starting point for most drawing operations. To establish this point,
use GR LOCATE to position the graphics cursor at your chosen coordinates.</p>
<p>For example:</p>
<code class="prefix edit">X=150 : Y=10
For R=3 To 87 Step 3
Gr Locate X,Y+R
Circle ,,R
Next R
</code>
<p><b>XGR</b><br>
<b>YGR</b><br>
<i>functions: return the relevant coordinate of the graphics cursor</i><br>
x=<b>Xgr</b><br>
y=<b>Ygr</b></p>
<p>
Use these functions to find the current coordinates of the graphics cursor, which is the default
location for future drawing operations. For example:</p>
<code class="prefix edit">Cls : Circle 100,100,50
Print Xgr,Ygr
</code>
</section>
<section id="03-drawing-lines">
<h2>Drawing lines</h2>
<h3 class="command" id="i-draw">DRAW</h3>
<p><i>instruction: draw a line</i><br>
<b>Draw</b> x1 ,y1 <b>To</b> x2,y2<br>
<b>Draw</b> <b>To</b> x,y</p>
<p>
Line drawing is extremely simple. Pick two sets of graphic coordinates, and draw your line from
one to the other. To draw a line from the current position of the graphics cursor, use DRAW TO
followed by a single set of coordinates. For example:</p>
<code class="prefix edit">Cls: Ink 2
Draw 50,50 To 250,150
Draw To 275,175
</code>
<p><b>Line styles</b><br>
Changing the appearance of straight lines is very simple with AMOS Professional. Each line
pattern is held in the form of a binary number made up of 16 bits, with zeros setting blank spaces
in the current background colour, and ones setting the solid parts of the pattern in the current ink
colour. So a normal solid line can be imagined as having all its bits set to one, like this:</p>
<pre>%01111111111111111</pre>
<h3 class="command" id="i-set-line">SET LINE</h3>
<p><i>instruction: set a line style</i><br>
<b>Set Line</b> binary mask</p>
<p>
This command sets the style of all straight lines that are subsequently drawn. Theoretically, the
16-bit mask can generate values for different patterns between 0 and 65535, but here is a more
practical example:</p>
<code class="prefix edit">Cls : Ink 2
Set Line $F0F0
Box 50,100 To 150,140
Set Line %1100110011001100
Box 60,110 To 160,160
</code>
</section>
<section id="04-drawing-outline-shapes">
<h2>Drawing outline shapes</h2>
<p>
Here is a range of AMOS Professional short-cuts for drawing outline shapes on the screen.</p>
<h3 class="command" id="i-polyline">POLYLINE</h3>
<p><i>instruction: draw multiple line</i><br>
<b>Polyline</b> x1 ,y1 <b>To</b> x2,y2 <b>To</b> x3,y3<br>
<b>Polyline</b> To x1 ,y1 <b>To</b> x2,y2</p>
<p>
The POLYLINE is identical to DRAW except that it accepts multiple coordinate settings at the
same time. In this way, complex many-sided outlines can be drawn with a single statement. In
its POLYLINE TO form, drawing begins at the current graphic cursor position. For example:</p>
<code class="prefix edit">Circle 160,100,95
Polyline 160,6 To 100,173 To 250,69 To 71,69 To 222,173 To 160,6
</code>
<h3 class="command" id="i-box">BOX</h3>
<p><i>instruction: draw a rectangular outline</i><br>
<b>Box</b> x1 ,y1 <b>To</b> x2,y2</p>
<p>
Boxed outlines are drawn at settings determined by the top left-hand and bottom right-hand
coordinates, as in the last example.</p>
<h3 class="command" id="i-circle">CIRCLE</h3>
<p><i>instruction: draw a circular outline</i><br>
<b>Circle</b> x,y,radius</p>
<p>
To draw circles, a pair of coordinates sets the position of the centre point around which the
shape is to be drawn, followed by the radius of the circle (the distance between the centre point
and the circumference or rim of the circle.) If the x,y-coordinates are omitted, the circle will be
drawn from the current graphic cursor position.</p>
<p>For example:</p>
<code class="prefix edit">Cls : Curs Off : Ink 3
Gr Locate 160,100
Circle ,,45 : Wait 100: Flash Off
Do
Ink Rnd(15) : X=Rnd(250) : Y=Rnd(150) : R=Rnd(90)+1
Circle X,Y,R
Loop
</code>
<h3 class="command" id="i-ellipse">ELLIPSE</h3>
<p><i>instruction: draw an elliptical outline</i><br>
<b>Ellipse</b> x,y,radius1,radius2</p>
<p>
An ellipse is drawn in a similar way. After the x,y-coordinates have set the centre location, two
radii must be given, one to set the horizontal width and the second to set the height of the
ellipse. Coordinates may be omitted as usual, providing the commas remain in place. For
example:</p>
<code class="prefix edit">Ellipse 100,100,50,20
Ellipse ,,20,50
</code>
<h3 class="command" id="i-clip">CLIP</h3>
<p><i>instruction: restrict drawing to a limited screen area</i><br>
<b>Clip</b>
<b>Clip</b> x1 ,y1 <b>To</b> x2,y2</p>
<p>
This command is used to set an invisible rectangular boundary on the screen, using the normal
top left-hand corner to bottom right-hand corner coordinates. All subsequent drawing
operations will be clipped off when they reach these boundaries. To toggle the command and
restore the normal screen display area, use CLIP and omit the coordinates. Areas that are
preserved outside of the clipped zone can be used for items such as borders and control panels.
For example:</p>
<code class="prefix edit">Clip 150,5 To 280,199
For R=4 To 96 Step 4
Gr Locate 150,R+5
Ellipse ,,R+9,R
Next R
</code>
</section>
<section id="05-selecting-colours">
<h2>Selecting colours</h2>
<p>
The next part of this Chapter explains how the AMOS Professional programmer is free to exploit
the Amiga's superb colour-handling features. Although the Amiga only provides 32 colour
registers, AMOS Professional allows the use of colour numbers ranging from 0 to 63. This is in
order to make full use of the extra colours available from the Half-Bright and HAM modes, as
explained in <a href="06-01-setting-up-screens.html">Chapter 6.1</a>.</p>
<h3 class="command" id="i-ink">INK</h3>
<p><i>instruction: set drawing colour</i><br>
<b>Ink</b> number<br>
<b>Ink</b> number,pattern,border</p>
<p>
You are not restricted to the pre-set colours that have been allocated for drawing operations.
The INK command is used to specify which colour is to be used for subsequent drawing, and
the number of the colour register is set like this:</p>
<code class="prefix edit">Cls: Ink 5
Draw To 319,199
</code>
<p>
The INK instruction can also be used to set patterns for filling shapes, as well as colours for
borders around shapes, and this will be explained later. The next concept to understand is how
different colours are mixed.</p>
<p>
Every shade of colour displayed on your television set or monitor is composed of various
mixtures of the same three primary colours: Red, Green and Blue (RGB for short). There is a
range of 16 intensities available for each of the RGB levels in every colour. A zero level is
equivalent to "none" of that colour (black), and the maximum intensity of 16 is the equivalent of
"all" of that colour. Because there are three separate components each with 16 possible
strengths, the maximum range of available shades is 16 times 16 times 16, in other words 4096
possible colours.</p>
<p>
The Amiga prefers to recognise colours by their RGB components, given in hexadecimal values,
known as "hex". The following table shows the equivalent decimal and hex values for the 16
numbers involved:</p>
<pre>
Hex digit 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
</pre>
<h3 class="command" id="fn-colour">COLOUR</h3>
<p><i>function: read the colour assignment</i><br>
c=<b>Colour</b>(index)</p>
<p>
It is not difficult to find which colours are occupying the colour index, and analyse how much
Red, Green and Blue is used to make up each shade. The COLOUR function can take an index
number from 0 to 31, and returns the colour value assigned to that number. Hex$ is used for this
purpose, as follows:</p>
<code class="prefix edit">Curs Off : Flash Off
For C=0 To 15: Ink C
Print Hex$(Colour(C),3)
Circle 160,75,(C+1)*4
Next C
</code>
<p>
That example creates a lit of 16 colour values in hex code, alongside a ripple of circles in those
colours. Note that the $ symbol is always used to introduce a hex number for the Amiga to
recognise. The first hex value in the example table should be $000, meaning no Red, no Green
and no Blue component is present in colour index 0. Sure enough, the innermost circle is drawn
in black ink.</p>
<p>Here are some other examples in this form of notation:</p>
<pre>
<b>Colour Hex value RGB components</b>
White $FFF R=F G=F B=F
Grey $666 R=6 G=6 B=6
Green $0F0 R=0 G=F B=0
Violet $FOF R=F G=0 B=F
Ox blood $801 R=8 G=0 B=1
Pig foot $A74 R=A G=7 B=4
</pre>
<h3 class="command" id="fn-colour">COLOUR</h3>
<p><i>instruction: assign a colour to an index</i><br>
<b>Colour</b> number,$RGB</p>
<p>
Used as an instruction, COLOUR allows you to assign the RGB components of a colour to each
of the Amiga's 32 colour registers. For example, if you wanted to load colour number 1 with a
subtle shade of pig's feet, you would use this:</p>
<code class="prefix edit">Cls : Colour 1,$A74</code>
<i>COLOUR BACK</i><br>
<i>instruction: assign a colour to the screen background</i><br>
<b>Colour Back</b> $RGB<br>
<b>Colour Back</b> (number)</p>
<p>
This command is used to assign your choice of RGB components for the screen's background
colour, which fills unused areas at the top and bottom of the visible screen. Alternatively,
existing colours may also be specified when enclosed in brackets.</p>
</section>
<section id="06-setting-several-colours">
<h2>Setting several colours</h2>
<p>
Impressive effects can be programmed using multi-colour changes, but assigning individual
colours to every colour index would be a tedious business. AMOS Professional handles all the
donkey work as usual.</p>
<h3 class="command" id="i-palette">PALETTE</h3>
<p><i>instruction: set the current screen colours</i><br>
<b>Palette</b> colour list</p
<p>This is a much more powerful command than COLOUR, and it can be used to set as few or as</p>
<p>many colours in your artist's palette as are needed. Your programs always begin using a list of
default colour values, and these values may be changed as in the next example.</p>
<p>Remember that only the colours specifically set with this command will be affected, and any
others will retain their original values.</p>
<code class="prefix edit">Palette $FFF : <comment>Rem set colour 0 to white</comment>
Palette ,,,,$F00,$D00,$A00,$700,$400 : <comment>Rem colours 4 to 8 graded reds</comment>
Palette $000,,$000: <comment>Rem colours 0 and 2 both black</comment>
</code>
<p>
PALETTE can also be used to set the colours used by the Half-Bright and HAM modes, and
some superb ready-made examples are available, care of <a href="06-01-setting-up-screens.html">Chapter 6.1</a>. For a little light relief, try
his routine, which changes the first five colours in the palette with a hexadecimal poem, and
displays the result on screen. Feel free to change the values or the poetry.</p>
<code class="prefix edit">Palette $BAD,$0DD,$B0D,$FAB,$F1B
Curs Off : Flash Off
For C=0 To 4: Ink C
Print Hex$(Colour(C,3)
Bar 50,8*C To 150,8*C+8
Next C
</code>
</section>
<section id="07-filled-shapes">
<h2>Filled shapes</h2>
<p>You should now be familiar with drawing basic shapes and setting choices of colour. The next
stage explains how to combine these skills. Re-set your colours now, by getting rid of any
customised PALETTE commands, before continuing.</p>
<h3 class="command" id="i-paint">PAINT</h3>
<p><i>instruction: fill a screen area with colour</i><br>
<b>Paint</b> x,y<br>
<b>Paint</b> x,y,mode</p>
<p>
The PAINT command allows you to fill any section of your screen with a solid block of colour.
You may also fill areas with various patterns previously selected with the SET PATTERN
command, which is explained later. Decide which area is to be filled, and follow the PAINT
command by a set of coordinates located anywhere inside the section of screen you want to
paint with the current ink colour. Try this, which if all goes well should result in the Japanese
national flag:</p>
<code class="prefix edit">Palette 0,$F00
Circle 160,100,50
Paint 50,50
</code>
<p>
The optional mode setting can be set to either zero or one. A value of 0 ends your PAINT
operation at the first pixel encountered of the current border colour. A mode of 1 stops the
painting operation at any colour which is different from the existing ink colour. If there are any
gaps in the boundaries of the sections you wish to fill, colour will leak out and stain the
adjoining area.</p>
<h3 class="command" id="i-bar">BAR</h3>
<p><i>instruction: draw a filled rectangle</i><br>
<b>Bar</b> x1,y1 <b>To</b> x2,y2</p>
<p>
This is used to draw solid bars of colour by the familiar method of setting the top left-hand and
bottom right-hand graphic coordinates.</p>
<h3 class="command" id="i-polygon">POLYGON</h3>
<p><i>instruction: draw a filled polygon</i><br>
<b>Polygon</b> x1,y1 <b>To</b> x2,y2 <b>To</b> x3,y3<br>
<b>Polygon</b> <b>To</b> x1,y1, <b>To</b> x2,y2</p>
<p>
This can be regarded as creating a solid version of the POLYLINE command, and your shape
will begin at the current graphic coordinates if you commence the command in its POLYGON
TO form. Provided that your single statement does not exceed the maximum allowed line
length of 255 characters, there is no limit to the number of pairs of coordinates you can use. Try
this example:</p>
<code class="prefix edit">Do
Ink Rnd(15)
X1=Rnd(250) : Y1=Rnd(150) : H=Rnd(200) : W=Rnd(150)
Polygon X1,Y1 To X1+W,Y1 To X1+W/2,Y1+H To X1,Y1
Loop
</code>
</section>
<section id="08-alternative-fill-style">
<h2>Alternative fill style</h2>
<p>
Filling shapes with plain colours is a useful technique, but the AMOS Professional programmer
has a much wider choice of fill effects.</p>
<h3 class="command" id="i-set-pattern">SET PATTERN</h3>
<p><i>instruction: select a fill pattern</i><br>
<b>Set Pattern</b> number</p>
<p>
Use this command to select from a range of pattern styles. The default status fills shapes with
the current ink colour, and is set with a zero, like this:</p>
<code class="prefix ex">Set Pattern 0</code>
<p>
If SET PATTERN is followed by a positive number from 1 to 34, shapes are filled from a ready-
made selection of patterns.</p>
<p>View them now, by running this routine:</p>
<code class="prefix direct">Do
For N=0 To 34
Set Pattern N
Ink 0,1,2: Set Paint 1
Bar 50,50 To 150,150
Locate 0,0: Print N ;" "
Wait 50
Next N
Loop
</code>
<p>
If SET PATTERN is followed by a negative number, shapes will be filled with a pattern grabbed
from a Sprite or Bob image, taken from the Object Bank (memory bank 1). Because these
patterns can be very complex, AMOS Professional will simplify them automatically, as follows.</p>
<p>
The width of the image is clipped to 16 pixels, and the height is rounded to the nearest power of
two (2, 4, 8, 16, 32 and so on.)</p>
<p>
The original colours of the image are discarded, and the pattern is drawn using the current ink
and paper colours. Two-colour patterns are drawn as monochrome images.</p>
<p>
If multi-coloured images are required using the original Object colours, the INK must first be set
up, as follows:</p>
<code class="prefix ex">Ink 15,0
Set Pattern -1
Paint 100,100
</code>
<p>
That example fills the screen area around the given coordinates with any of the Object colours,
except the transparent colour zero. The colour index number 15 acts as a mask, defining which
colours are to be used, and sets the range from 1 to 15. If the INK command is changed to the
following line, the Object will be drawn with the normally transparent colour filled by colour 1:
</p>
<code class="prefix ex">Ink 15,1</code>
<p>
Before making use of sprite images as fill patterns, remember to use GET SPRITE PALETTE to
avoid messy displays. Here is an example:</p>
<code class="prefix edit">Flash Off : Cls 0
Load "AMOSPro_Tutorial:Objects/Pattern.Abk"
Get Sprite Palette
Box 1,1 To 319,199
Ink 15,0
Set Pattern -1
Paint 102,102
</code>
<h3 class="command" id="i-set-paint">SET PAINT</h3>
<p><i>instruction: toggle outline mode</i><br>
<b>Set Paint</b> mode</p>
<p>
This is a simple command that toggles outlines off and on for any shapes drawn using the
POLYGON and BAR instructions. Follow SET PAINT with a mode value of 1, and borders will
appear in the previous ink colour. If the mode is set by a zero, the default setting applies, with
no borders shown. For example:</p>
<code class="prefix edit">Ink 0,1,2 : Set Paint 1
Bar 5,5 To 200,100
Set paint 0: Bar 210,75 To 310,190
</code>
<p>
In the last example, the INK command carried additional parameters. These optional settings
follow the usual colour number, and are used to determine paper and border colours. In other
words, they can set the colours to be used for fill patterns and outlines of bars and polygons.
Remember to include any commas for unused options, as follows:</p>
<code class="prefix ex">Ink 3: <comment>Rem Set ink colour</comment>
ink ,,5: <comment>Rem Set border outline only</comment>
Ink 0,8,2: <comment>Rem Set ink, fill colour and border</comment>
Ink 6,13: <comment>Rem Set ink and background fill colour</comment>
</code>
</section>
<section id="09-overwriting-styles">
<h2>Overwriting styles</h2>
<p>
When graphics are drawn, they normally get "written" over what is already displayed on the
screen. There are four alternative drawing modes that change the way your graphics appear,
and they may be used individually or combined to generate a whole range of effects.</p>
<h3 class="command" id="i-gr-writing">GR WRITING</h3>
<p><i>instruction: change graphic writing mode</i><br>
<b>Gr Writing</b> bitpattern</p>
<p>
This command is used to set the various modes used for drawing lines, shapes, filled shapes and
graphical text. Settings are made using a bit pattern, whose values give the following results:</p>
<code class="prefix edit">Ink 2,5 : Text 100,80, "NORMAL TEXT"
Wait 100 : Gr Writing 1
Text 10 ,80, "REPLACE"
</code>
<p>Try the next example for some simple demonstrations of alternative settings:</p>
<code class="prefix edit">Ink 2,5 : Text 100,80,"NORMAL TEXT"
Wait 100 : Gr Writing 0
Text 100,80, "MERGED"
Wait 100 : Gr Writing 4
Text 100,90, "STENCIL"
Wait 100 : Gr Writing 5
Text 100,100, "REVERSE"
</code>
</section>
<section id="10-advanced-techniques">
<h2>Advanced techniques</h2>
<p>
Whenever AMOS Professional performs a fill command, a special area of memory is reserved to
hold the fill pattern. This memory is automatically returned to the system after the fill
instruction has been performed. The size of the memory buffer is equivalent to a single bit plane
in the current screen mode, so the default screen takes up a total of 8k.</p>
<h3 class="command" id="i-set-tempras">SET TEMPRAS</h3>
<p><i>instruction: set Temporary Raster</i><br>
<b>Set Tempras</b><br>
<b>Set Tempras</b> buffer address,buffer size</p>
<p>
This command allows the AMOS Professional programmer to adjust the amount of memory
used by the various graphics operations. You are warned that improper usage can cause your
computer to crash! The address and size of the graphics buffer can be changed as explained
below.</p>
<p>
The buffer address can be either an address or a memory bank, and the memory reserved for
this buffer should always be Chip RAM. After allocating the buffer area at the start of your
program, there is no need to keep on reserving and restoring it, which means that the execution
of your programs can be speeded up by up to 5%!</p>
<p>
The buffer size is the number of bytes you want to reserve for the buffer area, ranging from 256
to 65536. To calculate the amount of memory you need for a particular object, enclose the object
in a rectangular box and apply the following formula:</p>
<p>Memory area = Width/8*Height</p>
<p>
If you are intending to use the PAINT command, make sure that your shape is closed, otherwise
additional memory may be called for, causing the system to crash.</p>
<p>
The buffer area can be restored to its original value by calling SET TEMPRAS with no
parameters.</p>
</section>
<footer>
<a href="06-03-screen-effects.html" rel="prev">Screen Effects</a>
<a href="./">Contents</a>
<a href="14-appendix-g-command-index.html">Index</a>
<a href="06-05-menus.html" rel="next">Menus</a>
</footer>
</body>
</html>