comparison lwasm/lwasm.c @ 354:60568b123281

Added os9 opcodes and ERROR
author lost@starbug
date Tue, 30 Mar 2010 23:10:01 -0600
parents 4dba8c7e242c
children 0cf4948d53b4
comparison
equal deleted inserted replaced
353:faa97115952e 354:60568b123281
127 { 127 {
128 cl -> output = lw_realloc(cl -> output, cl -> outputbl + 8); 128 cl -> output = lw_realloc(cl -> output, cl -> outputbl + 8);
129 cl -> outputbl += 8; 129 cl -> outputbl += 8;
130 } 130 }
131 cl -> output[cl -> outputl++] = byte & 0xff; 131 cl -> output[cl -> outputl++] = byte & 0xff;
132
133 if (cl -> inmod)
134 {
135 asmstate_t *as = cl -> as;
136 // update module CRC
137 // this is a direct transliteration from the nitros9 asm source
138 // to C; it can, no doubt, be optimized for 32 bit processing
139 byte &= 0xff;
140
141 byte ^= (as -> crc)[0];
142 (as -> crc)[0] = (as -> crc)[1];
143 (as -> crc)[1] = (as -> crc)[2];
144 (as -> crc)[1] ^= (byte >> 7);
145 (as -> crc)[2] = (byte << 1);
146 (as -> crc)[1] ^= (byte >> 2);
147 (as -> crc)[2] ^= (byte << 6);
148 byte ^= (byte << 1);
149 byte ^= (byte << 2);
150 byte ^= (byte << 4);
151 if (byte & 0x80)
152 {
153 (as -> crc)[0] ^= 0x80;
154 (as -> crc)[2] ^= 0x21;
155 }
156 }
132 } 157 }
133 158
134 void lwasm_emitop(line_t *cl, int opc) 159 void lwasm_emitop(line_t *cl, int opc)
135 { 160 {
136 if (opc > 0x100) 161 if (opc > 0x100)