-
Notifications
You must be signed in to change notification settings - Fork 98
/
defines.h
929 lines (769 loc) · 20.8 KB
/
defines.h
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
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
#include "hashmap.h"
#include "shared.h"
#ifndef _DEFINES_H
#define _DEFINES_H
#define HINT_NONE 0
#define HINT_8BIT 1
#define HINT_16BIT 2
#define HINT_24BIT 3
#define HINT_32BIT 4
#define HINT_TYPE_NONE 0
#define HINT_TYPE_GIVEN 1
#define HINT_TYPE_DEDUCED 2
/* want to have more operands and operators in a calculation? change this... */
#if defined(AMIGA) || defined(MSDOS)
#define MAX_STACK_CALCULATOR_ITEMS 64
#else
#define MAX_STACK_CALCULATOR_ITEMS 256
#endif
/* the number of times stack_calculate() can exist in call stack any given point in time */
#define MAX_STACK_CALCULATE_CALL_DEPTH 16
#define STACK_CALCULATE_DELAY 2
#define STACK_RETURN_LABEL 1024
#define STACK_RETURN_STRING 2048
#define INPUT_NUMBER_EOL 2
#define INPUT_NUMBER_ADDRESS_LABEL 3
#define INPUT_NUMBER_STRING 4
#define INPUT_NUMBER_STACK 5
#define INPUT_NUMBER_FLOAT 6
#define GET_NEXT_TOKEN_STRING 2
#define EVALUATE_TOKEN_NOT_IDENTIFIED 2
#define EVALUATE_TOKEN_EOP 6
#define DIRECTIVE_NOT_IDENTIFIED 9
#define OUTPUT_OBJECT 0
#define OUTPUT_LIBRARY 1
#define OUTPUT_NONE 2
#define ERROR_NONE 0
#define ERROR_LOG 1
#define ERROR_DIR 2
#define ERROR_NUM 3
#define ERROR_INC 4
#define ERROR_INB 5
#define ERROR_UNF 6
#define ERROR_INP 7
#define ERROR_STC 8
#define ERROR_WRN 9
#define ERROR_ERR 10
#define ERROR_FAI 11
/**************************************************************/
/* wla internal datatypes */
/**************************************************************/
/* A - absolute section */
/* c - stack (1 byte) */
/* C - stack (2 bytes) */
/* T - stack (3 bytes) */
/* U - stack (4 bytes) */
/* - - stack (9-bit short) */
/* d - data (1 byte) */
/* y - data (2 bytes) */
/* z - data (3 bytes) */
/* u - data (4 bytes) */
/* D - data block (incbin) */
/* O - origin */
/* o - absolute origin */
/* B - ROM bank */
/* b - BASE */
/* L - label */
/* r - 16-bit reference */
/* R - 8-bit pc ref */
/* M - 16-bit pc ref */
/* Q - 8-bit reference */
/* q - 24-bit reference */
/* V - 32-bit reference */
/* * - 9-bit short reference */
/* S - section */
/* s - end of section */
/* x - dsb */
/* X - dsw */
/* h - dsl */
/* w - dsd */
/* E - end of file */
/* f - file name id */
/* k - line number */
/* P - add_old = add */
/* p - add = add_old */
/* g - block (start) */
/* G - block (end) */
/* Y - symbol */
/* Z - breakpoint */
/* i - macro call start */
/* I - macro call end */
/* j - rept start */
/* J - rept end */
/* v - special case ID */
/* t - namespace */
/* n - 0-7 + label (2 bytes) */
/* N - 0-7 + stack (2 bytes) */
/* + - .bits [bits]: a [value] / b [label] / c [stack] */
/* . - flip the endianess of next r */
/**************************************************************/
/* gb-z80 */
/**************************************************************/
#ifdef GB
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 8 - * 8b */
/* 9 - * 16b */
#define INSTRUCTION_STRING_LENGTH_MAX 15
#define ARCH_STR "GB-Z80"
#define WLA_NAME "gb"
#endif
/**************************************************************/
/* superfx */
/**************************************************************/
#ifdef SUPERFX
/* instruction types */
/* 0 - plain text */
/* 1 - * (0-15) */
/* 2 - e */
/* 3 - * (0-15) x */
/* 4 - * (0-15) ? */
/* 5 - * (0-15) y */
/* 6 - * (0-15) * */
/* 7 - MOVE R*,#? - MACRO INSTRUCTION */
/* 8 - MOVE R*,(?) - MACRO INSTRUCTION */
/* 9 - MOVE (?),R* - MACRO INSTRUCTION */
/* 10 - MOVEB R*,(R*) - MACRO INSTURCTION */
/* 11 - MOVEB (R*),R* - MACRO INSTRUCTION */
/* 12 - MOVEW R*,(R*) - MACRO INSTURCTION */
/* 13 - MOVEW (R*),R* - MACRO INSTRUCTION */
/* 14 - ? * (0-15) */
/* 15 - y * (0-15) */
#define INSTRUCTION_STRING_LENGTH_MAX 14
#define ARCH_STR "SuperFX"
#define WLA_NAME "superfx"
#endif
/**************************************************************/
/* 6502 */
/**************************************************************/
#ifdef MCS6502
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x (absolute) */
#define INSTRUCTION_STRING_LENGTH_MAX 12
#define ARCH_STR "6502"
#define WLA_NAME "6502"
#endif
/**************************************************************/
/* 65C02 */
/**************************************************************/
#ifdef WDC65C02
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x (absolute) */
/* 5 - x-abs x-rel */
#define INSTRUCTION_STRING_LENGTH_MAX 12
#define ARCH_STR "WDC65C02"
#define WLA_NAME "65c02"
#endif
/**************************************************************/
/* 65CE02 */
/**************************************************************/
#ifdef CSG65CE02
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x (absolute) */
/* 5 - x-abs x-rel */
#define INSTRUCTION_STRING_LENGTH_MAX 12
#define ARCH_STR "CSG65CE02"
#define WLA_NAME "65ce02"
#endif
/**************************************************************/
/* huc6280 */
/**************************************************************/
#ifdef HUC6280
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - ? ? ? */
/* 5 - x x */
/* 6 - x ? */
/* 7 - x (absolute) */
/* 8 - x-abs x-rel */
#define INSTRUCTION_STRING_LENGTH_MAX 12
#define ARCH_STR "HUC6280"
#define WLA_NAME "huc6280"
#endif
/**************************************************************/
/* spc700 */
/**************************************************************/
#ifdef SPC700
/* instruction types */
/* 0 - plain text */
/* 1 - x */
/* 2 - ? */
/* 3 - x ~ (odd) */
/* 4 - x ~ (even) */
/* 5 - ~ (direct) */
/* a - x x [1, 2] */
/* b - x x [2, 1] */
/* c - x ~ x (odd) [1, 2] */
/* d - x ~ x (even) [1, 2] */
/* f - ? (13-bit) ~ */
#define INSTRUCTION_STRING_LENGTH_MAX 12
#define ARCH_STR "SPC700"
#define WLA_NAME "spc700"
#endif
/**************************************************************/
/* z80 */
/**************************************************************/
#ifdef Z80
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x */
/* 5 - x 24b */
/* 6 - ? 16b */
/* 7 - x x 16b */
/* 8 - * 8b */
/* 9 - * 16b */
/* a - * x 24b */
#define INSTRUCTION_STRING_LENGTH_MAX 18
#define ARCH_STR "Z80"
#define WLA_NAME "z80"
#endif
/**************************************************************/
/* z80n */
/**************************************************************/
#ifdef Z80N
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x */
/* 5 - x 24b */
/* 6 - ? 16b */
/* 7 - x x 16b */
/* 8 - * 8b */
/* 9 - * 16b */
/* a - * x 24b */
#define INSTRUCTION_STRING_LENGTH_MAX 18
#define ARCH_STR "Z80N"
#define WLA_NAME "z80n"
#endif
/**************************************************************/
/* 68000 */
/**************************************************************/
#ifdef MC68000
/* instruction types */
/* 0 - plain text 16b */
/* 1 - ABCD, SBCD, ADDX, SUBX */
/* 2 - ADD, SUB */
/* 3 - AND, ANDI, OR, ORI */
/* 4 - ASR/ASL, LSR/LSL, ROR/ROL, ROXR/ROXL */
/* 5 - Bcc */
/* 6 - BCHG, BCLR, BSET, BTST */
/* 7 - CHK */
/* 8 - CLR, NEG, NEGX, SCC, TAS, TST */
/* 9 - CMP */
/* 10 - DBcc */
/* 11 - DIVS, DIVU, MULS, MULU */
/* 12 - EOR */
/* 13 - EXG */
/* 14 - EXT */
/* 15 - JMP, JSR, PEA */
/* 16 - LEA */
/* 17 - LINK */
/* 18 - NBCD */
/* 19 - STOP */
/* 20 - SWAP */
/* 21 - TRAP */
/* 22 - UNLK */
/* 23 - MOVE, MOVEA, MOVEQ */
/* 24 - MOVEP */
/* 25 - MOVEM */
#define MC68000_MODE_ALL 0
#define MC68000_MODE_A 1
#define MC68000_MODE_I 2
#define MC68000_MODE_Q 3
#define MC68000_MODE_M 4
#define INSTRUCTION_STRING_LENGTH_MAX 16
#define ARCH_STR "MC68000"
#define WLA_NAME "68000"
#endif
/**************************************************************/
/* 6800 */
/**************************************************************/
#ifdef MC6800
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x (absolute) */
#define INSTRUCTION_STRING_LENGTH_MAX 11
#define ARCH_STR "MC6800"
#define WLA_NAME "6800"
#endif
/**************************************************************/
/* 6801 */
/**************************************************************/
#ifdef MC6801
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x (absolute) */
#define INSTRUCTION_STRING_LENGTH_MAX 11
#define ARCH_STR "MC6801"
#define WLA_NAME "6801"
#endif
/**************************************************************/
/* 6809 */
/**************************************************************/
#ifdef MC6809
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - plain text 16b */
/* 4 - x (absolute) */
/* 5 - 8-bit signed operand, relative address */
/* 6 - 5-bit signed operand, absolute address + post op byte code */
/* 7 - 8-bit signed operand, relative address + post op byte code */
/* 8 - 16-bit operand + post op byte code */
/* 9 - plain text 8-bit + post op byte code */
/* 10 - exg / tfr */
/* 11 - pshs / pshu / puls / pulu */
#define INSTRUCTION_STRING_LENGTH_MAX 13
#define ARCH_STR "MC6809"
#define WLA_NAME "6809"
#endif
/**************************************************************/
/* 8008 */
/**************************************************************/
#ifdef I8008
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 8 - * 8b */
#define INSTRUCTION_STRING_LENGTH_MAX 6
#define ARCH_STR "I8008"
#define WLA_NAME "8008"
#endif
/**************************************************************/
/* 8080 */
/**************************************************************/
#ifdef I8080
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 8 - * 8b */
#define INSTRUCTION_STRING_LENGTH_MAX 9
#define ARCH_STR "I8080"
#define WLA_NAME "8080"
#endif
/**************************************************************/
/* 65816 */
/**************************************************************/
#ifdef W65816
/* instruction types */
/* 0 - plain text 8b */
/* 1 - x */
/* 2 - ? */
/* 3 - & */
/* 4 - x/? (mem/acc) */
/* 5 - x x */
/* 6 - REP/SEP */
/* 7 - x/? (index) */
/* 8 - plain text 16b */
/* 9 - relative ? */
/* a - x (absolute) */
#define INSTRUCTION_STRING_LENGTH_MAX 14
#define ARCH_STR "W65816"
#define WLA_NAME "65816"
#endif
#if defined(SUPERFX)
struct instruction {
char *string;
unsigned char type;
unsigned char hex;
unsigned char prefix;
unsigned char min;
unsigned char max;
};
#else
struct instruction {
char *string;
unsigned short hex;
unsigned char type;
#if defined(MC68000)
unsigned char size;
unsigned char mode;
#endif
#if defined(Z80) || defined(Z80N)
unsigned char hex_x;
#endif
#if defined(Z80) || defined(Z80N) || defined(GB) || defined(I8008) || defined(I8080)
unsigned char value;
#endif
#if defined(MCS6502) || defined(WDC65C02) || defined(CSG65CE02) || defined(HUC6280) || defined(MC6800) || defined(MC6801) || defined(MC6809)
unsigned char skip_8bit;
#endif
#if defined(W65816)
unsigned char skip_xbit;
#endif
#if defined(MC6809)
unsigned char addressing_mode_bits;
#endif
#if defined(SPC700)
unsigned char has_dot;
#endif
};
#endif
#ifndef WLA_NAME
#error "Unknown WLA_NAME!"
#endif
#ifndef ARCH_STR
#error "Unknown ARCH_STR!"
#endif
#define DEFINITION_TYPE_VALUE 0
#define DEFINITION_TYPE_STRING 1
#define DEFINITION_TYPE_STACK 2
#define DEFINITION_TYPE_ADDRESS_LABEL 3
struct definition {
char *alias;
char *string;
double value;
int type;
int size;
};
struct after_section {
char alive;
char is_appendto;
struct section_def *section;
char after[MAX_NAME_LENGTH + 1];
struct after_section *next;
};
struct macro_argument {
int type;
double value;
int start;
char has_leading_hashtag;
char string[MAX_NAME_LENGTH + 1];
};
struct macro_static {
char name[MAX_NAME_LENGTH + 1];
char namespace[MAX_NAME_LENGTH + 1];
char defined_namespace[MAX_NAME_LENGTH + 1];
int id;
int start;
int calls;
int filename_id;
int start_line;
int nargument_names;
int isolated_local;
int isolated_unnamed;
char **argument_names;
struct macro_static *next;
};
struct macro_incbin {
unsigned char *data;
int swap;
int position;
int left;
int filter_size;
};
#define MACRO_CALLER_NORMAL 0
#define MACRO_CALLER_DBM 1
#define MACRO_CALLER_DWM 2
#define MACRO_CALLER_DLM 3
#define MACRO_CALLER_DDM 4
#define MACRO_CALLER_INCBIN 5
#define MACRO_CALLER_FILTER 6
struct definition_storage {
struct definition *definition;
struct definition_storage *next;
};
struct macro_runtime {
struct macro_static *macro;
int macro_return_i;
int macro_return_line;
int macro_return_filename_id;
int supplied_arguments;
int caller;
char string[MAX_NAME_LENGTH + 1];
int string_current;
int string_last;
int offset;
struct macro_incbin *incbin_data;
struct macro_argument **argument_data;
struct definition_storage *definition_storage;
};
struct function {
char name[MAX_NAME_LENGTH + 1];
int filename_id;
int line_number;
int nargument_names;
char *argument_names[64];
int type;
double value;
struct stack *stack;
struct function *next;
};
struct label_def {
char label[MAX_NAME_LENGTH + 1];
unsigned char section_status;
unsigned char alive;
unsigned char type;
unsigned char symbol;
int section_id;
int special_id;
int address; /* in bank */
int bank;
int slot;
int base;
int filename_id;
int linenumber;
int bits_position;
int bits_to_define;
struct section_def *section_struct;
struct label_def *next;
};
struct section_def {
char name[MAX_NAME_LENGTH + 1];
char banks[MAX_NAME_LENGTH + 1];
int alignment;
int offset;
int priority;
int address; /* in bank */
int address_from_dsp;
int keep;
int bank;
int base;
int slot;
int size;
int status; /* see SECTION_STATUS_* */
int bitwindow;
int window_start;
int window_end;
int alive;
int id;
int i;
int filename_id;
int advance_org;
int maxsize_status; /* ON/OFF */
int maxsize;
int listfile_items;
int *listfile_ints;
char *listfile_cmds;
unsigned char *data;
struct namespace_def *nspace;
struct map_t *label_map;
struct section_def *next;
};
struct ext_include_collection {
int count;
int max_name_size_bytes;
char **names;
};
struct incbin_file_data {
struct incbin_file_data *next;
char *data;
char *name;
int size;
};
struct export_def {
char name[MAX_NAME_LENGTH + 1];
struct export_def *next;
};
struct namespace {
char name[MAX_NAME_LENGTH + 1];
struct namespace *next;
};
struct active_file_info {
int filename_id;
int line_current;
char namespace[MAX_NAME_LENGTH + 1];
struct active_file_info *next;
struct active_file_info *prev;
};
struct file_name_info {
char *name;
int id;
unsigned long checksum;
struct file_name_info *next;
};
struct slot {
char name[MAX_NAME_LENGTH + 1];
int address;
int size;
struct slot *next;
};
struct block {
char name[MAX_NAME_LENGTH + 1];
int address;
int filename_id;
int line_number;
struct block *next;
};
struct block_name {
char name[MAX_NAME_LENGTH + 1];
int id;
struct block_name *next;
};
struct stack {
struct stack_item *stack_items;
int id;
int compressed_id;
int position;
int filename_id;
int stacksize;
int linenumber;
int type;
int bank;
int slot;
int relative_references;
int base;
int section_status;
int section_id;
int address;
int special_id;
int bits_position;
int bits_to_define;
char is_function_body;
char is_bankheader_section;
char is_single_instance;
char has_been_calculated;
double value;
};
struct stack_item {
int type;
char sign;
char can_calculate_deltas;
char has_been_replaced;
char is_in_postfix;
double value;
char string[MAX_NAME_LENGTH + 1];
};
#define STRUCTURE_ITEM_TYPE_DATA 0
#define STRUCTURE_ITEM_TYPE_DOTTED 1
#define STRUCTURE_ITEM_TYPE_INSTANCEOF 2
#define STRUCTURE_ITEM_TYPE_UNION 3
#define STRUCTURE_ITEM_TYPE_DOTTED_INSTANCEOF 4
struct structure_item {
char name[MAX_NAME_LENGTH + 1];
int type;
int size;
int defined_size;
/* only for TYPE_INSTANCE */
struct structure *instance;
int num_instances;
int start_from;
/* only for TYPE_UNION; each union entry is stored as a structure. */
struct structure *union_items;
struct structure_item *next;
};
struct structure {
char name[MAX_NAME_LENGTH + 1];
struct structure_item *items;
struct structure_item *last_item;
int size;
int defined_size;
struct structure *next;
int alive;
};
struct union_stack {
struct structure *active_struct;
struct structure *union_first_struct;
int union_base_offset, max_enum_offset;
struct union_stack *prev;
};
struct repeat_runtime {
int start;
int start_line;
int counter;
int repeats;
int start_ifdef;
int is_while;
char index_name[MAX_NAME_LENGTH + 1];
};
struct filepointer {
char name[MAX_NAME_LENGTH + 1];
char *filename;
FILE *f;
struct filepointer *next;
};
struct string {
char *string;
struct string *next;
};
struct stringmap_entry {
int bytes_length;
unsigned char *bytes;
int text_length;
char *text;
struct stringmap_entry *next;
};
struct stringmaptable {
char *name;
char *filename;
struct stringmap_entry *entries;
struct stringmaptable *next;
};
#define TYPE_STRING 0
#define TYPE_VALUE 1
#define TYPE_LABEL 2
#define TYPE_STACK_CALCULATION 3
struct array {
char name[MAX_NAME_LENGTH + 1];
int size;
int *data;
struct array *next;
};
struct stack_item_priority_item {
int op;
int priority;
};
struct data_stream_item {
char label[MAX_NAME_LENGTH + 1];
int section_id;
int address;
int bank;
int slot;
struct data_stream_item *next;
};
struct label_context {
struct label_def *parent_labels[10];
struct macro_static *isolated_macro;
struct label_context *next;
struct label_context *prev;
int running_number;
};
/* binary value macros */
#define HEX_(n) 0x##n##LU
#define B8_(x) ((x & 0x0000000FLU) ? 1:0) | \
((x & 0x000000F0LU) ? 2:0) | \
((x & 0x00000F00LU) ? 4:0) | \
((x & 0x0000F000LU) ? 8:0) | \
((x & 0x000F0000LU) ? 16:0) | \
((x & 0x00F00000LU) ? 32:0) | \
((x & 0x0F000000LU) ? 64:0) | \
((x & 0xF0000000LU) ? 128:0)
#define B8(d) ((unsigned char)B8_(HEX_(d)))
#define B16(db1, db2) (((unsigned short)(B8(db1) << 8) | B8(db2)))
#define B32(db1, db2, db3, db4) (((unsigned long)B8(db1) << 24) | \
((unsigned long)B8(db2) << 16) | \
((unsigned long)B8(db3) << 8) | \
((unsigned long)B8(db4)))
#endif /* _DEFINES_H */