LBSOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUNDINVALID KERNEL FILExةw,@  4  J  ȱ⩤i8#) ) 8Ler GRAFIXMO @;e /O %SEG.T jKŸ/ )PRINT.ALL KDISKNAME.DAT#l1k5WDESKTOP%q&q&III.BSB.04IC.02u' ARTICLE6!%ARTICLE7!%)BGRAF.INV('!L+*HELLO.TEXT*lO*MENU.MAKER - K;-READ.ME.FIRSTm#im#iЛ#Lȱ  6L憦  Lsmm l y` @8(Je稽 ʈGA3/1.01/LIN  `}wqnkjba_\[ZYXWVURQ$hhhhhh HH H)HHH`20+*)Hhhhhhh HHHH`&$< 詏 )x `a^]NMJGF>=<10/.+* )) y xHHHJJiH 詏 鮀hhhh  HH`420.,*)&#"! Rhhhhhh    HH`DB@><:983.+('&$h J)` `!0 nljhfdcbQNMLJFEDCBA<;6hhhhhh  HH`420.,*)&#"! Rhhhhhh    HH`DB@><:983.+('&$hhh-&#  P  `"hhhhhh  HH`420.,*)&#"! Rhhhhhh  B B HH`yyP`GB HH`)r` @A>~|zxvtslgbWTSRPMED=hhhh   HH`420.-&#  Phhhh   HH`420.h   HH`420.-&#  Phhhhhhhhhh  HH`DB@><:86421.+*)'jhhhhhhhh    X XLJFE>987410/-   `+(%" Bhhh h h h hh hhhhhh  HH`ZXVTRPNLJHFDB@<;85431hhh    `OLIHEDCB?<;8541.+*x  `"hhhhhhhh    HH`XVTRPN.GRAFIX jj# \\JHFD=;9210-,+*)!   v Q )``.`5`=`C`E` `BGRAF (C) APPLE 1980j @@@@ @``` kLK``9(89:9g:h:h L89:mm95:6:6hg gh h 99 O S   L `ee m`iɂ`0`hIhJh\h] wh]h^ w\\ ]] ]L ]L\A \A JHIH`i8\i]i\`\]`K`M %b&*L+ 16>:)    kLhhhhhh HHHH`&$<D^Z FpHx  )) y xHHHJJiH 詏 鮀RETADDR ISOSDSTATGSCB kSOSOPEN INITCHK READPARM5CREFNUM DWBUFADR ?BMOVCHK RBUFADR 7WRITEPAR=SREFNUM FRREFNUM 6WREFNUM >INITFLG KSOSCLOSE RETADDR % ! INITCHK  ITCHK LINETO LINETO WBUFLEN  UFLEN SOSWRITE SWRITERWBUF     CALCABS x q ABS RETADDR CALCABS  ABS RETADDR  SOSDSTAT SDSTATGSCB INITCHK  ITCHK DOTREL DOTREL WBUFLEN  UFLEN SOSWRITE SWRITERWBUF SWRITERWBUF  RETADDR c _ < 8 INITCHK O ITCHK WBUFLEN Y UFLEN SOSWRITE\ SWRITERWBUF T L H D @ DOTAT DOTAT RWBUF ZRNJFCALCABS BRETADDR SOSDSTATSDSTATGSCB  MOVEREL MOVEREL INITCHK ITCHK WBUFLEN UFLEN SOSWRITEWBUFLEN !UFLEN SOSWRITE$SWRITERWBUF BUF RETADDR ieB>INITCHK UITCHK MOVETO MOVETO  WBUFLEN _UFLEN SOSWRITEbSWRITERETADDR INITCHK ITCHK RANGECHKNGECHKWBUFLEN UFLEN SOSWRITESWRITERWBUF  INITCHK ITCHK FILLPORT FILLPORT RETADDR tpINITCHK ITCHK PENCOLOR PENCOLOR RANGECHKNGECHKWBUFLEN UFLEN SOSWRITESWRITERWBUF |x FILLCOLO FILLCOLO TRETADDR  SETCTAB SETCTAB  INITCHK ITCHK RANGECHKHKWBUFLEN UFLEN SOSWRITESWRITERWBUF  'SOSWRITESWRITERWBUF  RETADDR PLINITCHK sITCHK VIEWPORT VIEWPORTWBUFLEN }UFLEN SOSWRITESWRITERWBUF  xplhd`\XUFLEN SOSWRITESWRITERWBUF ~zvrRETADDR $ INITCHK ITCHK XFROPTIO XFROPTIORANGECHKNGECHKWBUFLEN UFLEN #ITCHK WBUFLEN DUFLEN SOSWRITEGSWRITERWBUF ?:72-(SYSFONT SYSFONT RETADDR njDRAWIMAG DRAWIMAGINITCHK ITCHK WBUFLEN RETADDR INITCHK ITCHK RANGECHKECHKWBUFLEN UFLEN SOSWRITESWRITERWBUF  NEWFONT NEWFONT INITCHK =+SOSWRITE@.!RWBUF  83& INITCHK uITCHK GRAFIXON GRAFIXONWBUFLEN UFLEN SOSWRITESWRITERWBUF zBUF GPGSREQDLGRAFIXMO GRAFIXMORBUFLEN 9RANGECHKwWBUFLEN ASOSWRITERWBUF \SOSREAD GBASADR TSOSSMARK$INITCHK ITCHK INITGRAF INITGRAFWBUFLEN  T P SOSDSTATj SDSTATGSCB LINEREL LINEREL INITCHK g ITCHK WBUFLEN  UFLEN SOSWRITE SWRITERWBUF } d ` \ X RELEASE RELEASE INITCHK  ITCHK BMOVCHK  OVCHK INITFLG  ITFLG RWBUF  F SOSDSTAT" SDSTATGSCB % CB INITCHK  ITCHK CREFNUM  EFNUM rticle1" and "Article2." Within those subdirectories, you will find the articles themselves, in this case named "Article.1" and Article.2." and where appropriate additional files that include the BUSINESS BASIC programs as described in the article. ry BUSINESS BASIC program written for use with those articles. We have placed these articles within subdirectories on each disk. For example, on this disk, the first of six, you will find on side one subdirectories for the first two articles. They are "Ai's /// SIG, with the permission of the author. NOTES ABOUT THIS DISK AND SUCCEEDING THIRD BASIC DISKS THIS DISK IS: 3BSB-04 BOOTABLE? : NOT Self Booting On these disks you will find all 23 articles as written by Mr. Pohlman, as well as eve !"#lic domain: The Third Basic By Taylor Pohlman A total of 23 articles about Apple /// Business Basic originally published in Softalk Magazine. The articles and their accompanying programs are being presented in a series of six disks by Washington Apple P WAP /// SIG PUBLIC DOMAIN LIBRARY 12022 Parklawn Drive Rockville, MD. 20852 (301)-984-0300 Washington Apple Pi /// SIG is proud to release into the pubYLOC  SDSTATGSCB  INITCHK  ITCHK XLOC XLOC RETADDR     SOSDSTAT SDSTATGSCB   INITCHK  ITCHK YLOC  ASADR SOSSMARK SSMARKRETADDR  z v INITCHK  ITCHK XYCOLOR XYCOLOR RWBUF  F SOSREAD  SREAD RETADDR  SOSDSTATGPGSREQD GSREQDSOSCLOSE SCLOSEGRAFIXMO AFIXMOGLOAD GLOAD RBUFLEN  N RWBUF    SOSREAD  EAD GBASADR GBASADR ( ASADR SOSDSTAT~ SDSTATGSCB  INITCHK { ITCHK CREFNUM  EFNUM RBUFADR  ADR SREFNUM  EFNUM RREFNUM  M WBUFADR   ADR GSAVE GSAVE WREFNUM F  M GPGSREQD5 GSREQDSOSCLOSE> SCLOSEWBUFLEN 8  LEN SOSWRITE; SWRITERWBUF C F  The Menu.Maker program will allow you to read each article and to run the programs should you so desire. BUT PLEASE NOTE: We would recommend you copy the programs to a separate disk and run them from that disk. Since many of these programs are basically examples to show certain things that BUSINESS BASIC can do, the original program could be damaged. Further, you may need to include other files, like BGRAF.INV or other invokable module in order to properly run these programs. Where space permits, we wiMMEND YOU COPY ANY APPROPRIATE BASIC PROGRAMS TO A SEPARATE DISK AND SET THEM UP TO RUN PROPERLY FROM THERE. We have also included our famous "Text.Dump" program on this disk so that you may print out any appropriate file you wish by design&$FNDRERIK@re not in the ///). /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// lman, as well as every BUSINESS BASIC program written for use with those articles. We have placed these articles within subdirectories on each disk. For e/ version should, with few changes, work on the GS version. GS-BASIC programs, however will not work on the /// in many cases because it is much more powerful and was designed to take advantage of the GS Toolkit and other features of that machine (which and are, perhaps, the best series ever published about the language. They will also serve as an excellent beginning point for anyone interested in learning the new GS-BASIC, which was developed from BUSINESS BASIC. Many of the programs written with the // Note that with Menu.Maker you can print ANY loaded textfile. OR you can use the program "Print.All" to print ALL the text files on this disk (and in fact any additional disk sides). FINALLY These articles on BUSINESS BASIC are excellent a any other Bootable /// SIG PD BUSINESS BASIC disk) and then place the proper disk in .D1 to get your menu. AGAIN: WE WOULD RECOMMEND YOU COPY ANY APPROPRIATE BASIC PROGRAMS TO A SEPARATE DISK AND SET THEM UP TO RUN PROPERLY FROM THERE. f the Third Basic disks will include Menu.Maker but not the SOS.Kernal, SOS.Driver and SOS.Interp files needed for your Apple /// to boot up. Since Menu.Maker will read and run programs from any disk placed in .D1, all you have to do is boot disk 1017 (orll include these on the disk at the directory level. But you will have to use System Utilities to transfer them to the appropriate disk. Please also note that in order to save space, we have made /// SIG PD disk 1017 a self-booting disk. The rest oating the proper pathname. FINALLY These articles on BUSINESS BASIC are excellent and are, perhaps, the best series ever published about the language. They will also serve as an excellent beginning point for anyone interested in learning the new GS-BASIC, which was developed from BUSINESS BASIC. Many of the programs written with the /// version should, with few changes, work on the GS version. GS-BASIC programs, however will not work on the /// in many cases because it is much more powerful and +Q Quits."r12);::"80C";a$;:+w#9,"DISKNAME.DAT":#9;DISKNAME$:#9|d$=DISKNAME$$=23:=0::"80C";d$;::12)201M=3:=14:"This /// SIG Disk is \^ 19";Р,2)", Washington Apple `, Ltd."=4:B$(1)="":B$(2)=""A$="BAS6,B) THEN 240 #1, d$="":=10:"80C";d$ ž#1300I=0"I=I+1:#1;A$(I):290,#1 6L=I-1@j=1:same=0 J:SEG=0 Tœ2030^CT<1CT=1:CT>13000Zha$="{,|,~,}; selects; to new disk; J/2)=4:=+1:ۙ=44B$(J);:J=J+1I:1,180,22:2,280,21:2,2380,23:8A$(1000),B$(1000),C%(511),C$(20),name$(20):=10:=0UCA=128:LCA=UCA+32CT=15 IF PREFIX$= PREFIX$+MID$(B$(I),1,./012OLUME NAME (/DISKNAME) OR DEVICE NAME (.Dx)"P12);::"80C";a$;:Zb$="CHANGING DISKS"$d=23:=0::"80C";b$;::12).n=12:=20:"MAKE A NEW MENU FOR DISK: ";N$xN$)<2110=N$ :210 I=1L(A$(I),A$))200B$(/ WAP /// SIG MENU.MAKER PROGRAM (v. 6.1) =".D1"210: Coldstart (320: Warmstart &*X=11000: TEXT SLOW-DOWN LOOP ,X.1 CHANGE DISK SUBROUTINE23œ202:2200<RFa$=" YOU MAY SELECT YOUR DISK BY Vide One of this disk for more information. We are excited and pleased to bring you these excellent series of articles and their accompanying programs. We hope you enjoy them!! disks that will contain all the articles written by Apple's Taylor Pohlman about Business Basic as found in Softalk Magazine. This disk is NOT self-booting but does include the WAP /// SIG Menu.Maker program. Please read "READ.ME. FIRST" on S)+00 WELCOME! WAP /// SIG Public Domain Library Disk Category/Number : Business Basic/3BSB-04 Disk Format: This disk Is NOT self-booting This is the second of five /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// SIG, Washington Apple Pi 12022 Parklawn Drive Rockville, MD. 20852 (301)-984-03 was designed to take advantage of the GS Toolkit and other features of that machine (which are not in the ///). /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// IC 0":150A$="TEXT 0":150A$="CAT 0":150A$="FONT 0":150A$="FOTO 0":150A$(L),"BLOCKS")510*=27:=19:"FREE MEMORY AVAILABLE: ";=7:=20:"80C";A$(L);$:=5:THPOS=4:I=1:IBOTM=J-1:620Q=:=26:=21:1600 =Q:WW=0A=:A=21A=9&oldprefix$=40A=31410: Control C "aborts" program to Basic(:A=13770: Return Selects a file *DA=27:50: Escape to change disks7FA=324000: back out one directory level -IA=(81+UCA)A=(dius with an arbitrary center that actually looks like a circle and doesn't take forever to finish is non-trivial. Non-trivial is a favorite word of mathematicians and engineers, principally because it allows them to assert that a task is difficult, but d that BGRAF only allows dots and lines, and given that none of the graphics modes have equal horizontal and vertical resolution, and given that monitors distort images because of "aspect ratio" differences, we will see that drawing a circle of arbitrary ra section on .GRAFIX. Rather than repeat all of that material, this column will briefly describe the functions of BGRAF.INV and then take up a subject which is not mentioned at all, HOW TO DRAW A CIRCLE. Drawing a circle may sound easy, but given the factc manual (which everyone who purchased Basic should have recieved by now), contains a sixty page section in Volume Two which describes the programming possible with the BGRAF.INV invokable module. In addition, the Standard Device Drivers Manual contains and in the Apple ///, the Infamous .GRAFIX driver and its faithful Indian companion, BGRAF.INV (The preceeding collection of mixed metaphors was just a sample of what some enterprising explorers have encountered on their own trips). The new Business Basi356789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdef the Business Basic's unique formatted output and arithmetic capabilities. There is a good more to say on those topics, but such exposition will be left to some future month. This month we will undertake a journey through some of the thickest jungles fou T H E T H I R D B A S I C by Taylor Pohlman Exploring Business Basic, Part Seven Last month we explored some of"JUNE":1750M$="JULY":1750M$="AUGUST":1750M$="SEPTEMBER":1750M$="OCTOBER":1750M$="NOVEMBER":1750M$="DECEMBER":1750826);"-";M$;" ";Ѡ,2));", ";"19";Р,2);" ";/П,2))=>13П,2))-12;џ,6);:1780$~240:=24:=0:"@ ..... "DATE.TIME.LINE" ....JM=Ҡ,4,2))BTM1630,1640,1650,1660,1670,1680,1690,1700,1710,1720,1730,1740^M$="JANUARY":1750hM$="FEBRUARY":1750rM$="MARCH":1750|M$="APRIL":1750M$="MAY":1750M$=B$(I),"CAT 0")1140*B$(I),"FONT 0")18504B$(I),"FOTO 0")1930>B$(I),"PASTXT 0")2070H540R\A$="RUNNING "+B$(I),16,B)f"79C";A$;:=0pB$(I),16,B) z::SEG=1".D1/SEG.T"t=+B$(I),16,B) yCT=CT+1I=1:I=2I>2=-1:I=I-2:IBOTM<30THPOS=44I=IBOTM/2)*2:=+IBOTM/2)-1:0=+IBOTM/2-.5):I=IBOTM:I/2=I/2)I=I-1 œ2120B=B$(I),16)," ")-1 B$(I),"BASIC 0")850B$(I),"TEXT 0")890 81+LCA):::: RebootN=THPOS:B$(I);XA<8A>11540bA-7640,660,690,720l:=THPOS:B$(I);v:520: 500THPOS=4:I/2=I/2)I=I-1I=IBOTM THPOS=44:I/2<>I/2)I=I+1I6 THEN stepamt=6 940 FOR i=1 TO 126 STEP stepamt 950 PERFORM lineto(%(xcos(i)*xscaleFORM moveto(%0,%8) 160 PRINT#1;"Press RETURN:"; 165 INPUT"";a$ 170 TEXT 175 GOTO 75 180 PERFORM release:PERFORM release:PERFORM release 190 INVOKE:CLOSE 200 END 900 xscale=r*scalefac 905 xcen=xcen+.5:ycen=ycen+.5 907 density=( INPUT"clear screen? ";a$ 80 a$=MID$(a$,1,1):IF a$="y" OR a$="Y" THEN PERFORM fillport 81 INPUT"radius: ";r 82 aratio=1.3 83 xcen=xdot(mode)/2:ycen=96 85 PERFORM grafixon 87 scalefac=(1/aratio)*(xdot(mode)/192) 90 GOSUB 900 150 PER0:xdot(1)=280:xdot(2)=560:xdot(3)=140 30 PERFORM initgrafix 35 INPUT"Mode: ";mode 37 IF mode<=0 THEN 180 40 PERFORM grafixmode(%mode,%1) 50 INPUT"pencolor,fillcolor: ";pen,fill 60 PERFORM pencolor(%pen) 70 PERFORM fillcolor(%fill) 75 INPUT"Graphics mode: ";mode$ 36 IF mode$="" THEN 180 37 mode=CONV(mode$) 40 PERFORM grafixmode(%mode,%1) 50 INPUT"pencolor,fillcolor: ";pen,fill 52 draw.radius=0 55 INPUT"draw the radii? ";a$ 56 a$=MID$(a$,1,1):IF a$="y" OR a$="Y" THEN draw.radius=1 60 PERFORM pencolor(%pen) 70 PERFORM fillcolor(%fill) 75 INPUT"clear screen? ";a$ 80 a$=MID$(a$,1,1):IF a$="y" OR a$="Y" THEN PERFORM fillport 82 horiz=xdot(mode)/192 85 scalefac=(1/aratio)*horiz 87 PERFORM grafixon )time(x)=60*ҟ,4,2))+ҟ,7,2))*time.elapse(x)=time(0)-start.time 1000: initialize"Circle drawer program"#"Graphics mode: ";mode$$mode$=""180%mode=mode$)(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pen,fihen, dig into your device driver manual documentation on .GRAFIX and the writeup on BGRAF.INV in the Business Basic Manual. There's a whole world inside this system! ! apabilities of the Apple ///. Next month we will tackle a few biggies, "area fill" (especially for the circles and arcs we have been drawing), and the whole area of user-definable character sets. With luck, we'll get to some animation examples. Until t down the drawing. Additionally, as was mentioned at the top, the graphics window can be set to anywhere on the screen, with any values outside the window automatically clipped. There are a thousand more topics to be covered in exploring the graphics civer handles this perfectly, because it treats its graphics area as a space of points from -32768 to 32767, with the screen as a window into the total space. This saves immeasurable amounts of bounds checking within programs, which usually ends up slowingpefully, these routines will also give you ideas on solving whatever other specific projects you might want to tackle. Normally, when you run the "arc" program above, you will get some arcs which are partially off the screen. Notice that the .GRAFIX drto create random centers, radii and arc lengths (in radians) and to use the subroutine at line 1100 to draw the resulting arcs. Between this routine and the one above to draw circles, you should be able to do most of the interesting tasks in graphics. Hoxcos(i)*xscale+xcen),%(ysin(i)*r+ycen)) 1160 NEXT i 1170 PERFORM lineto(%(COS(end.rad)*xscale+xcen),%(SIN(end.rad)*r+ycen)) 1175 IF draw.radius THEN PERFORM lineto(%xcen,%ycen) 1180 RETURN This program is set up to use lines 88 through 100 ELSE:PERFORM moveto(%(C OS(start.rad)*xscale+xcen),%(SIN(start.rad)*r+ycen)) 1120 stepamt=INT(20*(5-density)/r)+density 1130 IF stepamt>6 THEN stepamt=6 1140 FOR i=INT(start.rad*20+.5) TO end.rad*20 STEP stepamt 1150 PERFORM lineto(%(he endpoints 1100 xscale=r*scalefac 1105 xcen=xcen+.5:ycen=ycen+.5 1110 density=(mode=2)+2*(mode<2)+3*(mode=3) 1115 IF draw.radius THEN PERFORM moveto(%xcen,%ycen):PERFORM lineto(%(COS(st art.rad)*xscale+xcen),%(SIN(start.rad)*r+ycen)):coordinate of center 1096 REM ycen= y coordinate of center 1097 REM start.rad= starting point of arc in radians 1098 REM end.rad= ending point of arc in radians 1099 REM draw.radius=1 means draw the radius lines to txcos(i)=COS(i/20):ysin(i)=SIN(i/20):NEXT i 1040 xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140 1050 aratio=1.3 1060 PERFORM initgrafix 1070 RETURN 1094 REM r=radius, scalefac=aspect ratio * relative density 1095 REM xcen= x ess RETURN:"; 165 INPUT"";a$ 170 TEXT:GOTO 35 180 PERFORM release:PERFORM release:PERFORM release 190 CLOSE:INVOKE 200 END 1000 OPEN#1,".grafix" 1010 INVOKE".d1/bgraf.inv" 1020 DIM xcos(126),ysin(126),xdot(3) 1030 FOR i=0 TO 126:88 FOR loop=1 TO 25 90 r=INT(50*RND(1)+30) 91 xcen=INT(192*horiz*RND(1)) 92 ycen=INT(192*RND(1)) 93 start.rad=3.14*RND(1):end.rad=start.rad+3*RND(1) 95 GOSUB 1100 100 NEXT loop 150 PERFORM moveto(%0,%8) 160 PRINT#1;"Prll<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillportRhoriz=xdot(mode)/192Uscalefac=(1/aratio)*horizVelapsed.time=0 WgrafixonXloop=125Zr=50*1)+1)[xcen=192*horiz*1))\gij:moveto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))'`stepamt=20*(5-density)/r)+densityjstepamt>6stepamt=6.ti=start.rad*20+.5)end.rad*20stepamt5~lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))i;lineto(%(end.rad)*xsrc in radians3K end.rad= ending point of arc in radiansLxscale=r*scalefacQxcen=xcen+.5:ycen=ycen+.5*Vdensity=(mode=2)+2*(mode<2)+3*(mode=3)[draw.radiusmoveto(%xcen,%ycen):lineto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen)):xdot(3)=140aratio=1.3$initgrafix.F arc draw subroutine>G r=radius, scalefac=aspect ratio * relative density)H xcen= x coordinate of center )I ycen= y coordinate of center 7J start.rad= starting point of a relative density* xcen= x coordinate of center ( ycen= y coordinate of center#1,".grafix"".d1/bgraf.inv" xcos(126),ysin(126),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:)\ycen=192*1))0]start.rad=3.14*1):end.rad=start.rad+3*1) _1100 dloopmoveto(%0,%8)#1;"Press RETURN:"; "";a$':"total time = ";elapsed.time:35~ circle draw subroutine> r=radius, scalefac=aspect ratio *kmnodius=1<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillportRhoriz=xdot(mode)/192Uscalefac=(1/aratio)*horizVelapsed.time=0 WgrafixonXloop=125Zr=50*1)+30)[xcen=192*horiz*1)M 1000: initialize"Arc drawer program"#"Graphics mode: ";mode$$mode$=""180%mode=mode$)(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pen,fill4draw.radius=07"draw the radii? ";a$/8a$=a$,1,1):a$="y"a$="Y"draw.ra3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140aratio=1.3$initgrafix.6start.time=time(0)i=stepamt126stepamt5lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))ilineto(%firstx,%ycen).elapsed.time=elapsed.time+time.elapse(0)#1,".grafix"".d1/bgraf.inv" xcos(126),ysin(126),xdot(ter ( ycen= y coordinate of centerxscale=r*scalefacxcen=xcen+.5:ycen=ycen+.5*density=(mode=2)+2*(mode<2)+3*(mode=3)firstx=xcos(0)*xscale+xcenmoveto(%firstx,%ycen)'stepamt=20*(5-density)/r)+densitystepamt>6stepamt=ycen=192*1))_900 dloopmoveto(%0,%8)#1;"Press RETURN:"; "";a$':"total time = ";elapsed.time:35~ circle draw subroutine> r=radius, scalefac=aspect ratio * relative density* xcen= x coordinate of cencale+xcen),%(end.rad)*r+ycen))&draw.radiuslineto(%xcen,%ycen) (tme(x)=60*ҟ,4,2))+ҟ,7,2)))time.elapse(x)=tme(0)-start.time 1000: initialize"Circle drawer program"#"Graphics mode: ";mode$$mode$=""180%mode=mode$)(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pen,fillvxnt of arc in radiansLxscale=r*scalefacQxcen=xcen+.5:ycen=ycen+.5*Vdensity=(mode=2)+2*(mode<2)+3*(mode=3)[draw.radiusmoveto(%xcen,%ycen):lineto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))::moveto(%(start.rad)*xscale+xcen),%(sta!F arc draw subroutine>G r=radius, scalefac=aspect ratio * relative density)H xcen= x coordinate of center )I ycen= y coordinate of center 7J start.rad= starting point of arc in radians3K end.rad= ending poi20*(5-density)/r)+densityjstepamt>6stepamt=6.ti=start.rad*20+.5)end.rad*20stepamt5~lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))i;lineto(%(end.rad)*xscale+xcen),%(end.rad)*r+ycen))&draw.radiuslineto(%xcen,%ycen)le=r*scalefacQxcen=xcen+.5:ycen=ycen+.5*Vdensity=(mode=2)+2*(mode<2)+3*(mode=3)[draw.radiusmoveto(%xcen,%ycen):lineto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))::moveto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))'`stepamt=ime+60*ҟ,4,2))+ҟ,7,2))-start.time#1,".grafix"".d1/bgraf.inv" xcos(126),ysin(126),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140aratio=1.3$initgrafix.Lxscae=60*ҟ,4,2))+ҟ,7,2)).i=start.rad*20+.5)end.rad*20stepamt5lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))i;lineto(%(end.rad)*xscale+xcen),%(end.rad)*r+ycen))&draw.radiuslineto(%xcen,%ycen)Celapsed.time=elapsed.t(mode<2)+3*(mode=3)draw.radiusmoveto(%xcen,%ycen):lineto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))::moveto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))'stepamt=20*(5-density)/r)+densitystepamt>6stepamt=6)start.timme:35~ circle draw subroutine> r=radius, scalefac=aspect ratio * relative density* xcen= x coordinate of center ( ycen= y coordinate of centerxscale=r*scalefacxcen=xcen+.5:ycen=ycen+.5*density=(mode=2)+2*apsed.time=0 WgrafixonXloop=125Zr=50*1)+30)[xcen=192*horiz*1))\ycen=192*1))0]start.rad=3.14*1):end.rad=start.rad+3*1) _1100 dloopmoveto(%0,%8)#1;"Press RETURN:"; "";a$':"total time = ";elapsed.tiprstu4draw.radius=07"draw the radii? ";a$/8a$=a$,1,1):a$="y"a$="Y"draw.radius=1<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillportRhoriz=xdot(mode)/192Uscalefac=(1/aratio)*horizVelrt.rad)*r+ycen))'`stepamt=20*(5-density)/r)+densityjstepamt>6stepamt=6.ti=start.rad*20+.5)end.rad*20stepamt5~lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))i;lineto(%(end.rad)*xscale+xcen),%(end.rad)*r+ycen))&draw.ra~):a$="y"a$="Y"draw.radius=1<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillportRhoriz=xdot(mode)/192Uscalefac=(1/aratio)*horiz WgrafixonXloop=125Zr=50*1)+30)[xcen=192*ho arc draw subroutine  1000: initialize"Arc drawer program"#"Graphics mode: ";mode$$mode$=""180%mode=mode$)(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pen,fill4draw.radius=07"draw the radii? ";a$/8a$=a$,1,1>6stepamt=6.ti=start.rad*20+.5)end.rad*20stepamt5~lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))i;lineto(%(end.rad)*xscale+xcen),%(end.rad)*r+ycen))&draw.radiuslineto(%xcen,%ycen)+.5*Vdensity=(mode=2)+2*(mode<2)+3*(mode=3)[draw.radiusmoveto(%xcen,%ycen):lineto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))::moveto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))'`stepamt=20*(5-density)/r)+densityjstepamt ycen= y coordinate of center 8I start.rad= starting point of arc in radians 3J end.rad= ending point of arc in radiansFK draw.radius=1 means draw the radius lines to the endpointsLxscale=r*scalefacQxcen=xcen+.5:ycen=ycen),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140aratio=1.3$initgrafix.?F r=radius, scalefac=aspect ratio * relative density )G xcen= x coordinate of center *H riz*1))\ycen=192*1))0]start.rad=3.14*1):end.rad=start.rad+3*1) _1100 dloopmoveto(%0,%8)#1;"Press RETURN:"; "";a$35release:release:release:#1,".grafix"".d1/bgraf.inv" xcos(126),ysin(126y{|}):a$="y"a$="Y"draw.radius=1<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillportRhoriz=xdot(mode)/192Uscalefac=(1/aratio)*horiz WgrafixonXloop=125Zr=50*1)+30)[xcen=192*ho arc draw subroutine  1000: initialize"Arc drawer program"#"Graphics mode: ";mode$$mode$=""180%mode=mode$)(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pen,fill4draw.radius=07"draw the radii? ";a$/8a$=a$,1,1diuslineto(%xcen,%ycen)riz*1))\ycen=192*1))0]start.rad=3.14*1):end.rad=start.rad+3*1) _1100 dloopmoveto(%0,%8)#1;"Press RETURN:"; "";a$ :35release:release:release:#1,".grafix"".d1/bgraf.inv" xcos(126),ysin(1 #1,".grafix"".d1/bgraf.inv"xcos(64),ysin(64)/i=063:xcos(i)=i/10):ysin(i)=i/10):iinitgrafix(grafixmode(%1,%1)<pencolor(%13)Ffillcolor(%3) Pfillport'Q"radius: ";r:"center: ";xcen,ycen Ugrafixon0Zx%=r*(140/192)+xcen:y%=ycen:moveto(%x%,%y%))_xscale=r*(140/192):yscale=r*(192/140) di=163nx=xcos(i)*xscale+xcenxy=ysin(i)*yscale+ycenlineto(%x,%y)i #1,".grafix"".d1/bgraf.inv"xcos(64),ysin(64)/i=063:xcos(i)=i/10):ysin(i)=i/10):iinitgrafix(grafixmode(%3,%1)<pencolor(%13)Ffillcolor(%3) Pfillport'Q"radius: ";r:"center: ";xcen,ycen Ugrafixon0Zx%=r*(1scale=30*(140/192):yscale=30*(192/140) di=063nx=xcos(i)*xscale+70xy=ysin(i)*yscale+96lineto(%x,%y)i #1,".grafix"".d1/bgraf.inv"xcos(64),ysin(64)/i=063:xcos(i)=i/10):ysin(i)=i/10):iinitgrafix(grafixmode(%3,%1)<pencolor(%13)Ffillcolor(%3) Pfillport Ugrafixon-Zx%=30*(140/192)+70:y%=96:moveto(%x%,%y%)+_xale+70xy=i)*yscale+96lineto(%x,%y)i9 #1,".grafix"".d1/bgraf.inv"initgrafix(grafixmode(%3,%1)<pencolor(%13)Ffillcolor(%3) Pfillport Ugrafixon-Zx%=30*(140/192)+70:y%=96:moveto(%x%,%y%)+_xscale=30*(140/192):yscale=30*(192/140)di=06.3.1nx=i)*xsc #1,".grafix"".d1/bgraf.inv"initgrafix(grafixmode(%3,%1) 2grafixon<pencolor(%13)Ffillcolor(%3) PfillportZmoveto(%70,%96)di=06.28.05nx=i)*30+70xy=i)*30+96dotat(%x,%y)i #1,".grafix"".d1/bgraf.inv"initgrafix(grafixmode(%3,%1) 2grafixon<pencolor(%13)Ffillcolor(%3) PfillportZmoveto(%70,%96)di=06.28.05nx=i)*30*(140/192)+70xy=i)*30*(192/140)+96dotat(%x,%y)ien+.5*Vdensity=(mode=2)+2*(mode<2)+3*(mode=3)[draw.radiusmoveto(%xcen,%ycen):lineto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))::moveto(%(start.rad)*xscale+xcen),%(start.rad)*r+ycen))'`stepamt=20*(5-density)/r)+densityjstepa ycen= y coordinate of center 8I start.rad= starting point of arc in radians 3J end.rad= ending point of arc in radiansFK draw.radius=1 means draw the radius lines to the endpointsLxscale=r*scalefacQxcen=xcen+.5:ycen=yc26),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140aratio=1.3$initgrafix.?F r=radius, scalefac=aspect ratio * relative density )G xcen= x coordinate of center *H 92/280)+xcen:y%=ycen:moveto(%x%,%y%))_xscale=r*(192/280):yscale=r*(280/192) di=163nx=xcos(i)*xscale+xcenxy=ysin(i)*yscale+ycenlineto(%x,%y)i$ #1,".grafix"".d1/bgraf.inv"xcos(64),ysin(64),xdot(3)/i=063:xcos(i)=i/10):ysin(i)=i/10):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140initgrafix#"Mode: ";mode(grafixmode(%mode,%1)<pencolor(%13)FfillcolorH #1,".grafix"".d1/bgraf.inv" xcos(126),ysin(126),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140initgrafix#"Mode: ";mode(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pcos(i)*xscale+xcen),%(ysin(i)*r+ycen))ilineto(%firstx,%ycen)Mxscale=r*scalefacxcen=xcen+.5:ycen=ycen+.5*density=(mode=2)+2*(mode<2)+3*(mode=3)firstx=xcos(0)*xscale+xcenmoveto(%firstx,%ycen)'stepamt=20*(5-density)/r)+densitystepamt>6stepamt=6i=stepamt126stepamt5lineto(%(x)moveto(%0,%8)#1;"Press RETURN:"; "";a$ :355_firstx=xcos(0)*xscale+xcen:moveto(%firstx,%ycen)'astepamt=96/r+.5)*(560/xdot(mode))1bstepamt<1stepamt=1::stepamt>5stepamt=5di=1126stepamtnx=xcos(i)*xscale+xcenxy=ysin(i)*r+ycenlineto(%x,%y)ilineto(%firstx,%ycenen,fill<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillport'Q"radius: ";r:"center: ";xcen,ycenR"aspect ratio: ";aratio Ugrafixon(Wscalefac=(1/aratio)*(xdot(mode)/192)Zxscale=r*scalefacE #1,".grafix"".d1/bgraf.inv" xcos(126),ysin(126),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140initgrafix#"Mode: ";mode(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";plineto(%x,%y)ia$(%3) Pfillport'Q"radius: ";r:"center: ";xcen,ycenR"aspect ratio: ";aratio Ugrafixon(Wscalefac=(1/aratio)*(xdot(mode)/192)'Zx=r*scalefac+xcen:moveto(%x,%ycen)_xscale=r*scalefac di=163nx=xcos(i)*xscale+xcenxy=ysin(i)*r+ycenen,fill<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):a$="y"a$="Y"fillport'Q"radius: ";r:"center: ";xcen,ycenR"aspect ratio: ";aratio Ugrafixon(Wscalefac=(1/aratio)*(xdot(mode)/192)Z900moveto(%0Y #1,".grafix"".d1/bgraf.inv"initgrafix(grafixmode(%3,%1)-"step value: ";stepval."aspect ratio: ";aspect/aspect=1/aspect 2grafixon<pencolor(%13)Ffillcolor(%3) PfillportZmoveto(%70,%96)di=06.28stepval!tat(%x,%y)ia$# #1,".grafix"".d1/bgraf.inv"initgrafix(grafixmode(%3,%1)-"step value: ";stepval 2grafixon<pencolor(%13)Ffillcolor(%3) PfillportZmoveto(%70,%96)di=06.28stepvalnx=i)*30*(140/192)+70xy=i)*30+96do".d1/bgraf.inv" xcos(126),ysin(126),xdot(3)0i=0126:xcos(i)=i/20):ysin(i)=i/20):i3xdot(0)=280:xdot(1)=280:xdot(2)=560:xdot(3)=140aratio=1.3$initgrafix.ode=3)firstx=xcos(0)*xscale+xcenmoveto(%firstx,%ycen)'stepamt=20*(5-density)/r)+densitystepamt>6stepamt=6i=1126stepamt5lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))ilineto(%firstx,%ycen)#1,".grafix"~ circle draw subroutine> r=radius, scalefac=aspect ratio * relative density* xcen= x coordinate of center ( ycen= y coordinate of centerxscale=r*scalefacxcen=xcen+.5:ycen=ycen+.5*density=(mode=2)+2*(mode<2)+3*(ma$="y"a$="Y"fillportRhoriz=xdot(mode)/192Uscalefac=(1/aratio)*horiz WgrafixonXloop=150Zr=50*1)+1)[xcen=192*horiz*1))\ycen=192*1))_900 dloopmoveto(%0,%8)#1;"Press RETURN:"; "";a$ :35 1000: initialize"Circle drawer program"#"Graphics mode: ";mode$$mode$=""180%mode=mode$)(grafixmode(%mode,%1)$2"pencolor,fillcolor: ";pen,fill<pencolor(%pen)Ffillcolor(%fill)K"clear screen? ";a$+Pa$=a$,1,1):)*xscale+xcen),%(ysin(i)*r+ycen))ilineto(%firstx,%ycen),%8)#1;"Press RETURN:"; "";a$ :35xscale=r*scalefac5firstx=xcos(0)*xscale+xcen:moveto(%firstx,%ycen)'stepamt=96/r+.5)*(560/xdot(mode))1stepamt<1stepamt=1::stepamt>5stepamt=5i=1126stepamt5lineto(%(xcos(inx=i)*30*(140/192)*aspect+70xy=i)*30+96dotat(%x,%y)ia$t #1,".grafix"".d1/bgraf.inv"initgrafix(grafixmode(%3,%1)-"step value: ";stepval."aspect ratio: ";aspect/aspect=1/aspect 2grafixon<pencolor(%13)Ffillcolor(%3) Pfillport(Zmoveto(%30*(140/192)*aspect+70,%96)dThe Third Basic by Taylor Pohlman 79C";"PRESS ANY KEY TO HALT LISTING"::202 1020#2,B$(I),16,B)ž#242:::1160Z=1#2;A$:"78A";A$Z=Z+1:Z>1842:::Z=1980*:=23:=0::"79C";"CONTINUE...?":1C$:C$<>"Y"C$<>"y"C$<>"N"C$<>"n"10 MENU.MAKER TEXT MODULESEG=0"MENU.MAKER"890&*X=11000: TEXT SLOW-DOWN LOOP ,X.1,180,22:2,280,21:2,2380,23:z:A$="LISTING "+B$(I),16,B)$=01:=0::"80C";A$;::12)>=23:=0::"12405l=ơ):: Routine to back up one directory level.a$=С,l-1) s=a$)a$=a$,s-1)a$,1)="/"5060:s=s-1 5030=a$240( MENU.MAKER 6.10 * Thanks to C.M.Davidson for his help!NOT FOUND.)"X=11000:X:::210Z a$="{,|,~,}; selects; back 1 level; G$:::320H: Error Routine 202:U=11:"79C";"BAD PATH ERROR (NO DISK IN DISK DRIVE OR DESIRED FILE ,2))=0"12";џ,6);:ٟ;$П,2))=>12" PM-":" AM-" 1830WW=1530 =26:=21 1600 &:WW=1:0 :SEG=1;".D1/S EG.F" SEG=1".D1/SEG.G"diskname$=3802  CATCH PASCAL TEXT FILES mt>6stepamt=6.ti=start.rad*20+.5)end.rad*20stepamt5~lineto(%(xcos(i)*xscale+xcen),%(ysin(i)*r+ycen))i;lineto(%(end.rad)*xscale+xcen),%(end.rad)*r+ycen))&draw.radiuslineto(%xcen,%ycen)) PfillportUfactor=140/192$Zmoveto(%r*factor*aspect+70,%96) di=163 nx=xcos(i)*r*factor*aspect+70xy=ysin(i)*r+96lineto(%x,%y)ia$ #1,".grafix"".d1/bgraf.inv"xcos(63),ysin(63)/i=063:xcos(i)=i/10):ysin(i)=i/10):iinitgrafix(grafixmode(%3,%1)."aspect ratio: ";aspect/aspect=1/aspect0"radius: ";r 2grafixon<pencolor(%13)Ffillcolor(%3i=stepval6.28stepval!nx=i)*30*(140/192)*aspect+70xy=i)*30+96lineto(%x,%y)ia$30C$="N"C$="n"1160;:=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING": $1020.202 8::Z=1B::=23:=0::"79C";"WOULD YOU LIKE A PRINTED COPY?":1C$:C$<>"Y"C$<>"y"C$<>"N"C$<>"n"1170*C$="N"C$="n" Run Side Two Program#"TURN THIS DISK OVER, PLEASE."6"I WILL WAIT A FEW MOMENTS FOR YOU TO DO THAT..."(X=150002X<F!P"OK RUNNING SIDE TWO NOW..."ZX=11000dXn".D1/MENU.MAKER"x2010C$="N"C$="n"200;:=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING": 20002,280,21 DF$(I)=D$+"/DISKNAME.DAT"F$(I)=D$+"/FLASHNAME.DAT"410:ۺ310 PRINTER v 1.0 p$ 900A$="PRINTING"+F$(I):$=01:=0::"80C";A$;::12)F=23:=0::"79C";"PRESS ANY KEY TO HALT PRINTING"::2,280,21 2000*:=23:=0::"79C";"CONTINUE...?":1C$:C$<>"Y"C$<>"y"C$<>"N"C$<>"n"#1,D$::"Processing directory ";34);D$;34);", please wait."; ž#1880*#1;A$:A$)<48104A$,3,4)<>"TEXT"810>X=X+1:".";HE=15:F$=A$,16,15)RF$,E,1)=" "E=E-1:850\F$(X)=D$+"/"+F$,E)f810p:  Pausež#1740#1;A$:A$)<4710A$,3,4)="TEXT"X=X+1710 :X>YN=P::7);"There are no text files in the ";34);D$;34);" directory." ::I=P::7);"Unable to locate and open ";34);D$;34);" directory." ::IT$=N$,E,1):T$=" "T$=","610XE=E+1:E>N$)610:590bD$=N$,S,E-S)l:v:E>S+1600:D$="": œ770P=3:"Looking for ";34);D$;34);" directory." #1,D$=P3:"Reading from ";34);D$;34);" directory." I>X200300S=1:D=1:B=1570D$=""500 Y=X:S=ED$(D)=D$:640 X=Y440D=D+1:S=E:440D=D-1:X=0F$(X):X=0 J=1D D$=D$(J)790&J0 :œ6303DE=S+1:N$,S,1)=" "N$,S,1)=","S=S+1:580%Nž#2390 ^1000c: h#2;a$ma$rY=1150:Y0wB=B+1: Count the number of lines printed xB=15B=30355yB=60#3;12)zB=60B=1 {#3;a$|360B<=20#3;13)::410#3;12):Z=11000:ZI I=3d: PRINTER V. 1.0 ::=2::"PRINT.ALL v. 1.0":3=4:"Directory Name(s) or return to quit: ";n$N$)=0::"MENU.MAKER"430 X>0260I=11000:I:200: ,I=1X 14000 6#2,F$(I)@#3,".PRINTER" JEAD PASCAL TEXT FILES."04=10:"78C";"ANY KEY RETURNS TO THE MENU."!>G$:::".D1/MENU.MAKER",320R",220(204::"79A";""; 2D=1:F=1 <#4;a$ FD=D+1 P#5;a$ZD=60#5;12)dD=60D=1nF=F+1::d$;::Y=1100:Y x13402  CATCH PASCAL TEXT FILES 202 :F*=08:"78C";"SORRY BUT MENU.MAKER CAN'T R".D1/MENU.MAKER",220 d$="" A$="PRINTING "+B$(I),16,B)=01:=0::"80C";A$;:#3,B$(I),16,B)Z=1#3;b$:"78A";b$Z=Z+1:Z=18:1290 1260 #4,B$(I),16,B)#5,".PRINTER"+ž#4#5;12):::".D1/MENU.MAKEARTICLE6v' ')ARTICLE.6< t"DIR.DUMP.OUT;-DIRECTORYDUMP v  DUMP.DIR 3,EXTENDED.ADD 2FOR.NEXT.OUTle.second%Aa&=first&:b&=second& F1010>Herrorcode"Range of precision exceeded, try again.":10/K"sum= ";sum&;" scale factor= ";scalesum% Px%=sum&)):neg%=sum&<0)AUx%+scalesum%-neg%<=0form$="2#"::form$=x%+scalesum%)+"#"Zscge exceeded, try again.":25##scale.second%=scale%:second&=a&(45;first&,scale.first%0- " first value= ",20#," scale factor= ",3#255;second&,scale.second%17 "second value= ",20#," scale factor= ",3# .<scalea%=scale.first%:scaleb%=sca#1,"extend.out":#10"Test of extended precision add routines": :"First number: ";a$ a$=""9051errorcode"Range exceeded, try again.":10!scale.first%=scale%:first&=a&"Second number: ";a$9051 errorcode"Ranor%)%sum&=a&+b&:scalesum%=scalea%::.factor%=scalea%-scaleb%8a&=a&*10^factor%)%Bsum&=a&+b&:scalesum%=scaleb%::- add a& and b& and return result in sum&1 use scalea% and scaleb% to return scalesum%"errorcode=0:œerrorcode=::7scalea%=scaleb%sum&=a&+b&:scalesum%=scalea%::scalea%>scaleb%1070factor%=scaleb%-scalea%b&=b&*10^fact$ "Format string to test: ";form$%a=5:b=17:a&=1234567898765:b&=1234z1=a*b:z2=a/b:z3=b/a#(z1&=a&*b&:z2&=a&b&:z3&=a&b& 2z1,z2,z3<z1&,z2&,z3&Fform$;z1,z2,z3&Pform$;-3,z1&),-2,z2&),2,z3&)"Directory to dump: ";a$P" 1234567890123456789012345678901234567890123456789012345678901234567890"P" 1 2 3 4 5 6 7" #1,a$ ž#160 #1;a$a$)":"a$220<TEST.RECORD ܢ ,TEST.REQUEST  6 TESTFORMAT EXTEND.OUTC4 & LONG.ADD.SUB 4LONG.INPUT.SUB 6MYPROGRAM TEST.FIL.OUT6 -TEST.FILWRITE 3 -TEST.FOR.NEXT ܢalesum%>=097'_form$=form$+"."+scalesum%))+"#"a"scaled result of sum: ";dform$;scalesum%,sum&)i10< subroutine to convert input to long integer plus scale"errorcode=0:œerrorcode=::x=a$,".") x=0a&=a$):scale%=0::scale%=-(a$)-x)a$=a$,1,x-1)+a$,x+1)a&=a$)::- add a& and b& and return result in sum&1 use scalea% and scaleb% to return scalesum%"errorcode=0:œerrorcode=::7scalea%=scaleb%sum&=a&+b&:scalesum%=scaley multiplying this record number by the record size assigned when the file was originally created (default is 512 bytes). My understanding is that this 32,767 limit on record numbers is not the case in Pascal. Now that the Profile hard disk is available,sic limit is based. Basic even allows a real number to be used as a record number, but because Basic uses an integer type internally to keep track of the record number, the value still cannot exceed 32,767. The actual position in the file is determined bade on previous articles. Digression Number One I made the comment in one of the first articles that random record files were limited to 32,767 records, the maximum positive integer value. In fact, there is no particular limit in SOS on which this Bacover some parts of the new REQUEST invokable module and techniques on using PRINT USING. Fear not, all that and more is covered below, including some tips on Long Integer "decimal" arithmetic. But first, a few digressions based on comments some of you m T H E T H I R D B A S I C by Taylor Pohlman Exploring Business Basic, part six Last episode I covered a mixed bag of topics, and ended with a promise to 81 15:07 12/29/81 15:07 419 66: TEXT 00006 DIRECTORYDUMP 12/29/81 15:11 12/29/81 15:09 2422 68: 68: MYSUB (12/29/81) V0 68: 68: TYPE BLKS NAME MODIFIED TIME CREATED TIME EOF 65: BASIC 00001 MYPROGRAM 12/29/< subroutine to convert input to long integer plus scale"errorcode=0:œerrorcode=::x=a$,".") x=0a&=a$):scale%=0::scale%=-(a$)-x)a$=a$,1,x-1)+a$,x+1)a&=a$)::vokable Module designed for use with the Basic"L c$="program on this disk. Please see User Manual for more information."' e$="Returning you now to the menu." =10:"80C";b$; =11:"80C";c$; =13:"80C";e$; X=12000 X1( :240:830WW=1500=26:=21:1600 1600 &:WW=1: :::*b$="Sorry this is a PASCAL text file."/c$="You will need to read it using PASCAL."'e$="Returning you now to the menu." 2550 :::K b$="Sorry, this is an Ina%::scalea%>scaleb%1070factor%=scaleb%-scalea%b&=b&*10^factor%)%sum&=a&+b&:scalesum%=scalea%::.factor%=scalea%-scaleb%8a&=a&*10^factor%)%Bsum&=a&+b&:scalesum%=scaleb%:: some thought is being given to removing this restriction. Let me know if it's been a problem for you. Digression Number Two As I demonstrated last time, the GET# statement in Basic can be used to read the exact contents of most files on the Apple ///, one byte at a time. We even created a special "formatted dump" program to investigate the contents of Basic Data files. Some types of disk files cannot be opened by Basic, however. Most notably, these include Pascal Code and Data files. If you have a n (12/29/81) V0 68: 68: TYPE BLKS NAME MODIFIED TIME CREATED TIME EOF 65: BASIC 00001 MYPROGRAM 12/29/81 15:07 60 20 INPUT#1;a$ 30 PRINT LEN(a$)":"a$ 50 GOTO 20 60 CLOSE 70 END The only thing unusual here is that we arranged to print the length of each string that is read, to check for any special formatting. The output looks like this: 68: MYSUBBasic will automatically format the contents for you, just as it does in the CATalog command. The following simple program will illustrate, on the same subdirectory we just looked at: 1 INPUT"Directory to dump: ";a$ 10 OPEN#1,a$ 15 ON EOF#1 GOTOeing able to spot the subdirectory name and the file names, the printout is a big mystery. Business Basic to the rescue! It turns out that Basic is knowledgeable of the contents of directory files, so that when you open a directory or subdirectory file, he top row in each pair is the actual hex contents of the file, and the next row is the ascii equivalent characters. If the byte is a non-printing character, it is represented by a ".". This is all fine, but you will immediately protest that other than b last month's column, this may look bizzare, but it's really easy. Remember that this is a byte-by-byte image of the file. The numbers to the left (like 0000-001F) are the byte numbers in hexadecimal of that particular row. Each row contains 32 bytes. T. . . # . . . . c . . . # . . . . - D I R E C T O R Y D U M P 0060-007F 000004840006007609009DA3090F0000E300029DA3090F810000000000000000 . . . . . . . v . . . # . . . . c . . . # . . . . . . . . . . . For those of you who did not read. . . . . . # . . 0020-003F 000000270D020009000227194D5950524F4752414D0000000000000982000100 . . . ' . . . . . . ' . M Y P R O G R A M . . . . . . . . . . . 0040-005F A301009DA3070F0000E300029DA3070F81002D4449524543544F525944554D50 # ROGRAM" and "DIRECTORYDUMP". Using the formatted dump program from last time, the file contents look something like this: 0000-001F 00000000E54D595355420000000000000000000076000000000000009DA3060F . . . . e M Y S U B . . . . . . . . . . v . . s to check on everything before OPENing a file or CHAINing to another program. Those of you who read last month's article know about our handy-dandy file dump program using GET#. Let's pick a typical subdirectory named "MYSUB" containing the files "MYPiscover from a running program whether or not a given file or program already exists. There are some ways using ON ERR to work up a solution to this problem, but nothing very tidy. However, being able to open and read a directory or subdirectory allows ul features. If you aren't using subdirectories to group your files and programs logically, I suggest you read the relevant sections of the Basic manual and the Apple /// Owners Guide. One problem with files in Basic, however, is that it is difficult to de type which is very interesting to examine, and Basic will allow you to open it directly. Those are the "Catalog" or "Subdirectory" files which you create from Basic or the Utilities program. The subdirectory capability of SOS is one of its most powerfueed to examine the contents of those files from Basic, they can be accessed by using the Pascal Filer to change the file type to "Ascii", which Basic knows as the "Text" file. You Pascal programmers will enjoy Basic, once you try it! There is another fil12/29/81 15:07 419 66: TEXT 00006 DIRECTORYDUMP 12/29/81 15:11 12/29/81 15:09 2422 68: Since all the columns are in very predictable places, it is possible to easily extract the information desired by judicious use of the MID$ function. Also, since this is a subdirectory, there is no line showing blocks free and blocks in use. Try using this program on a volume directory. The last string read from the file will contain this inforified. It must be an integer variable. One note is important here. These proceedures read and write the exact contents of arrays. In the case of disk files, there is no way to read this data back once it is written, except by using the FILREAD proceed or written from the array. In the FILREAD proceedure, the extra parameter "count" allows the proceedure to pass back information about how many bytes were actually read, in case an EOF or other event prevented the reading of the full amount of data spec string, not the actual contents of the string itself. The invokable module is responsible for finding out what array name is in the string, and then locating the array in memory. The "numbytes" parameter tells the proceedure how many bytes are to be reaer value is passed to the proceedure. "Array$" refers to a string variable which contains the name of the array which your wish to read or write. The "@" character on the front of the string variable name instructs Basic to pass the memory address of the This includes device files like ".console" as well as disk-based text and data files. The "%" symbol in front of the "filnum" indicates that you should either use an integer variable, or put the % in front of any constant you use, to insure that an integPERFORM FILREAD(%filnum,@array$,%numbytes,@count) PERFORM FILWRITE(%filnum,@array$,%numbytes) "filnum" refers to the file number you used in the OPEN statement for the file to be read or written. It can be any file which Basic is allowed to open. To help solve this problem in situations where performance is at a premium, the REQUEST module contains two proceedures: FILREAD and FILWRITE. They are documented in the REQUEST.DOC file on the Basic disk, but for reference, here are the formats: ut more than one value in a single print or input statement, there are real limits on the amount of data which can be transfered at one time. This generally means that arrays of data get written using FOR-NEXT loops, adequate, but hardly a speedburner. o us now, however, is the ability to use SOS to directly read and write data to files. A single SOS FWRITE command can transfer up to 64K bytes of data to a file. Normally Basic allows writing only one variable at a time, and although it is possible to ptimes when certain status and control information needs to be interrogated or set. More information about what this information consists of for a particular driver can be found in the appropriate reference manual for that driver. Of greatest interest tinterprets your desires and performs operations called "SOS calls" to do the actual work of reading and writing to physical devices. There are times, however, when the programmer needs direct access to the information which SOS has about files, and other I promised last time, I want to go briefly into one of the most powerful new capabilities of Business Basic, the REQUEST invokable module. Normally, all access to SOS files is done through the INPUT, PRINT, READ, WRITE and GET statements of Basic. Basic reading the individual subdirectory files. Another treat for the esoteric members of the audience is to compare the information in the hex dump with the formatted output to discover where and how SOS hides all the information about files. New Stuff As mation, very useful if you want to check for imminent "Disk Full" errors. Also, since the volume directory lists all the subdirectorys (labeled "CAT" in the file type column), it is possible to get a full list of all the files on a volume by successively dure. That is, if you write an integer array to a DATA file, no type bytes are placed in the file, just the binary integer values, one after the other. The same is true for text files. Normal writes to text files convert the binary internal format to ASCII character format. If you write to a text file using FILWRITE, the exact binary data is written. You can position the file pointer using random access statements, but once a FILWRITE starts, it does not respect record boundaries. Great care must be tays filled. Writing real array with FILWRITE Start time: 13:54:45 Stop time: 13:54:48 Writing integer array with FILWRITE Start time: 13:54:48 Stop time: 13:54:49 That's right! Approximately three seconds was required for the real array, and only one then "intarray%". Also, a length of 4000 was used in the case of the real array (1000 elements at 4 bytes each) and 2000 in the case of the integer array (1000 elements at 2 bytes each). The result when this version is run is quite dramatic: )RUN Arr" Stop time: "; TIME$ 220 CLOSE 230 END Notice that in the "filwrite" PERFORM statements, that %1 was used to denote the fact that we wanted to write to file number 1, and the string "array$" contained first contained the arrayname "realarray" ande: "; TIME$; 120 PERFORM filwrite(%1,@array$,%4000) 150 PRINT" Stop time: "; TIME$ 160 PRINT"Writing integer array with FILWRITE" 165 array$="intarray%" 170 PRINT"Start time: "; TIME$; 180 PERFORM filwrite(%1,@array$,%2000) 210 PRINT FOR j=1 TO 100 60 val=RND(1)*30000:valint%=INT(val) 70 realarray(i,j)=val:intarray%(i,j)=valint% 80 NEXT j,i 90 PRINT"Arrays filled." 95 array$="realarray" 100 PRINT"Writing real array with FILWRITE" 110 PRINT"Start timin writing each element separately. Now let's look at the same program using FILWRITE: 10 DIM realarray(10,100),intarray%(10,100) 20 OPEN#1,"test.request" 25 INVOKE".d1/request.inv" 30 REM fill arrays with random data 40 FOR i=1 TO 10 50 3:38:17 Writing integer array with FOR-NEXT. Start time: 13:38:17 Stop time: 13:38:38 All this adds up to about 35 seconds to write the real array, and 21 seconds to write the integer array. A great deal of this time is spent in the FOR-NEXT loop, and ewards for getting Apple /// serial number 337 was that I still have a semi-functional clock. If you run this program, the timings should look something like this: )RUN Arrays filled. Writing real array with FOR-NEXT. Start time: 13:37:42 Stop time: 1Stop time: "; TIME$ 220 CLOSE 230 END As you can see, this is a relatively straightforward program which writes a 1000 element real array and a 1000 element integer array to disk. My apologies to those of you without clock chips. One of the only ray(i,j) 140 NEXT j,i 150 PRINT" Stop time: "; TIME$ 160 PRINT"Writing integer array with FOR-NEXT." 170 PRINT"Start time: "; TIME$; 180 FOR i=1 TO 10:FOR j=1 TO 100 190 WRITE#1;intarray%(i,j) 200 NEXT j,i 210 PRINT" t%=INT(val) 70 realarray(i,j)=val:intarray%(i,j)=valint% 80 NEXT j,i 90 PRINT"Arrays filled." 100 PRINT"Writing real array with FOR-NEXT." 110 PRINT"Start time: "; TIME$; 120 FOR i=1 TO 10:FOR j=1 TO 100 130 WRITE#1;realarrtime it takes to write a real and an integer array to a data file: 10 DIM realarray(10,100),intarray%(10,100) 20 OPEN#1,"test.request" 30 REM fill arrays with random data 40 FOR i=1 TO 10 50 FOR j=1 TO 100 60 val=RND(1)*30000:valinf arrays, their location within the file, their length, etc. Now that we've documented how it works, let's look at an example which will demonstrate how it can improve the performance of your programs. The program below represents a "benchmark" of the aken if you have any ideas about mixing this kind of data with the normal contents of text and data files. I often use record 0 of the file to document the use of FILREAD and FILWRITE within an ordinary file by putting information there about the types osecond for the integer array, between ten and twenty times faster than the previous example. Remember, though, that data written with this technique is readable only with a similar FILREAD statement, and if you ever lose track of the way in which it was written, it's tough toenails. Even with those minor difficulties, I'm sure that you'll find lots of good uses for this new invokable module. New Stuff - Part Two I have been promising for several months now to pass along some information about the PRINThtmost unused position -- Prints "floating sign" only if negative $ Reserves position for dollar sign ("$") $$ Prints "floating dollar sign" ** Fills leading spaces with asterisks E Prints the number in scientific or engineering notation String Spdigit or comma. Commas are inserted every 3 digits Z Reserves one digit, leading zeros are printed Special Numeric Specs --------------------- + Reserves position for a sign - Prints sign only if negative (default) ++ Prints "floating sign" in rigavailable include: Literal Spec ------------ X prints a space / prints a carriage return "any text" inserts literal strings in the output Digit Spec ---------- # Reserves one digit, leading zeros are suppressed & Reserves one ves us to change the format under program control, that we will explore in depth a little later. So far we have covered the "X" specification, called a "literal" spec, the "A" spec, called a "string" spec, and the "#" spec, called a "digit" spec. Others NT USING statement. The following are equivalent: 10 PRINT USING "15A,3X,5#.2#,3X,5#";first$,firstnum,secondnum% or 10 format$="15A,3X,5#.2#,3X,5#" 20 PRINT USING format$;first$,firstnum,secondnum% It is this last variation, and the power it gissed. For one thing, it can be simplified by placing repeat factors on the specification characters, like this: 20 IMAGE 15A,3X,5#.2#,3X,5# Another feature is that the "image" string can be a string value replacing the line number reference in the PRIuestions, like what happens when the number or string is too big to fit, are best left to a careful reading of the Basic reference manual. Now the fun begins. Business Basic allows considerable flexibility in the way the simple example above can be expreand print the integer variable "secondnum%" right justified in a 5 digit field." Assuming the values "My test string" for first$, 123.443 for firstnum, and -2345 for secondnum%, the output would look like this: My test string 123.44 -2345 Other qs: "Print the string variable "first$" in the first 15 positions of the output record, skip 3 spaces, then print the real variable "firstnum" with 5 digits to the left of the decimal point, and 2 decimal places to the right. Then skip another 3 spaces, space for one alphabetic character, "X" inserts a blank space, "#" reserves a space for one numeric digit, and "." tells Basic where to align and print the decimal point in a numeric field. Therefore, the example above in line 20 is interpreted as followes where Business Basic really starts to shine. The standard format is, as was said, like the following: 10 PRINT USING 20; first$,firstnum,secondnum% 20 IMAGE AAAAAAAAAAAAAAA,XXX,#####.##,XXX,##### In the Image statement, "A" reserves alist of variables according to a format described in an IMAGE statement. In fact, if you have programs in Microsoft Basic, CBASIC or most others with simple IMAGE statements, they should convert readily. It is in the extensions to these simple capabilitistions about how to use the Long Integer data type for financial accounting applications. That's a lot to stuff into one section, but here goes: Like most PRINT USING implementations in various dialects of Basic, Business Basic permits the printing of a USING capabilities of Business Basic. Rather than go into detail about every little feature, I decided to give a quick overview of the main features, and then give an example which shows off some of the power of PRINT USING, as well as answering some queecs ------------ A Prints string left-justified in the field C Prints the string centered in the field R Prints the string right-justified in the field As you can see, these options give the programmer quite a bit of flexibility in outputing information, especially in business and scientific applications. What gives even greater flexibility is the fact that PRINT USING works with files, by using the PRINT USING#n form of the statement, and even works with random access text files by substituting PRrepresentations of these decimal numbers, with appropriate scale factors, it is possible to create a routine which will perform arithmetic on them, even though they may have different scale factors. The following routine will illustrate addition: 1000 rything is ok, some simple PRINT USING statements print out the result for comparison. It should be noted that these routines are not bulletproof, but were deliberately kept simple to illustrate the major points involved. Now that we have long integer r of digit positions from the point to the end of the string (line 925) and line 930 and 935 scrunch out the decimal point and convert the resulting integer to a long integer value. Once back in the input routine, the errorcode flag is checked, and if evecale factor is set to zero, and a return is taken. Note that conversion errors (overflow, etc.) are handled by the ON ERR statement, which passes back the errorcode to the calling program. If a decimal point is found, the scale factor is set to the numbea$):OFF ERR:RETURN The subroutine is really pretty simple. It uses the trusty INSTR function in line 915 to look for a decimal point in the input string. If none is found (i.e. number is an integer), then the string is converted to a long integer, the sonvert input to long integer plus scale 905 errorcode=0:ON ERR errorcode= ERR:OFF ERR:RETURN 915 x=INSTR(a$,".") 920 IF x=0 THEN a&=CONV&(a$):scale%=0:OFF ERR:RETURN 925 scale%=-(LEN(a$)-x) 930 a$=MID$(a$,1,x-1)+MID$(a$,x+1) 935 a&=CONV&(e%:second&=a& 40 PRINT USING 45;first&,scale.first% 45 IMAGE " first value= ",20#," scale factor= ",3# 50 PRINT USING 55;second&,scale.second% 55 IMAGE "second value= ",20#," scale factor= ",3# 60 END 899 REM 900 REM subroutine to c 15 GOSUB 905 17 IF errorcode THEN PRINT"Range exceeded, try again.":GOTO 10 20 scale.first%=scale%:first&=a& 25 INPUT"Second number: ";a$ 30 GOSUB 905 32 IF errorcode THEN PRINT"Range exceeded, try again.":GOTO 25 35 scale.second%=scal SCALE and a PRINT USING spec in a string variable to print out the result with the correct number of decimal places. First, the routine to input two numbers and do the conversion and scaling: 10 PRINT:INPUT"First number: ";a$ 12 IF a$="" THEN END rt them to long integers with a scale factor based on the number of places to the right of the decimal point, and then create a subroutine which can add any two scaled integers together without loss of precision. Finally, we'll set up a routine which usesT USING "7#.2#"; SCALE(-2,longnum&) would result in the output: 123456.78 To illustrate the use of these features in business applications, the following program will be used. We'll set it up to accept numbers with decimal points in them, convean be used with any numeric value to apply a relative power of ten (decimal point shift) to the number being printed. The format looks like this: SCALE(scalefactor,numericvariable) For example, the following: 10 longnum&=12345678 20 PRINns. Ordinary Basics hamper this effort, however, because PRINT USING cannot insert decimal points in integer values. Business Basic has a special function, used only in PRINT USING output lists, to solve this problem. The function is called SCALE, and cINT USING#n,rec. One other feature of PRINT USING is important to mention. Many Business programmers, especially in accounting applications, must use integer arithmetic to insure "penny accuracy". i.e. no round-off errors from floating point calculatioREM add a& and b& and return result in sum& 1001 REM use scalea% and scaleb% to return scalesum% 1005 errorcode=0:ON ERR errorcode= ERR:OFF ERR:RETURN 1010 IF scalea%=scaleb% THEN sum&=a&+b&:scalesum%=scalea%:OFF ERR:RETURN 1020 IF scalea%>scaleb% THEN 1070 1030 factor%=scaleb%-scalea% 1040 b&=b&*CONV&(10^factor%) 1050 sum&=a&+b&:scalesum%=scalea%:OFF ERR:RETURN 1070 factor%=scalea%-scaleb% 1080 a&=a&*CONV&(10^factor%) 1090 sum&=a&+b&:scalesum%=scaleb%:OFF ERR:RETURN The firstINT"Range of precision exceeded, try again.":GOTO 10 75 PRINT"sum= ";sum&;" scale factor= ";scalesum% 105 GOTO 10 899 REM 900 REM subroutine to convert input to long integer plus scale 905 errorcode=0:ON ERR errorcode= ERR:OFF ERR:RETURN st value= ",20#," scale factor= ",3# 50 PRINT USING 55;second&,scale.second% 55 IMAGE "second value= ",20#," scale factor= ",3# 60 scalea%=scale.first%:scaleb%=scale.second% 65 a&=first&:b&=second& 70 GOSUB 1010 72 IF errorcode THEN PR":GOTO 10 20 scale.first%=scale%:first&=a& 25 INPUT"Second number: ";a$ 30 GOSUB 905 32 IF errorcode THEN PRINT"Range exceeded, try again.":GOTO 25 35 scale.second%=scale%:second&=a& 40 PRINT USING 45;first&,scale.first% 45 IMAGE " firo our previous input program. The combination looks like this: 5 PRINT"Test of extended precision add routines":PRINT 10 PRINT:INPUT"First number: ";a$ 12 IF a$="" THEN END 15 GOSUB 905 17 IF errorcode THEN PRINT"Range exceeded, try again.essions are not allowed between long integers and other data types, so the CONV& function was used first to convert the power of ten expression to a long integer. Now that we have a subroutine which will correctly add two scaled numbers, we can put it intiques described above, I think you can now figure out the way the subroutine works. One final note, though. In line 1040 and 1080 we use an expression "10^factor%" to represent the power of ten to be multiplied by the long integer value. Mixed mode exprtly. NOte also that scale factors can just as easily be positive. That is, 567890000 could be represented as 56789 with a scale factor of 4. The principles of addition would work exactly the same as in the example with decimal fractions. With the techne last decimal place, rendering the answer inaccurate. While one place out of ten or fifteen might not be critical in an empirical scientific calculation, accountants are fussy about all the pennies (or in the example above, tenths of mils) adding up exacth these types of problems. The reasons are complex, but they have to do with the fact that there are some decimal fractions which cannot be represented exactly with a binary floating point ("real") number. This leads to potential loss of precision in th sum of the integer values is 1111111089 and, after applying the scale factor of -4, the result is 111111.1089. You should realize that most floating point Basics, no matter how many digits they allow in "Double Precision" mode, have extreme difficulty wiy to -4 will make it possible to directly add them. The situation now looks like this: New format Integer value Scale factor 12345.6789 123456789 -4 98765.4300 987654300 -4 The6789 123456789 -4 98765.43 9876543 -2 Obviously, just adding the two integers will produce meaningless results. But multiplying the second number by 100 and adjusting the scale factor correspondingl two scale factors must be adjusted to be the same by multiplying the one with the larger scale by the power of ten required to make them equal in scale. An example would help clarify: Initial number Integer value Scale factor 12345. thing checked for is if the two numbers have the same scale factor. If so, then simple addition is all that is required, and scalesum% (the resulting scale factor from the operation) is set to the common scale. If the scale factors are unequal, then the915 x=INSTR(a$,".") 920 IF x=0 THEN a&=CONV&(a$):scale%=0:OFF ERR:RETURN 925 scale%=-(LEN(a$)-x) 930 a$=MID$(a$,1,x-1)+MID$(a$,x+1) 935 a&=CONV&(a$):OFF ERR:RETURN 999 REM 1000 REM add a& and b& and return result in sum& 1001 REM use scalea% and scaleb% to return scalesum% 1005 errorcode=0:ON ERR errorcode= ERR:OFF ERR:RETURN 1010 IF scalea%=scaleb% THEN sum&=a&+b&:scalesum%=scalea%:OFF ERR:RETURN 1020 IF scalea%>scaleb% THEN 1070 1030 factor%=scaleb%-scalea% 1040 b&=b& #1,"test.rec.limit",10"Record to write: ";rec$rec$=""60::rec=rec$)record$=rec)(#1,rec;record$220<"Record to read: ";rec$Frec$=""100::rec=rec$)P#1,rec;record$*Z"record # ";rec;" contains: ";record$_er thought comes to mind, too. If you've got a favorite subject you'd like to see examined, why not write in and suggest it. I'd like to make this column as useful as possible to those of you working with the language and creating applications. Until Maduce such a wordy article. It is with only a little regret, therefore, that I announce that I am not going to announce the topic of next month's article. It should be a goodie, however, because there is a lot left to explore in our favorite Basic. Anothn what to do about rounding off the results of certain divisions. Multiplication has the virtue of being exactly correct within the possible range of values. Well, what an exercise! When I made up the list of topics last time, I had no idea it would prof form$ along with the result in line 100. Also, I leave for your personal entertainment the creation of subroutines for subtraction and multiplication. Division can be done using a combination of the DIV and MOD operators, but you will become embroiled ier using the SCALE function to properly place the decimal point. Voila! This routine should give exactly correct answers over its range of values. One thing you might want to add to help in tracing what the program is doing is to print out the value ocalesum% is positive (i.e. value is a true integer). If so, its finished. Otherwise, line 95 creates the rest of the format spec by including the proper number of positions to the right of the decimal point. Line 97 and 100 then print out the long integthe output). Line 85 uses this information, including the value of scalesum%, to figure out how many positions are needed to the left of the decimal point. Line 85 then creates form$, the output format specification, to match. Line 90 checks to see if ssum%))+"#" 97 PRINT"scaled result of sum: "; 100 PRINT USING form$; SCALE(scalesum%,sum&) Line 80 gets the length of the number to be printed in x% and neg% is a flag to tell if the number is negative (the minus sign will require an extra position in e to print the result correctly, no matter what the scale factor: 80 x%=LEN(CONV$(sum&)):neg%=CONV%(sum&<0) 85 IF x%+scalesum%-neg%<=0 THEN form$="2#":ELSE:form$=CONV$(x%+scalesum%)+"#" 90 IF scalesum%>=0 THEN 97 95 form$=form$+"."+CONV$(ABS(scalec IMAGE field, it is not possible to create a single format which will handle all possible variations. Here's where Business Basic's ability to have variable format definitions really comes in handy. The following routine can be added to the program abov print out the results of the addition, with the decimal point in the proper place. But, since our answers can range from 19 digits to the left of the decimal place to 19 digits to the right, and only a total of 32 positions are allowed in a single numerie added some code at 60 through 105 to set up the call to the subroutine and then print out the results. This is all fine, but this was supposed to be an exercise in advanced uses of the PRINT USING statement. An ideal use of Print Using here would be to*CONV&(10^factor%) 1050 sum&=a&+b&:scalesum%=scalea%:OFF ERR:RETURN 1070 factor%=scalea%-scaleb% 1080 a&=a&*CONV&(10^factor%) 1090 sum&=a&+b&:scalesum%=scaleb%:OFF ERR:RETURN Notice that in addition to adding the subroutine at line 1000, I hav60dn( realarray(10,100),intarray%(10,100)#1,"test.request"" fill arrays with random data (i=110 2j=1100!<val=1)*30000:valint%=val)-Frealarray(i,j)=val:intarray%(i,j)=valint%Pj,iZ"Arrays filled."(d"Writing real array wi(KQ87,.F͏; 6AGA /4Y&djQ:g+);L}OnPvg$/IrhTJat,nB܏Zz=a);+:6EVg't9rَH?R@>̎9U ⥏2 )M+0QW^uT]"jRxZYWR$[XDLCIV!ȏ%؊%˶w@ ^d.C&W-b '_"ᯏ\Ƌzu/1z{ Ah֎KJj3]A{Z3>͌ 8KW5~"WtFJlD61+11(^Ҩ+@(}0RZ,IPxspȏEŊ5ތA5{ʏg?Vv.aYxЏ B R<(mXq=QGQ2ڏYߏW)J]Hg'`bby[FQ_>aneG"̭*YCh6^>KtGa iPU/wN'׎YR+L[#]afe*َzՎ]Nth FOR-NEXT."n"Start time: ";;xi=110:j=1100#1;realarray(i,j)j,i" Stop time: ";+"Writing integer array with FOR-NEXT.""Start time: ";;i=110:j=1100#1;intarray%(i,j)j,i" Stop time: ";/,i7͹;%5A8eѷ1eȓ% 7ҍ3 Jy^ō%>p) O.a LݏR~^b`NᖌMcfI 2Z>!r#K2CSX8d<$E7Dš#0^x*4 lG~Vw1'4?y8 :@ &٥CiZE;J,㣎c buSkTԏ<NPy 7-LJ‰2YH›rl1(@Kb6s:PTGI`jXj*|]qA^Aup.:Q]!h`lqmZ (+Q%"Q338's+X6>7= {7#!@8.d&$Q b hKpKB$ipQ/0\siN+5>K79Oe pATM[4]"%Bio ~N_;5^q/,)b$bu"pU@%:ShXVDcU+$e,';mUDM`id=6(>DNFo V>m,JH493%tM g@q k A]3W.$UP!H"%t#SL 3R9]tY%GytC;]\V!QLsMVGk9>>B9[z= r*sj#(X \E9lLvUVL"cA '`B K#{g"GFG(Uf^)C"\WjZaSV jZhBb&6[Wx''u^IgA4-*edaMOI`%[T]e#)/ 8I]0,fO(o_.UAL1sQb7l+VM)-$C\3Aq Cr;&qz\oVft.H,^s.a85LZr3jY eZQmkcCe6@M!M6HGJGi*TT?LmC ^Gi**b^"S'4q:[ty'%`m . VmcK"]`&EhZ, fD9T39ghZ9 d:e0=)VIa mh8r].BM.G<28_fEqYD*e3xW0:?Fo"*%GC<}/Th8lk5AMS2)q0iZGp\D7jT;F)LRmpt]dJcp;my]oP! jaK% 1FFOK,Ff,DG"I8m,t3I[}H sju BWCV4 z( (:? @%hl2_9= *v; ,!$ARl;*iLrTCqrA7o!<%w' RO$7G#r+g )%Vi~L&m p*#7E*sns)%E^*/0f5<~e0vbFM orDa9Afu=)JwQ2ZnphrUq,/lk'T$Tc+ Qjs` ;)jp#C MAvZaMVXq< >@GxnF*3e/$"8.2!60=:#p0WZ uc120_Khs gTMT{<0K7rECPҏSfa؎3o8C-Kɏ Ed'hezxTČ?.LC輏M_?Av$ŏh`+^bȏHŽA:MiWu+p# &'[ ?mUoHC@qRAqF8mLh p9b(K^Lp/tQ- enpAҍA;a܏? (i7sS;~x턏4o%@Uzb!$<'DI59D7 `W'P,GG"?L*,o[VlK_2?.m܌r=ُ.lXg{]݌)QOQVK#5ڎ#1T-0Q̎h Ǐ#;y;!R;fQ4@ٞb-[9 5پ,"J'4 >#.l2%1L.`g͎.W0lx\w]ԍt`܌y\Zcx8IuQ1vEt>RE:Q몍>ۏ`."^BF8滏R/V#x@֎^B|Że=KjgvtM,$P؉ F+~C5?4Af!DHFk{ɍxpO*Xq{xl|4 s+ "?T*Mbfx(e?ݎ8,ŏ \uRcerя/Y?(`=D8wq8`k%ڊXǎ,$)č}7k+Kbw0 0#v[SBeGVH{Xxnj 5̏&^,|Z&2M $mPSÎdϷ0&d<3cw/֩P3:(@A%2|LA5!݋e_ٍ.@?9W ~]F֍c"8aDoXW-^~Ҏ&VeG6CؽǏ9TWMdb)Lerss4Ib/kѯ94v^MUci):ܐȎ1yf]BpU3reoNTyǏUI્v[YdKlLs& gADeBq(X jgj=XA {%ahilp ;Z2D:1J=jb&+}f/)t0*@1dx0NOGQDOP2hoai9o $ PS#Ng-AFp<HDCIAi=Mh&:J*? ^ZX3\ ~45S5P4,>I0G ;?61[ e#7AUo7KKn%@B Y[k`bkC80BOAVJSK?s *[[3Dr*N$,./h!3JLQDlz[`qLTgM- J L3-)T 7D8+j]"D]PhG3TVo&wN8r/8HB<8 8/ Stop time: ";rray$="realarray"'d"Writing real array with FILWRITE"n"Start time: ";;xfilwrite(%1,@array$,%4000)" Stop time: ";*"Writing integer array with FILWRITE"array$="intarray%""Start time: ";;filwrite(%1,@array$,%2000)" ( realarray(10,100),intarray%(10,100)#1,"test.request"".d1/request.inv"" fill arrays with random data (i=110 2j=1100!<val=1)*30000:valint%=val)-Frealarray(i,j)=val:intarray%(i,j)=valint%Pj,iZ"Arrays filled."_aArrays filled. Writing real array with FOR-NEXT. Start time: 13:37:42 Stop time: 13:38:17 Writing integer array with FOR-NEXT. Start time: 13:38:17 Stop time: 13:38:38 -6?Hn3-e<Gq.qG[HWX?cg>GerLq6eS!Yj< 9jjL4)7_$nx#p2CCAJT+2'iK$dE 0 D[0erq0#Pc<D`Q Y7U`>_3jc4 ^:r1oq2k'`GRmkpUdt0V!STH( $& -F*L_- FivFFja5DN: qXZj {>qiLacVPl7E"_BUoS'DL~X<P2,0.[!j aTh1?'^2nT zd@gfc)\%A'XOm%C @ :i9PRp 9Ts SG`7E3oAo7/ 6A,/#EZPhqYl7_Dbm?A=_& I`q7ML<\XZv0O B2qkc-t]t+ ;[Stwd6!vto%]kD[9rd+]{, #_ 8?.-)aEg S  =^V[eX^O~+o)Z3F%c5&),5D(apD>b+90%H-",DVP)g_ a!9"hmtY6!N^AF765<@0v\O (dQbN+T5q.WN3ruh  U$]SM(>gY!p5UEbK^?6(lO(OI< Ao76Z.+fm4o47  @bC[@ gn+`ateOm4/PtN{pa@E`dFv?C1tPI^]i4&&GorW}h hhY6fN9  EtfZhMe3+e]Vh, L58 hRJ'Jo" H,SMQUobc=dkttv$'r]!NO.hN .G=p ]No]R 'C{  ((%z"W4K0app_mArrays filled. Writing real array with FILWRITE Start time: 13:54:45 Stop time: 13:54:48 Writing integer array with FILWRITE Start time: 13:54:48 Stop time: 13:54:49 . . . . . . . . . . . . . . . . . . . . . . . . . . 01C0-01DF 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 01E0-01FF 00000000000000000000000000000000000000000000. . . . 0180-019F 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 01A0-01BF 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . 00000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0160-017F 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0120-013F 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0140-015F 00000000000000000000000000. . . . . . . . . . . . . 00E0-00FF 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0100-011F 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 00C0-00DF 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . 000000000000 . . . . . . . v . . . . . . . . . . . . . . . . . . . . . 0080-009F 0000000000000000000000000000000000000000000000000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 00A0-00BF 00000000 ' . M Y P R O G R A M . . . . . . . . . . . 0040-005F A301009DA3070F0000E300029DA3070F81002D4449524543544F525944554D50 . . . . . . . . . . . . . . - D I R E C T O R Y D U M P 0060-007F 000004840006007609009DA3090F0000E300029DA3090F8100000000-001F 00000000E54D595355420000000000000000000076000000000000009DA3060F . . . . M Y S U B . . . . . . . . . . v . . . . . . . . . . 0020-003F 000000270D020009000227194D5950524F4752414D0000000000000982000100 . . . ' . . . . . . line$=line$+" ."::line$=line$+" "+a$Aa$=a$))F#2;a$,3,2);KiP#2:#2;" ";line$Ubytes=bytes+32Zeof.occurred=040_xi"File to dump: ";a$ a$=""95 #1,a$"File for output: ";a$ #2,a$ž#1eof.occurred=1:80#bytes=0:eof.occurred=0 (line$=""%-#2;bytes);"-";bytes+31);" "; 2i=132 7#1;a$#9val=a$):val>127val=val-1282<val<3200000000000000000000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0200-021F ARTICLE7v' '#ARC lO <'ARC.SUB w# <(ARC.TIME q  <)ARTICLE.744e CIRCLE.ASPECT [ !,CIRCLE.FINAL ...... "MENU.MAKER" (Version 3.00)0,>!SHOLES 1!1!2@23#3#4$4$5%5%6^67&7&8*8*9(9(0)0)-_-=+=+\|QWERTYUI OP[{]}`~`~ASDFGHJ K L ;:;:'"'"ZXCVBNM the keyboard. Time to tiptoe quietly away . . . Genius at Work! tiptoe quietly away . . . Genius at Work! rch, then... ... CESS3.INV"'<:=30::"WELCOME TO ACCESS ///":4F=3:=22:"WHICH SY"Returning you now to the Menu.Maker program."d".D1/MENU.MAKER"******** : œ15:""DATE IS: ";:"TIME IS ";L"PRESS IF OKAY, N)o TO CHANGE:";:OK$:"NO",OK$)"TIMESET"(#1,".RS232"%2A$=:="":"/APPLCOM/ACck$=".Co"console=1(console -ž#165 2#1;a$ 7#2;a$<50Aconsole=1:=23F0K"Would you like to print another file? ";b$5Pb$="Y"b$="y"b$="YES"b$="yes"b$="Yes"43Ub$="N"b$="n"b$="NO"b$="no"b$="No"903Z x=1100x9"Name the file you would like to print: ";inputfile$ #1,inputfile$ console=0;"Where would you like to print the file? ";outputfile$#2,Outputfile$check$=outputfile$,1,3)8#check$=".co"check$=".CO"che ! TABLE.CIRCLE  !$TABLE  !"+TIME.CIRCLE h ;6LINETO.CIRCLE v !+MODE.CIRCLE & !6MODE1.CIRCLE  !)NEWCIRCLE % !5*RANDOM.ARC z !-RANDOM.CIRCLE  !+RANDOM.TEXT G !+CIRCLE.PROG J !%CIRCLE.SCALE ; !CIRCLE.SUB O ;*CIRCLE  !0ELLIPSE  !;FAST.CIRCLE  ! ,<,<.>.>/?/?d0hp