-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathomfint.c
675 lines (584 loc) · 20.4 KB
/
omfint.c
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: OMF output routines.
*
****************************************************************************/
#include <stddef.h>
#include "globals.h"
#include "memalloc.h"
#include "parser.h"
#include "segment.h"
#include "fixup.h"
#include "omfint.h"
#include "omfspec.h"
#include "myassert.h"
#ifdef __I86__
#define FFQUAL __near
#else
#define FFQUAL
#endif
extern struct omf_wfile *file_out;
#define WRITE_REC 0 /* 1=enable unbuffered record write */
static void safeWrite( FILE *file, const uint_8 *buf, size_t len )
/****************************************************************/
{
if( fwrite( buf, 1, len, file ) != len )
WriteError();
}
#if 0
/* this function was needed to reposition to the record's
* length field for update. Now always the full record is
* kept in the buffer until WEndRec().
*/
static void safeSeek( FILE *file, long offset, int mode )
/*******************************************************/
{
if( fseek( file, offset, mode ) != 0 )
SeekError();
}
#endif
/* start a buffered OMF record output */
static void WBegRec( struct omf_wfile *out, uint_8 command )
/**********************************************************/
{
/**/myassert( out != NULL && !out->cmd );
out->in_buf = 0;
out->cmd = command;
}
/* WEndRec() finish a buffered record.
* - calculate checksum
* - store checksum behind buffer contents
* - writes the contents of the buffer(cmd, length, contents, checksum)
*/
static void WEndRec( struct omf_wfile *out )
/******************************************/
{
uint_8 checksum;
uint_8 *p;
/**/myassert( out != NULL && out->cmd );
out->reclen = out->in_buf + 1; /* add 1 for checksum byte */
checksum = out->cmd + ( out->reclen & 0xff ) + (( out->reclen ) >> 8);
for( p = out->buffer; p < out->buffer + out->in_buf; ) {
checksum += *p++;
}
checksum = - checksum;
*p = checksum; /* store chksum in buffer */
/* write buffer + 4 extra bytes (1 cmd, 2 length, 1 chksum) */
safeWrite( out->file, &out->cmd, out->in_buf + 4 );
out->cmd = 0;
}
#if WRITE_REC
/* Write an OMF record: command, length, content, checksum.
* Contents and length don't include checksum
*/
static void WriteRec( struct omf_wfile *out, uint_8 command, size_t length, const uint_8 *contents )
/**************************************************************************************************/
{
uint_8 buf[3];
uint_8 checksum;
const uint_8 *p;
const uint_8 *p2;
/**/myassert( out != NULL );
/* get checksum. calculated from all bytes (including cmd and length) */
checksum = buf[0] = command;
checksum += buf[1] = ( length + 1 ) & 0xff;
checksum += buf[2] = ( length + 1 ) >> 8;
for ( p = contents, p2 = contents + length; p < p2; ) {
checksum += *p++;
}
checksum = -checksum;
safeWrite( out->file, buf, 3 );
safeWrite( out->file, contents, length );
safeWrite( out->file, &checksum, 1 );
}
#endif
/* write a byte to the current record */
static void PutByte( struct omf_wfile *out, uint_8 value )
/********************************************************/
{
/**/myassert( out != NULL && out->cmd );
out->buffer[ out->in_buf++ ] = value;
}
/* write an index - 1|2 byte(s) - to the current record */
static void PutIndex( struct omf_wfile *out, uint_16 index )
/**********************************************************/
{
if( index > 0x7f ) {
PutByte( out, 0x80 | ( index >> 8 ) );
}
PutByte( out, index & 0xff );
}
/* write a word to the current record */
static void PutWord( struct omf_wfile *out, uint_16 value )
/*********************************************************/
{
/**/myassert( out != NULL && out->cmd );
WriteU16( out->buffer + out->in_buf, value );
out->in_buf += sizeof( uint_16 );
}
/* write a dword to the current record */
static void PutDword( struct omf_wfile *out, uint_32 value )
/**********************************************************/
{
/**/myassert( out != NULL && out->cmd );
WriteU32( out->buffer + out->in_buf, value );
out->in_buf += sizeof( uint_32 );
}
/* write a byte sequence to the current record */
static void PutMem( struct omf_wfile *out, const uint_8 *buf, size_t length )
/***************************************************************************/
{
const uint_8 *curr;
size_t amt;
/**/myassert( out != NULL && buf != NULL );
curr = buf;
amt = OBJ_BUFFER_SIZE - out->in_buf;
if( amt >= length ) {
memcpy( &out->buffer[ out->in_buf ], curr, length );
out->in_buf += length;
} else {
/* this "shouldn't happen". */
DebugMsg(("PutMem: error, amt(%u) < length(%u)\n", amt, length ));
EmitErr( INTERNAL_ERROR, __FILE__, __LINE__ );
}
}
/*--------------------------------------------------------*/
/* For 16-bit records which are the same under Intel and MS OMFs */
static int FFQUAL writeMisc( struct omf_wfile *out, struct omf_rec *objr )
/************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->data != NULL );
#if WRITE_REC
WriteRec( out, objr->command, objr->length, objr->data );
#else
WBegRec( out, objr->command );
PutMem( out, objr->data, objr->length );
WEndRec( out );
#endif
return( 0 );
}
/* For 32-bit records which are the same under Intel and MS OMFs */
static int FFQUAL writeMisc32( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->data != NULL );
if( objr->is_32 ) {
objr->command |= 0x01;
}
#if WRITE_REC
WriteRec( out, objr->command, objr->length, objr->data );
#else
WBegRec( out, objr->command );
PutMem( out, objr->data, objr->length );
WEndRec( out );
#endif
return( 0 );
}
static int FFQUAL writeComent( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->data != NULL );
WBegRec( out, CMD_COMENT );
PutByte( out, objr->d.coment.attr );
PutByte( out, objr->d.coment.class );
PutMem( out, objr->data, objr->length );
WEndRec( out );
return( 0 );
}
static int FFQUAL writeSegdef( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
int is32;
uint_8 acbp;
uint_8 align;
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_SEGDEF );
//is32 = objr->d.segdef.use_32;
is32 = objr->is_32;
WBegRec( out, is32 ? CMD_SEGD32 : CMD_SEGDEF );
/* ACBP: bits=AAACCCBP
* AAA=alignment
* CCC=combination
* B=big
* P=32bit
*/
acbp = ( objr->d.segdef.combine << 2 ) | ( objr->d.segdef.use_32 != 0 );
align = objr->d.segdef.align;
switch( align ) {
case SEGDEF_ALIGN_ABS: acbp |= ALIGN_ABS << 5; break;
case SEGDEF_ALIGN_BYTE: acbp |= ALIGN_BYTE << 5; break;
case SEGDEF_ALIGN_WORD: acbp |= ALIGN_WORD << 5; break;
case SEGDEF_ALIGN_PARA: acbp |= ALIGN_PARA << 5; break;
case SEGDEF_ALIGN_PAGE: acbp |= ALIGN_PAGE << 5; break;
case SEGDEF_ALIGN_DWORD: acbp |= ALIGN_DWORD << 5; break;
#if PAGE4K
case SEGDEF_ALIGN_4KPAGE:
acbp |= ALIGN_4KPAGE << 5;
if ( Parse_Pass == PASS_1 )
EmitWarn( 2, NO_4KPAGE_ALIGNED_SEGMENTS );
break;
#endif
default:
/**/never_reach();
}
/* set BIG bit. should also be done for 32-bit segments
* if their size is exactly 4 GB. Currently JWasm won't
* support segments with size 4 GB.
*/
if( is32 == 0 && objr->d.segdef.seg_length == 0x10000 ) {
acbp |= 0x02;
}
/* the segdef record is small (16bit: size 6 - 9 ):
* - byte acbp
* - word (32bit:dword) length
* - index seg name
* - index class name
* - index ovl name
* ABS segdefs are 3 bytes longer
*/
PutByte( out, acbp );
if( align == SEGDEF_ALIGN_ABS ) {
/* absolut segment has frame=word and offset=byte
* it isn't fixupp physical reference
* and don't depend on segment size (16/32bit)
*/
PutWord( out, objr->d.segdef.abs.frame );
PutByte( out, objr->d.segdef.abs.offset );
}
if( is32 ) {
PutDword( out, objr->d.segdef.seg_length );
} else {
PutWord( out, objr->d.segdef.seg_length & 0xffff );
}
PutIndex( out, objr->d.segdef.seg_name_idx );
PutIndex( out, objr->d.segdef.class_name_idx );
PutIndex( out, objr->d.segdef.ovl_name_idx );
//if( objr->d.segdef.access_valid ) {
// EmitError( ACCESS_CLASSES_NOT_SUPPORTED );
//}
WEndRec( out );
return( 0 );
}
static int FFQUAL writeFixup( struct omf_wfile *out, struct omf_rec *objr )
/*************************************************************************/
{
struct fixup *curr;
size_t written;
uint_8 buf[ 1024 ];
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_FIXUP );
curr = objr->d.fixup.fixup;
/* make sure FIXUP records won't go beyond the 1024 size limit */
do {
WBegRec( out, objr->is_32 ? CMD_FIXU32 : CMD_FIXUP );
written = 0;
while( curr != NULL && written < 1020 - FIX_GEN_MAX ) {
written += OmfFixGenFix( curr, buf + written, objr->is_32 ? FIX_GEN_MS386 : FIX_GEN_INTEL );
curr = curr->nextrlc;
}
PutMem( out, buf, written );
WEndRec( out );
} while( curr != NULL );
return( 0 );
}
/*
* Write LEDATA or LIDATA record.
* the overhead is:
* - 1 byte cmd
* - 2 byte len
* - 1/2 bytes segment index
* - 2/4 bytes starting offset
* - 1 byte chksum
* so the data size "should" not exceed 1024-10 = 1014
*
* For LIDATA, the structure is equal.
* The structure of the data block differs, however:
* - 2/4: repeat count
* - 2: block count
* - content
*/
static int FFQUAL writeLedata( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_LEDATA || objr->command == CMD_LIDATA );
WBegRec( out, objr->is_32 ? objr->command | 1: objr->command );
PutIndex( out, objr->d.ledata.idx );
if( objr->is_32 ) {
PutDword( out, objr->d.ledata.offset );
} else {
PutWord( out, objr->d.ledata.offset );
}
PutMem( out, objr->data, objr->length );
WEndRec( out );
return( 0 );
}
static int FFQUAL writeTheadr( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_THEADR );
return( writeMisc( out, objr ) );
}
static int FFQUAL writeModend( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
size_t len;
int is32 = FALSE;
uint_8 is_log;
uint_8 mtype;
uint_8 buf[ FIX_GEN_MAX ];
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_MODEND );
/* first byte is Module Type:
* bit 7: 1=main program module
* bit 6: 1=contains start address
* bit 5: Segment bit
* bit 1-4: must be 0
* bit 0: start address subfield contains relocatable (logical) address
*/
if ( objr->is_32 && objr->d.modend.start_addrs )
is32 = TRUE;
WBegRec( out, is32 ? CMD_MODE32 : CMD_MODEND );
mtype = objr->d.modend.main_module ? 0x80 : 0;
if( objr->d.modend.start_addrs ) {
is_log = objr->d.modend.is_logical;
mtype |= 0x40 | is_log;
PutByte( out, mtype );
len = OmfFixGenRef( &objr->d.modend.ref, is_log, buf,
is32 ? FIX_GEN_MS386 : FIX_GEN_INTEL );
PutMem( out, buf, len );
} else
PutByte( out, mtype );
WEndRec( out );
return( 0 );
}
static void writeBase( struct omf_wfile *out, struct omf_rec *objr )
/******************************************************************/
{
size_t grp_idx;
size_t seg_idx;
grp_idx = objr->d.base.grp_idx;
seg_idx = objr->d.base.seg_idx;
PutIndex( out, grp_idx );
PutIndex( out, seg_idx );
if( grp_idx == 0 && seg_idx == 0 ) {
PutWord( out, objr->d.base.frame );
}
}
/* COMDATs are initialized communal data records.
* This isn't used currently, the Masm COMM directive
* defines uninitialized communal data items (COMDEFs).
*/
static int FFQUAL writeComdat( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
int is_32;
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_COMDAT );
is_32 = objr->is_32;
/* write CMD_COMDAT or CMD_COMD32 */
WBegRec( out, objr->command | ( is_32 ? 1 : 0 ) );
PutByte( out, objr->d.comdat.flags );
PutByte( out, objr->d.comdat.attributes );
PutByte( out, objr->d.comdat.align );
if( is_32 ) {
PutDword( out, objr->d.comdat.offset );
} else {
PutWord( out, objr->d.comdat.offset );
}
PutIndex( out, objr->d.comdat.type_idx );
if( ( objr->d.comdat.attributes & COMDAT_ALLOC_MASK ) == COMDAT_EXPLICIT ) {
writeBase( out, objr );
}
PutIndex( out, objr->d.comdat.public_name_idx );
/* record is already in ms omf format */
PutMem( out, objr->data, objr->length );
WEndRec( out );
return( 0 );
}
static int FFQUAL writePubdef( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
int is32;
int i;
struct pubdef_data *pubdata;
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_PUBDEF ||
objr->command == CMD_LPUBDEF );
is32 = objr->is_32;
WBegRec( out, objr->command | ( is32 ? 1 : 0 ) );
writeBase( out, objr );
pubdata = objr->d.pubdef.pubs;
if( pubdata != NULL ) {
for ( i = 0; i < objr->d.pubdef.num_pubs; i++ ) {
PutByte( out, pubdata->len );
PutMem( out, (uint_8 *)pubdata->name, (size_t)pubdata->len );
if( is32 ) {
PutDword( out, pubdata->offset );
} else {
PutWord( out, pubdata->offset );
}
PutIndex( out, pubdata->type.idx );
pubdata = (struct pubdef_data *)(pubdata->name + pubdata->len);
}
}
WEndRec( out );
return( 0 );
}
static void writeLinnumData( struct omf_wfile *out, struct omf_rec *objr )
/************************************************************************/
{
int is32;
is32 = objr->is_32;
#if defined( __BIG_ENDIAN__ )
{
struct linnum_data *cur;
struct linnum_data *stop;
cur = objr->d.linnum.lines;
stop = cur + objr->d.linnum.num_lines;
while( cur < stop ) {
PutWord( out, cur->number );
if( is32 ) {
PutDword( out, cur->offset );
} else {
PutWord( out, (uint_16)cur->offset );
}
++cur;
}
}
#else
if( is32 ) {
PutMem( out, (uint_8 *)objr->d.linnum.lines,
6 * objr->d.linnum.num_lines );
/**/ myassert( sizeof( struct linnum_data ) == 6 );
} else {
struct linnum_data *cur;
struct linnum_data *stop;
cur = objr->d.linnum.lines;
stop = cur + objr->d.linnum.num_lines;
while( cur < stop ) {
PutWord( out, cur->number );
/**/ myassert( ( cur->offset & 0xffff0000 ) == 0 );
PutWord( out, (uint_16)cur->offset );
++cur;
}
}
#endif
}
static int FFQUAL writeLinnum( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_LINNUM );
WBegRec( out, objr->is_32 ? CMD_LINN32 : CMD_LINNUM );
writeBase( out, objr );
writeLinnumData( out, objr );
WEndRec( out );
return( 0 );
}
/* Not used. these record types are only used in conjunction
* with CMD_COMDAT.
*/
static int FFQUAL writeLinsym( struct omf_wfile *out, struct omf_rec *objr )
/**************************************************************************/
{
/**/myassert( objr != NULL );
/**/myassert( objr->command == CMD_LINSYM );
WBegRec( out, objr->is_32 ? CMD_LINS32 : CMD_LINSYM );
PutByte( out, objr->d.linsym.d.linsym.flags );
PutIndex( out, objr->d.linsym.d.linsym.public_name_idx );
writeLinnumData( out, objr );
WEndRec( out );
return( 0 );
}
static int FFQUAL writeUnexp( struct omf_wfile *out, struct omf_rec *objr )
/*************************************************************************/
{
DebugMsg(("unexpected OMF record type 0x%02X\n", objr->command ));
EmitErr( INTERNAL_ERROR, __FILE__, __LINE__ );
return( 0 );
}
typedef int FFQUAL (*pobj_filter)( struct omf_wfile *, struct omf_rec * );
static const pobj_filter myFuncs[] = {
writeUnexp,
writeMisc,
writeMisc32,
writeSegdef,
writeLedata,
writeFixup,
writeComent,
writeTheadr,
writeModend,
writePubdef,
writeLinnum,
writeComdat,
writeLinsym
};
enum omffiltfuncs {
OFF_UNEXP,
OFF_MISC,
OFF_MISC32,
OFF_SEGDEF,
OFF_LEDATA,
OFF_FIXUP,
OFF_COMENT,
OFF_THEADR,
OFF_MODEND,
OFF_PUBDEF,
OFF_LINNUM,
OFF_COMDAT,
OFF_LINSYM
};
static const uint_8 func_index[] = {
OFF_THEADR, 0, 0, 0, /* 80 THEADR, LHEADR, PEDATA, PIDATA */
OFF_COMENT, OFF_MODEND, OFF_MISC, OFF_MISC, /* 88 COMENT, MODEND, EXTDEF, TYPDEF */
OFF_PUBDEF, 0, OFF_LINNUM, OFF_MISC, /* 90 PUBDEF, LOCSYM, LINNUM, LNAMES */
OFF_SEGDEF, OFF_MISC, OFF_FIXUP, 0, /* 98 SEGDEF, GRPDEF, FIXUP, ??? */
OFF_LEDATA, OFF_LEDATA, 0, 0, /* A0 LEDATA, LIDATA, LIBHED, LIBNAM */
0, 0, 0, 0, /* A8 LIBLOC, LIBDIC, ???, ??? */
OFF_MISC, OFF_MISC32, OFF_MISC32, OFF_PUBDEF,/* B0 COMDEF, BAKPAT, LEXTDEF,LPUBDEF */
OFF_MISC, 0, OFF_MISC, 0, /* B8 LCOMDEF,???, CEXTDF, ??? */
0, OFF_COMDAT, OFF_LINSYM, OFF_MISC, /* C0 ???, COMDAT, LINSYM, ALIAS */
OFF_MISC32, OFF_MISC /* C8 NBKPAT, LLNAMES */
};
/* v2.06: jumpTable is obsolete */
//static pobj_filter jumpTable[ ( CMD_MAX_CMD - CMD_MIN_CMD + 2 ) >> 1 ];
#define JUMP_INDEX(cmd) ( ( ( cmd ) - CMD_MIN_CMD ) >> 1 )
/* call a function - bit 0 of command is always 0 */
void omf_write_record( struct omf_rec *objr )
/*******************************************/
{
/**/myassert( objr != NULL && objr->command >= CMD_MIN_CMD && objr->command <= CMD_MAX_CMD + 1 );
DebugMsg(("omf_write_record( %p ) cmd=%X data=%p length=%u\n", objr, objr->command, objr->data, objr->length ));
objr->curoff = 0;
//jumpTable[ JUMP_INDEX(objr->command) ] ( file_out, objr );
myFuncs[ func_index[JUMP_INDEX(objr->command) ] ] ( file_out, objr );
}