Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape24b_acorn_eu_1991_june.wav » Magic

Magic

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape24b_acorn_eu_1991_june.wav
Filename: Magic
Read OK:
File size: 0208 bytes
Load address: FFFF1A00
Exec address: FFFF8023
File contents
   10 REM 3 x 3 Magic Square
   20 REM by Jon Millington
   30 REM (c) The Micro User
   40 MODE 7
   50 PRINT "  Enter three numbers. ";
   60 PRINT " First two"'"unequal and";
   70 PRINT " one not twice the other."
   80 INPUT'',H'',V'',M TAB(12,4);
   90 VDU 23,1,0;0;0;0;
  100 PRINT "Magic Number is ";3*M
  110 FOR K=1 TO 2
  120 FOR C=-1 TO 1 STEP K
  130 FOR B=-1 TO 1 STEP K
  140 A=12*B+21
  150 D=9*C+15
  160 FOR N=30 TO 30*K
  170 PRINT TAB(A,D)SPC 6;
  180 IF N<37 OR N>54 D=D-C ELSE A=A-B
  190 PRINT TAB(A,D);H*B+V*C+M
  200 IF INKEY(210-100*K)>0 G=GET
  210 NEXT N:NEXT B
  220 NEXT C:NEXT K
  230 PRINT TAB(0,23)"Again? <Space>"
  240 REPEAT UNTIL GET=32:RUN

 � 3 x 3 Magic Square
 � by Jon Millington
 � (c) The Micro User
( � 7
2! � "  Enter three numbers. ";
<" � " First two"'"unequal and";
F" � " one not twice the other."
P �'',H'',V'',M �12,4);
Z � 23,1,0;0;0;0;
d � "Magic Number is ";3*M
n � K=1 � 2
x � C=-1 � 1 � K
� � B=-1 � 1 � K
� A=12*B+21
�
 D=9*C+15
� � N=30 � 30*K
� � �A,D)� 6;
�  � N<37 � N>54 D=D-C � A=A-B
� � �A,D);H*B+V*C+M
� � �(210-100*K)>0 G=�
� � N:� B
� � C:� K
� � �0,23)"Again? <Space>"
� � � �=32:�
�
00000000  0d 00 0a 19 20 f4 20 33  20 78 20 33 20 4d 61 67  |.... . 3 x 3 Mag|
00000010  69 63 20 53 71 75 61 72  65 0d 00 14 18 20 f4 20  |ic Square.... . |
00000020  62 79 20 4a 6f 6e 20 4d  69 6c 6c 69 6e 67 74 6f  |by Jon Millingto|
00000030  6e 0d 00 1e 19 20 f4 20  28 63 29 20 54 68 65 20  |n.... . (c) The |
00000040  4d 69 63 72 6f 20 55 73  65 72 0d 00 28 08 20 eb  |Micro User..(. .|
00000050  20 37 0d 00 32 21 20 f1  20 22 20 20 45 6e 74 65  | 7..2! . "  Ente|
00000060  72 20 74 68 72 65 65 20  6e 75 6d 62 65 72 73 2e  |r three numbers.|
00000070  20 22 3b 0d 00 3c 22 20  f1 20 22 20 46 69 72 73  | ";..<" . " Firs|
00000080  74 20 74 77 6f 22 27 22  75 6e 65 71 75 61 6c 20  |t two"'"unequal |
00000090  61 6e 64 22 3b 0d 00 46  22 20 f1 20 22 20 6f 6e  |and";..F" . " on|
000000a0  65 20 6e 6f 74 20 74 77  69 63 65 20 74 68 65 20  |e not twice the |
000000b0  6f 74 68 65 72 2e 22 0d  00 50 1a 20 e8 27 27 2c  |other."..P. .'',|
000000c0  48 27 27 2c 56 27 27 2c  4d 20 8a 31 32 2c 34 29  |H'',V'',M .12,4)|
000000d0  3b 0d 00 5a 14 20 ef 20  32 33 2c 31 2c 30 3b 30  |;..Z. . 23,1,0;0|
000000e0  3b 30 3b 30 3b 0d 00 64  1d 20 f1 20 22 4d 61 67  |;0;0;..d. . "Mag|
000000f0  69 63 20 4e 75 6d 62 65  72 20 69 73 20 22 3b 33  |ic Number is ";3|
00000100  2a 4d 0d 00 6e 0e 20 e3  20 4b 3d 31 20 b8 20 32  |*M..n. . K=1 . 2|
00000110  0d 00 78 13 20 e3 20 43  3d 2d 31 20 b8 20 31 20  |..x. . C=-1 . 1 |
00000120  88 20 4b 0d 00 82 13 20  e3 20 42 3d 2d 31 20 b8  |. K.... . B=-1 .|
00000130  20 31 20 88 20 4b 0d 00  8c 0e 20 41 3d 31 32 2a  | 1 . K.... A=12*|
00000140  42 2b 32 31 0d 00 96 0d  20 44 3d 39 2a 43 2b 31  |B+21.... D=9*C+1|
00000150  35 0d 00 a0 12 20 e3 20  4e 3d 33 30 20 b8 20 33  |5.... . N=30 . 3|
00000160  30 2a 4b 0d 00 aa 10 20  f1 20 8a 41 2c 44 29 89  |0*K.... . .A,D).|
00000170  20 36 3b 0d 00 b4 20 20  e7 20 4e 3c 33 37 20 84  | 6;...  . N<37 .|
00000180  20 4e 3e 35 34 20 44 3d  44 2d 43 20 8b 20 41 3d  | N>54 D=D-C . A=|
00000190  41 2d 42 0d 00 be 16 20  f1 20 8a 41 2c 44 29 3b  |A-B.... . .A,D);|
000001a0  48 2a 42 2b 56 2a 43 2b  4d 0d 00 c8 19 20 e7 20  |H*B+V*C+M.... . |
000001b0  a6 28 32 31 30 2d 31 30  30 2a 4b 29 3e 30 20 47  |.(210-100*K)>0 G|
000001c0  3d a5 0d 00 d2 0c 20 ed  20 4e 3a ed 20 42 0d 00  |=..... . N:. B..|
000001d0  dc 0c 20 ed 20 43 3a ed  20 4b 0d 00 e6 1d 20 f1  |.. . C:. K.... .|
000001e0  20 8a 30 2c 32 33 29 22  41 67 61 69 6e 3f 20 3c  | .0,23)"Again? <|
000001f0  53 70 61 63 65 3e 22 0d  00 f0 0f 20 f5 20 fd 20  |Space>".... . . |
00000200  a5 3d 33 32 3a f9 0d ff                           |.=32:...|
00000208
Magic.m0
Magic.m1
Magic.m2
Magic.m4
Magic.m5