-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05-06-text.html
761 lines (570 loc) · 30.1 KB
/
05-06-text.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
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
<!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>Text - 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/05-06-text.html">
</head>
<body>
<section>
<h1>Text</h1>
<p>This Chapter explains how to use the advantages of AMOS Professional for handling written
text. You may want to remind yourself of the visible character set by running this simple
routine:</p>
<code class="prefix edit">For 0=32 To 255
Print Chr$(C);" =Ascii Code";
Print Asc(Chr$(C)) : Wait 10
Next C
</code>
</section>
<section id="01-printing-on-the-screen">
<h2>Printing on the screen</h2>
<p>The PRINT instruction is one of the most familiar command words in most Basic languages.</p>
<h3 class="command" id="i-print">PRINT</h3>
<p><i>instruction: print items on screen</i><br>
<b>Print</b> items</p>
<p>Items are printed on the screen, starting from the current cursor position, and they may include
the characters in any group of variables or constants, up to the maximum line length of 255
characters. The PRINT command is also used to display graphics and information on screen, as
is demonstrated throughout this User Guide. This Chapter will deal with printing text only.</p>
<p>Print statements can occupy their own lines, but if more than one element to be printed is
written as a single line of your program, each element must be separated from the next by either
a semi-colon character or a comma. An element to be printed can be a string, a variable or a
constant, and is placed inside a pair of quotation marks.</p>
<p>A semi-colon is used to print elements immediately after one another, like this:</p>
<code class="prefix edit">Print "Follow";"on"</code>
<p>A comma moves the cursor to the next "Tab" position on the screen, as follows:</p>
<code class="prefix edit">Print "Next","Tab"</code>
<p>A Tab is an automatic marker that sets up a location for printing, and is often used to lay out
columns of figures, or to make indentations in text, and setting Tab positions is explained later.</p>
<p>Normally, the cursor is advanced downwards by one line after every PRINT command, but by
using the semi-colon or comma, the rule can be changed. Here is an example:</p>
<code class="prefix edit">Print "AMOS"
Print "Professional"
Print "AM";
Print "OS",
Print "Professional"
</code>
</section>
<section id="02-setting-text-options">
<h2>Setting text options</h2>
<h3 class="command" id="i-pen">PEN</h3>
<p><i>instruction: set the colour of text</i><br>
<b>Pen</b> index number</p>
<p>This command sets the colour of the text displayed in the current window, when followed by
the colour index number of your choice. The default setting of the pen colour is index number 2,
which is white, and alternative colours may be selected from one of up to 64 choices, depending
on the current graphics mode. For example:</p>
<code class="prefix edit">For INDEX=0 To 15
Pen INDEX
Print "Pen number ";INDEX
Next INDEX
</code>
<h3 class="command" id="fn-pen-dollar">PEN$</h3>
<p><i>function: return a control index number to set the pen colour</i><br>
p$=Pen$(index number)</p>
<p>This function returns a special control sequence that changes the pen colour inside a string.
This means that whenever the string is printed on the screen, the pre-set pen colour is
automatically assigned to it. The format of the string returned by PEN$ is:
Chr$(27)+"Pen"+Chr$(48+number). Here is an example:</p>
<code class="prefix edit">P$=Pen$(2)+"Well all WHITE, "+Pen$(6)+" I still got the BLUES"
Print P$
Pen 4
Print "In the RED"
</code>
<h3 class="command" id="i-paper">PAPER</h3>
<p><i>instruction: set colour of text background</i><br>
<b>Paper</b> index number</p>
<p>To select a background colour on which your text is to be printed, the PAPER command is
followed by a colour index number between 0 and 63, depending on the graphics mode in use,
in exactly the same way as PEN. The normal default colour index number is 1, giving an orange
background colour, with other possibilities listed under the SCREEN OPEN command in this
User Guide. Run the following simple example:</p>
<code class="prefix edit">Pen 2: For INDEX=0 To 15
Paper INDEX: Print "Paper number ";INDEX;Space$(23)
Next INDEX
</code>
<h3 class="command" id="fn-paper-dollar">PAPER$</h3>
<p><i>function: return a control index number to set background colour</i><br>
b$=<b>PAPER$</b>(index number)</p>
<p>Similarly to the PEN$ function, PAPER$ returns a character string that automatically sets the
background colour when the string is printed on the screen. For example:</p>
<code class="prefix edit">Pen 1
B$=Paper$(3)+"Flash Harry"+Paper$(1)+"The Invisible Man"
Print B$
</code>
</section>
<section id="03-changing-text-options">
<h2>Changing text options</h2>
<h3 class="command" id="i-inverse-on-off">INVERSE ON/OFF</h3>
<p><i>instructions: toggle inverse mode of subsequent text</i><br>
<b>Inverse On</b><br>
<b>Inverse Off</b></p>
<p>The INVERSE instruction swaps over the text and background colours already selected by the
PEN and PAPER commands, and so sets up an inverse mode for printing. For example:</p>
<code class="prefix edit">Pen 2 : Paper 4: Print "I appear normal"
Inverse On : Print "Poetry inverse"
Inverse Off : Print "Don't be so negative"
</code>
<h3 class="command" id="i-shade-on-off">SHADE ON/OFF</h3>
<p><i>instructions: toggle shading of subsequent text</i><br>
<b>Shade On</b><br>
<b>Shade Off</b></p>
<p>The appearance of your text can be changed more subtly by introducing a mask pattern that
reduces the brightness of the characters when printed. To make use of this shading facility,
simply turn it on and off like this:</p>
<code class="prefix edit">Shade On :Print "Shady Lady"
Shade Off:Print "Norman Normal"
</code>
</section>
<section id="04-setting-text-styles">
<h2>Setting text styles</h2>
<p>As well as customising the appearance of your text by changing the text options, you can also
use the standard type-face techniques available to printers and word processors.</p>
<h3 class="command" id="i-under-on-off">UNDER ON/OFF</h3>
<p><i>instructions: toggle underline mode of subsequent text</i><br>
<b>Under On</b><br>
<b>Under Off</b></p>
<p>To underline text when printed on screen like this, use the UNDER instructions, as follows:</p>
<code class="prefix edit">Under On : Print "This is where we draw the line"
Under Off: "That is groundless"
</code>
<p>In <a href="11-01-fonts.html">Section 11.1</a> there is a full explanation of how to take advantage of any number of different
type faces or fonts, by making use of what is known as "graphic text". For the time being, try the
next example:</p>
<code class="prefix edit">Cls: For S=0 To 7: Set Text S
Text 100,S*20+20,AMOS Professional" : Next S
</code>
<h3 class="command" id="i-set-text">SET TEXT</h3>
<p><i>instruction: set the style of a text font</i><br>
<b>Set Text</b> style number</p>
<p>The SET TEXT command allows you to change the style of a font by selecting one of eight
different styles that are produced by mixing the following three elements</p>
<pre>
Bit 0 <u>Underline</u>
Bit 1 <b>Bold</b>
Bit 2 <i>Italic</i>
</pre>
<p>Set the appropriate bits in the form of a style number from 0 to 7, as in the last example.</p>
<h3 class="command" id="fn-text-styles">TEXT STYLES</h3>
<p><i>function: return current text style</i><br>
s=<b>Text Styles</b></p>
<p>This function returns the index reference of the text style you last selected using SET TEXT. The
result is a bit-map in the same format as explained above:</p>
<pre>
Set Text 2: Print "Style Two"
Print Text Styles
</pre>
</section>
<section id="05-changing-the-text-mode">
<h2>Changing the text mode</h2>
<p>For even more flexibility in presenting your text on screen, you can select the way it is combined
with other screen data.</p>
<h3 class="command" id="i-writing">WRITING</h3>
<p><i>instruction: select text writing mode of subsequent text</i><br>
<b>Writing</b> value1<br>
<b>Writing</b> value1,optional value2</p>
<p>The WRITING command is used to control how the subsequent text interacts with what is
already on the screen, and it can be followed by either one or two values.</p>
<p>The first value selects one of five writing modes:</p>
<pre>
<b>Value Mode Effect</b>
0 REPLACE New text replaces any existing screen data
1 OR Merge new text with screen data, using logical OR
2 XOR Combine new text with screen data, using OR
3 AND Combine new text and screen data, using logical AND
4 IGNORE Ignore all subsequent printing instructions
</pre>
<p>A number set as the optional second value selects which parts of the text are to be printed on the
screen, as follows:</p>
<pre>
<b>Value Mode Effect</b>
0 Normal Print text and background together
1 Paper Only the background to be drawn on screen
2 Pen Ignore paper colour and print text on background colour zero
</pre>
<p>The default value for both of the WRITING parameters is zero, giving normal printed output.</p>
</section>
<section id="06-positioning-the-text-cursor">
<h2>Positioning the text cursor</h2>
<p>Characters are always printed at the current position of the text cursor, and the AMOS
Professional programmer is offered several methods of controlling the cursor in order to make
text look more orderly, attractive or eye-catching.</p>
<h3 class="command" id="i-locate">LOCATE</h3>
<p><i>instruction: position the text cursor</i><br>
<b>Locate</b> x,<br>
<b>Locate</b> ,y<br>
<b>Locate</b> x,y</p>
<p>This command moves the text cursor to the coordinates of your choice, and this new location
sets the start position for all subsequent text printing until you command otherwise. All screen
positions are measured in "text coordinates", which are measured in units of one printed
character on screen, with the x-coordinate controlling the horizontal position and the y-
coordinate referring to the vertical. So, the top left-hand corner of the screen has coordinates of
0,0 whereas text coordinates of 15,10 refer to a position 15 characters from the left-hand edge of
the screen and 10 characters from the top.</p>
<p>The range of these coordinates will depend on the size of your character set and the dimensions
of the display area allocated, known as a "window". All coordinate measurements are taken
using text coordinates relative to the current window. If you try and print something outside of
these limits, an error will be generated. Windows are dealt with in the next Section, but the
current screen is automatically treated as a window, so there is no need to "open" one to test the
following examples:</p>
<code class="prefix edit">Print "0,0": Locate 10, : Print "Stay on current line"
Locate ,5 : Print "Six from the top."
Locate 10,10 : Print "Ten down and ten across"
</code>
<h3 class="command" id="i-home">HOME</h3>
<p><i>instruction: force text cursor home</i><br>
<b>Home</b></p>
<p>
Whenever you need to move the text cursor back to the top left-hand corner of the screen in a
hurry, simply tell it to go HOME and it will automatically be relocated to coordinates 0,0 like
this:</p>
<code class="prefix edit">Cls: Locate 10,10: Print "I am going"
Wait 100: Home : Print "Home!"
</code>
<h3 class="command" id="i-cmove">CMOVE</h3>
<p><i>instruction: move text cursor</i><br>
<b>Cmove</b> width<br>
<b>Cmove</b> height<br>
<b>Cmove</b> width,height</p>
<p>It is also possible to move the text cursor a pre-set distance away from its current position, which
can come in useful if you need to show speech bubbles or shunt your text to one side
temporarily. The CMOVE command is followed by a pair of variables that represent the width
and height of the required offset, and these values are added to the current cursor coordinates.
Like LOCATE, either of the coordinates can be omitted, as long as the comma is positioned
correctly. An additional technique is to use negative values as well as positive offsets. For
example:</p>
<code class="prefix edit">Cls : Print "Iceland"
Cmove 5,5: Print "Scotland";
Cmove ,-3 : Print "Norway"
Cmove 10,14: Print "France"
</code>
<h3 class="command" id="fn-cmove-dollar">CMOVE$</h3>
<p><i>function: return control string to move text cursor</i><br>
a$=<b>Cmove$</b>(x,y)</p>
<p>Characters can be printed relative to the current cursor position by setting up a string using the
CMOVE$ function. The following example prints a string at coordinates 10,10 from the current
text cursor:</p>
<code class="prefix edit">A$=Cmove$(10,10)
A$=A$+"AMOS Professional"
Print A$
</code>
<h3 class="command" id="fn-at">AT</h3>
<p><i>function: return a string to position the text cursor</i><br>
a$=<b>At</b>(x,y)</p>
<p>You may also change the position of the text cursor directly from inside a character string. This
is ideal for positioning text once and for all on screen, no matter what happens in the program,
because the text cursor can be set during the program's initialisation phase. The string that is
returned takes the following format:</p>
<code class="prefix edit">A$="A"+At(10,10)+"Of"+At(2,4)+"String"+At(20,20)+"Pearls"
Print A$
</code>
<p>Imagine a Hi-Score table positioned like this:</p>
<code class="prefix edit">SCORE=999
Locate 12,10: Print "Hi Score ";SCORE
</code>
<p>By using the AT function, the same table can be moved by editing a single string, no matter how
many times it is used in the program, like this:</p>
<code class="prefix edit">SCORE=999
Locate 12,10: Print "Hi Score ";SCORE
</code>
<h3 class="command" id="i-centre">CENTRE</h3>
<p><i>instruction: print text centrally on current line</i><br>
<b>Centre</b> a$</p>
<p>Programmers often need to position text in the centre of the screen, and to save you the effort of
calculating the text coordinates in order to achieve this, the CENTRE command takes a string of
characters and prints it in the middle of the line currently occupied by the cursor.
For example:</p>
<code class="prefix edit">Locate 0,1
Centre "ABOVE"
Cmove ,3
Centre "suspicion"
</code>
<h3 class="command" id="fn-tab-dollar">TAB$</h3>
<p><i>function: move text cursor to next Tab</i><br>
t$=<b>Tab$</b></p>
<p>The TAB$ function returns a special control character called TAB, which carries the Ascii code of
9. When this character is printed, the text cursor is automatically moved to the next tabulated
column setting (Tab) to the right.</p>
<p>The default setting for this is four characters, which can be changed as follows:</p>
<h3 class="command" id="i-set-tab">SET TAB</h3>
<p><i>instruction: change Tab setting</i><br>
<b>Set Tab</b> number</p>
<p>This simple command specifies the number of characters that the text cursor will move to the
right when the next TAB$ is printed. For example:</p>
<code class="prefix edit">Cls : Print "Home"
Print Tab$;"And"
Set Tab 10 : Print Tab$;"Away"
</code>
<h3 class="command" id="i-cdown">CDOWN</h3>
<p><i>instruction: move text cursor down</i><br>
<b>Cdown</b></p>
<p>Use this command to force the text cursor down a single line, like this:</p>
<code class="prefix edit">Cls: Print "Over" : Cdown : Print "the Moon"</code>
<h3 class="command" id="fn-cdown-dollar">CDOWN$</h3>
<p><i>function: return control character to move text cursor down</i><br>
c$=<b>Cdown$</b></p>
<p>The effect of summoning up the special control character (Ascii 31) is exactly the same as
printing after a CDOWN command. The advantage of this alternative is that several text cursor
movements can be combined in a single string, using CDOWN$.
For example:</p>
<code class="prefix edit">C$="Going Down"+Cdown$
For A=0 To 20
Print C$
Next A
</code>
<h3 class="command" id="i-cup">CUP</h3>
<p><i>instruction: move text cursor one line up</i><br>
<b>Cup</b></p>
<h3 class="command" id="i-cleft">CLEFT</h3>
<p><i>instruction: move text cursor one character left</i><br>
<b>Cleft</b></p>
<h3 class="command" id="i-cright">CRIGHT</h3>
<p><i>instruction: move text cursor one character right</i><br>
<b>Cright</b></p><br>
<p>These three commands are self-explanatory, and work in exactly the same way as CDOWN.
their equivalent functions are listed below, and work in the same way as CDOWN$:</p>
<h3 class="command" id="fn-cup-dollar">CUP$</h3>
<p><i>function: return control character (30) to move cursor up one line</i><br>
x$=<b>Cup$</b></p>
<h3 class="command" id="fn-cleft-dollar">CLEFT$</h3>
<p><i>function: return control character (29) to move cursor left one character</i><br>
x$=<b>Cleft$</b></p>
<h3 class="command" id="fn-cright-dollar">CRIGHT$</h3>
<p><i>function: return control character (28) to move cursor right one character</i><br>
x$=<b>Cright$</b></p>
<h3 class="command" id="i-cline">CLINE</h3>
<p><i>instruction: clear some or all text on current cursor line</i><br>
<b>Cline</b><br>
<b>Cline</b> number</p>
<p>This command is used to clear the line currently occupied by the text cursor. If CLINE is
qualified by a number, then that number of characters get cleared, starting from the current
cursor position and leaving the cursor exactly where it is. For example:</p>
<code class="prefix edit">Print "Testing Testing Testing";
Cmove -7,
Cline 7
Wait Key
Cline
</code>
</section>
<section id="07-tracking-the-text-cursor">
<h2>Tracking the text cursor</h2>
<p>To track down the exact position of the text cursor, the following pair of functions may be used</p>
<h3 class="command" id="fn-x-curs">X CURS</h3>
<p><i>function: return the x-coordinate of the text cursor</i><br>
x=<b>X curs</b></p>
<h3 class="command" id="fn-y-curs">X CURS</h3>
<p><i>function: return the y-coordinate of the text cursor</i><br>
y=<b>Y curs</b></p>
<p>In this way, a variable is created that holds the relevant coordinate of the cursor, in text format,
and these two functions may be used independently or together. For example:</p>
<code class="prefix edit">Locate 5,10: Print X curs; : Print Y curs</code>
<h3 class="command" id="i-memorize-x-y">MEMORIZE X/Y</h3>
<p><i>instructions: save the x or y text cursor coordinates</i><br>
<b>Memorize X</b><br>
<b>Memorize Y</b></p>
<p>The MEMORIZE commands store the current position of the x or y text cursor, so that you can
print any text on the screen without destroying the original cursor coordinates. These may be
reloaded using the REMEMBER commands, as follows:</p>
<h3 class="command" id="i-remember-x-y">REMEMBER X/Y</h3>
<p><i>instructions: restore the x or y text cursor coordinates</i><br>
<b>Remember X</b><br>
<b>Remember Y</b></p>
<p>Use REMEMBER to position the text cursor at the coordinates saved by a previous MEMORIZE
command. If MEMORIZE has not been used, the relevant coordinate will automatically be set to
zero. There is a ready-made example demonstrating these commands to be found under the SET
CURS command, which is below.</p>
</section>
<section id="08-changing-the-text-cursor">
<h2>Changing the text cursor</h2>
<h3 class="command" id="i-curs-pen">CURS PEN</h3>
<p><i>instruction: select colour of text cursor</i><br>
<b>Curs Pen</b> index number</p>
<p>As a default, whenever your screen mode provides four or more colours the text cursor is set to
index number 3, which is endowed with a built-in flash. The flashing can be turned off and back
on again at any time using the FLASH OFF and FLASH commands, but as soon as you select
another colour for your text cursor, the automatic flash will not apply. To change colours, use
the CURS PEN command, followed by the index number of your choice. For example:</p>
<code class="prefix ex">Curs Pen 2</code>
<p>Note that the new colour only effects the text cursor in the current open window, and has no
influence over other cursors used by any other windows. If you want to introduce a flash to that
last example, you could add this line before the CURS PEN command:</p>
<code class="prefix ex">Flash 2,"(FFF,15)(000,15)"</code>
<h3 class="command" id="i-set-curs">SET CURS</h3>
<p><i>instruction: set the shape of the text cursor</i><br>
<b>Set Curs</b> L1,L2,L3,L4,L5,L6,L7,L8</p>
<p>To customise the text cursor into something a little more personalised, you can change its shape
into anything you like, providing you limit yourself to the eight lines of eight bits each that
represent its appearance. Lines are numbered one to eight from top to bottom, and every bit set
to 1 results in a pixel drawn in the current cursor pen colour, whereas a zero displays the current
paper colour. To familiarise yourself with the technique, try the next example, which changes
the text cursor into a Halloween mask:</p>
<code class="prefix edit">L1=%00111100
L2=%01111110
L3=%01011010
L4=%11100111
L5=%10111101
L6=%01011010
L7=%00100100
L8=%00011000
Set Curs L1 L2 , L3 L4 L5, L6 , L7, L8
</code>
<p>Your routine will appear slightly different from that, because the system automatically strips
away any leading zeros in binary listings.</p>
<h3 class="command" id="i-curs-on-off">CURS ON/OFF</h3>
<p><i>instructions: toggle text cursor</i><br>
<b>Curs On</b><br>
<b>Curs Off</b></p>
<p>This pair of commands is use to hide and reveal the text cursor in the current window. It has no
effect at all on any cursors used in other windows.</p>
</section>
<section id="09-advanced-text-commands">
<h2>Advanced text commands</h2>
<h3 class="command" id="fn-zone-dollar">ZONE$</h3>
<p><i>function: create a zone around text</i><br>
z$=<b>ZONE$</b>(text$,zone number)</p>
<p>
The AMOS Professional programmer is allowed to create powerful dialogue boxes and on-
screen control panels without the need to employ complex programming. The ZONES function
surrounds a section of text with its own screen zone, so that the presence of the mouse pointer
can be detected using the ZONE function. Simply supply the two parameters in brackets, which
are the string of text for one of your control "buttons", followed by the number of the screen
zone to be defined.</p>
<p>The maximum number of zones will be limited by the value specified in a previous RESERVE
ZONE command. The format for the control string is as follows:</p>
<pre>
Chr$(27)+"ZO"+A$+Chr$(27)+"R"+Chr$(48+n)
</pre>
<h3 class="command" id="fn-border-dollar">BORDER$</h3>
<p><i>function: create a border around text</i><br>
b$=<b>Border$</b>(text$, border number)</p>
<p>This works in much the same way as ZONES, by returning a string of characters that create a
border around the required string of text. The AMOS Professional programmer can use it with
ZONES to set up special "buttons" for alert windows and control consoles.</p>
<p>In this case, the text held in the string will start at the current text cursor position. Border
numbers can range from 1 to 16, for example:</p>
<code class="prefix edit">Locate 1,1: Print Border$("AMOS Professional",2)</code>
<p>The control sequence returned by BORDER has the following format:</p>
<pre>
Chr$(27)+"E0"+A$+Chr$(27)+"R"+Chr$(48+n)
</pre>
<h3 class="command" id="i-hscroll">HSCROLL</h3>
<p><i>instruction: scroll text horizontally</i><br>
<b>Hscroll</b> number</p>
<p>This command scrolls all text in the current open window horizontally, by a single character
position. The following numbers can be used:</p>
<pre>
<b>Number Effect</b>
1 Scroll current line to the left
2 Scroll entire screen to the left
3 Scroll current line to the right
4 Scroll entire screen to the right
</pre>
<h3 class="command" id="i-vscroll">VSCROLL</h3>
<p><i>instruction: scroll text vertical</i><br>
<b>Vscroll</b> number</p>
<p>Similarly to HSCROLL, the values given to this command result in different vertical scrolling
effects, one character at a time.</p>
<pre>
<b>Number Effect</b>
1 Scroll down text on and below current cursor Line
2 Scroll down text from top of screen to current cursor line only
3 Scroll up text from top of screen to current cursor line only
4 Scroll up text on or below current cursor line
</pre>
<p>Note that blank lines are inserted to fill any gaps left by these scrolling operations.</p>
</section>
<section id="10-advanced-printing">
<h2>Advanced printing</h2>
<p>The AMOS Professional programmer is not restricted to the standard PRINT command for
displaying information.</p>
<p>
<b>?</b><br>
<i>instruction: print</i><br>
<b>Print</b></p>
<p>The question mark character (?) can be used instead of PRINT as a keyboard short-cut.</p>
<!-- section -->
<p>When used in this way, it is automatically displayed as PRINT as soon as the line has been
entered into your listing.</p>
<code class="prefix edit">? "AMOS Professional"</code>
<h3 class="command" id="i-using">USING</h3>
<p><i>instruction: format printed output</i><br>
<b>Print Using</b> format$;variable list</p>
<p>USING is always employed with the PRINT command to allow subtle changes in the way
output is printed from a list of variables. The format string contains special characters, and each
one has a different effect, as explained below.</p>
<p>
<b>~</b><br>
<i>tilde character <kbd>Shift</kbd> + <kbd>#</kbd></i></p>
<p>Every ~ in the string variable is replaced by a single character from left to right, taken from an
output string. For example:</p>
<code class="prefix edit">Print Using "This is a ~~~~~~ example";"simple"</code>
<p>
<b>#</b><br>
<i>hash character</i></p>
<p>Each # specifies one digit at a time, to be printed out from a given variable, with any unused
digits being replaced by spaces. For example:</p>
<code class="prefix edit">Print Using "###";123456</code>
<p>
<b>+</b><br>
<i>plus character</i></p>
<p>This adds a plus sign to a positive number or a minus sign if the number is negative. For
example:</p>
<code class="prefix edit">Print Using "+##";10 : Print Using "+##";-10</code>
<p>
<b>-</b><br>
<i>minus character</i></p>
<p>This gives a minus sign to negative numbers only. Positive numbers will be preceded by a space.
For example:</p>
<code class="prefix edit">Print Using "-##";10:Print Using "-##";-10</code>
<p>
<b>.</b><br>
<i>full stop character</i></p>
<p>When used with PRINT USING, the full stop (period) character places a decimal point in a
number, and automatically centres it on screen. For example:</p>
<code class="prefix edit">Print Using ".###";Pi#</code>
<p>
<b>;</b><br>
<i>semi-colon character</i></p>
<p>This centres a number, but will not output a decimal point. For example:</p>
<code class="prefix edit">Print Using "Pl is #;###";Pi#</code>
<p>
<b>^</b><br>
<i>exponential (circumflex) character <kbd>Shift</kbd>+<kbd>6</kbd></i></p>
<p>This causes a number to be printed out in exponential format. For example:</p>
<code class="prefix edit">Print Using "This is an exponential number^";10000*10000.5</code>
</section>
<section id="11-sending-text-to-a-printer">
<h2>Sending text to a printer</h2>
<p><a href="10-03-accessing-a-printer.html">Chapter 10.3</a> is devoted to the exploitation of the printer device by AMOS Professional. The
following command offers easy access to a printer from inside an AMOS Professional program
or via Direct mode.</p>
<h3 class="command" id="i-lprint">LPRINT</h3>
<p><i>instruction: output a list of variables to a printer</i><br>
<b>Lprint</b> variable list</p>
<p>The LPRINT command is exactly the same as a PRINT command, but it sends data to a printer
instead of the screen, like this:</p>
<code class="prefix ex">Lprint "Greetings from AMOS Professional!"</code>
</section>
<footer>
<a href="05-05-procedures.html" rel="prev">Procedures</a>
<a href="./">Contents</a>
<a href="14-appendix-g-command-index.html">Index</a>
<a href="05-07-windows.html" rel="next">Windows</a>
</footer>
</body>
</html>