Home » Archimedes archive » Acorn User » AU 1994-06.adf » !BasicProg_BasicProg » Listing1

Listing1

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 » Acorn User » AU 1994-06.adf » !BasicProg_BasicProg
Filename: Listing1
Read OK:
File size: 0182 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM >Listing1
    2REM Reads and displays a text file
    3:
    4ON ERROR REPORT: PRINT " at line ";ERL:END
    5file$ = "<BackToBasics$Dir>.File1"
    6handle% = OPENIN(file$)
    7IF handle% = 0 THEN PRINT "File ";file$;" not found.": END
    8WHILE NOT EOF#handle%
    9 byte% = BGET#handle%
   10 IF (byte%=10) OR (byte%>=32) THEN
   11  PRINT CHR$(byte%);
   12 ELSE
   13  PRINT "."
   14 ENDIF
   15 IF (byte%=10) PRINT 'INT(PTR#handle%*100/EXT#handle%);"%"
   16ENDWHILE
   17CLOSE#handle%
   18END 
� >Listing1
$� Reads and displays a text file
:
� � �: � " at line ";�:�
&file$ = "<BackToBasics$Dir>.File1"
handle% = �(file$)
4� handle% = 0 � � "File ";file$;" not found.": �
ȕ � �#handle%
	 byte% = �#handle%

! � (byte%=10) � (byte%>=32) �
  � �(byte%);
 �

  � "."
 �
3 � (byte%=10) � '�(�#handle%*100/�#handle%);"%"
�

�#handle%
� 
�
00000000  0d 00 01 0f f4 20 3e 4c  69 73 74 69 6e 67 31 0d  |..... >Listing1.|
00000010  00 02 24 f4 20 52 65 61  64 73 20 61 6e 64 20 64  |..$. Reads and d|
00000020  69 73 70 6c 61 79 73 20  61 20 74 65 78 74 20 66  |isplays a text f|
00000030  69 6c 65 0d 00 03 05 3a  0d 00 04 1c ee 20 85 20  |ile....:..... . |
00000040  f6 3a 20 f1 20 22 20 61  74 20 6c 69 6e 65 20 22  |.: . " at line "|
00000050  3b 9e 3a e0 0d 00 05 26  66 69 6c 65 24 20 3d 20  |;.:....&file$ = |
00000060  22 3c 42 61 63 6b 54 6f  42 61 73 69 63 73 24 44  |"<BackToBasics$D|
00000070  69 72 3e 2e 46 69 6c 65  31 22 0d 00 06 16 68 61  |ir>.File1"....ha|
00000080  6e 64 6c 65 25 20 3d 20  8e 28 66 69 6c 65 24 29  |ndle% = .(file$)|
00000090  0d 00 07 34 e7 20 68 61  6e 64 6c 65 25 20 3d 20  |...4. handle% = |
000000a0  30 20 8c 20 f1 20 22 46  69 6c 65 20 22 3b 66 69  |0 . . "File ";fi|
000000b0  6c 65 24 3b 22 20 6e 6f  74 20 66 6f 75 6e 64 2e  |le$;" not found.|
000000c0  22 3a 20 e0 0d 00 08 12  c8 95 20 ac 20 c5 23 68  |": ....... . .#h|
000000d0  61 6e 64 6c 65 25 0d 00  09 16 20 62 79 74 65 25  |andle%.... byte%|
000000e0  20 3d 20 9a 23 68 61 6e  64 6c 65 25 0d 00 0a 21  | = .#handle%...!|
000000f0  20 e7 20 28 62 79 74 65  25 3d 31 30 29 20 84 20  | . (byte%=10) . |
00000100  28 62 79 74 65 25 3e 3d  33 32 29 20 8c 0d 00 0b  |(byte%>=32) ....|
00000110  11 20 20 f1 20 bd 28 62  79 74 65 25 29 3b 0d 00  |.  . .(byte%);..|
00000120  0c 06 20 cc 0d 00 0d 0b  20 20 f1 20 22 2e 22 0d  |.. .....  . ".".|
00000130  00 0e 06 20 cd 0d 00 0f  33 20 e7 20 28 62 79 74  |... ....3 . (byt|
00000140  65 25 3d 31 30 29 20 f1  20 27 a8 28 8f 23 68 61  |e%=10) . '.(.#ha|
00000150  6e 64 6c 65 25 2a 31 30  30 2f a2 23 68 61 6e 64  |ndle%*100/.#hand|
00000160  6c 65 25 29 3b 22 25 22  0d 00 10 05 ce 0d 00 11  |le%);"%"........|
00000170  0d d9 23 68 61 6e 64 6c  65 25 0d 00 12 06 e0 20  |..#handle%..... |
00000180  0d ff                                             |..|
00000182