4 * (C) Copyright 1989-1995
18 * The module lks19.c contains the function to
19 * output the relocated object code in the
20 * Motorola S19 format.
22 * lks19.c contains the following function:
25 * lks19.c contains no local variables.
29 * Record Type Field - This field signifies the start of a
30 * record and identifies the the record
33 * Ascii S1 - Data Record
34 * Ascii S9 - End of File Record
36 * Record Length Field - This field specifies the record length
37 * which includes the address, data, and
38 * checksum fields. The 8 bit record
39 * length value is converted to two ascii
40 * characters, high digit first.
42 * Load Address Field - This field consists of the four ascii
43 * characters which result from converting
44 * the the binary value of the address in
45 * which to begin loading this record. The
46 * order is as follows:
48 * High digit of high byte of address.
49 * Low digit of high byte of address.
50 * High digit of low byte of address.
51 * Low digit of low byte of address.
53 * In an End of File record this field con-
54 * sists of either four ascii zeros or the
55 * program entry address. Currently the
56 * entry address option is not supported.
58 * Data Field - This field consists of the actual data,
59 * converted to two ascii characters, high
60 * digit first. There are no data bytes in
61 * the End of File record.
63 * Checksum Field - The checksum field is the 8 bit binary
64 * sum of the record length field, the load
65 * address field, and the data field. This
66 * sum is then complemented (1's comple-
67 * ment) and converted to two ascii
68 * characters, high digit first.
73 * int i 0 - process data
76 * The function s19() outputs the relocated data
77 * in the standard Motorola S19 format.
80 * Addr_T chksum byte checksum
84 * FILE * ofp output file handle
85 * int rtcnt count of data words
86 * int rtflg[] output the data flag
87 * Addr_T rtval[] relocated data
90 * int fprintf() c_library
93 * The data is output to the file defined by ofp.
99 register Addr_T chksum;
102 if (ap->a_flag & A_NOLOAD)
109 for (i = 0, chksum = 1; i < rtcnt; i++) {
113 fprintf(ofp, "S1%02X", chksum);
114 for (i = 0; i < rtcnt ; i++) {
116 fprintf(ofp, "%02X", rtval[i]);
120 fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff);
122 fprintf(ofp, "S9030000FC\n");