comparison lwasm/list.c @ 389:fbb7bfed8076

Added in structure support and fixed up some warts in the listing code (by adding more warts)
author lost@l-w.ca
date Wed, 14 Jul 2010 22:33:55 -0600
parents a741d2e4869f
children 027d7fbcdcfc
comparison
equal deleted inserted replaced
388:8991eb507d2d 389:fbb7bfed8076
53 } 53 }
54 for (cl = as -> line_head; cl; cl = cl -> next) 54 for (cl = as -> line_head; cl; cl = cl -> next)
55 { 55 {
56 if (cl -> len < 1) 56 if (cl -> len < 1)
57 { 57 {
58 fprintf(of, " "); 58 if (cl -> soff >= 0)
59 {
60 fprintf(of, "%04X ", cl -> soff & 0xffff);
61 }
62 else if (cl -> dshow >= 0)
63 {
64 if (cl -> dsize == 1)
65 {
66 fprintf(of, " %02X ", cl -> dshow & 0xff);
67 }
68 else
69 {
70 fprintf(of, " %04X ", cl -> dshow & 0xff);
71 }
72 }
73 else if (cl -> dptr)
74 {
75 lw_expr_t te;
76 te = lw_expr_copy(cl -> dptr -> value);
77 as -> exportcheck = 1;
78 as -> csect = cl -> csect;
79 lwasm_reduce_expr(as, te);
80 as -> exportcheck = 0;
81 if (lw_expr_istype(te, lw_expr_type_int))
82 {
83 fprintf(of, " %04X ", lw_expr_intval(te) & 0xffff);
84 }
85 else
86 {
87 fprintf(of, " ???? ");
88 }
89 lw_expr_destroy(te);
90 }
91 else
92 {
93 fprintf(of, " ");
94 }
59 } 95 }
60 else 96 else
61 { 97 {
62 lw_expr_t te; 98 lw_expr_t te;
63 te = lw_expr_copy(cl -> addr); 99 te = lw_expr_copy(cl -> addr);
64 as -> exportcheck = 1; 100 as -> exportcheck = 1;
101 as -> csect = cl -> csect;
65 lwasm_reduce_expr(as, te); 102 lwasm_reduce_expr(as, te);
66 as -> exportcheck = 0; 103 as -> exportcheck = 0;
104 // fprintf(of, "%s\n", lw_expr_print(te));
67 fprintf(of, "%04X ", lw_expr_intval(te) & 0xffff); 105 fprintf(of, "%04X ", lw_expr_intval(te) & 0xffff);
68 lw_expr_destroy(te); 106 lw_expr_destroy(te);
69 for (i = 0; i < cl -> outputl && i < 8; i++) 107 for (i = 0; i < cl -> outputl && i < 8; i++)
70 { 108 {
71 fprintf(of, "%02X", cl -> output[i]); 109 fprintf(of, "%02X", cl -> output[i]);
74 { 112 {
75 fprintf(of, " "); 113 fprintf(of, " ");
76 } 114 }
77 fprintf(of, " "); 115 fprintf(of, " ");
78 } 116 }
79 fprintf(of, "%15s:%05d %s\n", cl -> linespec, cl -> lineno, cl -> ltext); 117 fprintf(of, "(%31.31s):%05d %s\n", cl -> linespec, cl -> lineno, cl -> ltext);
80 if (cl -> outputl > 8) 118 if (cl -> outputl > 8)
81 { 119 {
82 for (i = 8; i < cl -> outputl; i++) 120 for (i = 8; i < cl -> outputl; i++)
83 { 121 {
84 if (i % 8 == 0) 122 if (i % 8 == 0)