123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
-
-
-
-
-
- #include <stdio.h>
- #include <unistd.h>
-
-
-
-
- typedef unsigned char t_u8;
- typedef unsigned short t_u16;
-
- #define LL_MAX_LINE 16
- typedef struct
- {
- t_u8 intel_lg_data;
- t_u16 intel_adr;
- t_u8 intel_type;
- t_u8 intel_data [LL_MAX_LINE];
- t_u8 intel_lrc;
- } t_one_line;
- #define INTEL_DATA_TYPE 0
- #define EXIT_OK 0
- int main (const int argc, const char ** const argv)
- {
- t_one_line line;
-
-
- line.intel_adr = 0;
- line.intel_type = INTEL_DATA_TYPE;
-
-
- while ((line.intel_lg_data = read (0, &line.intel_data [0] ,LL_MAX_LINE )) > 0)
- {
- t_u8 i;
-
-
- line.intel_lrc = line.intel_lg_data;
- line.intel_lrc += ((line.intel_adr >> 8) & 0xff);
- line.intel_lrc += (line.intel_adr &0xff);
- line.intel_lrc += line.intel_type;
-
-
- (void) printf (":%02X%04X%02X",
- line.intel_lg_data,
- line.intel_adr,
- line.intel_type);
-
-
- for (i=0; i<line.intel_lg_data; i++)
- {
- (void) printf ("%02X",
- (line.intel_data [i] & 0xff));
-
-
- line.intel_lrc +=line.intel_data [i];
- }
-
-
- (void) printf ("%02X\n",
- (0x100 - line.intel_lrc) & 0xff);
-
-
- line.intel_adr+=line.intel_lg_data;
- }
-
-
- printf (":00000001FF\n");
- exit (EXIT_OK);
- }
|