@@ -88,7 +88,7 @@ static void print_statement_address(FILE *out, int n, uint16_t logical, uint8_t
8888 fprintf (out , "%*c; bank: $%03x logical: $%04x" , last_column_spacing (n ), ' ' , page , logical );
8989}
9090
91- static void print_label (FILE * out , label_t * label ) {
91+ static void print_label (FILE * out , Label * label ) {
9292 int n = last_column_spacing ((int )strlen (label -> name ) + 1 );
9393 /* Print description */
9494 print_comment (out , label -> description );
@@ -97,7 +97,7 @@ static void print_label(FILE *out, label_t *label) {
9797}
9898
9999/* Finds any jump address from the current section. */
100- int label_extract (section_t * section , memmap_t * map , label_repository_t * repository ) {
100+ bool label_extract (Section * section , MemoryMap * map , LabelRepository * repository ) {
101101 int i ;
102102 uint8_t inst ;
103103 uint8_t data [6 ];
@@ -106,9 +106,9 @@ int label_extract(section_t *section, memmap_t *map, label_repository_t *reposit
106106 uint16_t logical ;
107107 uint8_t page ;
108108
109- const opcode_t * opcode ;
109+ const Opcode * opcode ;
110110
111- if (section -> type != Code ) {
111+ if (section -> type != SECTION_TYPE_CODE ) {
112112 return 1 ;
113113 }
114114
@@ -160,7 +160,7 @@ int label_extract(section_t *section, memmap_t *map, label_repository_t *reposit
160160 return 1 ;
161161}
162162
163- static int data_extract_binary (FILE * out , section_t * section , memmap_t * map , label_repository_t * repository ) {
163+ static int data_extract_binary (FILE * out , Section * section , MemoryMap * map , LabelRepository * repository ) {
164164 uint16_t logical ;
165165 int32_t i ;
166166 for (i = 0 , logical = section -> logical ; i < section -> size ; i ++ , logical ++ ) {
@@ -170,16 +170,16 @@ static int data_extract_binary(FILE *out, section_t *section, memmap_t *map, lab
170170 return 1 ;
171171}
172172
173- static int data_extract_hex (FILE * out , section_t * section , memmap_t * map , label_repository_t * repository ,
174- comment_repository_t * comments , int extra_infos ) {
173+ static int data_extract_hex (FILE * out , Section * section , MemoryMap * map , LabelRepository * repository ,
174+ CommentRepository * comments , int extra_infos ) {
175175 const int32_t element_size = section -> data .element_size ;
176176 const int32_t elements_per_line = section -> data .elements_per_line ;
177177
178178 int32_t i , j ;
179179 uint16_t logical ;
180180
181- label_t label ;
182- comment_t comment ;
181+ Label label ;
182+ Comment comment ;
183183
184184 uint8_t buffer [2 ] = {0 };
185185 int32_t top = 0 ;
@@ -211,7 +211,7 @@ static int data_extract_hex(FILE *out, section_t *section, memmap_t *map, label_
211211 j = 0 ;
212212 }
213213
214- comment_t dummy ;
214+ Comment dummy ;
215215 if (comment_repository_find (comments , logical , page , & dummy )) {
216216 if (has_comment ) {
217217 if (top && (top < element_size )) {
@@ -223,7 +223,7 @@ static int data_extract_hex(FILE *out, section_t *section, memmap_t *map, label_
223223 }
224224 print_inline_comment (out , (int )(ftell (out ) - line_offset ), comment .text );
225225 }
226- memcpy (& comment , & dummy , sizeof (comment_t ));
226+ memcpy (& comment , & dummy , sizeof (Comment ));
227227 has_comment = 1 ;
228228 j = 0 ;
229229 }
@@ -288,8 +288,8 @@ static int data_extract_hex(FILE *out, section_t *section, memmap_t *map, label_
288288 return 1 ;
289289}
290290
291- static int data_extract_string (FILE * out , section_t * section , memmap_t * map , label_repository_t * repository ,
292- comment_repository_t * comments , int extra_infos ) {
291+ static int data_extract_string (FILE * out , Section * section , MemoryMap * map , LabelRepository * repository ,
292+ CommentRepository * comments , int extra_infos ) {
293293 const int32_t elements_per_line = section -> data .elements_per_line ;
294294
295295 int32_t i , j ;
@@ -303,13 +303,13 @@ static int data_extract_string(FILE *out, section_t *section, memmap_t *map, lab
303303 uint16_t line_logical = 0 ;
304304 uint8_t line_page ;
305305
306- comment_t comment = {0 };
306+ Comment comment = {0 };
307307
308308 for (i = 0 , j = 0 , logical = section -> logical ; i < section -> size ; i ++ , logical ++ ) {
309309 uint8_t data = memmap_read (map , logical );
310310 uint8_t page = memmap_page (map , logical );
311311
312- label_t label = {0 };
312+ Label label = {0 };
313313
314314 has_label = label_repository_find (repository , logical , page , & label );
315315
@@ -325,7 +325,7 @@ static int data_extract_string(FILE *out, section_t *section, memmap_t *map, lab
325325 print_label (out , & label );
326326 }
327327
328- comment_t dummy ;
328+ Comment dummy ;
329329 if (comment_repository_find (comments , logical , page , & dummy )) {
330330 if (j ) {
331331 if (c ) { // close string if neededs
@@ -337,7 +337,7 @@ static int data_extract_string(FILE *out, section_t *section, memmap_t *map, lab
337337 if (has_comment ) {
338338 print_inline_comment (out , (int )(ftell (out ) - line_offset ), comment .text );
339339 }
340- memcpy (& comment , & dummy , sizeof (comment_t ));
340+ memcpy (& comment , & dummy , sizeof (Comment ));
341341 has_comment = 1 ;
342342 }
343343
@@ -409,16 +409,16 @@ static int data_extract_string(FILE *out, section_t *section, memmap_t *map, lab
409409 return 1 ;
410410}
411411
412- static int data_extract_jump_table (FILE * out , section_t * section , memmap_t * map , label_repository_t * repository ,
413- comment_repository_t * comments , int extra_infos ) {
412+ static int data_extract_jump_table (FILE * out , Section * section , MemoryMap * map , LabelRepository * repository ,
413+ CommentRepository * comments , int extra_infos ) {
414414 const int32_t elements_per_line = section -> data .elements_per_line ;
415415
416416 int32_t i , j ;
417417 uint8_t page ;
418418 uint16_t logical ;
419419
420- label_t label ;
421- comment_t comment ;
420+ Label label ;
421+ Comment comment ;
422422
423423 size_t line_offset = ftell (out );
424424 uint8_t line_page = section -> page ;
@@ -444,12 +444,12 @@ static int data_extract_jump_table(FILE *out, section_t *section, memmap_t *map,
444444 j = 0 ;
445445 }
446446
447- comment_t dummy ;
447+ Comment dummy ;
448448 if (comment_repository_find (comments , logical , page , & dummy )) {
449449 if (has_comment ) {
450450 print_inline_comment (out , (int )(ftell (out ) - line_offset ), comment .text );
451451 }
452- memcpy (& comment , & dummy , sizeof (comment_t ));
452+ memcpy (& comment , & dummy , sizeof (Comment ));
453453 has_comment = 1 ;
454454 j = 0 ;
455455 }
@@ -498,25 +498,25 @@ static int data_extract_jump_table(FILE *out, section_t *section, memmap_t *map,
498498}
499499
500500/* Process data section. The result will be output has a binary file or an asm file containing hex values or strings. */
501- int data_extract (FILE * out , section_t * section , memmap_t * map , label_repository_t * repository ,
502- comment_repository_t * comments , int extra_infos ) {
501+ bool data_extract (FILE * out , Section * section , MemoryMap * map , LabelRepository * repository ,
502+ CommentRepository * comments , int extra_infos ) {
503503 switch (section -> data .type ) {
504- case Binary :
504+ case DATA_TYPE_BINARY :
505505 return data_extract_binary (out , section , map , repository );
506- case Hex :
506+ case DATA_TYPE_HEX :
507507 return data_extract_hex (out , section , map , repository , comments , extra_infos );
508- case String :
508+ case DATA_TYPE_STRING :
509509 return data_extract_string (out , section , map , repository , comments , extra_infos );
510- case JumpTable :
510+ case DATA_TYPE_JUMP_TABLE :
511511 return data_extract_jump_table (out , section , map , repository , comments , extra_infos );
512512 default :
513- return 0 ;
513+ return false ;
514514 }
515515}
516516
517517/* Process code section. */
518- int decode (FILE * out , uint16_t * logical , section_t * section , memmap_t * map , label_repository_t * repository ,
519- comment_repository_t * comments , int extra_infos ) {
518+ int decode (FILE * out , uint16_t * logical , Section * section , MemoryMap * map , LabelRepository * repository ,
519+ CommentRepository * comments , int extra_infos ) {
520520 int i , delta ;
521521 uint8_t inst , data [6 ], is_jump ;
522522 char eor ;
@@ -525,9 +525,9 @@ int decode(FILE *out, uint16_t *logical, section_t *section, memmap_t *map, labe
525525 uint8_t current_page ;
526526 uint16_t current_logical ;
527527 uint16_t next_logical ;
528- label_t label ;
528+ Label label ;
529529
530- const opcode_t * opcode ;
530+ const Opcode * opcode ;
531531
532532 eor = 0 ;
533533
@@ -794,7 +794,7 @@ int decode(FILE *out, uint16_t *logical, section_t *section, memmap_t *map, labe
794794 }
795795
796796 /* display inline comments if any */
797- comment_t comment = {0 };
797+ Comment comment = {0 };
798798 int n = (int )(ftell (out ) - start );
799799 if (comment_repository_find (comments , current_logical , current_page , & comment )) {
800800 print_inline_comment (out , n , comment .text );
@@ -806,10 +806,10 @@ int decode(FILE *out, uint16_t *logical, section_t *section, memmap_t *map, labe
806806}
807807
808808/* Computes section size. */
809- int32_t compute_size (section_t * sections , int index , int count , memmap_t * map ) {
809+ int32_t compute_size (Section * sections , int index , int count , MemoryMap * map ) {
810810 uint8_t i ;
811811 uint8_t data [7 ];
812- section_t * current = & sections [index ];
812+ Section * current = & sections [index ];
813813 uint32_t start = current -> logical ;
814814 uint32_t logical = start ;
815815
@@ -833,7 +833,7 @@ int32_t compute_size(section_t *sections, int index, int count, memmap_t *map) {
833833 }
834834 uint8_t page = memmap_page (map , logical );
835835 data [0 ] = memmap_read (map , logical );
836- const opcode_t * opcode = opcode_get (data [0 ]);
836+ const Opcode * opcode = opcode_get (data [0 ]);
837837 for (i = 1 ; i < opcode -> size ; i ++ ) {
838838 data [i ] = memmap_read (map , logical + i );
839839 }
@@ -875,10 +875,10 @@ int32_t compute_size(section_t *sections, int index, int count, memmap_t *map) {
875875}
876876
877877/* Output hardware IO port and RAM labels. */
878- void label_dump (FILE * out , memmap_t * map , label_repository_t * repository ) {
878+ void label_dump (FILE * out , MemoryMap * map , LabelRepository * repository ) {
879879 int count = label_repository_size (repository );
880880 for (int i = 0 ; i < count ; i ++ ) {
881- label_t label ;
881+ Label label ;
882882 if (label_repository_get (repository , i , & label )) {
883883 // IO port and RAM
884884 if ((label .page == 0xff ) || (label .page == 0xf8 )) {
0 commit comments