-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
142 lines (104 loc) · 4.87 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
bin2tap v1.3 (APPEND edition) - binary to tape convertor (C) 2009
A convertor from ordinary file to tape image file for ZX Spectrum emulator
Michal Jurica
TABLE OF CONTENTS
*****************
1. Disclaimer
2. Installation
3. Using
4. Format of .tap file
5. Bugs
6. Contacts
1. Disclaimer
-------------
I'm not liable for any damage caused by the use of this program.
2. Installation
---------------
Program is distributed in source code. For installation you need C compiler to
compile binary execution file. If you are useing gcc compiler you can compile
program by
$ gcc bin2tap.c -o bin2tap
This will produce execution file. For other compilers read their documentation.
Than, copy execution file into directory, where your operating system search for
execution files. For example:
$ cp bin2tap /usr/bin/
3. Using
--------
Program convert input file into CODE block in .tap file. Program can create
simple BASIC loader too. Program syntax is as follow:
bin2tap [options] input_file
All options are optional except input file name. If some option is requied and
not set, it's used default value. Options are:
-a address start address of CODE block, default value is 32768
-o output_file assign output .tap file. If this switch is not set,
program try to replace extension of input file
(extension is search in last 4 characters) by .tap
extension. If he's not successfull, join extension
after name of input file.
-b this switch include BASIC loader in output file
-c clear_address set address in CLEAR command in loader, default value
is 24575
-r run_address set run address in loader (RANDOMIZE USR), defaul value
is 32768
-cb value set BORDER colour to value, default value is 0
-cp value set PAPER colour to value, default value is 0
-ci value set INK colour to value, default value is 7
-d80 create D80 loader, name of BASIC loader is set to "run"
-append append created tap at end of file
-hp | --header-poke include POKE 23739,111 command for dissabling tape headers
-h | --help print usage information
-v | --version print program version
BASIC loader looks as follow:
10 REM loader by bin2tap1.3
20 BORDER VAL "0": PAPER VAL "0": INK VAL "7"
30 CLEAR VAL "24575"
40 POKE VAL "23739", CODE "o"
50 LOAD "name_of_file" CODE
60 RANDOMIZE USR VAL "32768"
4. Format of .tap file
----------------------
The .tap files contain blocks of tape-saved data. All blocks start with two
bytes specifying how many bytes will follow (not counting the two length bytes).
Then raw tape data follows, including the flag and checksum bytes. The checksum
is the bitwise XOR of all bytes including the flag byte. For example, when you
execute the line SAVE "ROM" CODE 0,2 this will result:
|------ Spectrum-generated data -------| |------|
13 00 00 03 52 4f 4d 7x20 02 00 00 00 00 80 f1 04 00 ff f3 af a3
^^^^^...... first block is 19 bytes (17 bytes+flag+checksum)
^^... flag byte (A reg, 00 for headers, ff for data blocks)
^^ first byte of header, indicating a code block
file name ..^^^^^^^^^^^^^
header info ..............^^^^^^^^^^^^^^^^^
checksum of header .........................^^
length of second block ........................^^^^^
flag byte ...........................................^^
first two bytes of rom .................................^^^^^
checksum .....................................................^^
Note that it is possible to join .tap files by simply stringing them together,
for example COPY /B FILE1.TAP + FILE2.TAP ALL.TAP
Here is the structure of a tape header, which always consists of 17 bytes:
Byte Length Description
---------------------------
0 1 Type (0,1,2 or 3)
1 10 Filename (padded with blanks)
11 2 Length of data block
13 2 Parameter 1
15 2 Parameter 2
The type is 0,1,2 or 3 for a PROGRAM, Number array, Character array or CODE
file. A SCREEN$ file is regarded as a CODE file with start address 16384 and
length 6912 decimal. If the file is a PROGRAM file, parameter 1 holds the
autostart line number (or a number >=32768 if no LINE parameter was given) and
parameter 2 holds the start of the variable area relative to the start of the
program. If it's a CODE file, parameter 1 holds the start of the code block when
saved, and parameter 2 holds 32768. For data files finally, the byte at position
14 decimal holds the variable name.
5. Bugs
-------
If you find bug in program, contact me at email mike at zeroteam.sk. Also you
can send tips for improve program.
6. Contact
----------
Homepage of program is:
http://zeroteam.sk/utils.html
Author email:
Michal Jurica - mike at zeroteam.sk