Home » Archimedes archive » Archimedes World » AW-1993-05.adf » AWMay93 » !AWMay93/Goodies/BASICS/Info

!AWMay93/Goodies/BASICS/Info

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 » Archimedes archive » Archimedes World » AW-1993-05.adf » AWMay93
Filename: !AWMay93/Goodies/BASICS/Info
Read OK:
File size: 03BA bytes
Load address: 0000
Exec address: 0000
File contents
 
                                Multiply 
                         � Archimedes World 1993

This months program contains two new procedures which allow the game to save
the high scores to disk, rather than keeping the scores in memory.


The basis of discussion this month is file handling, often a complex and
forgotten subject but none the less still a major part of a programs make
up.

Take a look at the new procedures and try to work from the program listing
in the magazine, as to what that part of the program is doing. See you next
month have fun.
 

 Procedures Used
 ---------------
 

 Loading High Score Table
 ------------------------ 
 DEFPROCload_Scores
 file=OPENIN("<Multiply$Dir>.HighScores")
 FOR T%=1 TO 10
 INPUT#file,hi$(T%)
 NEXT
 CLOSE#file
 ENDPROC

 Saving High Score Table
 -----------------------
 DEFPROCsave_Scores
 file=OPENOUT("<Multiply$Dir>.HighScores")
 FOR T%=1 TO 10
 PRINT#file,hi$(T%)
 NEXT
 CLOSE#file
 ENDPROC
00000000  0a 20 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |. .             |
00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000020  20 20 20 4d 75 6c 74 69  70 6c 79 20 0a 20 20 20  |   Multiply .   |
00000030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000040  20 20 20 20 20 20 a9 20  41 72 63 68 69 6d 65 64  |      . Archimed|
00000050  65 73 20 57 6f 72 6c 64  20 31 39 39 33 0a 0a 54  |es World 1993..T|
00000060  68 69 73 20 6d 6f 6e 74  68 73 20 70 72 6f 67 72  |his months progr|
00000070  61 6d 20 63 6f 6e 74 61  69 6e 73 20 74 77 6f 20  |am contains two |
00000080  6e 65 77 20 70 72 6f 63  65 64 75 72 65 73 20 77  |new procedures w|
00000090  68 69 63 68 20 61 6c 6c  6f 77 20 74 68 65 20 67  |hich allow the g|
000000a0  61 6d 65 20 74 6f 20 73  61 76 65 0a 74 68 65 20  |ame to save.the |
000000b0  68 69 67 68 20 73 63 6f  72 65 73 20 74 6f 20 64  |high scores to d|
000000c0  69 73 6b 2c 20 72 61 74  68 65 72 20 74 68 61 6e  |isk, rather than|
000000d0  20 6b 65 65 70 69 6e 67  20 74 68 65 20 73 63 6f  | keeping the sco|
000000e0  72 65 73 20 69 6e 20 6d  65 6d 6f 72 79 2e 0a 0a  |res in memory...|
000000f0  0a 54 68 65 20 62 61 73  69 73 20 6f 66 20 64 69  |.The basis of di|
00000100  73 63 75 73 73 69 6f 6e  20 74 68 69 73 20 6d 6f  |scussion this mo|
00000110  6e 74 68 20 69 73 20 66  69 6c 65 20 68 61 6e 64  |nth is file hand|
00000120  6c 69 6e 67 2c 20 6f 66  74 65 6e 20 61 20 63 6f  |ling, often a co|
00000130  6d 70 6c 65 78 20 61 6e  64 0a 66 6f 72 67 6f 74  |mplex and.forgot|
00000140  74 65 6e 20 73 75 62 6a  65 63 74 20 62 75 74 20  |ten subject but |
00000150  6e 6f 6e 65 20 74 68 65  20 6c 65 73 73 20 73 74  |none the less st|
00000160  69 6c 6c 20 61 20 6d 61  6a 6f 72 20 70 61 72 74  |ill a major part|
00000170  20 6f 66 20 61 20 70 72  6f 67 72 61 6d 73 20 6d  | of a programs m|
00000180  61 6b 65 0a 75 70 2e 0a  0a 54 61 6b 65 20 61 20  |ake.up...Take a |
00000190  6c 6f 6f 6b 20 61 74 20  74 68 65 20 6e 65 77 20  |look at the new |
000001a0  70 72 6f 63 65 64 75 72  65 73 20 61 6e 64 20 74  |procedures and t|
000001b0  72 79 20 74 6f 20 77 6f  72 6b 20 66 72 6f 6d 20  |ry to work from |
000001c0  74 68 65 20 70 72 6f 67  72 61 6d 20 6c 69 73 74  |the program list|
000001d0  69 6e 67 0a 69 6e 20 74  68 65 20 6d 61 67 61 7a  |ing.in the magaz|
000001e0  69 6e 65 2c 20 61 73 20  74 6f 20 77 68 61 74 20  |ine, as to what |
000001f0  74 68 61 74 20 70 61 72  74 20 6f 66 20 74 68 65  |that part of the|
00000200  20 70 72 6f 67 72 61 6d  20 69 73 20 64 6f 69 6e  | program is doin|
00000210  67 2e 20 53 65 65 20 79  6f 75 20 6e 65 78 74 0a  |g. See you next.|
00000220  6d 6f 6e 74 68 20 68 61  76 65 20 66 75 6e 2e 0a  |month have fun..|
00000230  20 0a 0a 20 50 72 6f 63  65 64 75 72 65 73 20 55  | .. Procedures U|
00000240  73 65 64 0a 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |sed. -----------|
00000250  2d 2d 2d 2d 0a 20 0a 0a  20 4c 6f 61 64 69 6e 67  |----. .. Loading|
00000260  20 48 69 67 68 20 53 63  6f 72 65 20 54 61 62 6c  | High Score Tabl|
00000270  65 0a 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |e. -------------|
00000280  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 20 0a 20 44 45  |----------- . DE|
00000290  46 50 52 4f 43 6c 6f 61  64 5f 53 63 6f 72 65 73  |FPROCload_Scores|
000002a0  0a 20 66 69 6c 65 3d 4f  50 45 4e 49 4e 28 22 3c  |. file=OPENIN("<|
000002b0  4d 75 6c 74 69 70 6c 79  24 44 69 72 3e 2e 48 69  |Multiply$Dir>.Hi|
000002c0  67 68 53 63 6f 72 65 73  22 29 0a 20 46 4f 52 20  |ghScores"). FOR |
000002d0  54 25 3d 31 20 54 4f 20  31 30 0a 20 49 4e 50 55  |T%=1 TO 10. INPU|
000002e0  54 23 66 69 6c 65 2c 68  69 24 28 54 25 29 0a 20  |T#file,hi$(T%). |
000002f0  4e 45 58 54 0a 20 43 4c  4f 53 45 23 66 69 6c 65  |NEXT. CLOSE#file|
00000300  0a 20 45 4e 44 50 52 4f  43 0a 0a 20 53 61 76 69  |. ENDPROC.. Savi|
00000310  6e 67 20 48 69 67 68 20  53 63 6f 72 65 20 54 61  |ng High Score Ta|
00000320  62 6c 65 0a 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ble. -----------|
00000330  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 20 44 45  |------------. DE|
00000340  46 50 52 4f 43 73 61 76  65 5f 53 63 6f 72 65 73  |FPROCsave_Scores|
00000350  0a 20 66 69 6c 65 3d 4f  50 45 4e 4f 55 54 28 22  |. file=OPENOUT("|
00000360  3c 4d 75 6c 74 69 70 6c  79 24 44 69 72 3e 2e 48  |<Multiply$Dir>.H|
00000370  69 67 68 53 63 6f 72 65  73 22 29 0a 20 46 4f 52  |ighScores"). FOR|
00000380  20 54 25 3d 31 20 54 4f  20 31 30 0a 20 50 52 49  | T%=1 TO 10. PRI|
00000390  4e 54 23 66 69 6c 65 2c  68 69 24 28 54 25 29 0a  |NT#file,hi$(T%).|
000003a0  20 4e 45 58 54 0a 20 43  4c 4f 53 45 23 66 69 6c  | NEXT. CLOSE#fil|
000003b0  65 0a 20 45 4e 44 50 52  4f 43                    |e. ENDPROC|
000003ba