2 I figured it would be easier to write the assembly if I had a
3 working model in C first ...
10 // S11329300FFFFFFFFFFF0F0F0F0F0F0FFFFFFFFF33
22 unsigned c
= getchar();
24 if ('0' <= c
&& c
<= '9')
26 else if ('a' <= c
&& c
<= 'f')
28 else if ('A' <= c
&& c
<= 'F')
36 unsigned n
= getdigit();
37 n
= n
*16 + getdigit();
38 sum
= 255 & (sum
+ n
);
44 unsigned n
= get2digits();
45 return n
*256 + get2digits();
55 unsigned type
, count
, address
, i
, data
, xsum
;
56 while (getchar() != 'S');
58 if (type
!= 1 && type
!= 9)
62 address
= get4digits();
63 printf("type %d count %d starting %x\n", type
, count
, address
);
64 for (i
= 2; i
< count
- 1; ++i
, ++address
) {
66 printf("%04x:%02x\n", address
, data
);
70 printf("Mismatch %02x =? %02x\n", sum
, xsum
);