@@ -97,11 +97,7 @@ func decodeBlock(d *decode.D) {
97
97
length := d .FieldU24 ("length" ) // Length of data that follows
98
98
99
99
// Data as in .TAP files
100
- d .FieldArray ("data" , func (d * decode.D ) {
101
- for i := uint64 (0 ); i < length ; i ++ {
102
- d .FieldU8 ("byte" )
103
- }
104
- })
100
+ d .FieldRawLen ("data" , int64 (length )* 8 )
105
101
},
106
102
107
103
// ID: 12h (18d) | Pure Tone
@@ -135,11 +131,7 @@ func decodeBlock(d *decode.D) {
135
131
length := d .FieldU24 ("length" ) // Length of data that follows
136
132
137
133
// Data as in .TAP files
138
- d .FieldArray ("data" , func (d * decode.D ) {
139
- for i := uint64 (0 ); i < length ; i ++ {
140
- d .FieldU8 ("byte" )
141
- }
142
- })
134
+ d .FieldRawLen ("data" , int64 (length )* 8 )
143
135
},
144
136
145
137
// ID: 15h (21d) | Direct Recording
@@ -151,17 +143,11 @@ func decodeBlock(d *decode.D) {
151
143
// The preferred sampling frequencies are 22050 or 44100 Hz
152
144
// (158 or 79 T-states/sample).
153
145
0x15 : func (d * decode.D ) {
154
- d .FieldU16 ("t_states" ) // Number of T-states per sample (bit of data)
155
- d .FieldU16 ("pause" ) // Pause after this block in milliseconds (ms.)
156
- d .FieldU8 ("used_bits" ) // Used bits (samples) in last byte of data (1-8)
157
- length := d .FieldU24 ("length" ) // Length of data that follows
158
-
159
- // Samples data. Each bit represents a state on the EAR port
160
- d .FieldArray ("data" , func (d * decode.D ) {
161
- for i := uint64 (0 ); i < length ; i ++ {
162
- d .FieldU8 ("byte" )
163
- }
164
- })
146
+ d .FieldU16 ("t_states" ) // Number of T-states per sample (bit of data)
147
+ d .FieldU16 ("pause" ) // Pause after this block in milliseconds (ms.)
148
+ d .FieldU8 ("used_bits" ) // Used bits (samples) in last byte of data (1-8)
149
+ length := d .FieldU24 ("length" ) // Length of data that follows
150
+ d .FieldRawLen ("data" , int64 (length )* 8 ) // Samples data. Each bit represents a state on the EAR port
165
151
},
166
152
167
153
// ID: 18h (24d) | CSW Recording
@@ -184,11 +170,7 @@ func decodeBlock(d *decode.D) {
184
170
d .FieldU32 ("stored_pulse_count" )
185
171
186
172
// CSW data, encoded according to the CSW specification
187
- d .FieldArray ("data" , func (d * decode.D ) {
188
- for i := uint64 (0 ); i < length ; i ++ {
189
- d .FieldU8 ("byte" )
190
- }
191
- })
173
+ d .FieldRawLen ("data" , int64 (length )* 8 )
192
174
},
193
175
194
176
// ID: 19h (25d) | Generalized Data
@@ -212,11 +194,7 @@ func decodeBlock(d *decode.D) {
212
194
// PilotStreams []PilotRLE // 0x12+ (2*NPP+1)*ASP - PRLE[TOTP] Pilot and sync data stream
213
195
// DataSymbols []Symbol // 0x12+ (TOTP>0)*((2*NPP+1)*ASP)+TOTP*3 - SYMDEF[ASD] Data symbols definition table
214
196
// DataStreams []uint8 // 0x12+ (TOTP>0)*((2*NPP+1)*ASP)+ TOTP*3+(2*NPD+1)*ASD - BYTE[DS] Data stream
215
- d .FieldArray ("data" , func (d * decode.D ) {
216
- for i := uint64 (0 ); i < length ; i ++ {
217
- d .FieldU8 ("byte" )
218
- }
219
- })
197
+ d .FieldRawLen ("data" , int64 (length )* 8 )
220
198
},
221
199
222
200
// ID: 20h (32d) | Pause Tape Command
@@ -409,13 +387,9 @@ func decodeBlock(d *decode.D) {
409
387
// some information written by a utility, extra settings required by a
410
388
// particular emulator, etc.
411
389
0x35 : func (d * decode.D ) {
412
- d .FieldStr ("identification" , 10 , charmap .ISO8859_1 )
390
+ d .FieldStr ("identification" , 16 , charmap .ISO8859_1 )
413
391
length := d .FieldU32 ("length" )
414
- d .FieldArray ("info" , func (d * decode.D ) {
415
- for i := uint64 (0 ); i < length ; i ++ {
416
- d .FieldU8 ("byte" )
417
- }
418
- })
392
+ d .FieldRawLen ("info" , int64 (length )* 8 )
419
393
},
420
394
421
395
// ID: 5Ah (90d) | Glue Block
0 commit comments