Mercurial > hg-old > index.cgi
diff lwasm/os9.c @ 238:a9a14e6b4bc8
Fixed os9 module CRC calculation
author | lost |
---|---|
date | Sat, 15 Aug 2009 05:26:02 +0000 |
parents | a58f49a77441 |
children |
line wrap: on
line diff
--- a/lwasm/os9.c Fri Aug 14 04:20:15 2009 +0000 +++ b/lwasm/os9.c Sat Aug 15 05:26:02 2009 +0000 @@ -113,7 +113,9 @@ as -> addr = 0; // init crc - as -> crc = 0xffffff; + as -> crc[0] = 0xff; + as -> crc[1] = 0xff; + as -> crc[2] = 0xff; as -> inmod = 1; // sync bytes @@ -138,7 +140,7 @@ lwasm_emit(as, l, ~(0x87 ^ 0xCD ^ (modvals[0] >> 8) ^ (modvals[0] & 0xff) ^ (modvals[1] >> 8) ^ (modvals[1] & 0xff) ^ modvals[2] ^ modvals[3])); - + // module type specific output // note that these are handled the same for all so // there need not be any special casing @@ -154,7 +156,7 @@ OPFUNC(pseudo_emod) { - unsigned long tcrc; + unsigned char tcrc[3]; if (as -> outformat != OUTPUT_OS9) { @@ -169,9 +171,11 @@ } // don't mess with CRC! - tcrc = as -> crc; - lwasm_emit(as, l, tcrc >> 16); - lwasm_emit(as, l, tcrc >> 8); - lwasm_emit(as, l, tcrc); + tcrc[0] = as -> crc[0] ^ 0xff; + tcrc[1] = as -> crc[1] ^ 0xff; + tcrc[2] = as -> crc[2] ^ 0xff; + lwasm_emit(as, l, tcrc[0]); + lwasm_emit(as, l, tcrc[1]); + lwasm_emit(as, l, tcrc[2]); as -> inmod = 0; }