Home » Archimedes archive » Micro User » MU 1991-10.adf » Listings » Routines/DataCnv

Routines/DataCnv

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 » Micro User » MU 1991-10.adf » Listings
Filename: Routines/DataCnv
Read OK:
File size: 0257 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Data file to DATA statement
   20REM conversion program
   30REM by Jonathan Markland
   40REM (c) The Micro User
   50REPEAT:INPUT ''"Name of source file: "source$:UNTIL source$<>""
   60REPEAT:INPUT "Name of destination file: "dest$:UNTIL dest$<>""
   70REPEAT:INPUT "Start line number: "line%:UNTIL line%>=0
   80REPEAT:INPUT "Line number increment: "lineinc%:UNTIL lineinc%>0
   90REPEAT:INPUT "Number of bytes per line: "bpl%:UNTIL bpl%>0 AND bpl%<121
  100PRINT:OSCLI "SPOOL "+dest$:X%=OPENIN source$:REPEAT:C%=0:PRINT STR$(line%)"DATA ";:line%=line%+lineinc%:REPEAT:C%=C%+1:J%=BGET#X%:IF J%<16 PRINT "0";
  110PRINT STR$~(J%);:UNTIL EOF#X% OR C%=bpl%:PRINT:UNTIL EOF#X%
  120PRINT STR$(line%)"DATA --":OSCLI "SPOOL":CLOSE #0:PRINT '"File "+dest$+" complete.":END
!� Data file to DATA statement
� conversion program
� by Jonathan Markland
(� (c) The Micro User
26�:� ''"Name of source file: "source$:� source$<>""
<5�:� "Name of destination file: "dest$:� dest$<>""
F-�:� "Start line number: "line%:� line%>=0
P6�:� "Line number increment: "lineinc%:� lineinc%>0
Z<�:� "Number of bytes per line: "bpl%:� bpl%>0 � bpl%<121
ds�:� "SPOOL "+dest$:X%=� source$:�:C%=0:� �(line%)"DATA ";:line%=line%+lineinc%:�:C%=C%+1:J%=�#X%:� J%<16 � "0";
n'� �~(J%);:� �#X% � C%=bpl%:�:� �#X%
xF� �(line%)"DATA --":� "SPOOL":� #0:� '"File "+dest$+" complete.":�
�
00000000  0d 00 0a 21 f4 20 44 61  74 61 20 66 69 6c 65 20  |...!. Data file |
00000010  74 6f 20 44 41 54 41 20  73 74 61 74 65 6d 65 6e  |to DATA statemen|
00000020  74 0d 00 14 18 f4 20 63  6f 6e 76 65 72 73 69 6f  |t..... conversio|
00000030  6e 20 70 72 6f 67 72 61  6d 0d 00 1e 1a f4 20 62  |n program..... b|
00000040  79 20 4a 6f 6e 61 74 68  61 6e 20 4d 61 72 6b 6c  |y Jonathan Markl|
00000050  61 6e 64 0d 00 28 18 f4  20 28 63 29 20 54 68 65  |and..(.. (c) The|
00000060  20 4d 69 63 72 6f 20 55  73 65 72 0d 00 32 36 f5  | Micro User..26.|
00000070  3a e8 20 27 27 22 4e 61  6d 65 20 6f 66 20 73 6f  |:. ''"Name of so|
00000080  75 72 63 65 20 66 69 6c  65 3a 20 22 73 6f 75 72  |urce file: "sour|
00000090  63 65 24 3a fd 20 73 6f  75 72 63 65 24 3c 3e 22  |ce$:. source$<>"|
000000a0  22 0d 00 3c 35 f5 3a e8  20 22 4e 61 6d 65 20 6f  |"..<5.:. "Name o|
000000b0  66 20 64 65 73 74 69 6e  61 74 69 6f 6e 20 66 69  |f destination fi|
000000c0  6c 65 3a 20 22 64 65 73  74 24 3a fd 20 64 65 73  |le: "dest$:. des|
000000d0  74 24 3c 3e 22 22 0d 00  46 2d f5 3a e8 20 22 53  |t$<>""..F-.:. "S|
000000e0  74 61 72 74 20 6c 69 6e  65 20 6e 75 6d 62 65 72  |tart line number|
000000f0  3a 20 22 6c 69 6e 65 25  3a fd 20 6c 69 6e 65 25  |: "line%:. line%|
00000100  3e 3d 30 0d 00 50 36 f5  3a e8 20 22 4c 69 6e 65  |>=0..P6.:. "Line|
00000110  20 6e 75 6d 62 65 72 20  69 6e 63 72 65 6d 65 6e  | number incremen|
00000120  74 3a 20 22 6c 69 6e 65  69 6e 63 25 3a fd 20 6c  |t: "lineinc%:. l|
00000130  69 6e 65 69 6e 63 25 3e  30 0d 00 5a 3c f5 3a e8  |ineinc%>0..Z<.:.|
00000140  20 22 4e 75 6d 62 65 72  20 6f 66 20 62 79 74 65  | "Number of byte|
00000150  73 20 70 65 72 20 6c 69  6e 65 3a 20 22 62 70 6c  |s per line: "bpl|
00000160  25 3a fd 20 62 70 6c 25  3e 30 20 80 20 62 70 6c  |%:. bpl%>0 . bpl|
00000170  25 3c 31 32 31 0d 00 64  73 f1 3a ff 20 22 53 50  |%<121..ds.:. "SP|
00000180  4f 4f 4c 20 22 2b 64 65  73 74 24 3a 58 25 3d 8e  |OOL "+dest$:X%=.|
00000190  20 73 6f 75 72 63 65 24  3a f5 3a 43 25 3d 30 3a  | source$:.:C%=0:|
000001a0  f1 20 c3 28 6c 69 6e 65  25 29 22 44 41 54 41 20  |. .(line%)"DATA |
000001b0  22 3b 3a 6c 69 6e 65 25  3d 6c 69 6e 65 25 2b 6c  |";:line%=line%+l|
000001c0  69 6e 65 69 6e 63 25 3a  f5 3a 43 25 3d 43 25 2b  |ineinc%:.:C%=C%+|
000001d0  31 3a 4a 25 3d 9a 23 58  25 3a e7 20 4a 25 3c 31  |1:J%=.#X%:. J%<1|
000001e0  36 20 f1 20 22 30 22 3b  0d 00 6e 27 f1 20 c3 7e  |6 . "0";..n'. .~|
000001f0  28 4a 25 29 3b 3a fd 20  c5 23 58 25 20 84 20 43  |(J%);:. .#X% . C|
00000200  25 3d 62 70 6c 25 3a f1  3a fd 20 c5 23 58 25 0d  |%=bpl%:.:. .#X%.|
00000210  00 78 46 f1 20 c3 28 6c  69 6e 65 25 29 22 44 41  |.xF. .(line%)"DA|
00000220  54 41 20 2d 2d 22 3a ff  20 22 53 50 4f 4f 4c 22  |TA --":. "SPOOL"|
00000230  3a d9 20 23 30 3a f1 20  27 22 46 69 6c 65 20 22  |:. #0:. '"File "|
00000240  2b 64 65 73 74 24 2b 22  20 63 6f 6d 70 6c 65 74  |+dest$+" complet|
00000250  65 2e 22 3a e0 0d ff                              |e.":...|
00000257