4 * (C) Copyright 1989-1995
19 * The module lks19.c contains the function to
20 * output the relocated object code in the
21 * Motorola S19 format.
23 * lks19.c contains the following function:
26 * lks19.c contains no local variables.
30 * Record Type Field - This field signifies the start of a
31 * record and identifies the the record
34 * Ascii S1 - Data Record
35 * Ascii S9 - End of File Record
37 * Record Length Field - This field specifies the record length
38 * which includes the address, data, and
39 * checksum fields. The 8 bit record
40 * length value is converted to two ascii
41 * characters, high digit first.
43 * Load Address Field - This field consists of the four ascii
44 * characters which result from converting
45 * the the binary value of the address in
46 * which to begin loading this record. The
47 * order is as follows:
49 * High digit of high byte of address.
50 * Low digit of high byte of address.
51 * High digit of low byte of address.
52 * Low digit of low byte of address.
54 * In an End of File record this field con-
55 * sists of either four ascii zeros or the
56 * program entry address. Currently the
57 * entry address option is not supported.
59 * Data Field - This field consists of the actual data,
60 * converted to two ascii characters, high
61 * digit first. There are no data bytes in
62 * the End of File record.
64 * Checksum Field - The checksum field is the 8 bit binary
65 * sum of the record length field, the load
66 * address field, and the data field. This
67 * sum is then complemented (1's comple-
68 * ment) and converted to two ascii
69 * characters, high digit first.
74 * int i 0 - process data
77 * The function s19() outputs the relocated data
78 * in the standard Motorola S19 format.
81 * Addr_T chksum byte checksum
85 * FILE * ofp output file handle
86 * int rtcnt count of data words
87 * int rtflg[] output the data flag
88 * Addr_T rtval[] relocated data
91 * int fprintf() c_library
94 * The data is output to the file defined by ofp.
100 register Addr_T chksum;
108 for (i = 0, chksum = 1; i < rtcnt; i++) {
112 fprintf(ofp, "S1%02X", chksum);
113 for (i = 0; i < rtcnt ; i++) {
115 fprintf(ofp, "%02X", rtval[i]);
119 fprintf(ofp, "%02X\n", (-chksum-1) & 0xff);
121 fprintf(ofp, "S9030000FC\n");