X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=as%2Flink%2Fmcs51%2Flks19.c;fp=as%2Flink%2Fmcs51%2Flks19.c;h=e4a297f7d6bbfaf91a3b247bc253d2aefaeb47a5;hb=22ec133e94d056a395025c302b6c331c8cd04658;hp=26d8892e850de128e3d1d929b5c66fab5db3c7de;hpb=b7fec7bdb767e95165097f43e52cf1cbc4ee6017;p=fw%2Fsdcc diff --git a/as/link/mcs51/lks19.c b/as/link/mcs51/lks19.c index 26d8892e..e4a297f7 100644 --- a/as/link/mcs51/lks19.c +++ b/as/link/mcs51/lks19.c @@ -1,122 +1,129 @@ -/* lks19.c */ +/* lks19.c -/* - * (C) Copyright 1989-1995 - * All Rights Reserved - * - * Alan R. Baldwin - * 721 Berkeley St. - * Kent, Ohio 44240 - */ + Copyright (C) 1989-1995 Alan R. Baldwin + 721 Berkeley St., Kent, Ohio 44240 + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ #include #include #include "aslink.h" -/*)Module lks19.c +/*)Module lks19.c * - * The module lks19.c contains the function to - * output the relocated object code in the - * Motorola S19 format. + * The module lks19.c contains the function to + * output the relocated object code in the + * Motorola S19 format. * - * lks19.c contains the following function: - * VOID s19(i) + * lks19.c contains the following function: + * VOID s19(i) * - * lks19.c contains no local variables. + * lks19.c contains no local variables. */ /*)S19 Format * Record Type Field - This field signifies the start of a * record and identifies the the record - * type as follows: + * type as follows: * - * Ascii S1 - Data Record - * Ascii S9 - End of File Record + * Ascii S1 - Data Record + * Ascii S9 - End of File Record * * Record Length Field - This field specifies the record length * which includes the address, data, and * checksum fields. The 8 bit record * length value is converted to two ascii - * characters, high digit first. + * characters, high digit first. * * Load Address Field - This field consists of the four ascii * characters which result from converting * the the binary value of the address in * which to begin loading this record. The - * order is as follows: + * order is as follows: * - * High digit of high byte of address. - * Low digit of high byte of address. - * High digit of low byte of address. - * Low digit of low byte of address. + * High digit of high byte of address. + * Low digit of high byte of address. + * High digit of low byte of address. + * Low digit of low byte of address. * * In an End of File record this field con- * sists of either four ascii zeros or the * program entry address. Currently the - * entry address option is not supported. + * entry address option is not supported. * * Data Field - This field consists of the actual data, * converted to two ascii characters, high * digit first. There are no data bytes in - * the End of File record. + * the End of File record. * * Checksum Field - The checksum field is the 8 bit binary * sum of the record length field, the load * address field, and the data field. This * sum is then complemented (1's comple- * ment) and converted to two ascii - * characters, high digit first. + * characters, high digit first. */ -/*)Function s19(i) +/*)Function s19(i) * - * int i 0 - process data - * 1 - end of data + * int i 0 - process data + * 1 - end of data * - * The function s19() outputs the relocated data - * in the standard Motorola S19 format. + * The function s19() outputs the relocated data + * in the standard Motorola S19 format. * - * local variables: - * Addr_T chksum byte checksum + * local variables: + * Addr_T chksum byte checksum * - * global variables: - * int hilo byte order - * FILE * ofp output file handle - * int rtcnt count of data words - * int rtflg[] output the data flag - * Addr_T rtval[] relocated data + * global variables: + * int hilo byte order + * FILE * ofp output file handle + * int rtcnt count of data words + * int rtflg[] output the data flag + * Addr_T rtval[] relocated data * - * functions called: - * int fprintf() c_library + * functions called: + * int fprintf() c_library * - * side effects: - * The data is output to the file defined by ofp. + * side effects: + * The data is output to the file defined by ofp. */ VOID s19(i) { - register Addr_T chksum; + register Addr_T chksum; - if (i) { - if (hilo == 0) { - chksum = rtval[0]; - rtval[0] = rtval[1]; - rtval[1] = chksum; - } - for (i = 0, chksum = 1; i < rtcnt; i++) { - if (rtflg[i]) - chksum++; - } - fprintf(ofp, "S1%02X", chksum); - for (i = 0; i < rtcnt ; i++) { - if (rtflg[i]) { - fprintf(ofp, "%02X", rtval[i]); - chksum += rtval[i]; - } - } - fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff); - } else { - fprintf(ofp, "S9030000FC\n"); - } + if (i) { + if (hilo == 0) { + chksum = rtval[0]; + rtval[0] = rtval[1]; + rtval[1] = chksum; + } + for (i = 0, chksum = 1; i < rtcnt; i++) { + if (rtflg[i]) + chksum++; + } + fprintf(ofp, "S1%02X", chksum); + for (i = 0; i < rtcnt ; i++) { + if (rtflg[i]) { + fprintf(ofp, "%02X", rtval[i]); + chksum += rtval[i]; + } + } + fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff); + } else { + fprintf(ofp, "S9030000FC\n"); + } }