4 * (C) Copyright 1989-1995
14 //#if !defined(_MSC_VER)
21 * The module lks19.c contains the function to
22 * output the relocated object code in the
23 * Motorola S19 format.
25 * lks19.c contains the following function:
28 * lks19.c contains no local variables.
32 * Record Type Field - This field signifies the start of a
33 * record and identifies the the record
36 * Ascii S1 - Data Record
37 * Ascii S9 - End of File Record
39 * Record Length Field - This field specifies the record length
40 * which includes the address, data, and
41 * checksum fields. The 8 bit record
42 * length value is converted to two ascii
43 * characters, high digit first.
45 * Load Address Field - This field consists of the four ascii
46 * characters which result from converting
47 * the the binary value of the address in
48 * which to begin loading this record. The
49 * order is as follows:
51 * High digit of high byte of address.
52 * Low digit of high byte of address.
53 * High digit of low byte of address.
54 * Low digit of low byte of address.
56 * In an End of File record this field con-
57 * sists of either four ascii zeros or the
58 * program entry address. Currently the
59 * entry address option is not supported.
61 * Data Field - This field consists of the actual data,
62 * converted to two ascii characters, high
63 * digit first. There are no data bytes in
64 * the End of File record.
66 * Checksum Field - The checksum field is the 8 bit binary
67 * sum of the record length field, the load
68 * address field, and the data field. This
69 * sum is then complemented (1's comple-
70 * ment) and converted to two ascii
71 * characters, high digit first.
76 * int i 0 - process data
79 * The function s19() outputs the relocated data
80 * in the standard Motorola S19 format.
83 * Addr_T chksum byte checksum
87 * FILE * ofp output file handle
88 * int rtcnt count of data words
89 * int rtflg[] output the data flag
90 * Addr_T rtval[] relocated data
93 * int fprintf() c_library
96 * The data is output to the file defined by ofp.
102 register Addr_T chksum;
110 for (i = 0, chksum = 1; i < rtcnt; i++) {
114 fprintf(ofp, "S1%02X", chksum);
115 for (i = 0; i < rtcnt ; i++) {
117 fprintf(ofp, "%02X", rtval[i]);
121 fprintf(ofp, "%02X\n", (-chksum-1) & 0xff);
123 fprintf(ofp, "S9030000FC\n");