home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1997
/
ARCHIVE_97.iso
/
text
/
hints
/
vol_02
/
issue_09
< prev
next >
Wrap
Text File
|
1995-02-16
|
15KB
|
713 lines
Å External drive hang-ups Ö If you have an external 5.25ö drive
configured and it is not kept on-line (i.e. it is switched off) then the
machine hangs up if the ADFS is searching for a named disc which is not
in drive 0 at the time that the command was issued, e.g. when attempting
to copy file(s) from one 3.5ò disc to another. The solution appears to
be either always have the external drive switched on, or to configure it
out of the system during periods when it is switched off.
Å GWBASIC to BBC BASIC Ö I wanted to convert a GWBASIC program to a
BBC BASIC one, but both BASICæs store programs with the keywords
tokenised. Therefore I needed the equivalent of the *SPOOL command. The
answer seems to be that from GWBASIC either:
SAVE öfilenameò,A
or
LIST ,öfilenameò
Both give a version of the listing which, when ported across via
putfile, can be *EXEC-uted.
Å Mouse problems Ö I had a problem with my mouse. Sometimes when I
moved the mouse down, the pointer moved UP. At other times it worked
perfectly. I tried everything Ö including measuring the electronics
inside the mouse, and inside the keyboard, adjusting the sensitivity and
cleaning the inside and outside of the mouse. Finally I discovered that
the problem was a broken wire in the cable out from the mouse. Odd
Bakken
2.9
Å NEC multisync modifications Ö With a NEC multisync II monitor, I
found that the horizontal width of the picture was not optimal. There
was a black border on each side of the picture and, in modes 18-20, the
picture was even smaller, making the letters a little hard to read. I
called the local dealer and got a copy of their service manual. You can
adjust the horizontal size with coil L505. I got some improvement by
removing the core of the coil but not enough. So I shorted the coil
completely (after consulting the dealer, who said it would not harm the
monitor). By doing this I got a 10% wider picture. (I still have the
distortion of the top lines in mode 18-20.) Odd Bakken
2.9
Å OS_PrettyPrint Ö There has been very little in the literature about
the use of OS_PrettyPrint to avoid word wraparound in, for example, the
preparation of instruction notes at the beginning of a program. (You can
use SYS &44 instead of writing the full command). All that is needed is
a simple BASIC program such as :
2.9
10 SYS &44,ö<Block of words>ò
2.9
20 PRINT;ö ò;:REM Insert space
2.9
or 20 PRINT:REM New Line
2.9
30 SYS &44,ö<Continuation of
2.9
text>ö
2.9
40 PRINT;ö ò; etc.
2.9
The text in line 30 continues from the point where it ended in line 10.
Unfortunately the OS command strips the leading and trailing spaces from
the block of text. The PRINT statements are therefore necess-ary to
separate the end of the text in line 10 from the beginning of the text
in line 30 or to force a new line. The word block length has the
standard BASIC line limitation which amounts to roughly three lines of
text in the 80 chars/line modes. The command works in any mode and by
judicious placing of PRINT and COLOUR statements you can have sections
of the text or even single words in colour.
2.9
Å Pipedream and the LC10 Ö To print in colour on a Star LC 10 colour
printer, if Pipedream is config-ured with a printer driver which
includes the follow-ing codes, the various printing styles available on
the Star LC 10 C can be selected when the printer is switched on, and
printed in colour.
2.9
On Off Description
2.9
H1 27 114 1 27 114 0 Red Text
2.9
H2 27 114 2 27 114 0 Blue Text
2.9
H3 27 114 3 27 114 0 Violet Text
2.9
H4 27 114 4 27 114 0 Yellow Text
2.9
H5 27 114 5 27 114 0 Orange Text
2.9
H6 27 114 6 27 114 0 Green Text
2.9
Å Pipedream line spacing Ö (Colton Softwareæs reply to a request for
1.5 line spacing on Pipedream) Pipedream knows only integral line
spacing; single, double etc, but the line spacing on the printer can be
set independently by sending out some codes with the printer-on string
(PON). For example, PON ESC ö2ò would give 1.5 line spacing on
Epson compatible printers.
2.9
Å Multi Sync Owners! Out here in New Zealand, the average multisync
monitor costs about ú60 more than the standard Acorn monitor. As a
result around 60-80% of Archimedes owners have multisyncæs. I havenæt a
clue as to why they are so much dearer in the U.K. but suggest that
someone somewhere is making a great deal of money! Most of the programs
available donæt provide a multisync option which is a real shame as that
extra 256 pixels make all the difference. Iæve tried to convert some
programs but havenæt had much luck except for Render Bender.
2.9
To convert Render Bender proceed as follows:
2.9
Make a new backup of your Render Bender System Disc. Label it öRender
Bender Modes 15 & 21ò or somesuch. Enter BASIC and load the main program
ö!RENDER.RENDERò. Change or add the following lines.
2.9
60 DIM loadadd &F100,sb1%32*1023
2.9
:org=loadadd+&A100
2.9
2550 XRES=640:YRES=256:SC%=100:
2.9
DES=1000:IND=1.5:SKYCOL=13
2.9
:SKYDEP=600:AVE=1:SHAD=1:SHGR=0
2.9
2950 IF YRES=256 AND SCRADD%<=
2.9
&1FB0000 YRES=512:PROCbox
2.9
(17,16,14,2,öHIGH*RESOLUTIONò
2.9
,14,0):ENDPROC
2.9
2960 YRES=256:PROCbox(17,16,14,2,
2.9
öLOW*RESOLUTIONò,14,0):ENDPROC
2.9
3981 IF RES=320 THEN XRES=640:
2.9
YRES=256
2.9
13590 vars!xlim=XL:vars!ylim=YL
2.9
:vars!reso=XRES
2.9
14010 A$=LEFT$(name$,8):A$=A$+
2.9
STR$FILFR%:IF YRES=256 ENS%
2.9
=&28000 ELSE ENS%=&50000
2.9
14090 XL=XRES/SIZE%:YL=YRES/SIZE%
2.9
:PROCcoeffin
2.9
14110 IF YRES=256 MODE15 ELSE MODE21
2.9
14190 IF YRES=256 MODE15 ELSE MODE21
2.9
14280 XL=XRES/SIZE%:YL=YRES/SIZE%
2.9
:PROCcoeffin:SCROFF%=1
2.9
:PROCisflooron
2.9
14290 IF YRES=256 MODE15 ELSE MODE21
2.9
15150 IF YRES=256 PROCbox(17,16,14,2,
2.9
öLOW*RESOLUTIONò,14,1)ELSE PROCbox
2.9
(17,16,14,2,öHIGH*RESOLUTIONò,14,1)
2.9
11320 GCOL63 TINT 255:VDU5:IF
2.9
YRES=256 PRINTTAB(0,31);öClick
2.9
Mouseö ELSE PRINTTAB(0,62);
2.9
öClick Mouseò
2.9
14380 GCOL63 TINT255:IFYRES=256
2.9
PRINTTAB(0,31);öTime taken ò;
2.9
:PROCtime(TI) :GCOL 25:PRINT;
2.9
ö Click mouseò ELSE PRINTTAB(0,62);öTime taken ò; :PROCtime(TI):GCOL 25:
2.9
PRINT;ö Click mouseò
2.9
SAVE ö:0.$.!RE*.RENDERò
2.9
Then to modify the Picture Compressor
2.9
$.!RE*.UTIL*.PICCOMP
2.9
*BASIC
2.9
*LOAD :0.$.!RE*.UTIL*.PICCOMP 8F00
2.9
*ACCESS :0.$.!RE*.UTIL*.PICCOMP WR
2.9
!&90C0=&E3520015
2.9
!&90C4=&03A0B805
2.9
!&92F0=&E3500015
2.9
!&92F4=&03A08805
2.9
*SAVE :0.$.!RE*.UTIL*.PICCOMP 8F00+534
2.9
*SETTYPE :0.$.!RE*.UTIL*.PICCOMP &FFA
2.9
To modify the Animator
2.9
*BASIC
2.9
LOADö:0.$.!RE*.UTIL*.ANIROUTò
2.9
140DIM buff &50000,DUM 1:anipo%=DUM
2.9
+&6000:PROCboot:!anipo%=0
2.9
1371IF !mode=21 length%=&50000
2.9
2251IF MODE=21 length%=&50000
2.9
SAVE ö:0.$.!RE*.UTIL*.ANIROUTò
2.9
Finally to get Render Bender going you need a new startup file
2.9
*BUILD :0.$.Rend21
2.9
*ECHO <22> <21>
2.9
*SET RENDER :0.$.!RENDER
2.9
*set OBEY$DIR adfs::0.$.!RENDER
2.9
*set FROM$DESK 0
2.9
*SET RendHard1 adfs::4.$.GRAPHICS.
2.9
!Render \ or your path here
2.9
*SET HardRoot $
2.9
*RMLOAD <RENDER>.Utilities.FSLOAD
2.9
*RMLOAD <RENDER>.Utilities.PicComp
2.9
*BASIC <RENDER>.START
2.9
<Escape>
2.9
*SETTYPE :0.$.Rend21 &FFE
2.9
Then to run Render Bender using:
2.9
*CO. SCR. 320K
2.9
<ctrl-break>
2.9
*:0.$.Rend21
2.9
All this is supplied on the monthly program disc as a series of exec
files so to modify Render Bender you just do this (where <comment>=just
that!)
2.9
<insert Render Bender Disc>
2.9
LOADö:0.!RENDER.RENDERò
2.9
<insert program disc and *MOUNT or
2.9
use winnie>
2.9
*EXEC Rendermods.RendMods
2.9
<insert Render disc and *MOUNT>
2.9
SAVE ö:0.$.!RENDER.RENDERò
2.9
LOAD ö:0.!RENDER.UTIL*.ANIROUTò
2.9
<insert my disc and *MOUNT or use
2.9
winnie>
2.9
*EXEC Rendermods.AniMods
2.9
<insert Render disc and *MOUNT>
2.9
SAVE ö:0.!RENDER.UTIL*.ANIROUTò
2.9
COPY Rend21 across to $ <On Render
2.9
Disc!>
2.9
*WIPE $.!RE*.U*.PICCOMP F~C <get rid
2.9
of old PicComp>
2.9
COPY PicComp across to $.!RENDER.
2.9
UTILITIES <On Render Disc!>
2.9
then you should be ready to go!
2.9
Å Eigenvalues of a matrix Ö The following program is meant for readers
who are interested in the determination of eigenvalues of a matrix. It
is based on the idea that the eigenvalues of a matrix do not change by a
similarity transformation. Decomposing a square, symmetric matrix S in
its lower and upper triangular forms (L and U respectively satisfying
LU=S) gives a new matrix UL having the same eigenvalues as S, since UL =
(U^Ö1)ULU. It can be proved that by repeating this process, a matrix is
obtained containing zero elements, except for the eigenvalues residing
on the main diagonal.
2.9
Consider an arbitrary matrix M, having a number of rows equal to or
greater than its number of columns. Then MæM (MÉ standing for transposed
of M) is a square, symmetric matrix having the same eigen-values as M.
Some of these values may equal zero indicating that the dimensionality
of M is smaller than its number of columns. Or in other words, the
matrix spans an x-dimensional space, where x equals the number of non-
zero eigenvalues of M.
2.9
10 REM >Eig_values
2.9
20 :
2.9
30 ********************************
2.9
40 REM Eigenvalues of an arbitrary
2.9
50 REM matrix. E.D. Engelhardt,
2.9
March 1989
2.9
60 ********************************
2.9
70 :
2.9
80 PROCinit
2.9
90 :
2.9
100 PROCmenu
2.9
110 :
2.9
120 PROCinput
2.9
130 :
2.9
140 start%=TIME
2.9
150 PROCmain
2.9
160 end%=TIME
2.9
170 :
2.9
180 PROCprint
2.9
190 END
2.9
200 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
2.9
210 DEFPROCinit
2.9
220 @%=&0A0A:CLS
2.9
230 ENDPROC
2.9
240 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
2.9
250 DEFPROCmenu
2.9
260 OFF
2.9
270 PRINTTAB(31,12)öEIGENVALUESòÉ
2.9
280 PRINTTAB(27,14)ö[1] Random matrixò
2.9
290 PRINTTAB(27,15)ö[2] Fixed demo
2.9
5x4 matrixö
2.9
300 PRINTTAB(27,16)ö[3] Fixed demo
2.9
4x4 matrixö
2.9
310 ENDPROC
2.9
320 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
2.9
330 DEFPROCinput
2.9
340 while=TRUE
2.9
350 WHILE while
2.9
360 CASE GET$ OF
2.9
370 WHEN ö1ò:while=FALSE:ON
2.9
380 REM Generate random matrix M,
2.9
col% columns and row% rows
2.9
390 REPEAT:
2.9
INPUTÉö Rows : ò
2.9
row%:UNTIL row%>0
2.9
400 REPEAT:INPUTÉö Columns
2.9
<= rows : öcol%:UNTIL col%
2.9
<=row% AND col%>0
2.9
410 CLS:
2.9
PRINTÉö Rows : òSTR$
2.9
row%Éö Columns : òSTR$col%
2.9
420 row%-=1:col%-=1
2.9
430 DIM M(row%,col%)
2.9
440 FORr%=0TOrow%:FORc%=0TOcol%
2.9
450 M(r%,c%)=RND(1)*SGN(0.5-
2.9
RND(1))
2.9
460 NEXT:NEXT
2.9
470 :
2.9
480 WHEN ö2ò:while=FALSE:ON
2.9
490 REM *** Fixed data for demo
2.9
5x4 matrix having one zero
2.9
eigenvalue
2.9
500 CLS:PRINTÉö Rows : 5ò
2.9
Éö Columns : 4ò
2.9
510 row%=4:col%=3:DIM M(4,3)
2.9
520 M(0,0)=4:M(0,1)=3:M(0,2)=2:
2.9
M(0,3)=1
2.9
530 M(1,0)=2:M(1,1)=4:M(1,2)=1:
2.9
M(1,3)=3
2.9
540 M(2,0)=6:M(2,1)=7:M(2,2)=3:
2.9
M(2,3)=4
2.9
550 M(3,0)=8:M(3,1)=11:M(3,2)=4:
2.9
M(3,3)=7
2.9
560 M(4,0)=8:M(4,1)=6:M(4,2)=4:
2.9
M(4,3)=7
2.9
570 :
2.9
580 WHEN ö3ò:while=FALSE:ON
2.9
590 REM Fixed data for demo 4x4
2.9
matrix having four eigenvalues
2.9
600 CLS:PRINTÉö Rows : 4ò
2.9
Éö Columns : 4ò
2.9
610 row%=3:col%=3:DIM M(3,3)
2.9
620 M(0,0)=1.00:M(0,1)=0.42:
2.9
M(0,2)=0.54:M(0,3)=0.66
2.9
630 M(1,0)=0.42:M(1,1)=1.00:
2.9
M(1,2)=0.32:M(1,3)=0.44
2.9
640 M(2,0)=0.54:M(2,1)=0.32:
2.9
M(2,2)=1.00:M(2,3)=0.22
2.9
650 M(3,0)=0.66:M(3,1)=0.44:
2.9
M(3,2)=0.22:M(3,3)=1.00
2.9
660 ENDCASE
2.9
670 ENDWHILE
2.9
680 ENDPROC
2.9
690 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ-
2.9
700 DEFPROCmain
2.9
710 DIM Mt(col%,row%),MtM(col%,col%)
2.9
,E(col%)
2.9
720 PROCtranspose(M(),Mt())
2.9
730 PROCsquare_sym(M(),Mt(),MtM())
2.9
740 PROCeigenvalues(MtM(),E())
2.9
750 ENDPROC
2.9
760 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ-
2.9
770 DEFPROCtranspose(R(),Rt())
2.9
780 LOCAL v%,h%
2.9
790 v%=DIM(R(),1):h%=DIM(R(),2)
2.9
800 FOR r%=0 TO v%:FOR c%=0 TO h%:
2.9
Rt(c%,r%)=R(r%,c%):NEXT:NEXT
2.9
810 ENDPROC
2.9
820 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ-
2.9
830 DEFPROCsquare_sym(R(),Rt(),RtR())
2.9
840 RtR()=Rt().R()
2.9
850 ENDPROC
2.9
860 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ-
2.9
870 DEFPROCeigenvalues(RtR(),EV())
2.9
880 REM Eigenvalues are determined
2.9
from R-transposed x R, using the property that eigenvalues do not
change by a similarity
2.9
890 REM *** transformation. Rt.R is
2.9
decomposed in a lower and upper
2.9
tri-angular matrix, Rt.R=LU. Then
2.9
UL has the same eigenvalues as LU.
2.9
900 REM Repeating this process
2.9
iterates all non-diagonal elements to 0, and the diagonal
elements
2.9
to the eigenvalues.
2.9
910 :
2.9
920 REM E.D. Engelhardt, March 1989
2.9
930 :
2.9
940 LOCAL L(),U(),UL(),h%,c%,r%,t%,
2.9
repeat,max,iterations%
2.9
950 h%=DIM(EV(),1)
2.9
960 DIM L(h%,h%),U(h%,h%),UL(h%,h%)
2.9
970 :
2.9
980 PRINTTAB(1,30)öIteration : ò
2.9
:REM This info may be left out
2.9
990 :
2.9
1000 repeat=TRUE
2.9
1010 REPEAT
2.9
1020 iterations%+=1:PRINTTAB(13,30)
2.9
iterations% :REM may be left out
2.9
1030 REM Calculate lower triangle
2.9
L of RtR
2.9
1040 FOR c%=0 TO h%:FOR r%=c% TO h%
2.9
1050 L(r%,c%)=RtR(r%,c%):t%=c%-1
2.9
1060 IF t%>=0 FORt%=t%TO0STEP-1:
2.9
L(r%,c%)=L(r%,c%)-L(r%,t%)
2.9
*L(c%,t%):NEXT
2.9
1070 IF r%>c% THEN L(r%,c%)=
2.9
L(r%,c%)/L(c%,c%)
2.9
1080 IF r%=c% IF L(r%,c%)<0 THEN:
2.9
FOR t%=0 TO h%:L(t%,c%)=0:NEXT
2.9
1090 IF r%=c% L(r%,c%)=SQR L(r%,c%)
2.9
1100 IF r%=c% AND L(r%,c%)=0 r%=h%
2.9
1110 NEXT:NEXT
2.9
1120 :
2.9
1130 PROCtranspose(L(),U())
2.9
1140 :
2.9
1150 REM Matrix similar to RtR (ie
2.9
having same eigenvalues) is UL
2.9
1160 UL()=U().L()
2.9
1170 :
2.9
1180 REM Determine if diagonals of
2.9
RtR and UL are equivalent
2.9
1190 t%=0
2.9
1200 REPEAT
2.9
1210 IF UL(t%,t%)<>RtR(t%,t%)
2.9
:repeat=FALSE
2.9
1220 t%+=1:IF t%>h% repeat=FALSE
2.9
1230 UNTIL repeat=FALSE
2.9
1240 IF t%<=h% repeat=TRUE:RtR()=
2.9
UL()
2.9
1250 UNTIL repeat=FALSE
2.9
1260 :
2.9
1270 REM Put eigenvalues smaller then
2.9
non-diagonal elements to zero
2.9
1280 FOR t%=0 TO h%:UL(t%,t%)=0:NEXT
2.9
1290 FOR r%=1 TO h%-1:FOR c%=1 TO r%
2.9
1300 IF ABS UL(r%,c%)>max max=ABS
2.9
UL(r%,c%)
2.9
1310 NEXT:NEXT
2.9
1320 FOR c%=0 TO h%
2.9
1330 EV(c%)=RtR(c%,c%):IF EV(c%)<=
2.9
max EV(c%)=0
2.9
1340 NEXT
2.9
1360 ENDPROC
2.9
1370 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
2.9
1380 DEFPROCprint
2.9
1390 VDU 14
2.9
1400 CLS:PRINTÉö Rows : òSTR$
2.9
row%Éö Columns : òSTR$col%
2.9
1410 PRINTÉö Time(centisecs) : ò;STR$
2.9
(end%-start%)Éæ
2.9
1420 PRINTö ******** Eigenvalues : òÉ
2.9
1430 FOR c%=0 TO col%
2.9
1440 PRINT E(c%)
2.9
1450 NEXT:PRINT
2.9
1460 VDU 15
2.9
1470 ENDPROC