You can use this function to select any part of a string. For instance, ifC$=MID$(A$,start_posn,num) C$=MID$(A$,Z)
thenname$="BBCBASIC(86)"
would assign BASIC to 'part$'. If the last number is omitted or there are insufficient characters to the right of the specified position, MID$ returns with the right hand part of the string starting at the specified position. Thus,part$=MID$(name$,4,5)
would assign (86) to 'part$'.part$=MID$(name$,9)
For example,
would print10 name$="BBCBASIC(86)" 20 FOR i=1 TO LEN(name$) 30 PRINT MID$(name$,i,10) 40 NEXT
BBCBASIC(8 BCBASIC(86 CBASIC(86) BASIC(86) ASIC(86) SIC(86) IC(86) C(86) (86) 86) 6) )
<s-var>=MID$(<str>,<numeric>[,<numeric>])
LEFT$, RIGHT$, LEN, INSTR
MOD is defined such that,X=A MOD B
If you are doing integer division (DIV) of whole numbers it is often desirable to know the remainder. (A 'teach children to divide' program for instance.) For example, 23 divided by 3 is 7, remainder 2. Thus,A MOD B = A - ( A DIV B ) * B.
would print10 PRINT 23 DIV 3 20 PRINT 23 MOD 3
You can use real numbers in these calculations, but they are truncated to their integer part before BBCBASIC(86) calculates the result. Thus,7 2
would give exactly the same results as the previous example.10 PRINT 23.1 DIV 3.9 20 PRINT 23.1 MOD 3.9
<n-var>=<numeric> MOD <numeric>
DIV
MODE |
MO. |
The following example sets the display mode to mode 3 (80x25 text only).
BBCBASIC(86) does not have a default display mode; it starts in whatever mode MS-DOS was using at the time BBCBASIC(86) was run.MODE 3
This table indicates the number of logical colours available in each display mode. As described in the Graphics and Colours section, the number of physical colours available depends upon the display adapter fitted.
Mode Graphics (pixels) Logical Colours Text (chars) 0 640x200 2 colour display 80x25 1 320x200 4 colour display 40x25 2 Same as mode 1 3 None 16 colour text only 80x25 4 320x200 4 colour display 40x25 5 Same as mode 4 6 None 16 colour text only 40x25 7 None Monochrome text only 80x25 Viewdata emulation 40x25 8 640x200 16 colour 80x25 9 320x200 16 colour 40x25 10 Same as mode 9 11 Same as mode 3 12 Same as mode 9 13 Same as mode 9 14 Same as mode 6 15 640x350 monochrome display 80x25 16 640x350 16 colour 80x25 or 80x43 17 Reserved for expansion. 18 640x480 16 colour 80x30 or 80x60
Modes 1, 2, 4 and 5 are identical except that, when using the NTSC composite video output, modes 4 and 5 cause the colour subcarrier to be suppressed.
Several display adapters with widely differing capabilities are available for the PC. Because of this difference in capabilities, the display modes available to BBCBASIC(86) depend upon the display adapter fitted to your computer.
Modes 8 to 15 have been mapped as closely as possible (as regards graphics resolution and number of text columns) onto CGA modes 0 to 7. This has been done to simplify conversion of software to use the EGA modes. You simply need to add 8 to the original CGA mode number.
You can automatically map the CGA modes 0 to 7 to the EGA modes 8 to 15 with the *EGA command. Normal operation may be restored by issuing the command *EGA OFF.
Graphics operations in the EGA modes are significantly slower than in the CGA modes. Since all EGA cards also support the CGA modes, you should use the CGA modes 0 to 7 unless you actually need EGA features (16 colours, for example).
Attempting to select a screen mode of which the hardware of the computer is not capable should give the 'Bad mode' error, although the screen may first be cleared. However, some computers may 'crash' if no EGA or VGA card is fitted and an attempt is made to select modes 8 to 18 (or modes 0 to 7 after *EGA). This is due to shortcomings of the BIOS fitted to some PC compatibles.
MODE <numeric>
CLS, CLG
The MOVE statement is identical to PLOT 4.MOVE X,Y MOVE 124,327
MOVE <numeric>,<numeric>
DRAW, MODE, GCOL, PLOT
This command effectively 'removes' a program from the computer's memory. In reality, the program is still there, but BBCBASIC(86) has been told to forget about it.NEW
If you have made a mistake, you can recover your old program by typing OLD. However, this won't work if you have begun to enter a new program.
NEW
OLD
NEXT |
N. |
If the control variable is present then FOR....NEXT loops may be 'popped' automatically in an attempt to match the correct FOR statement (this should not be necessary). If a matching FOR statement cannot be found, a 'Can't match FOR' error will be reported.NEXT NEXT J
Leaving out the control variable will make the program run quicker, but this is not to be encouraged.
See the keyword FOR for more details about the structure of FOR....NEXT loops.
NEXT [<n-var>{,<n-var>}]
FOR, TO, STEP
NOT is most commonly used in an IF....THEN....ELSE statement to reverse the effect of the test.A=NOT 3 flag=NOT flag flag=NOT(A=B)
BBCBASIC(86) does not have true boolean variables; it makes do with numeric variables. This can lead to confusion because the testable condition in an IF....THEN....ELSE statement is evaluated mathematically and can result in something other than -1 (TRUE) or 0 (FALSE).IF NOT(rate>5 AND TIME<100) THEN ..... IF NOT flag THEN .....
When the test in an IF....THEN....ELSE is evaluated, FALSE=0 and anything else is considered to be TRUE. If you wish to use NOT to reverse the action of an IF statement it is important to ensure that the testable condition does actually evaluate to -1 for TRUE.
If the testable condition evaluates to 1, for example, the result of the test would be considered to be TRUE and the THEN part of the IF....THEN....ELSE statement would be carried out. However, using NOT in front of the testable condition would not reverse the action. NOT 1 evaluates to -2, which would also be considered to be TRUE.
<n-var>=NOT<numeric>
None
OLD works even if BBCBASIC(86) has been re-loaded and re-started from MS-DOS. However, it will only work if no other programs have been run and BBCBASIC(86) loads at the same address as before.OLD
OLD
NEW
The ON statement alters the path through your program by transferring control to one of a selection of line numbers depending on the value of a variable. For example,ON option GOTO 1000,2000,3000,4000 ON action GOSUB 100,3000,200,5000,30 ON choice PROC_add,PROC_find,PROC_delete
would send your program to line 1000 if 'number' was 1, to line 2000 if 'number' was 2, to line 500 if 'number' was 3 and to line 100 if 'number' was 4.200 ON number GOTO 1000,2000,500,100
Exceptions may be trapped using the ELSE statement delimiter.
If there is no statement after the ELSE, the program will 'drop through' to the following line if an exception occurs. In the two following examples, the program would drop through to the error handling part of the program if 'choice' or 'B-46' was less than one or more than 3.ON action GOTO 100,300,120 ELSE PRINT"Illegal"
You can use ON...GOTO, ON...GOSUB, and ON...PROC to execute the appropriate part of your program as the result of a menu selection. The following skeleton example offers a menu with three choices.ON choice PROC_add,PROC_find(a$),PROC_delete ELSE PRINT "Illegal Choice - Try again" ON B-46 GOSUB 100,200,(C/200) ELSE PRINT "ERROR"
20 CLS 30 PRINT "SELECT THE ACTION YOU WISH TO TAKE" 40 PRINT "1 OPEN A NEW DATA FILE" 50 PRINT "2 ADD DATA TO THE FILE" 60 PRINT "3 CLOSE THE FILE AND END"'' 70 REPEAT 80 INPUT TAB(10,20)"WHAT DO YOU WANT ? "choice 90 UNTIL choice>0 AND choice<4 100 ON choice PROC_open,PROC_add,PROC_close ELSE 110 .....etc
would be interpreted asON entry PROC_start,PROC_add(":"),PROC_end
and give rise to an interesting crop of error messages.ON entry PROC_start,PROC_add(" :"),PROC_end
ON <numeric> GOTO <l-num>{,<l-num>} [ELSE <stmt>{:<stmt>}] ON <numeric> GOSUB <l-num>{,<l-num>} [ELSE <stmt>{:<stmt>}] ON <numeric> PROC<name>[(<exp>{,<exp>})] {,PROC<name>[(<exp>{,<exp>})]} [ELSE <stmt>{:<stmt>}]
ON ERROR, ON ERROR LOCAL, GOTO, GOSUB, PROC
ON ERROR OFF returns the control of error handling to BBCBASIC(86).
For example, the ON ERROR statement can be used to trap out the escape key to prevent a program being terminated at the wrong time by its accidental use.ON ERROR PRINT"Suicide":END ON ERROR GOTO 100 ON ERROR OFF
Error handling is explained more fully in the General Information section.50 ON ERROR IF ERR=17 THEN 70 60 PRINT:REPORT:PRINT " at line ";ERL:END 70 : etc.
ON ERROR <stmt>{:<stmt>} ON ERROR OFF
ON, ON ERROR LOCAL, GOTO, GOSUB, PROC
Unlike the ON ERROR command, ON ERROR LOCAL prevents BBCBASIC(86) clearing the program stack. By using this command, you can trap errors within a FOR...NEXT or REPEAT...UNTIL loop or a subroutine, function or procedure without BBCBASIC(86) losing its place within the program structure.
ON ERROR OFF returns the control of error handling to BBCBASIC(86).
The following example program will continue after the inevitable 'Division by zero' error in line 30.ON ERROR LOCAL PRINT"Suicide":END ON ERROR LOCAL GOTO 100 ON ERROR OFF
Error handling is explained more fully in the General Information section.10 FOR n=-5 TO 5 20 ON ERROR LOCAL PRINT "Infinity":GOTO 40 30 PRINT "The reciprocal of ";n;" is ";1/n 40 NEXT N
ON ERROR LOCAL <stmt>{:<stmt>} ON ERROR OFF
ON, ON ERROR, GOTO, GOSUB, PROC
OPENIN |
OP. |
A returned value of zero signifies that the specified file was not found on the disk.
OPENIN may also be used to open a channel from an input device, such as "AUX" (the auxiliary device, usually a serial port), "COM1" (the first serial port) or "COM2" (the second serial port). The serial port must first be initialised to the required mode of operation using the MS-DOS MODE command.
The example below reads data from disk into an array. If the data file does not exist, an error message is printed and the program ends.X=OPENIN "jim" X=OPENIN A$ X=OPENIN (A$) X=OPENIN ("FILE1") X=OPENIN ("COM2")
10 DIM posn(10),name$(10) 20 fnum=OPENIN "TOPTEN" 30 IF fnum=0 THEN PRINT "No TOPTEN data": END 40 FOR i=1 TO 10 50 INPUT#fnum,posn(i),name$(i) 60 NEXT 70 CLOSE#fnum
<n-var>=OPENIN(<str>)
OPENOUT, OPENUP, CLOSE#, PTR#, PRINT#, INPUT#, BGET#, BPUT#, EOF#
A returned value of zero indicates that the specified file could not be created.
OPENOUT may also be used to open a channel to an output device, such as "PRN" (the system printer, usually a parallel port), "COM1" (the first serial port), "COM2" (the second serial port) or "LPT1" (the first parallel port). The parallel or serial port must first be initialised to the required mode of operation using the MS-DOS MODE command.
You can also read from a file which has been opened using OPENOUT. This is of little use until you have written some data to it. However, once you have done so, you can move around the file using PTR# and read back previously written data.X=OPENOUT(A$) X=OPENOUT("DATAFILE") X=OPENOUT("LPT1")
Data is not written to the file at the time it is opened. Consequently, it is possible to successfully open a file on a full disk. Under these circumstances, a 'Disk full' error would be reported when you tried to write data to the file for the first time.
The example below writes the contents of two arrays (tables) to a file called 'TOPTEN.BBC'.
10 A=OPENOUT "TOPTEN" 20 FOR Z=1 TO 10 30 PRINT#A,N(Z),N$(Z) 40 NEXT 50 CLOSE#A 60 END
<n-var>=OPENOUT(<str>)
OPENIN, OPENUP, CLOSE#, PTR#, PRINT#, INPUT#, BGET#, BPUT#, EOF#
A returned value of zero signifies that the specified file was not found on the disk.
See the random file examples (F-RAND?) in the BBCBASIC Disk Files section for examples of the use of OPENUP.X=OPENUP "jim" X=OPENUP A$ X=OPENUP (A$) X=OPENUP ("FILE1")
<n-var>=OPENUP(<str>)
OPENIN, OPENOUT, CLOSE#, PTR#, PRINT#, INPUT#, BGET#, BPUT#, EOF#
Value Action 0 assembler errors suppressed; no listing. 1 assembler errors suppressed; listing. 2 assembler errors reported; no listing. 3 assembler errors reported; listing (default).
The possible assembler errors are:
Value Action 4 assembler errors suppressed; no listing. 5 assembler errors suppressed; listing. 6 assembler errors reported; no listing. 7 assembler errors reported; listing.
Out of range - error code 40.
No such variable - error code 26.
Multiple label - error code 3.
Size needed - error code 2.
OPT <numeric>
None
You can leave out the space between OR and a preceding constant, but it makes your programs difficult to read.IF A=2 OR B=3 THEN 110 X=B OR 4
You can use OR as a logical operator or as a 'bit-by-bit' (bitwise) operator. The operands can be boolean (logical) or numeric.
Unfortunately, BBC BASIC does not have true boolean variables; it uses numeric variables and assigns the value 0 for FALSE and -1 for TRUE. This can lead to confusion at times. (See NOT for more details.)
In the example below, the operands are boolean (logical). In other words, the result of the tests (IF) A=2 and (IF) B=3 is either TRUE or FALSE. The result of this example will be TRUE if A=2 or B=3.
The brackets are not necessary, they have been included to make the example easier to follow.answer=(A=2 OR B=3)
The last example, uses the OR in a similar fashion to the numeric operators (+, -, etc).
Suppose X was -20 in the following example,
the OR operation would be:A=X OR 11
11111111 11111111 11111111 11101100 00000000 00000000 00000000 00001011 11111111 11111111 11111111 11101111 = -17
<n-var>=<numeric> OR <numeric>
AND, EOR, NOT
If the command is not one of the resident commands, it is passed to COMMAND.COM for execution. (This will only work of there is a copy of COMMAND.COM available to BBCBASIC(86) and there is sufficient RAM.) If the command is not one of the MS-DOS resident commands, the appropriate .EXE or .COM file will be loaded and executed.command$="DEL PHONE.DTA" OSCLI command$ command$="REN ADDRESS.DTA=NAME.DTA" OSCLI command$
Unlike the resident commands, commands passed to COMMAND.COM do NOT assume an extension of .BBC if the extension is omitted.
See the Operating System Interface section for more details.
OSCLI <str>
All operating system (*) commands.
PAGE |
PA. |
PAGE is automatically initialised by BBCBASIC(86) to the address of the lowest available page in RAM (&900), but you may change it.PAGE=&3100 PRINT ~PAGE PAGE=TOP+&100: REM Move to start of next page.
If you make PAGE less than its original value or greater than the original value of HIMEM, you will get a 'Bad program' error when you try to enter a program line and you may well crash BBCBASIC(86).
If you make PAGE greater than HIMEM, a 'No room' error will occur if the program exits to command level.
With care, several programs can be left around in RAM without the need for saving them.
USE WITH CARE.
PAGE=<numeric> <n-var>=PAGE
TOP, LOMEM, HIMEM
You can use PI to calculate the circumference and area of a circle. The example below calculates the circumference and area of a circle of a given radius.X=PI
PI can also be used to convert degrees to radians and radians to degrees.10 CLS 20 INPUT "What is the radius of the circle ",rad 30 PRINT "The circumference is: ";2*PI*rad 40 PRINT "The area is: ";PI*rad*rad 50 END
However, BBCBASIC(86) has two functions (RAD and DEG) which perform these conversions to a higher accuracy.radians=PI/180*degrees degrees=180/PI*radians
<n-var>=PI
RAD, DEG
PLOT |
PL. |
Lines are drawn from the current graphics cursor position (the last point 'visited') to the specified X,Y coordinates. The graphics origin is usually the bottom left-hand corner of the screen, but it can be changed using the VDU 29 statement.PLOT Mode,X,Y
The two most commonly used statements, PLOT 4 and PLOT 5, have the duplicate keywords MOVE and DRAW.
The available PLOT modes are listed on the following pages. Examples of the more complicated PLOT modes are given in the Graphics and Colours section.
Mode Action 0 Move relative to the last point. 1 Draw a line, in the current graphics foreground colour, relative to the last point. 2 Draw a line, in the logical inverse colour, relative to the last point. 3 Draw a line, in the background colour, relative to the last point. 4 Move to the absolute position X, Y. 5 Draw a line, in the current foreground colour, to the absolute coordinates specified by X and Y. 6 Draw a line, in the logical inverse colour, to the absolute coordinates specified by X and Y. 7 Draw a line, in the current background colour, to the absolute coordinates specified by X and Y.
Mode Action 8-15 As 0-7, except that the last point is plotted twice. 16-31 As 0-15, but the line is drawn dotted. 32-47 As 0-15, but the line is drawn dashed. 48-63 As 0-15, but the line is drawn broken. 64-71 As 0-7, but only a single point is plotted.
If the PLOT number is 73 or 77, the line is drawn in the current foreground colour. If the PLOT number is 72 or 76, the cursor movements are made, but no line is drawn.
If the PLOT number is 81 or 85, the triangle is drawn and filled in the current foreground colour.
If the PLOT number is 91 or 95, the line will be drawn in the current background colour. If the PLOT number is 88 or 92, the cursor movements are made, but no line is drawn.
If the PLOT number is 97 or 101, the rectangle will be drawn and filled in the current foreground colour.
If the PLOT number is 107 or 111, the line will be drawn in the current background colour. If the PLOT number is 104 or 108, the cursor movements are made, but no line is drawn.
The order in which the points are visited is important.point3-point2+point1
If the PLOT number is 113 or 117, the parallelogram will be drawn and filled in the current foreground colour.
If the PLOT number is 123 or 127, the line will be drawn in the current background colour. If the PLOT number is 120 or 124, the cursor movements are made, but no line is drawn.
will draw a circle centred on x1,y1 with the point x2,y2 in its circumference.MOVE x1,y1 PLOT 149,x2,y2
orMOVE x,y PLOT 145,R,0
will draw a circle of radius R centred about the point x,y.MOVE x,y PLOT 145,0,R
The shape is drawn 'circular' in terms of graphics units. As previously explained, the shape will be elliptical in modes 15 and 16. The adjustment of the monitor (height, width and linearity) will also affect the shape displayed.
If plot codes 156 to 159 are used, the point specified will be on the circumference of the disc. If plot codes 152 to 155 are used, the non-zero parameter is interpreted as the radius of the disc.
would draw a line in the current graphics foreground colour from 200, 300 to 200,450.PLOT 1,0,150
Logical Inverse 0 1 1 0
Logical Inverse 0 3 1 2 2 1 3 0
Logical Inverse 0 15 1 14 2 13 3 12 4 11 5 10 6 9 7 8 8 7 9 6 10 5 11 4 12 3 13 2 14 1 15 0
PLOT <numeric>,<numeric>,<numeric>
MODE, CLG, MOVE, DRAW, POINT, VDU, GCOL
There must not be a space between POINT and the opening bracket.
You can use POINT to find out the colour of the screen at the specified point and take action accordingly. In an adventure game, for example, the swamps may be marked in green. If the explorer ventured into a green area he must be in the swamp and 'swamp type demons' would be activated.colour=POINT(X,Y) IF POINT(X,Y)=3 THEN 300
<n-var>=POINT(<numeric>,<numeric>)
PLOT, DRAW, MOVE, GCOL
COUNT will tell you the print head position of the printer. It is an uncertain indicator of the horizontal position of the cursor on the screen. (See the keyword COUNT for details.)X=POS
See VPOS for an example of the use of POS and VPOS.
<n-var>=POS
COUNT, TAB, VPOS
P. |
You can cause the screen to be printed by pressing <Shift>/<Print Screen>. If you wish to print a graphics screen, you will need to have run the 'GRAPHICS' command from MS-DOS (see your MS DOS (PC DOS) reference manual for details). Not all versions of GRAPHICS support the EGA and VGA. Note that the foregoing does not apply to Microsoft WindowsTM; see your Windows documentation for the action of the Print Screen key.
In the examples which follow, commas have been printed instead of spaces to help you count.
The screen is divided into zones (initially) 10 characters wide. By default, numeric quantities are printed right justified in the print zone and strings are printed just as they are (with no leading spaces). Numeric quantities can be printed left justified by preceding them with a semi-colon. In the examples the zone width is indicated as z10, z4 etc.
Initially numeric items are printed in decimal. If a tilde (~) is encountered in the print list, the numeric items which follow it are printed in hexadecimal. If a comma or a semi-colon is encountered further down the print list, the format reverts to decimal.z10 012345678901234567890123456789 PRINT 23.162 ,,,,23.162 PRINT "HELLO" HELLO PRINT ;23.162 23.162
A comma (,) causes the cursor to TAB to the beginning of the next print zone unless the cursor is already at the start of a print zone. A semi-colon causes the next and following items to be printed on the same line immediately after the previous item. This 'no-gap' printing continues until a comma (or the end of the print list) is encountered. An apostrophe (') will force a new line. TAB(X) and TAB(Y,Z) can also be used at any position in the print line to position the cursor.z10 012345678901234567890123456789 PRINT ~10 58,58 ,,,,,,,,,A,,,,,,,,3A,,,,,,,,58
Unlike most other versions of BASIC, a comma at the end of the print list will not suppress the new line and advance the cursor to the next zone. If you wish to split a line over two or more PRINT statements, end the previous print list with a semicolon and start the following list with a comma or end the line with a comma followed by a semicolon.z10 012345678901234567890123456789 PRINT "HELLO",24.2 HELLO ,,,,,,24.2 PRINT "HELLO";24.2 HELLO24.2 PRINT ;2 5 4.3,2 254.3 ,,,,,,,,,2 PRINT "HELLO"'2.45 HELLO ,,,,,,2.45
orz10 012345678901234567890123456789 PRINT "HELLO" 12; HELLO,,,,,,,,12,,,,,,,,,,23.67 PRINT ,23.67
Printing a string followed by a numeric effectively moves the start of the print zones towards the right by the length of the string. This displacement continues until a comma is encountered.PRINT "HELLO" 12,; PRINT 23.67
z10 012345678901234567890123456789 PRINT "HELLO"12 34 HELLO,,,,,,,,12,,,,,,,,34 PRINT "HELLO"12,34 HELLO,,,,,,,,12 ,,,,,,,,34
@%=&SSNNPPWW
Byte Range Default Purpose SS 00-01 00 STR$ Format Control NN 00-02 00 Format Selection PP ??-?? 09 Number of Digits Printed WW 00-0F 0A(10) Zone and Print Field Width
00 General Format (G).
01 Exponential Format (E).
02 Fixed Format (F).
G Format | Numbers that are integers are printed as such. Numbers in the range 0.1 to 1 will be printed as such. Numbers less than 0.1 will be printed in E format. Numbers greater than the range set by Byte 1 will be printed in E format. In which case, the number of digits printed will still be controlled by Byte 1, but according to the E format rules. |
The earlier examples were all printed in G9 format. | |
E Format | Numbers are printed in the scientific (engineering) notation. |
F Format | Numbers are printed with a fixed number of decimal places. |
Format | Range | Control Function |
---|---|---|
G | 01-0A | The maximum number of digits which can be printed, excluding
the decimal point, before changing to the E format.
01234567890123456789 &030A - G3z10 (00'00'03'0A) PRINT 1000.31 ,,,,,,,1E3 PRINT 1016.31 ,,,,1.02E3 PRINT 10.56 ,,,,,,10.6 |
E | 01-FF | The total number of digits to be printed excluding the
decimal point and the digits after the E. Three characters or spaces
are always printed after the E. If the number of significant figures
called for is greater than 10, then trailing zeros will be printed.
01030A - E3z10 (00'01'03'0A) 01234567890123456789 PRINT 10.56 ,,1.06E1 &010F0A - E15z10 (00'01'0F'0A) 01234567890123456789 PRINT 10.56 1.05600000000000E1 |
F | 00-0A | The number of digits to be printed after the decimal
point.
&02020A - F2z10 (00'02'02'0A) 01234567890123456789 PRINT 10.56 ,,,,,10.56 PRINT 100.5864 ,,,,100.59 PRINT .64862 ,,,,,,0.65 |
followed by&020208 - F2z8 (00'00'02'08)
&020206 - F2z6 (00'02'02'06) 01234567890123456789 PRINT 10.2,3.8 ,,,10.20,,,,3.80 PRINT 10.2,3.8 ,10.20,,3.80
Functions have to return an answer, but the value returned by this function is a null string. Consequently, its only effect is to change the print control variable. Thus the PRINT statementDEF FN_pformat(N):@%=N:=""
will print x in G9z10 format and y in F2z10 format.PRINT FN_pformat(&90A) x FN_pformat(&2020A) y
The results obtained by running the following example program show the effect of changing the zone width. The results for zone widths of 5 and 10 (&0A) illustrate what happens when the zone width is too small for the number to be printed properly. The example also illustrates what happens when the number is too large for the chosen precision.G9z10 G2z10 &00090A &00020A 012345678901234 012345678901234 1111.11111 ,,,,,1.1E3 13.7174211 ,,,,,,,,14 ,1.5241579 ,,,,,,,1.5 1.88167642E-2 ,,,,1.9E-2 2.09975158E-3 ,,,,2.1E-3 F2z10 E2z10 &02020A &0102A 012345678901234 012345678901234 ,,,1111.11 ,,,1.1E3 ,,,,,13.72 ,,,1.4E1 ,,,,,,1.52 ,,,1.5E0 ,,,,,,0.02 ,,,1.9E-2 ,,,,,,0.00 ,,,2.1E-3
10 test=7.8123 20 FOR i=5 TO 25 STEP 5 30 PRINT 40 @%=&020200+i 50 PRINT "@%=&000";~@% 60 PRINT STRING$(3,"0123456789") 70 FOR j=1 TO 10 80 PRINT test^j 90 NEXT 100 PRINT ' 110 NEXT 120 @%=&90A &00020205 012345678901234567890123456789 7.81 61.03 476.80 3724.91 29100.11 227338.75 1776038.54 13874945.89 1.083952398E8 8.46816132E8 &0002020A 012345678901234567890123456789 7.81 61.03 476.80 3724.91 29100.11 227338.75 1776038.54 13874945.89 1.083952398E8 8.46816132E8 &0002020F 012345678901234567890123456789 7.81 61.03 476.80 3724.91 29100.11 227338.75 1776038.54 13874945.89 1.083952398E8 8.46816132E8 &00020214 012345678901234567890123456789 7.81 61.03 476.80 3724.91 29100.11 227338.75 1776038.54 13874945.89 1.083952398E8 8.46816132E8 &00020219 012345678901234567890123456789 7.81 61.03 476.80 3724.91 29100.11 227338.75 1776038.54 13874945.89 1.083952398E8 8.46816132E8
PRINT {[TAB(<numeric>[,<numeric>])][SPC(<numeric>] ['][,][;][~][<str>|<numeric>]}
PRINT#, TAB, POS, STR$, WIDTH, INPUT, VDU
CONTENTS |
CONTINUE |