* asranlib/asranlib.c, link/lkar.h, link/lkar.c:
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 5 Feb 2009 22:15:19 +0000 (22:15 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 5 Feb 2009 22:15:19 +0000 (22:15 +0000)
  added support for BSD (Mac OS X) ar format
* as/asxxsrc/aslex.c, as/as/asxxsrc/asnoice.c, as/as/asxxsrc/assym.c,
  as/as/hc08/asdata.c, as/hc08/asexpr.c, as/hc08/aslist.c,
  as/hc08/asm.h, as/hc08/asmain.c, as/hc08/asout.c, as/hc08/assubr.c,
  as/hc08/m08adr.c, as/hc08/m08ext.c, as/hc08/m08mch.c,
  as/hc08/m08pst.c, as/hc08/m6808.h, as/link/aslink.h,
  as/link/hc08/lkarea.c, as/link/hc08/lkelf.c, as/link/hc08/lkihx.c,
  as/link/hc08/lkmain.c, as/link/hc08/lkmem.c, as/link/hc08/lkrloc.c,
  as/link/hc08/lks19.c, as/link/lkaomf51.c, as/link/lkdata.c,
  as/link/lkeval.c, as/link/lkhead.c, as/link/lklex.c, as/link/lklib.c,
  as/link/lklibr.c, as/link/lklibr.h, as/link/lklist.c,
  as/link/lknoice.c, as/link/lkrel.c, as/link/lkrel.h,
  as/link/lksdcclib.c, as/link/lkstore.c, as/link/lksym.c,
  as/link/mcs51/lkarea.c, as/link/mcs51/lkihx.c,
  as/link/mcs51/lkmain.c, as/link/mcs51/lkmem.c,
  as/link/mcs51/lkrloc.c, as/link/mcs51/lks19.c, as/link/z80/lkarea.c,
  as/link/z80/lkgb.c, as/link/z80/lkgg.c, as/link/z80/lkihx.c,
  as/link/z80/lkmain.c, as/link/z80/lkrloc.c, as/link/z80/lks19.c,
  as/mcs51/asdata.c, as/mcs51/asexpr.c, as/mcs51/aslist.c,
  as/mcs51/asm.h, as/mcs51/asmain.c, as/mcs51/asout.c,
  as/mcs51/assubr.c, as/mcs51/i51adr.c, as/mcs51/i51ext.c,
  as/mcs51/i51mch.c, as/mcs51/i51pst.c, as/mcs51/i8051.h,
  as/xa51/xa_link.c, as/xa51/xa_main.c, as/xa51/xa_main.h,
  as/xa51/xa_rasm.l, as/xa51/xa_rasm.y, as/xa51/xa_version.h,
  as/z80/asdata.c, as/z80/asexpr.c, as/z80/aslist.c, as/z80/asm.h,
  as/z80/asmain.c, as/z80/asout.c, as/z80/assubr.c, as/z80/z80.h,
  as/z80/z80adr.c, as/z80/z80ext.c, as/z80/z80mch.c, as/z80/z80pst.c:
  changed license to GPL either version 3, or (at your option) any
  later version

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5356 4a8a32a2-be11-0410-ad9d-d568d2c75423

82 files changed:
ChangeLog
as/asxxsrc/aslex.c
as/asxxsrc/asnoice.c
as/asxxsrc/assym.c
as/hc08/asdata.c
as/hc08/asexpr.c
as/hc08/aslist.c
as/hc08/asm.h
as/hc08/asmain.c
as/hc08/asout.c
as/hc08/assubr.c
as/hc08/m08adr.c
as/hc08/m08ext.c
as/hc08/m08mch.c
as/hc08/m08pst.c
as/hc08/m6808.h
as/link/aslink.h
as/link/hc08/lkarea.c
as/link/hc08/lkelf.c
as/link/hc08/lkihx.c
as/link/hc08/lkmain.c
as/link/hc08/lkmem.c
as/link/hc08/lkrloc.c
as/link/hc08/lks19.c
as/link/lkaomf51.c
as/link/lkdata.c
as/link/lkeval.c
as/link/lkhead.c
as/link/lklex.c
as/link/lklib.c
as/link/lklibr.c
as/link/lklibr.h
as/link/lklist.c
as/link/lknoice.c
as/link/lkrel.c
as/link/lkrel.h
as/link/lksdcclib.c
as/link/lkstore.c
as/link/lksym.c
as/link/mcs51/lkarea.c
as/link/mcs51/lkihx.c
as/link/mcs51/lkmain.c
as/link/mcs51/lkmem.c
as/link/mcs51/lkrloc.c
as/link/mcs51/lks19.c
as/link/z80/lkarea.c
as/link/z80/lkgb.c
as/link/z80/lkgg.c
as/link/z80/lkihx.c
as/link/z80/lkmain.c
as/link/z80/lkrloc.c
as/link/z80/lks19.c
as/mcs51/asdata.c
as/mcs51/asexpr.c
as/mcs51/aslist.c
as/mcs51/asm.h
as/mcs51/asmain.c
as/mcs51/asout.c
as/mcs51/assubr.c
as/mcs51/i51adr.c
as/mcs51/i51ext.c
as/mcs51/i51mch.c
as/mcs51/i51pst.c
as/mcs51/i8051.h
as/xa51/xa_link.c
as/xa51/xa_main.c
as/xa51/xa_main.h
as/xa51/xa_rasm.l
as/xa51/xa_rasm.y
as/xa51/xa_version.h
as/z80/asdata.c
as/z80/asexpr.c
as/z80/aslist.c
as/z80/asm.h
as/z80/asmain.c
as/z80/asout.c
as/z80/assubr.c
as/z80/z80.h
as/z80/z80adr.c
as/z80/z80ext.c
as/z80/z80mch.c
as/z80/z80pst.c

index 5891d3c4c00070ce5553b653797482ea96eab992..f3286f40e8033847b38a95b3996e97bcad579234 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2009-02-05 Borut Razem <borut.razem AT siol.net>
+
+       * asranlib/asranlib.c, link/lkar.h, link/lkar.c:
+         added support for BSD (Mac OS X) ar format
+       * as/asxxsrc/aslex.c, as/as/asxxsrc/asnoice.c, as/as/asxxsrc/assym.c,
+         as/as/hc08/asdata.c, as/hc08/asexpr.c, as/hc08/aslist.c,
+         as/hc08/asm.h, as/hc08/asmain.c, as/hc08/asout.c, as/hc08/assubr.c,
+         as/hc08/m08adr.c, as/hc08/m08ext.c, as/hc08/m08mch.c,
+         as/hc08/m08pst.c, as/hc08/m6808.h, as/link/aslink.h,
+         as/link/hc08/lkarea.c, as/link/hc08/lkelf.c, as/link/hc08/lkihx.c,
+         as/link/hc08/lkmain.c, as/link/hc08/lkmem.c, as/link/hc08/lkrloc.c,
+         as/link/hc08/lks19.c, as/link/lkaomf51.c, as/link/lkdata.c,
+         as/link/lkeval.c, as/link/lkhead.c, as/link/lklex.c, as/link/lklib.c,
+         as/link/lklibr.c, as/link/lklibr.h, as/link/lklist.c,
+         as/link/lknoice.c, as/link/lkrel.c, as/link/lkrel.h,
+         as/link/lksdcclib.c, as/link/lkstore.c, as/link/lksym.c,
+         as/link/mcs51/lkarea.c, as/link/mcs51/lkihx.c,
+         as/link/mcs51/lkmain.c, as/link/mcs51/lkmem.c,
+         as/link/mcs51/lkrloc.c, as/link/mcs51/lks19.c, as/link/z80/lkarea.c,
+         as/link/z80/lkgb.c, as/link/z80/lkgg.c, as/link/z80/lkihx.c,
+         as/link/z80/lkmain.c, as/link/z80/lkrloc.c, as/link/z80/lks19.c,
+         as/mcs51/asdata.c, as/mcs51/asexpr.c, as/mcs51/aslist.c,
+         as/mcs51/asm.h, as/mcs51/asmain.c, as/mcs51/asout.c,
+         as/mcs51/assubr.c, as/mcs51/i51adr.c, as/mcs51/i51ext.c,
+         as/mcs51/i51mch.c, as/mcs51/i51pst.c, as/mcs51/i8051.h,
+         as/xa51/xa_link.c, as/xa51/xa_main.c, as/xa51/xa_main.h,
+         as/xa51/xa_rasm.l, as/xa51/xa_rasm.y, as/xa51/xa_version.h,
+         as/z80/asdata.c, as/z80/asexpr.c, as/z80/aslist.c, as/z80/asm.h,
+         as/z80/asmain.c, as/z80/asout.c, as/z80/assubr.c, as/z80/z80.h,
+         as/z80/z80adr.c, as/z80/z80ext.c, as/z80/z80mch.c, as/z80/z80pst.c:
+         changed license to GPL either version 3, or (at your option) any
+         later version
+
 2009-02-05 Borut Razem <borut.razem AT siol.net>
 
        * asranlib/asranlib.c, link/lkar.h, link/lkar.c:
 
 2005-04-02 Vangelis Rokas <vrokas AT users.sourceforge.net>
 
-        * device/include/asm/pic16/features.h,
-        * pic18f*.h headers,
-        * device/include/pic16/adc.h,
-        * device/include/pic16/delay.h,
-        * device/include/pic16/i2c.h,
-        * device/include/pic16/malloc.h,
-        * device/include/pic16/stdio.h,
-        * device/include/pic16/stdlib.h,
-        * device/include/pic16/string.h,
-        * device/lib/pic16/libc/stdio/printf_tiny.c,
-        * device/lib/pic16/libc/stdio/printf_small.c,
-        * device/lib/pic16/libc/stdio/strmgpsim.c,
-        * device/lib/pic16/libc/stdio/strmmssp.c,
-        * device/lib/pic16/libc/stdio/strmusart.c,
-        * device/lib/pic16/libc/stdio/vfprintf.c,
-        * device/lib/pic16/libc/stdlib/ltoa.c,
-        * device/lib/pic16/libc/stdlib/putchar.c,
-        * device/lib/pic16/libc/stdlib/x_ftoa.c,
-        * device/lib/pic16/libc/stdlib/memchrpgm.c,
-        * device/lib/pic16/libc/stdlib/memchrram.c,
-        * device/lib/pic16/libc/stdlib/memcpypgm2ram.c,
-        * device/lib/pic16/libc/stdlib/memcpyram2ram.c,
-        * device/lib/pic16/libio/adc/adcbusy.c,
-        * device/lib/pic16/libio/adc/adcread.c,
-        * device/lib/pic16/libio/adc/adcsetch.c,
-        * device/lib/pic16/libio/usart/ubaud.c,
-        * device/lib/pic16/libio/usart/ubusy.c,
-        * device/lib/pic16/libio/usart/udrdy.c,
-        * device/lib/pic16/libio/usart/uopen.c,
-        * device/lib/pic16/libio/usart/uputc.c,
-        * device/lib/pic16/libsdcc/gptr/gptrget1.c,
-        * device/lib/pic16/libsdcc/gptr/gptrget2.c,
-        * device/lib/pic16/libsdcc/gptr/gptrget3.c,
-        * device/lib/pic16/libsdcc/gptr/gptrget4.c,
-        * device/lib/pic16/libsdcc/gptr/gptrput1.c,
-        * device/lib/pic16/libsdcc/gptr/gptrput2.c,
-        * device/lib/pic16/libsdcc/gptr/gptrput3.c,
-        * device/lib/pic16/libsdcc/gptr/gptrput4.c: modified all SDCC
-        specific keywords to double underlined form,
-        * device/lib/pic16/libc/Makefile.rules,
-        * device/lib/pic16/libsdcc/Makefile.rules,
-        * device/lib/pic16/libm/Makefile,
-        * device/lib/pic16/libio/Makefile.rules: added CSTD macro in CFLAGS
-        to compile with C standard set in Makefile.common
-        * device/lib/pic16/libc/stdlib/Makefile: added new C sources
-        rand.c and crc.c in compilation process,
-        * device/lib/pic16/libsdcc/int/divuint.c,
-        * device/lib/pic16/libsdcc/long/divulong.c: changed declaration of
-        `c' from signed to unsigned,
-        * device/lib/pic16/startup/crt0.c,
-        * device/lib/pic16/startup/crt0i.c,
-        * device/lib/pic16/startup/crt0iz.c: adopted to all SDCC specific
-        keywords to double underlined form, bug fixes in _do_cinit function
-        which prevented the correct initialization of the .idata segment,
-        * src/pic16/pcoderegs.c (insideLRBlock): fixed a bug that caused the
-        core to enter a infinite loop
-        * device/lib/pic16/libc/stdlib/rand.c, crc.c: new files
+       * device/include/asm/pic16/features.h,
+       * pic18f*.h headers,
+       * device/include/pic16/adc.h,
+       * device/include/pic16/delay.h,
+       * device/include/pic16/i2c.h,
+       * device/include/pic16/malloc.h,
+       * device/include/pic16/stdio.h,
+       * device/include/pic16/stdlib.h,
+       * device/include/pic16/string.h,
+       * device/lib/pic16/libc/stdio/printf_tiny.c,
+       * device/lib/pic16/libc/stdio/printf_small.c,
+       * device/lib/pic16/libc/stdio/strmgpsim.c,
+       * device/lib/pic16/libc/stdio/strmmssp.c,
+       * device/lib/pic16/libc/stdio/strmusart.c,
+       * device/lib/pic16/libc/stdio/vfprintf.c,
+       * device/lib/pic16/libc/stdlib/ltoa.c,
+       * device/lib/pic16/libc/stdlib/putchar.c,
+       * device/lib/pic16/libc/stdlib/x_ftoa.c,
+       * device/lib/pic16/libc/stdlib/memchrpgm.c,
+       * device/lib/pic16/libc/stdlib/memchrram.c,
+       * device/lib/pic16/libc/stdlib/memcpypgm2ram.c,
+       * device/lib/pic16/libc/stdlib/memcpyram2ram.c,
+       * device/lib/pic16/libio/adc/adcbusy.c,
+       * device/lib/pic16/libio/adc/adcread.c,
+       * device/lib/pic16/libio/adc/adcsetch.c,
+       * device/lib/pic16/libio/usart/ubaud.c,
+       * device/lib/pic16/libio/usart/ubusy.c,
+       * device/lib/pic16/libio/usart/udrdy.c,
+       * device/lib/pic16/libio/usart/uopen.c,
+       * device/lib/pic16/libio/usart/uputc.c,
+       * device/lib/pic16/libsdcc/gptr/gptrget1.c,
+       * device/lib/pic16/libsdcc/gptr/gptrget2.c,
+       * device/lib/pic16/libsdcc/gptr/gptrget3.c,
+       * device/lib/pic16/libsdcc/gptr/gptrget4.c,
+       * device/lib/pic16/libsdcc/gptr/gptrput1.c,
+       * device/lib/pic16/libsdcc/gptr/gptrput2.c,
+       * device/lib/pic16/libsdcc/gptr/gptrput3.c,
+       * device/lib/pic16/libsdcc/gptr/gptrput4.c: modified all SDCC
+       specific keywords to double underlined form,
+       * device/lib/pic16/libc/Makefile.rules,
+       * device/lib/pic16/libsdcc/Makefile.rules,
+       * device/lib/pic16/libm/Makefile,
+       * device/lib/pic16/libio/Makefile.rules: added CSTD macro in CFLAGS
+       to compile with C standard set in Makefile.common
+       * device/lib/pic16/libc/stdlib/Makefile: added new C sources
+       rand.c and crc.c in compilation process,
+       * device/lib/pic16/libsdcc/int/divuint.c,
+       * device/lib/pic16/libsdcc/long/divulong.c: changed declaration of
+       `c' from signed to unsigned,
+       * device/lib/pic16/startup/crt0.c,
+       * device/lib/pic16/startup/crt0i.c,
+       * device/lib/pic16/startup/crt0iz.c: adopted to all SDCC specific
+       keywords to double underlined form, bug fixes in _do_cinit function
+       which prevented the correct initialization of the .idata segment,
+       * src/pic16/pcoderegs.c (insideLRBlock): fixed a bug that caused the
+       core to enter a infinite loop
+       * device/lib/pic16/libc/stdlib/rand.c, crc.c: new files
 
 2005-04-02 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
 2005-03-31 Vangelis Rokas <vrokas AT users.sourceforge.net>
 
        * src/pic16/device.c (Pics16[]): added devices 18F2550, 18F4331,
-        18F4455,
-        * (pic16_assignConfigWordValue): disable testing of configuration
-        register value with config mask,
-        * src/pic16/gen.c (pic16_testStackOverflow): prefix stack test
-        function with port->fun_prefix,
-        * (genFunction): when generating a naked interrupt function never
-        create an absolute segment placed in interrupt vector address, place
-        the actual interrupt function at IVA instead, when an interrupt
-        function is generated with unspecified interrupt then do not create
-        the absolute section,
-        * (genGenPointerGet, genGenPointerSet, genPackBits): replace all
-        code for generating a call to generic pointer get/put function with
-        a call to function pic16_callGenericPointer(),
-        * src/pic16/genutils.c (pic16_callGenericPointerRW): NEW, generates
-        the call to the generic pointer get/put functions with prefixing the
-        function name with port->fun_prefix,
-        * src/pic16/glue.c (pic16glue): ifdef-out test of OF_LR_SUPPORT,
-        * src/pic16/main.c (_process_pragma): prefix function with
-        port->fun_prefix,
-        * (_pic16_finaliseOptions): define macro __18Fxxxx macro when
-        calling assembler, old 18Fxxxx macro is deprecated,
-        * src/pic16/pcode.c (unlinkpCodeFromBranch): added PC_INLINE and
-        PC_ASMDIR in while condition,
-        * (findInstruction): add PC_ASMDIR in while condition,
-        * (buildCallTree): prefix main with port->fun_prefix,
-        * (pic16_pCode2str): fixed bug that didn't emit the memory access
-        identifier for variable with banked access in instructions BTFSS,
-        BTFSC, BCF, BSF, BTG
-        * (AnalyzeFlow): moved call to OptimizepCode to pic16_AnalyzeBanking,
-        * src/pic16/pcodepeep.c (pCodeOpCompare): increase size of b to 1024,
-        * src/pic16/pcoderegs.c (pic16_pCodeRegoptimizeRegUsage): don't
-        perform optimization when enviroment variable NO_REG_OPT is set,
-        * (insideLRBlock): NEW, return 1 if register is inside an
-        INF_LOCALREGS block,
-        * (RemoveRegFromLRBlock): remove a register that is completely
-        eliminated by register optimization, but it is still left in local
-        register store/restore in/from stack block,
-        * (Remove2pcodes): after removing register, check to see if it
-        should be removed from local register store/restore in/from stack
-        block,
-        * src/pic16/ralloc.c (pic16_decodeOp): added decode for
-        DUMMY_READ_VOLATILE,
-
-        * device/include/pic16/adc.h: minor prototype modifications and
-        update,
-        * device/include/pic16/malloc.h: added GPL notice various
-        modifications,
-        * device/include/pic16/stdint.h: NEW, standard header for ints
-        * device/include/pic16/delay.h: NEW, header for delay functions,
-        delay10tcy, delay100tcy, delay1ktcy, delay10ktcy, delay100ktcy,
-        delay1mtcy,
-        * device/include/pic16/signal.h: NEW, header providing helper macros
-        for implementing signal handlers,
-        * device/include/pic16/stdio.h: added prototypes for functions,
-        printf, vprintf, sprintf, vsprintf, fprintf, vfprintf. Added
-        prototypes for stdin and stdout, added macro PUTCHAR to
-        automatically implement putchar function prototype,
-        * device/include/pic16/usart.h: modified and updated USART library,
-        * device/lib/pic16/libio/adc/,
-        * device/lib/pic16/libio/i2c: some modifications to improve library
-        performance,
-        * device/lib/pic16/libc/stdio/: modifications for the new printf*
-        family of functions,
-        * device/lib/pic16/libc/stdlib/: various modifications in the malloc
-        family of functions and other sources,
-        * device/lib/pic16/libio/usart/: NEW, c sources for the usart module
-        of the PIC18Fxx[28] devices,
-        * device/lib/pic16/libc/delay/: NEW, c sources for the delay functions,
-        * device/lib/pic16/libc/utils/: minor modifications in the .S sources,
-        * device/lib/pic16/startup/{crt0i.c, crt0iz.c}: redesign of the
-        _do_cinit function, because the previous failed when local variables
-        where not placed in the same memory bank,
-        * device/lib/pic16/libsdcc/char/: various modifications to improve
-        library performance,
-        * doc/sdccman.lyx: some reorganization of the PIC16 part, added many
-        information on the new functions of the c library and more...
+       18F4455,
+       * (pic16_assignConfigWordValue): disable testing of configuration
+       register value with config mask,
+       * src/pic16/gen.c (pic16_testStackOverflow): prefix stack test
+       function with port->fun_prefix,
+       * (genFunction): when generating a naked interrupt function never
+       create an absolute segment placed in interrupt vector address, place
+       the actual interrupt function at IVA instead, when an interrupt
+       function is generated with unspecified interrupt then do not create
+       the absolute section,
+       * (genGenPointerGet, genGenPointerSet, genPackBits): replace all
+       code for generating a call to generic pointer get/put function with
+       a call to function pic16_callGenericPointer(),
+       * src/pic16/genutils.c (pic16_callGenericPointerRW): NEW, generates
+       the call to the generic pointer get/put functions with prefixing the
+       function name with port->fun_prefix,
+       * src/pic16/glue.c (pic16glue): ifdef-out test of OF_LR_SUPPORT,
+       * src/pic16/main.c (_process_pragma): prefix function with
+       port->fun_prefix,
+       * (_pic16_finaliseOptions): define macro __18Fxxxx macro when
+       calling assembler, old 18Fxxxx macro is deprecated,
+       * src/pic16/pcode.c (unlinkpCodeFromBranch): added PC_INLINE and
+       PC_ASMDIR in while condition,
+       * (findInstruction): add PC_ASMDIR in while condition,
+       * (buildCallTree): prefix main with port->fun_prefix,
+       * (pic16_pCode2str): fixed bug that didn't emit the memory access
+       identifier for variable with banked access in instructions BTFSS,
+       BTFSC, BCF, BSF, BTG
+       * (AnalyzeFlow): moved call to OptimizepCode to pic16_AnalyzeBanking,
+       * src/pic16/pcodepeep.c (pCodeOpCompare): increase size of b to 1024,
+       * src/pic16/pcoderegs.c (pic16_pCodeRegoptimizeRegUsage): don't
+       perform optimization when enviroment variable NO_REG_OPT is set,
+       * (insideLRBlock): NEW, return 1 if register is inside an
+       INF_LOCALREGS block,
+       * (RemoveRegFromLRBlock): remove a register that is completely
+       eliminated by register optimization, but it is still left in local
+       register store/restore in/from stack block,
+       * (Remove2pcodes): after removing register, check to see if it
+       should be removed from local register store/restore in/from stack
+       block,
+       * src/pic16/ralloc.c (pic16_decodeOp): added decode for
+       DUMMY_READ_VOLATILE,
+
+       * device/include/pic16/adc.h: minor prototype modifications and
+       update,
+       * device/include/pic16/malloc.h: added GPL notice various
+       modifications,
+       * device/include/pic16/stdint.h: NEW, standard header for ints
+       * device/include/pic16/delay.h: NEW, header for delay functions,
+       delay10tcy, delay100tcy, delay1ktcy, delay10ktcy, delay100ktcy,
+       delay1mtcy,
+       * device/include/pic16/signal.h: NEW, header providing helper macros
+       for implementing signal handlers,
+       * device/include/pic16/stdio.h: added prototypes for functions,
+       printf, vprintf, sprintf, vsprintf, fprintf, vfprintf. Added
+       prototypes for stdin and stdout, added macro PUTCHAR to
+       automatically implement putchar function prototype,
+       * device/include/pic16/usart.h: modified and updated USART library,
+       * device/lib/pic16/libio/adc/,
+       * device/lib/pic16/libio/i2c: some modifications to improve library
+       performance,
+       * device/lib/pic16/libc/stdio/: modifications for the new printf*
+       family of functions,
+       * device/lib/pic16/libc/stdlib/: various modifications in the malloc
+       family of functions and other sources,
+       * device/lib/pic16/libio/usart/: NEW, c sources for the usart module
+       of the PIC18Fxx[28] devices,
+       * device/lib/pic16/libc/delay/: NEW, c sources for the delay functions,
+       * device/lib/pic16/libc/utils/: minor modifications in the .S sources,
+       * device/lib/pic16/startup/{crt0i.c, crt0iz.c}: redesign of the
+       _do_cinit function, because the previous failed when local variables
+       where not placed in the same memory bank,
+       * device/lib/pic16/libsdcc/char/: various modifications to improve
+       library performance,
+       * doc/sdccman.lyx: some reorganization of the PIC16 part, added many
+       information on the new functions of the c library and more...
 
 2005-03-28 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
 
 2004-07-20 Maarten Brock <sourceforge.brock AT dse.nl>
 
-        * src/SDCCast.c (decorateType): removed buggy fix for bug #979599
+       * src/SDCCast.c (decorateType): removed buggy fix for bug #979599
 
 2004-07-11 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * src/SDCCglue.c (printIvalArray): fixed bug #984229, thanks to Phuah
-          Yee Keat for the patch
-        * src/SDCCast.c (decorateType): fixed bug #979599
-        * src/ds390/gen.h: removed local fReturnSizeDS390
-        * src/ds390/gen.c: made fReturnSizeDS390 signed short to remove a warning
-        * src/ds390/gen.c (genAnd, genOr, genXor),
-        * src/mcs51/gen.c (genAnd, genOr, genXor): generate better optimized code
+         Yee Keat for the patch
+       * src/SDCCast.c (decorateType): fixed bug #979599
+       * src/ds390/gen.h: removed local fReturnSizeDS390
+       * src/ds390/gen.c: made fReturnSizeDS390 signed short to remove a warning
+       * src/ds390/gen.c (genAnd, genOr, genXor),
+       * src/mcs51/gen.c (genAnd, genOr, genXor): generate better optimized code
 
 2004-07-04 Vangelis Rokas <vrokas AT otenet.gr>
 
        * src/pic16/pcoderegs.c: many modifications to re-enable peepholes,
        they are disabled by default, but can be enabled explicit with
        command argument --denable-peeps, for testing,
-        * device/lib/pic16/startup/Makefile: added --no-peep,--pomit-config-words,
-        --pomit-ivt in COMPILE_FLAGS
+       * device/lib/pic16/startup/Makefile: added --no-peep,--pomit-config-words,
+       --pomit-ivt in COMPILE_FLAGS
 
 2004-06-06 Maarten Brock <sourceforge.brock AT dse.nl>
 
 
 2004-06-02 Vangelis Rokas <vrokas AT otenet.gr>
 
-        * src/pic16/gen.c (genPcall): warning about gpsim and PCLATU
+       * src/pic16/gen.c (genPcall): warning about gpsim and PCLATU
        is commented out
 
 2004-06-01 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
 2003-11-03 Martin Helmling <Martin.Helmling AT octo-soft.de>
 
-        * debugger/mcs51/cmd.c: allows filename starting with digit(+ some debug)
+       * debugger/mcs51/cmd.c: allows filename starting with digit(+ some debug)
 
 2003-11-02 Bernhard Held <bernhard AT bernhardheld.de>
 
-        * src/SDCCmain.c (linkEdit): "fixed" again bug #833605
+       * src/SDCCmain.c (linkEdit): "fixed" again bug #833605
 
 2003-11-01 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
 
        Some hc08 related updates that I missed earlier
        * sim/ucsim/stypes.h
-        * support/regression/ports/hc08/spec.mk
+       * support/regression/ports/hc08/spec.mk
 
 2003-10-15 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
 2003-08-31  Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * src/SDCCpeeph.c (notVolatile, notVolatileVariable): handle IFX
-        and JUMPTABLE iCodes properly now (worked by accident before)
+       and JUMPTABLE iCodes properly now (worked by accident before)
        * src/mcs51/gen.c (leftRightUseAcc),
        * src/ds390/gen.c (leftRightUseAcc): handle IFX and JUMPTABLE
        iCode properly now. Use getSize instead of nRegs since a & b
 
 2003-07-19  Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
-        * device/include/regc515c.h: fixed #758477
-        * device/lib/_gptrget.c: saving some cycles in generic pointer get
-        * device/lib/_gptrput.c: saved a few bytes
+       * device/include/regc515c.h: fixed #758477
+       * device/lib/_gptrget.c: saving some cycles in generic pointer get
+       * device/lib/_gptrput.c: saved a few bytes
        * my tab spacing is 8, yours too?)
-        * device/lib/_ser.c: process RX bytes earlier than TX bytes
-        * device/lib/serial.c: process RX bytes earlier than TX bytes
-        * src/mcs51/gen.c(genGenPointerGet/Set): removed writing of type after postincrement
+       * device/lib/_ser.c: process RX bytes earlier than TX bytes
+       * device/lib/serial.c: process RX bytes earlier than TX bytes
+       * src/mcs51/gen.c(genGenPointerGet/Set): removed writing of type after postincrement
 
 2003-07-18  Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
 
 2003-07-17  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-    * link/z80/lklibr.c: fixed bug when there is a '.' in a library path.
+       * link/z80/lklibr.c: fixed bug when there is a '.' in a library path.
 
 2003-07-17  Bernhard Held <bernhard AT bernhardheld.de>
 
 
 2003-07-13  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-    * src/SDCCmain.c, src/SDCCglobl.h: added option --no-std-crt0
+       * src/SDCCmain.c, src/SDCCglobl.h: added option --no-std-crt0
 
 2003-07-12  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-    * sdcc.dsw, all.dsp, link/z80/linkgbz80.dsp, as/z80/as-gbz80.dsp:
-    added gbz80 build to MSVC project.
-    * src/SDCCmain.c, src/SDCCglue.c, src/z80/main.c, src/z80/z80.dsp,
-    link/z80/aslink.h, linkz80.dsp: cleaned up z80 and gbz80 asm files
-    from 8051 stuff and setup so it links using a .lnk file.
+       * sdcc.dsw, all.dsp, link/z80/linkgbz80.dsp, as/z80/as-gbz80.dsp:
+       added gbz80 build to MSVC project.
+       * src/SDCCmain.c, src/SDCCglue.c, src/z80/main.c, src/z80/z80.dsp,
+       link/z80/aslink.h, linkz80.dsp: cleaned up z80 and gbz80 asm files
+       from 8051 stuff and setup so it links using a .lnk file.
 
 2003-07-06  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-    * support/librarian/sdcclib.c: sdcc librarian.
-    * as/mcs51/aslink.h, as/mcs51/lklib.c: Support for libraries created
-    with sdcclib.
+       * support/librarian/sdcclib.c: sdcc librarian.
+       * as/mcs51/aslink.h, as/mcs51/lklib.c: Support for libraries created
+       with sdcclib.
 
 2003-07-03  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-    * as/mcs51/lkmain.c: properly handle extensions in function afile.
+       * as/mcs51/lkmain.c: properly handle extensions in function afile.
 
 2003-07-02  Borut Razem <borut.razem AT siol.net>
 
 
 2003-07-01 Kevin Vigor <kevin AT vigor.nu>
 
-        * DS800C400 fun, improved ROM interface and tinibios.
+       * DS800C400 fun, improved ROM interface and tinibios.
 
 2003-06-27 Kevin Vigor <kevin AT vigor.nu>
 
 2003-06-02  Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * doc/sdccman.lyx: cvs revision keywords, passing pdf information in latex preamble,
-          additions to the "related tools/documentation" section
+         additions to the "related tools/documentation" section
 
 2003-06-02  Bernhard Held <bernhard AT bernhardheld.de>
 
 2003-05-25  Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * src/mcs51/peeph.def: added rules 244.x, 245.x. Although they pass
-          the regression tests I'm not brave enough to enable 245.b, 245.c
+         the regression tests I'm not brave enough to enable 245.b, 245.c
        * doc/sdccman.lyx: added latex preamble for hyperref package.
          Using pdflatex this will give you a hyperlinked pdf file with
-          bookmarks. (prepend '%' before /usepackage if this breaks something)
+         bookmarks. (prepend '%' before /usepackage if this breaks something)
 
 2003-05-24  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
            generated
        * src/pic16/glue.c: commented out some error producing lines
        * src/pic16/main.c: __config directives are commented out to stop
-            gpasm complaining and test the linkage with gplink, _linkCmd and
-            _asmCmd changed to be more gplink and gpasm friendly
+           gpasm complaining and test the linkage with gplink, _linkCmd and
+           _asmCmd changed to be more gplink and gpasm friendly
        * src/pic16/peeph.def: peep rule 3 is commented out, since it
            produced an error when parsed, peep rule 12 is added to utilize
            movff, but it is commented out since the pCode does not support
 2003-05-17  Karl Bongers(apply patches from Martin Helmling)
 
        * debugger/mcs51/sdcdb.c,cmd.c,break.c and .h files.
-  Added feature to script commands from file.
+       Added feature to script commands from file.
 
 2003-05-14  Bernhard Held <bernhard AT bernhardheld.de>
 
-        * device/lib/_strtok.c: fixed bug #734355 by Lenny Story and Tim Woodall
+       * device/lib/_strtok.c: fixed bug #734355 by Lenny Story and Tim Woodall
        * src/SDCCutil.c: include ctype.h for win32
 
 2003-05-13  Bernhard Held <bernhard AT bernhardheld.de>
 2003-05-12  Karl Bongers(apply development patches from Martin Helmling)
 
        * debugger/mcs51/sdcdb.c,simi.c,cmd.c,break.c and .h files.
-  Fixed so you can set breakpoints prior to run, run does not stop
-  on entry now.  Add tbreak.  Other enhancements and fixes for use
-  with ddd.
+       Fixed so you can set breakpoints prior to run, run does not stop
+       on entry now.  Add tbreak.  Other enhancements and fixes for use
+       with ddd.
 
 2003-05-12  Borut Razem <borut.razem AT siol.net>
 
 2003-05-05  Karl Bongers(apply patches from Martin Helmling)
 
        * debugger/mcs51/sdcdb.c,simi.c,cmd.c,symtab.c and .h files.
-  cache sfr, optimize next,step, fix off by one sourceline,
-  support ddd list function.
+       cache sfr, optimize next,step, fix off by one sourceline,
+       support ddd list function.
        * sim/ucsim/cmd.src/newcmd.cc - small fix for sdcdb use.
 
 2003-05-04  Bernhard Held <bernhard AT bernhardheld.de>
        * src/pic/* Applied the pointer-to-function patch from Steve Tell.
        * src/pic/* Fixed several pointer bugs. (PIC port broke when the ruonly bit was
         set - this bit used to not be set...).
-        * src/pic/gen.c Fixed buf 609268 ==> x = (x+1) & 0xf; generated
-          bad code in PIC Port
-        * src/regression/and2.c added to test bug 609268
-        * src/regression/Makefile added and2.c to regression test
+       * src/pic/gen.c Fixed buf 609268 ==> x = (x+1) & 0xf; generated
+         bad code in PIC Port
+       * src/regression/and2.c added to test bug 609268
+       * src/regression/Makefile added and2.c to regression test
 
 
 2003-04-08    <johan AT CP255758-A>
 2003-03-28  Borut Razem <borut.razem AT siol.net>
 
        * src/SDCC.lex: Fix for bug #711240: dynamic buffer handling of C
-          literal strings in stringLiteral()
+         literal strings in stringLiteral()
        * support/Util/dbuf.c, support/Util/dbuf.h: added: dynamic buffer handling
        * src/Makefile.bcc, src/Makefile.in, src/src.dsp: added support/Util/dbuf.c
-          to the project
+         to the project
 
 2003-03-27  Paul Stoffregen <paul AT pjrc.com>
 
 
 2003-03-11  Bernhard Held <bernhard AT bernhardheld.de>
 
-        * src/SDCCloop.c (mergeRegions): an evil beast is dead
+       * src/SDCCloop.c (mergeRegions): an evil beast is dead
        * src/SDCCmain.c (preProcess): minor cleanup: eliminate preOutName
 
 2003-03-10  Borut Razem <borut.razem AT siol.net>
 
 2003-02-18  Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
-        * src/SDCCpeeph.c: added peephole conditions testing for same arguments
-        * src/mcs51/peeph.def: added rules 238a-d which remove redundant moves
+       * src/SDCCpeeph.c: added peephole conditions testing for same arguments
+       * src/mcs51/peeph.def: added rules 238a-d which remove redundant moves
 
 2003-02-18    <johan AT balder>
 
 
 2003-01-06    <karl AT turbobit.com>
        * sim/ucsim/cmd.src/command.cc: fixed so "break xram r 0x7654" works again in
-   regression tests.
+       regression tests.
 
 2003-01-06    <johan AT balder>
 
        * src/SDCCval.c (getNelements): fixed the initialized array of structures
 
 2002-12-29  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
-        * as/mcs51/Makefile.bcc: fixed typo lkomf51.o -> lkaomf51.o
+       * as/mcs51/Makefile.bcc: fixed typo lkomf51.o -> lkaomf51.o
 
 2002-12-28  Bernhard Held <bernhard AT bernhardheld.de>
        * src/mcs51/peeph.def: added rules 234 and 235 from Frieder Ferlemann <frieder.ferlemann AT web.de>
        * src/mcs51/gen.c (aopGetUsesAcc): inserted missing "return FALSE"
 
 2002-12-27  Bernhard Held <bernhard AT bernhardheld.de>
-        * as/mcs51/Makefile.in: fixed typo lkomf51.o -> lkaomf51.o
+       * as/mcs51/Makefile.in: fixed typo lkomf51.o -> lkaomf51.o
 
 2002-12-26  Bernhard Held <bernhard AT bernhardheld.de>
        * src/mcs51/main.c: removed {bindir}{sep} from aslink
 
 2002-12-10  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-    * in /sdcc/as/mcs51/ changed these files in order to create an
-    aomf51 file: aslink.h, lkdta.c, lklex.c, lklibr.c, lklist.c,
-    lkmain.c.  Also added: lkmem.c and lkaomf51.c.  Changed the
-    following files to include the previous two files: aslink.dsp,
-    Makefile.aslink, Makefile.bcc, and Makefile.in.
+       * in /sdcc/as/mcs51/ changed these files in order to create an
+       aomf51 file: aslink.h, lkdta.c, lklex.c, lklibr.c, lklist.c,
+       lkmain.c.  Also added: lkmem.c and lkaomf51.c.  Changed the
+       following files to include the previous two files: aslink.dsp,
+       Makefile.aslink, Makefile.bcc, and Makefile.in.
 
-    * Changed /sdcc/src/SDCCmain.c so it creates files with extension
-    .adb instead of .cdb
+       * Changed /sdcc/src/SDCCmain.c so it creates files with extension
+       .adb instead of .cdb
 
 2002-11-09  Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
 
        * sdcc/sim/ucsim/s51.src/uc390cl.h: Improvement for ds390 to run regression tests
 
-        * sdcc/sim/ucsim/s51.src/uc390.h: Improvement for ds390 to run regression tests
+       * sdcc/sim/ucsim/s51.src/uc390.h: Improvement for ds390 to run regression tests
 
-        * sdcc/sim/ucsim/s51.src/regs51.h: Improvement for ds390 to run regression tests
+       * sdcc/sim/ucsim/s51.src/regs51.h: Improvement for ds390 to run regression tests
 
-        * sdcc/sim/ucsim/s51.src/glob.cc: Improvement for ds390 to run regression tests
+       * sdcc/sim/ucsim/s51.src/glob.cc: Improvement for ds390 to run regression tests
 
        * sdcc/support/regression/tests/bug-460010.c: Small change for ds390
 
 
 2001-08-30 Bernhard Held   <bernhard AT bernhardheld.de>
 
-  * sim/ucsim/configure:    little improvement of Cygwin-detection
-  * sim/ucsim/configure.in: little improvement of Cygwin-detection
-  * sim/ucsim/cmd.src/newcmdcl.h: include <sys/types.h> to define fd_set automated build
-  * support/regression/tests/bug-221100.c: small changes for mcs51
-  * support/regression/tests/bug-221168.c: small changes for mcs51
-  * support/regression/tests/bug-227710.c: small changes for mcs51
-  * support/regression/tests/staticinit.c: small changes for mcs51
-  * as/mcs51/aslink.h: accept everything as symbol name in rel-files, bug fix ID 452601
-  * as/mcs51/lklex.c:  accept everything as symbol name in rel-files, bug fix ID 452601
-  * as/mcs51/lksym.c:  accept everything as symbol name in rel-files, bug fix ID 452601
+       * sim/ucsim/configure:    little improvement of Cygwin-detection
+       * sim/ucsim/configure.in: little improvement of Cygwin-detection
+       * sim/ucsim/cmd.src/newcmdcl.h: include <sys/types.h> to define fd_set automated build
+       * support/regression/tests/bug-221100.c: small changes for mcs51
+       * support/regression/tests/bug-221168.c: small changes for mcs51
+       * support/regression/tests/bug-227710.c: small changes for mcs51
+       * support/regression/tests/staticinit.c: small changes for mcs51
+       * as/mcs51/aslink.h: accept everything as symbol name in rel-files, bug fix ID 452601
+       * as/mcs51/lklex.c:  accept everything as symbol name in rel-files, bug fix ID 452601
+       * as/mcs51/lksym.c:  accept everything as symbol name in rel-files, bug fix ID 452601
 
 $Revision$
index ae3161560d970df7f59bbbff4b235617f213e238..d63920948f17af3148bca66085b4a63a24a9d0dd 100644 (file)
@@ -1,13 +1,22 @@
-/* aslex.c */
+/* aslex.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH bug in getst(): sign extend on ~(SPACE|ILL)
  *           causes infinite loop
  */
index 7c182e82015322c212257bf664f7355b19a50dc2..a13fec7db26d18536bec534a1da7ee3f3297cef4 100644 (file)
@@ -1,4 +1,20 @@
-/* asnoice.c */
+/* asnoice.c - Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files
index 13d175a8923c2b43913c2803bb626ac6fd4ad1c1..172ff4030eebc4df0e6ad70377f5ab8b4f1fc12b 100644 (file)
@@ -1,13 +1,22 @@
-/* assym.c */
+/* assym.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 10-Nov-07 borutr:
  *           - use strsto instead StoreString and include it in assym.c
  *             for compatibility with the original asxxxx
index 5455398f6cf21c64e8e21ba87922a74db2f2ea5d..0349acd744aaa02b787e3c09bb61275b23761b40 100644 (file)
@@ -1,13 +1,22 @@
-/* asdata.c */
+/* asdata.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH:
  *           - change s_id from [NCPS] to pointer (comment)
  *  2-Nov-97 JLH:
index e146a5be7a57e90ce04ce7c14ac2d1ff2722fe52..348f4fc9ec64e700f0eb61e15c7af1afc3819014 100644 (file)
@@ -1,13 +1,20 @@
-/* asexpr.c */
+/* asexpr.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 2224403a2a4be921578b19029d3aacd5a97dfbc3..af165f1c734ae67d2bc8f5a875055eb48af2ed2b 100644 (file)
@@ -1,13 +1,22 @@
-/* aslist.c */
+/* aslist.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH: 
  *          - lstsym: show s_id as string rather than array [NCPS]
  */
index 039fcfe486e3d6f6b0261879cb541e4f93352c66..9b293ea069c12d79b26c26fb5a60158865ca8471 100644 (file)
@@ -1,13 +1,22 @@
-/* asm.h */
+/* asm.h
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH:
  *           - add proto for StoreString
  *           - change s_id from [NCPS] to pointer
index 0de7a75272675c0dba1ba81fa45130a9b0aaf891..d771e77394cbb2f381d07a44142990743176c8a2 100644 (file)
@@ -1,13 +1,22 @@
-/* asmain.c */
+/* asmain.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 29-Oct-97 JLH pass ";!" comments to output file
  */
 
index 6ffbae45e6f8188b40f348cb47c6bae2d64f170e..9ba6f4d07cfeaf44db1844e9a6ad033dca2ead58 100644 (file)
@@ -1,13 +1,22 @@
-/* asout.c */
+/* asout.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH: 
  *          - outsym: show s_id as string rather than array [NCPS]
  *           - Added outr11 to support 8051's 11 bit destination address
index 1751c29454b02bf39b79786f23b25d22f5a99d79..f21c847fcf4e79dfa02c654473bc6d01c8c79ed3 100644 (file)
@@ -1,13 +1,20 @@
-/* assubr.c */
+/* assubr.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index aa904650f70cf8b1b74119862c800f7c93c8e1e7..1f0821c8bd3d0891ceb2c0d300500e434c576d30 100644 (file)
@@ -1,13 +1,20 @@
-/* m08adr.c */
+/* m08adr.c
 
-/*
- * (C) Copyright 1993-2002
- * 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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 8824731504d897adf5e4e9bc82416b6355d75a12..319fde0fa94cd85ca28f321a7aa3186943fbabbc 100644 (file)
@@ -1,13 +1,20 @@
-/* m08ext.c */
+/* m08ext.c
 
-/*
- * (C) Copyright 1993-2002
- * 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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 5c54496b086319f339701b46e0b4d899b8ce3675..155d10a754b0b5ead60a3104eac5edcd70f2a5ae 100644 (file)
@@ -1,13 +1,20 @@
-/* m08mch.c */
+/* m08mch.c
 
-/*
- * (C) Copyright 1993-2002
- * 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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 34b945bb741994bcc005ca01375c6abe4c1051d7..f1caf1b0ddb39cddfb5ec0f12382074423960f28 100644 (file)
@@ -1,13 +1,20 @@
-/* m08pst.c */
-
-/*
- * (C) Copyright 1993-2002
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- */
+/* m08pst.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 89929a4a10673da7d2f8ef67b022fb0c48466505..397e6abde64fe405ce8da940394592d1833531fc 100644 (file)
@@ -1,13 +1,20 @@
-/* m6808.h */
+/* m6808.h
 
-/*
- * (C) Copyright 1993-2002
- * 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 <http://www.gnu.org/licenses/>. */
 
 /*)BUILD
        $(PROGRAM) =    AS6808
index 4f21df913777f7cdee9dc17ba934bf428ab3bf1d..ff45b4661cae2d4e02931a3d833b874da2377a6f 100644 (file)
@@ -1,14 +1,22 @@
-/* aslink.h */
+/* aslink.h
 
-/*
- * (C) Copyright 1989-1996
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
- * 28-Oct-97 JLH:
+   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 <http://www.gnu.org/licenses/>. */
+
+/* 28-Oct-97 JLH:
  *           - add proto for StoreString
  *           - change s_id from [NCPS] to pointer
  *           - change NCPS to 80
index b103bc0a6cbae8fe55ac5ec675985f45c94f3d3d..0f44b0ea8048a0f96da9e8edea3a26abc3919098 100644 (file)
@@ -1,13 +1,22 @@
-/* lkarea.c */
+/* lkarea.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  *  3-Nov-97 JLH:
  *           - change lkparea to use a_type == 0 as "virgin area" flag
  * 02-Apr-98 JLH: add code to link 8051 data spaces
@@ -601,9 +610,9 @@ Addr_T lnksect(struct area *tap)
             taxp = taxp->a_axp;
         }
     } else if (tap->a_flag & A_ABS) {
-       /*
-        * Absolute sections
-        */
+        /*
+         * Absolute sections
+         */
         while (taxp) {
             allocate_space(taxp->a_addr, taxp->a_size, tap->a_id, codemap);
             taxp->a_addr = 0; /* reset to zero so relative addresses become absolute */
index 827ef48c57047cc86942132851a39aad461cfcea..e1c191ff046ab069fd40f31bca4eb816496ad118 100644 (file)
@@ -1,22 +1,19 @@
-/*-------------------------------------------------------------------------
-  lkelf.c - Create an executable ELF/DWARF file
+/* lkelf.c - Create an executable ELF/DWARF file
 
-   Written By -  Erik Petrich, epetrich@users.sourceforge.net (2004)
+   Copyright (C) 2004 Erik Petrich, epetrich at users dot sourceforge dot net
 
-   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 2, or (at your option) any
-   later version.
+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.
+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, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------*/
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <ctype.h>
 #include <stdio.h>
index 824e41529ea5b8f2f31724b9e0e3e68ebce9d1a6..196f1dc23b54f34a6fa20d221f76d9be82df43eb 100644 (file)
@@ -1,36 +1,43 @@
-/* lkihx.c */
+/* lkihx.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include "aslink.h"
 
-/*)Module      lkihx.c
+/*)Module       lkihx.c
  *
- *     The module lkihx.c contains the function to
- *     output the relocated object code in the
- *     Intel Hex format.
+ *      The module lkihx.c contains the function to
+ *      output the relocated object code in the
+ *      Intel Hex format.
  *
- *     lkihx.c contains the following functions:
- *             VOID    hexRecord(addr, rtvalIndex)
- *             VOID    ihx(i)
- *             VOID    ihxExtendedLinearAddress(a)
+ *      lkihx.c contains the following functions:
+ *              VOID    hexRecord(addr, rtvalIndex)
+ *              VOID    ihx(i)
+ *              VOID    ihxExtendedLinearAddress(a)
  *
- *     local variables: hexPageOverrun, lastHexAddr
+ *      local variables: hexPageOverrun, lastHexAddr
  */
 
 /*Intel Hex Format
  *      Record Mark Field    -  This  field  signifies  the  start  of a
  *                              record, and consists of an  ascii  colon
- *                              (:).  
+ *                              (:).
  *
  *      Record Length Field  -  This   field   consists   of  two  ascii
  *                              characters which indicate the number  of
  *                              the  number  of  bytes  in binary to two
  *                              ascii characters, high digit first.   An
  *                              End  of  File  record contains two ascii
- *                              zeros in this field.  
+ *                              zeros in this field.
  *
  *      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.
  *
  *      Record Type Field    -  This  field  identifies the record type,
  *                              which is either 0 for data records or  1
  *                              for  an End of File record.  It consists
  *                              of two ascii characters, with  the  high
  *                              digit of the record type first, followed
- *                              by the low digit of the record type.  
+ *                              by the low digit of the record type.
  *
  *      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
@@ -75,7 +82,7 @@
  *                              and the data field.  This  sum  is  then
  *                              negated  (2's  complement) and converted
  *                              to  two  ascii  characters,  high  digit
- *                              first.  
+ *                              first.
  */
 
 /* Static variable which holds the count of hex page overruns
@@ -90,173 +97,173 @@ static int hexPageOverrun = 0;
 unsigned int lastHexAddr = 0;
 
 
-/*)Function    hexRecord(addr, rtvalIndex)
+/*)Function     hexRecord(addr, rtvalIndex)
  *
- *             unsigned addr   starting address of hex record
- *             int rtvalIndex  starting index into the rtval[] array
+ *              unsigned addr   starting address of hex record
+ *              int rtvalIndex  starting index into the rtval[] array
  *
- *     The function hexRecord() outputs the relocated data
- *     in the standard Intel Hex format (with inserting
- *     the extended address record if necessary).
+ *      The function hexRecord() outputs the relocated data
+ *      in the standard Intel Hex format (with inserting
+ *      the extended address record if necessary).
  *
- *     local variables:
- *             Addr_T  chksum          byte checksum
- *             int             i                       index for loops
- *             int             overrun         temporary storage for hexPageOverrun
- *             int             bytes           counter for bytes written
+ *      local variables:
+ *              Addr_T  chksum          byte checksum
+ *              int             i                       index for loops
+ *              int             overrun         temporary storage for hexPageOverrun
+ *              int             bytes           counter for bytes written
  *
- *     global variables:
- *             FILE *  ofp             output file handle
- *             int     rtcnt           count of data words
- *             int     rtflg[]         output the data flag
- *             Addr_T  rtval[]         relocated data
+ *      global variables:
+ *              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
- *             ihxExtendedLinearAddress()      lkihx.c
- *             hexRecord()             lkihx.c         (recursion)
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              ihxExtendedLinearAddress()      lkihx.c
+ *              hexRecord()             lkihx.c         (recursion)
  *
- *     side effects:
- *             hexPageOverrun is eventually incremented,
- *             lastHexAddr is updated
+ *      side effects:
+ *              hexPageOverrun is eventually incremented,
+ *              lastHexAddr is updated
  */
 
 VOID
 hexRecord(unsigned addr, int rtvalIndex)
 {
-       Addr_T chksum;
-       int i, overrun, bytes;
+        Addr_T chksum;
+        int i, overrun, bytes;
 
-       for (i = rtvalIndex, chksum = 0; i < rtcnt; i++) {
-               if (rtflg[i]) {
-                       if (addr + ++chksum > 0xffff)
-                               break;
-               }
-       }
-       if (chksum == 0)
-               return;                 // nothing to output
+        for (i = rtvalIndex, chksum = 0; i < rtcnt; i++) {
+                if (rtflg[i]) {
+                        if (addr + ++chksum > 0xffff)
+                                break;
+                }
+        }
+        if (chksum == 0)
+                return;                 // nothing to output
 
-       if (lastHexAddr > addr) {
-               overrun = hexPageOverrun + 1;
-               ihxExtendedLinearAddress(lastExtendedAddress + overrun);
-               hexPageOverrun = overrun;
-               hexRecord(addr, rtvalIndex);
-               return;
-       }
+        if (lastHexAddr > addr) {
+                overrun = hexPageOverrun + 1;
+                ihxExtendedLinearAddress(lastExtendedAddress + overrun);
+                hexPageOverrun = overrun;
+                hexRecord(addr, rtvalIndex);
+                return;
+        }
 
-       lastHexAddr = addr;
-       fprintf(ofp, ":%02X%04X00", chksum, addr);
-       chksum += (addr >> 8) + (addr & 0xff);
-       for (i = rtvalIndex, bytes = 0; i < rtcnt; i++) {
-               if (rtflg[i]) {
-                   fprintf(ofp, "%02X", rtval[i]);
-                   chksum += rtval[i];
+        lastHexAddr = addr;
+        fprintf(ofp, ":%02X%04X00", chksum, addr);
+        chksum += (addr >> 8) + (addr & 0xff);
+        for (i = rtvalIndex, bytes = 0; i < rtcnt; i++) {
+                if (rtflg[i]) {
+                    fprintf(ofp, "%02X", rtval[i]);
+                    chksum += rtval[i];
 #if 0
-                       if (addr + ++bytes > 0xffff) {
-                               if (rflag) {
-                                       fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
-                                       overrun = hexPageOverrun + 1;
-                                       ihxExtendedLinearAddress(lastExtendedAddress + overrun);
-                                       hexPageOverrun = overrun;
-                                       hexRecord(0, i + 1);
-                                       return;
-                               } else {
-                                       fprintf(stderr, 
-                                               "warning: extended linear address encountered; "
-                                               "you probably want the -r flag.\n");
-                               }
-                       }
+                        if (addr + ++bytes > 0xffff) {
+                                if (rflag) {
+                                        fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
+                                        overrun = hexPageOverrun + 1;
+                                        ihxExtendedLinearAddress(lastExtendedAddress + overrun);
+                                        hexPageOverrun = overrun;
+                                        hexRecord(0, i + 1);
+                                        return;
+                                } else {
+                                        fprintf(stderr,
+                                                "warning: extended linear address encountered; "
+                                                "you probably want the -r flag.\n");
+                                }
+                        }
 #endif
-               }
-       }
-       fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
+                }
+        }
+        fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
 }
 
-/*)Function    ihx(i)
+/*)Function     ihx(i)
  *
- *             int     i               0 - process data
- *                                     1 - end of data
+ *              int     i               0 - process data
+ *                                      1 - end of data
  *
- *     The function ihx() calls the hexRecord() function for processing data
- *     or writes the End of Data record to the file defined by ofp.
+ *      The function ihx() calls the hexRecord() function for processing data
+ *      or writes the End of Data record to the file defined by ofp.
  *
- *     local variables:
- *             Addr_T  n               auxiliary variable
+ *      local variables:
+ *              Addr_T  n               auxiliary variable
  *
- *     global variables:
- *             int     hilo            byte order
- *             FILE *  ofp             output file handle
- *             Addr_T  rtval[]         relocated data
+ *      global variables:
+ *              int     hilo            byte order
+ *              FILE *  ofp             output file handle
+ *              Addr_T  rtval[]         relocated data
  *
- *     functions called:
- *             VOID hexRecord()        lkihx.c
- *             int     fprintf()               c_library
+ *      functions called:
+ *              VOID hexRecord()        lkihx.c
+ *              int     fprintf()               c_library
  *
- *     side effects:
- *             The sequence of rtval[0], rtval[1] is eventually changed.
+ *      side effects:
+ *              The sequence of rtval[0], rtval[1] is eventually changed.
  */
 
 VOID
 ihx(i)
 {
-       Addr_T n;
-       if (i) {
-               if (ap->a_flag & A_NOLOAD)
-                       return;
-               if (hilo == 0) {
-                       n = rtval[0];
-                       rtval[0] = rtval[1];
-                       rtval[1] = n;
-               }
-               hexRecord((rtval[0]<<8) + rtval[1], 2);
-       } else {
-               fprintf(ofp, ":00000001FF\n");
-       }
+        Addr_T n;
+        if (i) {
+                if (ap->a_flag & A_NOLOAD)
+                        return;
+                if (hilo == 0) {
+                        n = rtval[0];
+                        rtval[0] = rtval[1];
+                        rtval[1] = n;
+                }
+                hexRecord((rtval[0]<<8) + rtval[1], 2);
+        } else {
+                fprintf(ofp, ":00000001FF\n");
+        }
 }
 
-/*)Function    ihxNewArea(i)
+/*)Function     ihxNewArea(i)
  * The function ihxNewArea() is called when processing of new area is started.
  * It resets the value of lastHexAddr.
- */ 
+ */
 
 VOID
 ihxNewArea()
 {
-       lastHexAddr = 0;
+        lastHexAddr = 0;
 }
 
-/*)Function    ihxExtendedLinearAddress(i)
+/*)Function     ihxExtendedLinearAddress(i)
  *
- *             Addr_T  i               16 bit extended linear address.
+ *              Addr_T  i               16 bit extended linear address.
  *
- *     The function ihxExtendedLinearAddress() writes an extended
- *     linear address record (type 04) to the output file.
+ *      The function ihxExtendedLinearAddress() writes an extended
+ *      linear address record (type 04) to the output file.
  *
- *     local variables:
- *             Addr_T  chksum          byte checksum
+ *      local variables:
+ *              Addr_T  chksum          byte checksum
  *
- *     global variables:
- *             FILE *  ofp             output file handle
+ *      global variables:
+ *              FILE *  ofp             output file handle
  *
- *     functions called:
- *             int     fprintf()       c_library
+ *      functions called:
+ *              int     fprintf()       c_library
  *
- *     side effects:
- *             The data is output to the file defined by ofp.
- *             hexPageOverrun and lastHexAddr is cleared
+ *      side effects:
+ *              The data is output to the file defined by ofp.
+ *              hexPageOverrun and lastHexAddr is cleared
  */
 VOID
 ihxExtendedLinearAddress(Addr_T a)
 {
-    Addr_T     chksum;
-  
+    Addr_T      chksum;
+
     /* The checksum is the complement of the bytes in the
      * record: the 2 is record length, 4 is the extended linear
      * address record type, plus the two address bytes.
-     */ 
-    chksum = 2 + 4 + (a & 0xff) + ((a >> 8) & 0xff);    
-    
+     */
+    chksum = 2 + 4 + (a & 0xff) + ((a >> 8) & 0xff);
+
     fprintf(ofp, ":02000004%04X%02X\n", a & 0xffff, (0-chksum) & 0xff);
-       hexPageOverrun = 0;
-       lastHexAddr = 0;
+        hexPageOverrun = 0;
+        lastHexAddr = 0;
 }
index 88c46c7abbdf96127abbf3e5c15ebe262637764d..8bab54603c7c4e05ee6bc68543790a85393ad33e 100644 (file)
@@ -1,13 +1,22 @@
-/* lkmain.c */
+/* lkmain.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 31-Oct-97 JLH:
  *           - add jflag and jfp to control NoICE output file genration
  *  3-Nov-97 JLH:
index e250f95d62c778664e2ae32d6436839427e81db7..433e90548a36b650fb680e3580af9136f41c302e 100644 (file)
-/*-------------------------------------------------------------------------
-  lkmem.c - Create a memory summary file with extension .mem
+/* lkmem.c - Create a memory summary file with extension .mem
 
-   Written By -  Jesus Calvino-Fraga, jesusc@ieee.org (2002)
+   Copyright (C) 2002 Jesus Calvino-Fraga, jesusc at ieee dot org
 
-   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 2, or (at your option) any
-   later version.
+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.
+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, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------*/
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include "aslink.h"
 
-int summary(struct area * areap) 
+int summary(struct area * areap)
 {
-       #define EQ(A,B) !as_strcmpi((A),(B))
-       #define MIN_STACK 16
-       #define REPORT_ERROR(A, H) \
-       {\
-               fprintf(of, "%s%s", (H)?"*** ERROR: ":"", (A)); \
-               fprintf(stderr, "%s%s", (H)?"\n?ASlink-Error-":"",(A)); \
-               toreturn=1; \
-       }
-
-       #define REPORT_WARNING(A, H) \
-       { \
-               fprintf(of, "%s%s", (H)?"*** WARNING: ":"", (A)); \
-               fprintf(stderr, "%s%s",(H)?"\n?ASlink-Warning-":"", (A)); \
-       }
-
-       char buff[128];
-       int j, toreturn=0;
-       unsigned int Total_Last=0, k; 
-
-       struct area * xp;
-       FILE * of;
-       
-       /*Artifacts used for printing*/
-       char start[15], end[15], size[15], max[15];
-       char format[]="   %-16.16s %-8.8s %-8.8s %-8.8s %-8.8s\n";
-       char line[]="---------------------";
-
-       typedef struct
-       {
-               unsigned long Start;
-               unsigned long Size;
-               unsigned long Max;
-               char Name[NCPS];
-               unsigned long flag;
-       } _Mem;
-
-       unsigned int dram[0x100];
-       _Mem Ram[]={
-               {0,     0,      0,       "REG_BANK_0", 0x0001},
-               {0x0,   0,      0,       "REG_BANK_1", 0x0002},
-               {0x0,   0,      0,       "REG_BANK_2", 0x0004},
-               {0x0,   0,      0,       "REG_BANK_3", 0x0008},
-               {0x0,   0,      0,       "BSEG_BYTES", 0x0010},
-               {0,     0,      256,    "UNUSED",     0x0000},
-               {0xff,  0,      256,    "DATA",       0x0020},
-               {0,             0,      256, "TOTAL:",     0x0000}
-       };
-       
-       _Mem IRam= {0xff,   0,     0, "INDIRECT RAM",           0x0080};
-       _Mem Stack={0xff,   0,     1, "STACK",                          0x0000};
-       _Mem XRam= {0xffff, 0, 65536, "EXTERNAL RAM",           0x0100};
-       _Mem Rom=  {0xffff, 0, 65536, "ROM/EPROM/FLASH",        0x0200};
-       
+        #define EQ(A,B) !as_strcmpi((A),(B))
+        #define MIN_STACK 16
+        #define REPORT_ERROR(A, H) \
+        {\
+                fprintf(of, "%s%s", (H)?"*** ERROR: ":"", (A)); \
+                fprintf(stderr, "%s%s", (H)?"\n?ASlink-Error-":"",(A)); \
+                toreturn=1; \
+        }
+
+        #define REPORT_WARNING(A, H) \
+        { \
+                fprintf(of, "%s%s", (H)?"*** WARNING: ":"", (A)); \
+                fprintf(stderr, "%s%s",(H)?"\n?ASlink-Warning-":"", (A)); \
+        }
+
+        char buff[128];
+        int j, toreturn=0;
+        unsigned int Total_Last=0, k;
+
+        struct area * xp;
+        FILE * of;
+
+        /*Artifacts used for printing*/
+        char start[15], end[15], size[15], max[15];
+        char format[]="   %-16.16s %-8.8s %-8.8s %-8.8s %-8.8s\n";
+        char line[]="---------------------";
+
+        typedef struct
+        {
+                unsigned long Start;
+                unsigned long Size;
+                unsigned long Max;
+                char Name[NCPS];
+                unsigned long flag;
+        } _Mem;
+
+        unsigned int dram[0x100];
+        _Mem Ram[]={
+                {0,     0,      0,       "REG_BANK_0", 0x0001},
+                {0x0,   0,      0,       "REG_BANK_1", 0x0002},
+                {0x0,   0,      0,       "REG_BANK_2", 0x0004},
+                {0x0,   0,      0,       "REG_BANK_3", 0x0008},
+                {0x0,   0,      0,       "BSEG_BYTES", 0x0010},
+                {0,     0,      256,    "UNUSED",     0x0000},
+                {0xff,  0,      256,    "DATA",       0x0020},
+                {0,             0,      256, "TOTAL:",     0x0000}
+        };
+
+        _Mem IRam= {0xff,   0,     0, "INDIRECT RAM",           0x0080};
+        _Mem Stack={0xff,   0,     1, "STACK",                          0x0000};
+        _Mem XRam= {0xffff, 0, 65536, "EXTERNAL RAM",           0x0100};
+        _Mem Rom=  {0xffff, 0, 65536, "ROM/EPROM/FLASH",        0x0200};
+
 #if 0
-       if(rflag) /*For the DS390*/
-       {
-               XRam.Max=0x1000000; /*24 bits*/
-               XRam.Start=0xffffff;
-               Rom.Max=0x1000000;
-               Rom.Start=0xffffff;
-       }
-
-       if((iram_size<=0)||(iram_size>0x100)) /*Default: 8052 like memory*/
-       {
-               Ram[5].Max=0x80;
-               Ram[6].Max=0x80;
-               Ram[7].Max=0x80;
-               IRam.Max=0x80;
-               iram_size=0x100;
-       }
-       else if(iram_size<0x80)
-       {
-               Ram[5].Max=iram_size;
-               Ram[6].Max=iram_size;
-               Ram[7].Max=iram_size;
-               IRam.Max=0;
-       }
-       else
-       {
-               Ram[5].Max=0x80;
-               Ram[6].Max=0x80;
-               Ram[7].Max=0x80;
-               IRam.Max=iram_size-0x80;
-       }
+        if(rflag) /*For the DS390*/
+        {
+                XRam.Max=0x1000000; /*24 bits*/
+                XRam.Start=0xffffff;
+                Rom.Max=0x1000000;
+                Rom.Start=0xffffff;
+        }
+
+        if((iram_size<=0)||(iram_size>0x100)) /*Default: 8052 like memory*/
+        {
+                Ram[5].Max=0x80;
+                Ram[6].Max=0x80;
+                Ram[7].Max=0x80;
+                IRam.Max=0x80;
+                iram_size=0x100;
+        }
+        else if(iram_size<0x80)
+        {
+                Ram[5].Max=iram_size;
+                Ram[6].Max=iram_size;
+                Ram[7].Max=iram_size;
+                IRam.Max=0;
+        }
+        else
+        {
+                Ram[5].Max=0x80;
+                Ram[6].Max=0x80;
+                Ram[7].Max=0x80;
+                IRam.Max=iram_size-0x80;
+        }
 #endif
 
-       for(j=0; j<(int)iram_size; j++) dram[j]=0;
-       for(; j<0x100; j++) dram[j]=0x8000; /*Memory not available*/
-
-       /* Open Memory Summary File*/
-       of = afile(linkp->f_idp, "mem", 1);
-       if (of == NULL)
-       {
-               lkexit(1);
-       }
-
-       xp=areap;
-       while (xp)
-       {
-               /**/ if (EQ(xp->a_id, "REG_BANK_0"))
-               {
-                       Ram[0].Size=xp->a_size;
-               }
-               else if (EQ(xp->a_id, "REG_BANK_1"))
-               {
-                       Ram[1].Size=xp->a_size;
-               }
-               else if (EQ(xp->a_id, "REG_BANK_2"))
-               {
-                       Ram[2].Size=xp->a_size;
-               }
-               else if (EQ(xp->a_id, "REG_BANK_3"))
-               {
-                       Ram[3].Size=xp->a_size;
-               }
-               else if (EQ(xp->a_id, "BSEG_BYTES"))
-               {
-                       Ram[4].Size=xp->a_size;
-               }
-               else if ( EQ(xp->a_id, "DSEG") || EQ(xp->a_id, "OSEG") )
-               {
-                       Ram[6].Size+=xp->a_size;
-                       if(xp->a_addr<Ram[6].Start) Ram[6].Start=xp->a_addr;
-               }
-
-               else if( EQ(xp->a_id, "CSEG") || EQ(xp->a_id, "GSINIT") ||
-                                EQ(xp->a_id, "GSFINAL") || EQ(xp->a_id, "HOME") )
-               {
-                       Rom.Size+=xp->a_size;
-                       if(xp->a_addr<Rom.Start) Rom.Start=xp->a_addr;
-               }
-               
-               else if (EQ(xp->a_id, "SSEG"))
-               {
-                       Stack.Size+=xp->a_size;
-                       if(xp->a_addr<Stack.Start) Stack.Start=xp->a_addr;
-               }
-
-               else if (EQ(xp->a_id, "XSEG") || EQ(xp->a_id, "XISEG")) 
-               {
-                       XRam.Size+=xp->a_size;
-                       if(xp->a_addr<XRam.Start) XRam.Start=xp->a_addr;
-               }
-
-               else if (EQ(xp->a_id, "ISEG"))
-               {
-                       IRam.Size+=xp->a_size;
-                       if(xp->a_addr<IRam.Start) IRam.Start=xp->a_addr;
-               }
-               xp=xp->a_ap;
-       }
-
-       for(j=0; j<7; j++)
-               for(k=Ram[j].Start; (k<(Ram[j].Start+Ram[j].Size))&&(k<0x100); k++)
-                       dram[k]|=Ram[j].flag; /*Mark as used*/
-       
+        for(j=0; j<(int)iram_size; j++) dram[j]=0;
+        for(; j<0x100; j++) dram[j]=0x8000; /*Memory not available*/
+
+        /* Open Memory Summary File*/
+        of = afile(linkp->f_idp, "mem", 1);
+        if (of == NULL)
+        {
+                lkexit(1);
+        }
+
+        xp=areap;
+        while (xp)
+        {
+                /**/ if (EQ(xp->a_id, "REG_BANK_0"))
+                {
+                        Ram[0].Size=xp->a_size;
+                }
+                else if (EQ(xp->a_id, "REG_BANK_1"))
+                {
+                        Ram[1].Size=xp->a_size;
+                }
+                else if (EQ(xp->a_id, "REG_BANK_2"))
+                {
+                        Ram[2].Size=xp->a_size;
+                }
+                else if (EQ(xp->a_id, "REG_BANK_3"))
+                {
+                        Ram[3].Size=xp->a_size;
+                }
+                else if (EQ(xp->a_id, "BSEG_BYTES"))
+                {
+                        Ram[4].Size=xp->a_size;
+                }
+                else if ( EQ(xp->a_id, "DSEG") || EQ(xp->a_id, "OSEG") )
+                {
+                        Ram[6].Size+=xp->a_size;
+                        if(xp->a_addr<Ram[6].Start) Ram[6].Start=xp->a_addr;
+                }
+
+                else if( EQ(xp->a_id, "CSEG") || EQ(xp->a_id, "GSINIT") ||
+                                 EQ(xp->a_id, "GSFINAL") || EQ(xp->a_id, "HOME") )
+                {
+                        Rom.Size+=xp->a_size;
+                        if(xp->a_addr<Rom.Start) Rom.Start=xp->a_addr;
+                }
+
+                else if (EQ(xp->a_id, "SSEG"))
+                {
+                        Stack.Size+=xp->a_size;
+                        if(xp->a_addr<Stack.Start) Stack.Start=xp->a_addr;
+                }
+
+                else if (EQ(xp->a_id, "XSEG") || EQ(xp->a_id, "XISEG"))
+                {
+                        XRam.Size+=xp->a_size;
+                        if(xp->a_addr<XRam.Start) XRam.Start=xp->a_addr;
+                }
+
+                else if (EQ(xp->a_id, "ISEG"))
+                {
+                        IRam.Size+=xp->a_size;
+                        if(xp->a_addr<IRam.Start) IRam.Start=xp->a_addr;
+                }
+                xp=xp->a_ap;
+        }
+
+        for(j=0; j<7; j++)
+                for(k=Ram[j].Start; (k<(Ram[j].Start+Ram[j].Size))&&(k<0x100); k++)
+                        dram[k]|=Ram[j].flag; /*Mark as used*/
+
 #if 0
-       for(k=IRam.Start; (k<(IRam.Start+IRam.Size))&&(k<0x100); k++)
-               dram[k]|=IRam.flag; /*Mark as used*/
+        for(k=IRam.Start; (k<(IRam.Start+IRam.Size))&&(k<0x100); k++)
+                dram[k]|=IRam.flag; /*Mark as used*/
 #endif
 
-       /*Compute the amount of unused memory in direct data Ram.  This is the
-       gap between the last register bank or bit segment and the data segment.*/
-       for(k=Ram[6].Start-1; (dram[k]==0) && (k>0); k--);
-       Ram[5].Start=k+1;
-       Ram[5].Size=Ram[6].Start-Ram[5].Start; /*It may be zero (which is good!)*/
-
-       /*Compute the data Ram totals*/
-       for(j=0; j<7; j++)
-       {
-               if(Ram[7].Start>Ram[j].Start) Ram[7].Start=Ram[j].Start;
-               Ram[7].Size+=Ram[j].Size;
-       }
-       Total_Last=Ram[6].Size+Ram[6].Start-1;
-
-       /*Report the Ram totals*/
-       fprintf(of, "Direct Internal RAM:\n");
-       fprintf(of, format, "Name", "Start", "End", "Size", "Max");
-
-       for(j=0; j<8; j++)
-       {
-               if((j==0) || (j==7)) fprintf(of, format, line, line, line, line, line);
-               if((j!=5) || (Ram[j].Size>0))
-               {
-                       sprintf(start, "0x%02lx", Ram[j].Start);
-                       if(Ram[j].Size==0)
-                               end[0]=0;/*Empty string*/
-                       else
-                               sprintf(end,  "0x%02lx", j==7?Total_Last:Ram[j].Size+Ram[j].Start-1);
-                       sprintf(size, "%5lu", Ram[j].Size);
-                       sprintf(max, "%5lu", Ram[j].Max);
-                       fprintf(of, format, Ram[j].Name, start, end, size, max);
-               }
-       }
+        /*Compute the amount of unused memory in direct data Ram.  This is the
+        gap between the last register bank or bit segment and the data segment.*/
+        for(k=Ram[6].Start-1; (dram[k]==0) && (k>0); k--);
+        Ram[5].Start=k+1;
+        Ram[5].Size=Ram[6].Start-Ram[5].Start; /*It may be zero (which is good!)*/
+
+        /*Compute the data Ram totals*/
+        for(j=0; j<7; j++)
+        {
+                if(Ram[7].Start>Ram[j].Start) Ram[7].Start=Ram[j].Start;
+                Ram[7].Size+=Ram[j].Size;
+        }
+        Total_Last=Ram[6].Size+Ram[6].Start-1;
+
+        /*Report the Ram totals*/
+        fprintf(of, "Direct Internal RAM:\n");
+        fprintf(of, format, "Name", "Start", "End", "Size", "Max");
+
+        for(j=0; j<8; j++)
+        {
+                if((j==0) || (j==7)) fprintf(of, format, line, line, line, line, line);
+                if((j!=5) || (Ram[j].Size>0))
+                {
+                        sprintf(start, "0x%02lx", Ram[j].Start);
+                        if(Ram[j].Size==0)
+                                end[0]=0;/*Empty string*/
+                        else
+                                sprintf(end,  "0x%02lx", j==7?Total_Last:Ram[j].Size+Ram[j].Start-1);
+                        sprintf(size, "%5lu", Ram[j].Size);
+                        sprintf(max, "%5lu", Ram[j].Max);
+                        fprintf(of, format, Ram[j].Name, start, end, size, max);
+                }
+        }
 
 #if 0
-       for(k=Ram[6].Start; (k<(Ram[6].Start+Ram[6].Size))&&(k<0x100); k++)
-       {
-               if(dram[k]!=Ram[6].flag)
-               {
-                       sprintf(buff, "Internal memory overlap starting at 0x%02x.\n", k);
-                       REPORT_ERROR(buff, 1);
-                       break;
-               }
-       }
-
-       if(Ram[4].Size>Ram[4].Max)
-       {
-               k=Ram[4].Size-Ram[4].Max;
-               sprintf(buff, "Insufficient bit addressable memory.  "
-                                       "%d byte%s short.\n", k, (k==1)?"":"s");
-               REPORT_ERROR(buff, 1);
-       }
-
-       if(Ram[5].Size!=0)
-       {
-               sprintf(buff, "%ld bytes in data memory wasted.  "
-                           "SDCC link could use: --data-loc 0x%02lx\n",
-                                       Ram[5].Size, Ram[6].Start-Ram[5].Size);
-               REPORT_WARNING(buff, 1);
-       }
-
-       if((Ram[6].Start+Ram[6].Size)>Ram[6].Max)
-       {
-               k=(Ram[6].Start+Ram[6].Size)-Ram[6].Max;
-               sprintf(buff, "Insufficient space in data memory.   "
-                                       "%d byte%s short.\n", k, (k==1)?"":"s");
-               REPORT_ERROR(buff, 1);
-       }
+        for(k=Ram[6].Start; (k<(Ram[6].Start+Ram[6].Size))&&(k<0x100); k++)
+        {
+                if(dram[k]!=Ram[6].flag)
+                {
+                        sprintf(buff, "Internal memory overlap starting at 0x%02x.\n", k);
+                        REPORT_ERROR(buff, 1);
+                        break;
+                }
+        }
+
+
+        if(Ram[4].Size>Ram[4].Max)
+        {
+                k=Ram[4].Size-Ram[4].Max;
+                sprintf(buff, "Insufficient bit addressable memory.  "
+                                        "%d byte%s short.\n", k, (k==1)?"":"s");
+                REPORT_ERROR(buff, 1);
+        }
+
+        if(Ram[5].Size!=0)
+        {
+                sprintf(buff, "%ld bytes in data memory wasted.  "
+                            "SDCC link could use: --data-loc 0x%02lx\n",
+                                        Ram[5].Size, Ram[6].Start-Ram[5].Size);
+                REPORT_WARNING(buff, 1);
+        }
+
+        if((Ram[6].Start+Ram[6].Size)>Ram[6].Max)
+        {
+                k=(Ram[6].Start+Ram[6].Size)-Ram[6].Max;
+                sprintf(buff, "Insufficient space in data memory.   "
+                                        "%d byte%s short.\n", k, (k==1)?"":"s");
+                REPORT_ERROR(buff, 1);
+        }
 #endif
-       /*Report the position of the beginning of the stack*/
-       fprintf(of, "\n%stack starts at: 0x%02lx (sp set to 0x%02lx)",
-               rflag ? "16 bit mode initial s" : "S", Stack.Start, Stack.Start-1);
+        /*Report the position of the beginning of the stack*/
+        fprintf(of, "\n%stack starts at: 0x%02lx (sp set to 0x%02lx)",
+                rflag ? "16 bit mode initial s" : "S", Stack.Start, Stack.Start-1);
 
 #if 0
-       /*Check that the stack pointer is landing in a safe place:*/
-       if( (dram[Stack.Start] & 0x8000) == 0x8000 )
-       {
-               fprintf(of, ".\n");
-               sprintf(buff, "Stack set to unavailable memory.\n");
-               REPORT_ERROR(buff, 1);
-       }
-       else if(dram[Stack.Start])
-       {
-               fprintf(of, ".\n");
-               sprintf(buff, "Stack overlaps area ");
-               REPORT_ERROR(buff, 1);
-               for(j=0; j<7; j++)
-               {
-                               if(dram[Stack.Start]&Ram[j].flag)
-                       {
-                               sprintf(buff, "'%s'\n", Ram[j].Name);
-                               break;
-                       }
-               }
-               if(dram[Stack.Start]&IRam.flag)
-               {
-                       sprintf(buff, "'%s'\n", IRam.Name);
-               }
-               REPORT_ERROR(buff, 0);
-       }
-       else
-       {
-               for(j=Stack.Start, k=0; (j<(int)iram_size)&&(dram[j]==0); j++, k++);
-               fprintf(of, " with %d bytes available\n", k);
-               if (k<MIN_STACK)
-               {
-                       sprintf(buff, "Only %d byte%s available for stack.\n",
-                               k, (k==1)?"":"s");
-                       REPORT_WARNING(buff, 1);
-               }
-       }
+        /*Check that the stack pointer is landing in a safe place:*/
+        if( (dram[Stack.Start] & 0x8000) == 0x8000 )
+        {
+                fprintf(of, ".\n");
+                sprintf(buff, "Stack set to unavailable memory.\n");
+                REPORT_ERROR(buff, 1);
+        }
+        else if(dram[Stack.Start])
+        {
+                fprintf(of, ".\n");
+                sprintf(buff, "Stack overlaps area ");
+                REPORT_ERROR(buff, 1);
+                for(j=0; j<7; j++)
+                {
+                        if(dram[Stack.Start]&Ram[j].flag)
+                        {
+                                sprintf(buff, "'%s'\n", Ram[j].Name);
+                                break;
+                        }
+                }
+                if(dram[Stack.Start]&IRam.flag)
+                {
+                        sprintf(buff, "'%s'\n", IRam.Name);
+                }
+                REPORT_ERROR(buff, 0);
+        }
+        else
+        {
+                for(j=Stack.Start, k=0; (j<(int)iram_size)&&(dram[j]==0); j++, k++);
+                fprintf(of, " with %d bytes available\n", k);
+                if (k<MIN_STACK)
+                {
+                        sprintf(buff, "Only %d byte%s available for stack.\n",
+                                k, (k==1)?"":"s");
+                        REPORT_WARNING(buff, 1);
+                }
+        }
 #endif
 
-       fprintf(of, "\nOther memory:\n");
-       fprintf(of, format, "Name", "Start", "End", "Size", "Max");
-       fprintf(of, format, line, line, line, line, line);
-
-       /*Report IRam totals:*/
-       sprintf(start, "0x%02lx", IRam.Start);
-       if(IRam.Size==0)
-               end[0]=0;/*Empty string*/
-       else
-               sprintf(end,  "0x%02lx", IRam.Size+IRam.Start-1);
-       sprintf(size, "%5lu", IRam.Size);
-       sprintf(max, "%5lu", IRam.Max);
-       fprintf(of, format, IRam.Name, start, end, size, max);
-
-       /*Report XRam totals:*/
-       sprintf(start, "0x%04lx", XRam.Start);
-       if(XRam.Size==0)
-               end[0]=0;/*Empty string*/
-       else
-               sprintf(end,  "0x%04lx", XRam.Size+XRam.Start-1);
-       sprintf(size, "%5lu", XRam.Size);
-       sprintf(max, "%5lu", xram_size<0?XRam.Max:xram_size);
-       fprintf(of, format, XRam.Name, start, end, size, max);
-
-       /*Report Rom/Flash totals:*/
-       sprintf(start, "0x%04lx", Rom.Start);
-       if(Rom.Size==0)
-               end[0]=0;/*Empty string*/
-       else
-               sprintf(end,  "0x%04lx", Rom.Size+Rom.Start-1);
-       sprintf(size, "%5lu", Rom.Size);
-       sprintf(max, "%5lu", code_size<0?Rom.Max:code_size);
-       fprintf(of, format, Rom.Name, start, end, size, max);
-
-       /*Report any excess:*/
+        fprintf(of, "\nOther memory:\n");
+        fprintf(of, format, "Name", "Start", "End", "Size", "Max");
+        fprintf(of, format, line, line, line, line, line);
+
+        /*Report IRam totals:*/
+        sprintf(start, "0x%02lx", IRam.Start);
+        if(IRam.Size==0)
+                end[0]=0;/*Empty string*/
+        else
+                sprintf(end,  "0x%02lx", IRam.Size+IRam.Start-1);
+        sprintf(size, "%5lu", IRam.Size);
+        sprintf(max, "%5lu", IRam.Max);
+        fprintf(of, format, IRam.Name, start, end, size, max);
+
+        /*Report XRam totals:*/
+        sprintf(start, "0x%04lx", XRam.Start);
+        if(XRam.Size==0)
+                end[0]=0;/*Empty string*/
+        else
+                sprintf(end,  "0x%04lx", XRam.Size+XRam.Start-1);
+        sprintf(size, "%5lu", XRam.Size);
+        sprintf(max, "%5lu", xram_size<0?XRam.Max:xram_size);
+        fprintf(of, format, XRam.Name, start, end, size, max);
+
+        /*Report Rom/Flash totals:*/
+        sprintf(start, "0x%04lx", Rom.Start);
+        if(Rom.Size==0)
+                end[0]=0;/*Empty string*/
+        else
+                sprintf(end,  "0x%04lx", Rom.Size+Rom.Start-1);
+        sprintf(size, "%5lu", Rom.Size);
+        sprintf(max, "%5lu", code_size<0?Rom.Max:code_size);
+        fprintf(of, format, Rom.Name, start, end, size, max);
+
+        /*Report any excess:*/
 #if 0
-       if((IRam.Start+IRam.Size)>(IRam.Max+0x80))
-       {
-               sprintf(buff, "Insufficient INDIRECT RAM memory.\n");
-               REPORT_ERROR(buff, 1);
-       }
+        if((IRam.Start+IRam.Size)>(IRam.Max+0x80))
+        {
+                sprintf(buff, "Insufficient INDIRECT RAM memory.\n");
+                REPORT_ERROR(buff, 1);
+        }
 #endif
-       if( ((XRam.Start+XRam.Size)>XRam.Max) ||
-               (((int)XRam.Size>xram_size)&&(xram_size>=0)) )
-       {
-               sprintf(buff, "Insufficient EXTERNAL RAM memory.\n");
-               REPORT_ERROR(buff, 1);
-       }
-       if( ((Rom.Start+Rom.Size)>Rom.Max) ||
-               (((int)Rom.Size>code_size)&&(code_size>=0)) )
-       {
-               sprintf(buff, "Insufficient ROM/EPROM/FLASH memory.\n");
-               REPORT_ERROR(buff, 1);
-       }
-
-       fclose(of);
-       return toreturn;                
+        if( ((XRam.Start+XRam.Size)>XRam.Max) ||
+                (((int)XRam.Size>xram_size)&&(xram_size>=0)) )
+        {
+                sprintf(buff, "Insufficient EXTERNAL RAM memory.\n");
+                REPORT_ERROR(buff, 1);
+        }
+        if( ((Rom.Start+Rom.Size)>Rom.Max) ||
+                (((int)Rom.Size>code_size)&&(code_size>=0)) )
+        {
+                sprintf(buff, "Insufficient ROM/EPROM/FLASH memory.\n");
+                REPORT_ERROR(buff, 1);
+        }
+
+        fclose(of);
+        return toreturn;
 }
index cfa15d1e74106273dc6452a922b29e80ae1c77ca..ca6f3582c89dc26f79c6a49302b81dc3898c1eeb 100644 (file)
@@ -1,16 +1,25 @@
-/* lkrloc.c */
+/* lkrloc.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 29-Oct-97 JLH:
- *              - errdmp: show s_id as string rather than array [NCPS]
- *              - relr: add support for 11 bit 8051 addressing
+ *               - errdmp: show s_id as string rather than array [NCPS]
+ *               - relr: add support for 11 bit 8051 addressing
  * 02-Apr-98 JLH: don't output empty hex records
  */
 
 #include <string.h>
 #include "aslink.h"
 
-/*)Module      lkrloc.c
- *
- *     The module lkrloc.c contains the functions which
- *     perform the relocation calculations.
- *
- *     lkrloc.c contains the following functions:
- *             Addr_T  adb_b()
- *             Addr_T  adb_lo()
- *             Addr_T  adb_hi()
- *             Addr_T  adw_w()
- *             Addr_T  adw_lo()
- *             Addr_T  adw_hi()
- *             VOID    erpdmp()
- *             VOID    errdmp()
- *             Addr_T  evword()
- *             VOID    prntval()
- *             VOID    rele()
- *             VOID    relerr()
- *             VOID    relerp()
- *             VOID    reloc()
- *             VOID    relp()
- *             VOID    relr()
- *             VOID    relt()
- *
- *     lkrloc.c the local variable errmsg[].
+/*)Module       lkrloc.c
+ *
+ *      The module lkrloc.c contains the functions which
+ *      perform the relocation calculations.
+ *
+ *      lkrloc.c contains the following functions:
+ *              Addr_T  adb_b()
+ *              Addr_T  adb_lo()
+ *              Addr_T  adb_hi()
+ *              Addr_T  adw_w()
+ *              Addr_T  adw_lo()
+ *              Addr_T  adw_hi()
+ *              VOID    erpdmp()
+ *              VOID    errdmp()
+ *              Addr_T  evword()
+ *              VOID    prntval()
+ *              VOID    rele()
+ *              VOID    relerr()
+ *              VOID    relerp()
+ *              VOID    reloc()
+ *              VOID    relp()
+ *              VOID    relr()
+ *              VOID    relt()
+ *
+ *      lkrloc.c the local variable errmsg[].
  *
  */
 
@@ -56,364 +65,364 @@ int    lastExtendedAddress=-1;
  */
 static int lastAreaIndex = -1;
 
-/*)Function    VOID    reloc(c)
+/*)Function     VOID    reloc(c)
  *
- *                     char c          process code
+ *                      char c          process code
  *
- *     The function reloc() calls a particular relocation
- *     function determined by the process code.
+ *      The function reloc() calls a particular relocation
+ *      function determined by the process code.
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             int     lkerr           error flag
+ *      global variables:
+ *              int     lkerr           error flag
  *
- *     called functions:
- *             int     fprintf()       c_library
- *             VOID    rele()          lkrloc.c
- *             VOID    relp()          lkrloc.c
- *             VOID    relr()          lkrloc.c
- *             VOId    relt()          lkrloc.c
+ *      called functions:
+ *              int     fprintf()       c_library
+ *              VOID    rele()          lkrloc.c
+ *              VOID    relp()          lkrloc.c
+ *              VOID    relr()          lkrloc.c
+ *              VOId    relt()          lkrloc.c
  *
- *     side effects:
- *             Refer to the called relocation functions.
+ *      side effects:
+ *              Refer to the called relocation functions.
  *
  */
 
 VOID reloc(char c)
 {
-       switch(c) {
+        switch(c) {
 
-       case 'T':
-               relt();
-               break;
+        case 'T':
+                relt();
+                break;
 
-       case 'R':
-               relr();
-               break;
+        case 'R':
+                relr();
+                break;
 
-       case 'P':
-               relp();
-               break;
+        case 'P':
+                relp();
+                break;
 
-       case 'E':
-               rele();
-               break;
+        case 'E':
+                rele();
+                break;
 
-       default:
-               fprintf(stderr, "Undefined Relocation Operation\n");
-               lkerr++;
-               break;
+        default:
+                fprintf(stderr, "Undefined Relocation Operation\n");
+                lkerr++;
+                break;
 
-       }
+        }
 }
 
 
-/*)Function    VOID    relt()
+/*)Function     VOID    relt()
  *
- *     The function relt() evaluates a T line read by
- *     the linker. Each byte value read is saved in the
- *     rtval[] array, rtflg[] is set, and the number of
- *     evaluations is maintained in rtcnt.
+ *      The function relt() evaluates a T line read by
+ *      the linker. Each byte value read is saved in the
+ *      rtval[] array, rtflg[] is set, and the number of
+ *      evaluations is maintained in rtcnt.
  *
- *             T Line
+ *              T Line
  *
- *             T xx xx nn nn nn nn nn ...
+ *              T xx xx nn nn nn nn nn ...
  *
  *
- *             In:     "T n0 n1 n2 n3 ... nn"
+ *              In:     "T n0 n1 n2 n3 ... nn"
  *
- *             Out:     0   1    2        ..  rtcnt
- *                       +----+----+----+----+----+
- *             rtval | n0 | n1 | n2 | .. | nn |
- *                   +----+----+----+----+----+
- *             rtflag|  1 |  1 |  1 |  1 |  1 |
+ *              Out:     0   1    2        ..  rtcnt
+ *                        +----+----+----+----+----+
+ *              rtval | n0 | n1 | n2 | .. | nn |
+ *                    +----+----+----+----+----+
+ *              rtflag|  1 |  1 |  1 |  1 |  1 |
  *            +----+----+----+----+----+
  *
- *     The T line contains the assembled code output by the assem-
- *     bler with xx xx being the offset address from the current area
- *     base address and nn being the assembled instructions and data in
- *     byte format.
+ *      The T line contains the assembled code output by the assem-
+ *      bler with xx xx being the offset address from the current area
+ *      base address and nn being the assembled instructions and data in
+ *      byte format.
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             int     rtcnt           number of values evaluated
- *             int     rtflg[]         array of evaluation flags
- *             int     rtval[]         array of evaluation values
+ *      global variables:
+ *              int     rtcnt           number of values evaluated
+ *              int     rtflg[]         array of evaluation flags
+ *              int     rtval[]         array of evaluation values
  *
- *     called functions:
- *             int     eval()          lkeval.c
- *             int     more()          lklex.c
+ *      called functions:
+ *              int     eval()          lkeval.c
+ *              int     more()          lklex.c
  *
- *     side effects:
- *             Linker input T line evaluated.
+ *      side effects:
+ *              Linker input T line evaluated.
  *
  */
 
 VOID relt(VOID)
 {
-       rtcnt = 0;
-       while (more()) {
-               if (rtcnt < NTXT) {
-                       rtval[rtcnt] = eval();
-                       rtflg[rtcnt] = 1;
-                       rtcnt++;
-               }
-       }
+        rtcnt = 0;
+        while (more()) {
+                if (rtcnt < NTXT) {
+                        rtval[rtcnt] = eval();
+                        rtflg[rtcnt] = 1;
+                        rtcnt++;
+                }
+        }
 }
 
-/*)Function    VOID    relr()
- *
- *     The function relr() evaluates a R line read by
- *     the linker.  The R line data is combined with the
- *     previous T line data to perform the relocation of
- *     code and data bytes.  The S19 / IHX output and
- *     translation of the LST files to RST files may be
- *     performed.
- *
- *             R Line
- *
- *             R 0 0 nn nn n1 n2 xx xx ...
- *
- *             The R line provides the relocation information to the linker.
- *     The nn nn value is the current area index, i.e.  which area  the
- *     current  values  were  assembled.  Relocation information is en-
- *     coded in groups of 4 bytes:
- *
- *     1.      n1 is the relocation mode and object format
- *                     1.      bit 0 word(0x00)/byte(0x01)
- *                     2.      bit 1 relocatable area(0x00)/symbol(0x02)
- *                     3.      bit 2 normal(0x00)/PC relative(0x04) relocation
- *                     4.      bit  3  1-byte(0x00)/2-byte(0x08) object format for
- *                     byte data
- *                     5.      bit 4 signed(0x00)/unsigned(0x10) byte data
- *                     6.      bit 5 normal(0x00)/page '0'(0x20) reference
- *                     7.      bit 6 normal(0x00)/page 'nnn'(0x40) reference
- *
- *     2.      n2      is      a byte index into the corresponding (i.e.  pre-
- *                     ceeding) T line data (i.e.      a pointer to the data to be
- *                     updated  by  the  relocation).   The T line data may be
- *                     1-byte or  2-byte  byte  data  format  or  2-byte  word
- *                     format.
- *
- *     3.      xx xx  is the area/symbol index for the area/symbol be-
- *                     ing referenced.  the corresponding area/symbol is found
- *             in the header area/symbol lists.
- *
- *     The groups of 4 bytes are repeated for each item requiring relo-
- *     cation in the preceeding T line.
- *
- *     local variable:
- *             areax   **a             pointer to array of area pointers
- *             int     aindex          area index
- *             char    *errmsg[]       array of pointers to error strings
- *             int     error           error code
- *             int     lkerr           error flag
- *             int     mode            relocation mode
- *             adrr_t  paga            paging base area address
- *             Addr_T  pags            paging symbol address
- *             Addr_T  pc              relocated base address
- *             Addr_T  r               PCR relocation value
- *             Addr_T  reli            relocation initial value
- *             Addr_T  relv            relocation final value
- *             int     rindex          symbol / area index
- *             Addr_T  rtbase          base code address
- *             Addr_T  rtofst          rtval[] index offset
- *             int     rtp             index into T data
- *             sym     **s             pointer to array of symbol pointers
- *
- *     global variables:
- *             head    *hp             pointer to the head structure
- *             rerr    rerr            linker error structure
- *             FILE    *stderr         standard error device
- *
- *     called functions:
- *             Addr_T  adb_b()         lkrloc.c
- *             Addr_T  adb_lo()        lkrloc.c
- *             Addr_T  adb_hi()        lkrloc.c
- *             Addr_T  adw_w()         lkrloc.c
- *             VOID    elf()           lkelf.c
- *             Addr_T  evword()        lkrloc.c
- *             int     eval()          lkeval.c
- *             int     fprintf()       c_library
- *             VOID    ihx()           lkihx.c
- *             int     lkulist         lklist.c
- *             int     more()          lklex.c
- *             VOID    relerr()        lkrloc.c
- *             VOID    s19()           lks19.c
- *             int     symval()        lksym.c
- *
- *     side effects:
- *             The R and T lines are combined to produce
- *             relocated code and data.  Output S19 / IHX
- *             and relocated listing files may be produced.
+/*)Function     VOID    relr()
+ *
+ *      The function relr() evaluates a R line read by
+ *      the linker.  The R line data is combined with the
+ *      previous T line data to perform the relocation of
+ *      code and data bytes.  The S19 / IHX output and
+ *      translation of the LST files to RST files may be
+ *      performed.
+ *
+ *              R Line
+ *
+ *              R 0 0 nn nn n1 n2 xx xx ...
+ *
+ *              The R line provides the relocation information to the linker.
+ *      The nn nn value is the current area index, i.e.  which area  the
+ *      current  values  were  assembled.  Relocation information is en-
+ *      coded in groups of 4 bytes:
+ *
+ *      1.      n1 is the relocation mode and object format
+ *                      1.      bit 0 word(0x00)/byte(0x01)
+ *                      2.      bit 1 relocatable area(0x00)/symbol(0x02)
+ *                      3.      bit 2 normal(0x00)/PC relative(0x04) relocation
+ *                      4.      bit  3  1-byte(0x00)/2-byte(0x08) object format for
+ *                      byte data
+ *                      5.      bit 4 signed(0x00)/unsigned(0x10) byte data
+ *                      6.      bit 5 normal(0x00)/page '0'(0x20) reference
+ *                      7.      bit 6 normal(0x00)/page 'nnn'(0x40) reference
+ *
+ *      2.      n2      is      a byte index into the corresponding (i.e.  pre-
+ *                      ceeding) T line data (i.e.      a pointer to the data to be
+ *                      updated  by  the  relocation).   The T line data may be
+ *                      1-byte or  2-byte  byte  data  format  or  2-byte  word
+ *                      format.
+ *
+ *      3.      xx xx  is the area/symbol index for the area/symbol be-
+ *                      ing referenced.  the corresponding area/symbol is found
+ *              in the header area/symbol lists.
+ *
+ *      The groups of 4 bytes are repeated for each item requiring relo-
+ *      cation in the preceeding T line.
+ *
+ *      local variable:
+ *              areax   **a             pointer to array of area pointers
+ *              int     aindex          area index
+ *              char    *errmsg[]       array of pointers to error strings
+ *              int     error           error code
+ *              int     lkerr           error flag
+ *              int     mode            relocation mode
+ *              adrr_t  paga            paging base area address
+ *              Addr_T  pags            paging symbol address
+ *              Addr_T  pc              relocated base address
+ *              Addr_T  r               PCR relocation value
+ *              Addr_T  reli            relocation initial value
+ *              Addr_T  relv            relocation final value
+ *              int     rindex          symbol / area index
+ *              Addr_T  rtbase          base code address
+ *              Addr_T  rtofst          rtval[] index offset
+ *              int     rtp             index into T data
+ *              sym     **s             pointer to array of symbol pointers
+ *
+ *      global variables:
+ *              head    *hp             pointer to the head structure
+ *              rerr    rerr            linker error structure
+ *              FILE    *stderr         standard error device
+ *
+ *      called functions:
+ *              Addr_T  adb_b()         lkrloc.c
+ *              Addr_T  adb_lo()        lkrloc.c
+ *              Addr_T  adb_hi()        lkrloc.c
+ *              Addr_T  adw_w()         lkrloc.c
+ *              VOID    elf()           lkelf.c
+ *              Addr_T  evword()        lkrloc.c
+ *              int     eval()          lkeval.c
+ *              int     fprintf()       c_library
+ *              VOID    ihx()           lkihx.c
+ *              int     lkulist         lklist.c
+ *              int     more()          lklex.c
+ *              VOID    relerr()        lkrloc.c
+ *              VOID    s19()           lks19.c
+ *              int     symval()        lksym.c
+ *
+ *      side effects:
+ *              The R and T lines are combined to produce
+ *              relocated code and data.  Output S19 / IHX
+ *              and relocated listing files may be produced.
  *
  */
 
 VOID relr(VOID)
 {
-       register int mode;
-       register Addr_T reli, relv;
-       int aindex, rindex, rtp, error;
-       Addr_T r, rtbase, rtofst, paga, pags, pc;
-       struct areax **a;
-       struct sym **s;
-
-       /*
-        * Get area and symbol lists
-        */
-       a = hp->a_list;
-       s = hp->s_list;
-
-       /*
-        * Verify Area Mode
-        */
-       if (eval() != (R_WORD | R_AREA) || eval()) {
-               fprintf(stderr, "R input error\n");
-               lkerr++;
-       }
-
-       /*
-        * Get area pointer
-        */
-       aindex = evword();
-       if (aindex >= hp->h_narea) {
-               fprintf(stderr, "R area error\n");
-               lkerr++;
-               return;
-       }
+        register int mode;
+        register Addr_T reli, relv;
+        int aindex, rindex, rtp, error;
+        Addr_T r, rtbase, rtofst, paga, pags, pc;
+        struct areax **a;
+        struct sym **s;
+
+        /*
+         * Get area and symbol lists
+         */
+        a = hp->a_list;
+        s = hp->s_list;
+
+        /*
+         * Verify Area Mode
+         */
+        if (eval() != (R_WORD | R_AREA) || eval()) {
+                fprintf(stderr, "R input error\n");
+                lkerr++;
+        }
+
+        /*
+         * Get area pointer
+         */
+        aindex = evword();
+        if (aindex >= hp->h_narea) {
+                fprintf(stderr, "R area error\n");
+                lkerr++;
+                return;
+        }
         ap = a[aindex]->a_bap;
 
-       /*
-        * Base values
-        */
-       rtbase = adw_w(0, 0);
-       rtofst = 2;
-
-       /*
-        * Relocate address
-        */
-       pc = adw_w(a[aindex]->a_addr, 0);
-
-       #if 0
-       printf("area %d base address: 0x%x size: 0x%x rtbase: 0x%x\n", aindex, 
-               a[aindex]->a_addr, a[aindex]->a_size, rtbase);
-       #endif
-       /*
-        * Do remaining relocations
-        */
-       while (more()) {
-               error = 0;
-               mode = eval();
-               
-               if ((mode & R_ESCAPE_MASK) == R_ESCAPE_MASK)
-               {
-                   mode = ((mode & ~R_ESCAPE_MASK) << 8) | eval();
-                   /* printf("unescaping rmode\n"); */
-               }
-               
-               rtp = eval();
-               rindex = evword();
-
-               /*
-                * R_SYM or R_AREA references
-                */
-               if (mode & R_SYM) {
-                       if (rindex >= hp->h_nglob) {
-                               fprintf(stderr, "R symbol error\n");
-                               lkerr++;
-                               return;
-                       }
-                       reli = symval(s[rindex]);
-               } else {
-                       if (rindex >= hp->h_narea) {
-                               fprintf(stderr, "R area error\n");
-                               lkerr++;
-                               return;
-                       }
-                       reli = a[rindex]->a_addr;
-               }
-
-               /*
-                * R_PCR addressing
-                */
-               if (mode & R_PCR) {
-                       if (mode & R_BYTE) {
-                               reli -= (pc + (rtp-rtofst) + 1);
-                       } else {
-                               reli -= (pc + (rtp-rtofst) + 2);
-                       }
-               }
-
-               /*
-                * R_PAG0 or R_PAG addressing
-                */
-               if (mode & (R_PAG0 | R_PAG)) {
-                       paga  = sdp.s_area->a_addr;
-                       pags  = sdp.s_addr;
-                       reli -= paga + pags;
-               }
-
-               /*
-                * R_BYTE or R_WORD operation
-                */
-               if (mode & R_BYTE) {
-                       if (mode & R_BYT3)
-                       {
-                               /* This is a three byte address, of which 
-                                * we will select one byte.
-                                */
-                               if (mode & R_HIB)
-                               {
-                                       /* printf("24 bit address selecting hi byte.\n"); */
-                                       relv = adb_24_hi(reli, rtp);
-                               }               
-                               else if (mode & R_MSB)
-                               {
-                                       /* Note that in 24 bit mode, R_MSB
-                                        * is really the middle byte, not
-                                        * the most significant byte.
-                                        *
-                                        * This is ugly and I can only apologize
-                                        * for any confusion.
-                                        */
-                                       /* printf("24 bit address selecting middle byte.\n"); */
-                                       relv = adb_24_mid(reli, rtp);                           
-                               }
-                               else
-                               {
-                                       /* printf("24 bit address selecting lo byte.\n"); */
-                                       relv = adb_24_lo(reli, rtp);                            
-                               }
-                       }
-                       else if (mode & R_BYT2) {
-                               /* This is a two byte address, of
-                                * which we will select one byte.
-                                */
-                               if (mode & R_MSB) {
-                                       relv = adb_hi(reli, rtp);
-                               } else {
-                                       relv = adb_lo(reli, rtp);
-                               }
-                       } else {
-                               relv = adb_b(reli, rtp);
-                       }
-               } else if (IS_R_J11(mode)) {
-                       /* JLH: 11 bit jump destination for 8051.  Forms
-                       /  two byte instruction with op-code bits
-                       /  in the MIDDLE!
-                       /  rtp points at 3 byte locus: first two
-                       /  will get the instructiion. third one
-                       /  has raw op-code.
-                       */
-       
-                       /* Calculate absolute destination
-                       /  relv must be on same 2K page as pc
-                       */
-                       relv = adw_w(reli, rtp);
+        /*
+         * Base values
+         */
+        rtbase = adw_w(0, 0);
+        rtofst = 2;
+
+        /*
+         * Relocate address
+         */
+        pc = adw_w(a[aindex]->a_addr, 0);
+
+        #if 0
+        printf("area %d base address: 0x%x size: 0x%x rtbase: 0x%x\n", aindex,
+                a[aindex]->a_addr, a[aindex]->a_size, rtbase);
+        #endif
+        /*
+         * Do remaining relocations
+         */
+        while (more()) {
+                error = 0;
+                mode = eval();
+
+                if ((mode & R_ESCAPE_MASK) == R_ESCAPE_MASK)
+                {
+                    mode = ((mode & ~R_ESCAPE_MASK) << 8) | eval();
+                    /* printf("unescaping rmode\n"); */
+                }
+
+                rtp = eval();
+                rindex = evword();
+
+                /*
+                 * R_SYM or R_AREA references
+                 */
+                if (mode & R_SYM) {
+                        if (rindex >= hp->h_nglob) {
+                                fprintf(stderr, "R symbol error\n");
+                                lkerr++;
+                                return;
+                        }
+                        reli = symval(s[rindex]);
+                } else {
+                        if (rindex >= hp->h_narea) {
+                                fprintf(stderr, "R area error\n");
+                                lkerr++;
+                                return;
+                        }
+                        reli = a[rindex]->a_addr;
+                }
+
+                /*
+                 * R_PCR addressing
+                 */
+                if (mode & R_PCR) {
+                        if (mode & R_BYTE) {
+                                reli -= (pc + (rtp-rtofst) + 1);
+                        } else {
+                                reli -= (pc + (rtp-rtofst) + 2);
+                        }
+                }
+
+                /*
+                 * R_PAG0 or R_PAG addressing
+                 */
+                if (mode & (R_PAG0 | R_PAG)) {
+                        paga  = sdp.s_area->a_addr;
+                        pags  = sdp.s_addr;
+                        reli -= paga + pags;
+                }
+
+                /*
+                 * R_BYTE or R_WORD operation
+                 */
+                if (mode & R_BYTE) {
+                        if (mode & R_BYT3)
+                        {
+                                /* This is a three byte address, of which
+                                 * we will select one byte.
+                                 */
+                                if (mode & R_HIB)
+                                {
+                                        /* printf("24 bit address selecting hi byte.\n"); */
+                                        relv = adb_24_hi(reli, rtp);
+                                }
+                                else if (mode & R_MSB)
+                                {
+                                        /* Note that in 24 bit mode, R_MSB
+                                         * is really the middle byte, not
+                                         * the most significant byte.
+                                         *
+                                         * This is ugly and I can only apologize
+                                         * for any confusion.
+                                         */
+                                        /* printf("24 bit address selecting middle byte.\n"); */
+                                        relv = adb_24_mid(reli, rtp);
+                                }
+                                else
+                                {
+                                        /* printf("24 bit address selecting lo byte.\n"); */
+                                        relv = adb_24_lo(reli, rtp);
+                                }
+                        }
+                        else if (mode & R_BYT2) {
+                                /* This is a two byte address, of
+                                 * which we will select one byte.
+                                 */
+                                if (mode & R_MSB) {
+                                        relv = adb_hi(reli, rtp);
+                                } else {
+                                        relv = adb_lo(reli, rtp);
+                                }
+                        } else {
+                                relv = adb_b(reli, rtp);
+                        }
+                } else if (IS_R_J11(mode)) {
+                        /* JLH: 11 bit jump destination for 8051.  Forms
+                        /  two byte instruction with op-code bits
+                        /  in the MIDDLE!
+                        /  rtp points at 3 byte locus: first two
+                        /  will get the instructiion. third one
+                        /  has raw op-code.
+                        */
+
+                        /* Calculate absolute destination
+                        /  relv must be on same 2K page as pc
+                        */
+                        relv = adw_w(reli, rtp);
 
             if ((relv & ~0x7ff) != ((pc + rtp - rtofst) & ~0x7ff)) {
                     error = 2;
@@ -424,1015 +433,1015 @@ VOID relr(VOID)
             */
             rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+2];
             rtflg[rtp+2] = 0;
-                       rtofst += 1;
-               }
-               else if (IS_R_J19(mode)) {
-                       /* 19 bit jump destination for DS80C390.  Forms
-                       /  three byte instruction with op-code bits
-                       /  in the MIDDLE!
-                       /  rtp points at 4 byte locus: first three
-                       /  will get the instructiion. fourth one
-                       /  has raw op-code.
-                        */
-       
-                       /* Calculate absolute destination
-                       /  relv must be on same 512K page as pc
-                       */
-                       relv = adw_24(reli, rtp);
+                        rtofst += 1;
+                }
+                else if (IS_R_J19(mode)) {
+                        /* 19 bit jump destination for DS80C390.  Forms
+                        /  three byte instruction with op-code bits
+                        /  in the MIDDLE!
+                        /  rtp points at 4 byte locus: first three
+                        /  will get the instructiion. fourth one
+                        /  has raw op-code.
+                         */
+
+                        /* Calculate absolute destination
+                        /  relv must be on same 512K page as pc
+                        */
+                        relv = adw_24(reli, rtp);
 
             if ((relv & ~0x7ffff) != ((pc + rtp - rtofst) & ~0x7ffff)) {
                     error = 2;
-                               }
+                                }
 
             /* Merge MSB (byte 0) with op-code, ignoring
             /  top 5 bits of address.  Then hide the op-code
             */
             rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+3];
             rtflg[rtp+3] = 0;
-                       rtofst += 1;
-               }                
-               else if (IS_C24(mode))
-               {
-                       /* 24 bit address */
-                       relv = adw_24(reli, rtp);
-                       }
-               else
-               {
-                       /* 16 bit address. */
-                       relv = adw_w(reli, rtp);
-               }
-
-               /*
-                * R_BYTE with R_BYT2 offset adjust
-                */
-               if (mode & R_BYTE) {
-                       if (mode & R_BYT2) {
-                               rtofst += 1;
-                       }
-               }
-
-               /*
-                * Unsigned Byte Checking
-                */
-               if (mode & R_USGN && mode & R_BYTE && relv & ~0xFF)
-                       error = 1;
-
-               /*
-                * PCR Relocation Error Checking
-                */
-               if (mode & R_PCR && mode & R_BYTE) {
-                       r = relv & ~0x7F;
-                       if (r != (Addr_T) ~0x7F && r != 0)
-                               error = 2; 
-               }
-
-               /*
-                * Page Relocation Error Checking
-                */
-               /* if (mode & R_PAG0 && (relv & ~0xFF || paga || pags))
-                       error = 3;*/
-               if (mode & R_PAG  && (relv & ~0xFF))
-                       error = 4;
-
-               /*
-                * Error Processing
-                */
-               if (error) {
-                       rerr.aindex = aindex;
-                       rerr.mode = mode;
-                       rerr.rtbase = rtbase + rtp - rtofst - 1;
-                       rerr.rindex = rindex;
-                       rerr.rval = relv - reli;
-                       relerr(errmsg[error-1]);
-               }
-       }
-       if (uflag != 0) {
-               lkulist(1);
-       }
-
-       /* JLH: output only if data (beyond two byte address) */
-       if ((oflag == 1) && (rtcnt > 2)) {
-               // int extendedAddress = (a[aindex]->a_addr >> 16) & 0xffff;
-               
-               /* Boy, is this a hack: for ABS sections, the
-                * base address is stored as zero, and the T records
-                * indicate the offset from zero.
-                *
-                * Since T records can only indicate a 16 bit offset, this
-                * obviously creates a problem for ABS segments located
-                * above 64K (this is only meaningful in flat24 mode).
-                *
-                * However, the size of an ABS area is stored as
-                * base address + section size (I suspect this is a bug,
-                * but it's a handy one right now). So the upper 8 bits of
-                * the 24 bit address are stored in the size record.
-                * Thus we add it in.
-                *
-                * This is another reason why we can't have areas greater
-                * than 64K yet, even in flat24 mode.
-                */
-       //      extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
-       //      commented out by jr 
-               
-               if (lastAreaIndex != aindex) {
-                       lastAreaIndex = aindex;
-                       ihxNewArea();
-               }
-#if 0          
-               if (extendedAddress != lastExtendedAddress)
-               {
-               
-                   if (lastExtendedAddress!=-1) {
-                     printf("output extended linear address record 0x%x 0x%x\n",
-                            extendedAddress, lastExtendedAddress);
-                   }
-                   
-                   if (rflag)
-                   {
-                       ihxExtendedLinearAddress(extendedAddress);
-                   }
-                   else if (extendedAddress)
-                   {
-                       /* Not allowed to generate extended address records,
-                        * but one is called for here...
-                        */
-                       fprintf(stderr, 
-                               "warning: extended linear address encountered; "
-                               "you probably want the -r flag.\n");
-                   }
-                   lastExtendedAddress = extendedAddress;
-               }
+                        rtofst += 1;
+                }
+                else if (IS_C24(mode))
+                {
+                        /* 24 bit address */
+                        relv = adw_24(reli, rtp);
+                        }
+                else
+                {
+                        /* 16 bit address. */
+                        relv = adw_w(reli, rtp);
+                }
+
+                /*
+                 * R_BYTE with R_BYT2 offset adjust
+                 */
+                if (mode & R_BYTE) {
+                        if (mode & R_BYT2) {
+                                rtofst += 1;
+                        }
+                }
+
+                /*
+                 * Unsigned Byte Checking
+                 */
+                if (mode & R_USGN && mode & R_BYTE && relv & ~0xFF)
+                        error = 1;
+
+                /*
+                 * PCR Relocation Error Checking
+                 */
+                if (mode & R_PCR && mode & R_BYTE) {
+                        r = relv & ~0x7F;
+                        if (r != (Addr_T) ~0x7F && r != 0)
+                                error = 2;
+                }
+
+                /*
+                 * Page Relocation Error Checking
+                 */
+                /* if (mode & R_PAG0 && (relv & ~0xFF || paga || pags))
+                        error = 3;*/
+                if (mode & R_PAG  && (relv & ~0xFF))
+                        error = 4;
+
+                /*
+                 * Error Processing
+                 */
+                if (error) {
+                        rerr.aindex = aindex;
+                        rerr.mode = mode;
+                        rerr.rtbase = rtbase + rtp - rtofst - 1;
+                        rerr.rindex = rindex;
+                        rerr.rval = relv - reli;
+                        relerr(errmsg[error-1]);
+                }
+        }
+        if (uflag != 0) {
+                lkulist(1);
+        }
+
+        /* JLH: output only if data (beyond two byte address) */
+        if ((oflag == 1) && (rtcnt > 2)) {
+                // int extendedAddress = (a[aindex]->a_addr >> 16) & 0xffff;
+
+                /* Boy, is this a hack: for ABS sections, the
+                 * base address is stored as zero, and the T records
+                 * indicate the offset from zero.
+                 *
+                 * Since T records can only indicate a 16 bit offset, this
+                 * obviously creates a problem for ABS segments located
+                 * above 64K (this is only meaningful in flat24 mode).
+                 *
+                 * However, the size of an ABS area is stored as
+                 * base address + section size (I suspect this is a bug,
+                 * but it's a handy one right now). So the upper 8 bits of
+                 * the 24 bit address are stored in the size record.
+                 * Thus we add it in.
+                 *
+                 * This is another reason why we can't have areas greater
+                 * than 64K yet, even in flat24 mode.
+                 */
+        //      extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
+        //      commented out by jr
+
+                if (lastAreaIndex != aindex) {
+                        lastAreaIndex = aindex;
+                        ihxNewArea();
+                }
+#if 0
+                if (extendedAddress != lastExtendedAddress)
+                {
+
+                    if (lastExtendedAddress!=-1) {
+                      printf("output extended linear address record 0x%x 0x%x\n",
+                             extendedAddress, lastExtendedAddress);
+                    }
+
+                    if (rflag)
+                    {
+                        ihxExtendedLinearAddress(extendedAddress);
+                    }
+                    else if (extendedAddress)
+                    {
+                        /* Not allowed to generate extended address records,
+                         * but one is called for here...
+                         */
+                        fprintf(stderr,
+                                "warning: extended linear address encountered; "
+                                "you probably want the -r flag.\n");
+                    }
+                    lastExtendedAddress = extendedAddress;
+                }
 #endif
-               ihx(1);
-       } else
-       if ((oflag == 2) && (rtcnt > 2)) {
-               s19(1);
-       } else
-       if ((oflag == 3) && (rtcnt > 2)) {
-               elf(1);
-       }
+                ihx(1);
+        } else
+        if ((oflag == 2) && (rtcnt > 2)) {
+                s19(1);
+        } else
+        if ((oflag == 3) && (rtcnt > 2)) {
+                elf(1);
+        }
 }
 
 char *errmsg[] = {
-       "Unsigned Byte error",
-       "Byte PCR relocation error",
-       "Page0 relocation error",
-       "Page Mode relocation error"
+        "Unsigned Byte error",
+        "Byte PCR relocation error",
+        "Page0 relocation error",
+        "Page Mode relocation error"
 };
 
 
-/*)Function    VOID    relp()
- *
- *     The function relp() evaluates a P line read by
- *     the linker.  The P line data is combined with the
- *     previous T line data to set the base page address
- *     and test the paging boundary and length.
- *
- *             P Line
- *
- *             P 0 0 nn nn n1 n2 xx xx
- *
- *     The P line provides the paging information to the linker as
- *     specified by a .setdp directive.  The format of the relocation
- *     information is identical to that of the R line.  The correspond-
- *     ing T line has the following information:
- *             T xx xx aa aa bb bb
- *
- *     Where aa aa is the area reference number which specifies the
- *     selected page area and bb bb is the base address of the page.
- *     bb bb will require relocation processing if the 'n1 n2 xx xx' is
- *     specified in the P line.  The linker will verify that the base
- *     address is on a 256 byte boundary and that the page length of an
- *     area defined with the PAG type is not larger than 256 bytes.
- *
- *     local variable:
- *             areax   **a             pointer to array of area pointers
- *             int     aindex          area index
- *             int     mode            relocation mode
- *             Addr_T  relv    relocation value
- *             int     rindex          symbol / area index
- *             int     rtp                     index into T data
- *             sym     **s                     pointer to array of symbol pointers
- *
- *     global variables:
- *             head *hp                pointer to the head structure
- *             int     lkerr           error flag
- *             sdp     sdp                     base page structure
- *             FILE *stderr    standard error device
- *
- *     called functions:
- *             Addr_T adw_w()  lkrloc.c
- *             Addr_T evword() lkrloc.c
- *             int     eval()          lkeval.c
- *             int     fprintf()       c_library
- *             int     more()          lklex.c
- *             int     symval()        lksym.c
- *
- *     side effects:
- *             The P and T lines are combined to set
- *             the base page address and report any
- *             paging errors.
+/*)Function     VOID    relp()
+ *
+ *      The function relp() evaluates a P line read by
+ *      the linker.  The P line data is combined with the
+ *      previous T line data to set the base page address
+ *      and test the paging boundary and length.
+ *
+ *              P Line
+ *
+ *              P 0 0 nn nn n1 n2 xx xx
+ *
+ *      The P line provides the paging information to the linker as
+ *      specified by a .setdp directive.  The format of the relocation
+ *      information is identical to that of the R line.  The correspond-
+ *      ing T line has the following information:
+ *              T xx xx aa aa bb bb
+ *
+ *      Where aa aa is the area reference number which specifies the
+ *      selected page area and bb bb is the base address of the page.
+ *      bb bb will require relocation processing if the 'n1 n2 xx xx' is
+ *      specified in the P line.  The linker will verify that the base
+ *      address is on a 256 byte boundary and that the page length of an
+ *      area defined with the PAG type is not larger than 256 bytes.
+ *
+ *      local variable:
+ *              areax   **a             pointer to array of area pointers
+ *              int     aindex          area index
+ *              int     mode            relocation mode
+ *              Addr_T  relv    relocation value
+ *              int     rindex          symbol / area index
+ *              int     rtp                     index into T data
+ *              sym     **s                     pointer to array of symbol pointers
+ *
+ *      global variables:
+ *              head *hp                pointer to the head structure
+ *              int     lkerr           error flag
+ *              sdp     sdp                     base page structure
+ *              FILE *stderr    standard error device
+ *
+ *      called functions:
+ *              Addr_T adw_w()  lkrloc.c
+ *              Addr_T evword() lkrloc.c
+ *              int     eval()          lkeval.c
+ *              int     fprintf()       c_library
+ *              int     more()          lklex.c
+ *              int     symval()        lksym.c
+ *
+ *      side effects:
+ *              The P and T lines are combined to set
+ *              the base page address and report any
+ *              paging errors.
  *
  */
 
 VOID relp(VOID)
 {
-       register int aindex, rindex;
-       int mode, rtp;
-       Addr_T relv;
-       struct areax **a;
-       struct sym **s;
-
-       /*
-        * Get area and symbol lists
-        */
-       a = hp->a_list;
-       s = hp->s_list;
-
-       /*
-        * Verify Area Mode
-        */
-       if (eval() != (R_WORD | R_AREA) || eval()) {
-               fprintf(stderr, "P input error\n");
-               lkerr++;
-       }
-
-       /*
-        * Get area pointer
-        */
-       aindex = evword();
-       if (aindex >= hp->h_narea) {
-               fprintf(stderr, "P area error\n");
-               lkerr++;
-               return;
-       }
-
-       /*
-        * Do remaining relocations
-        */
-       while (more()) {
-               mode = eval();
-               rtp = eval();
-               rindex = evword();
-
-               /*
-                * R_SYM or R_AREA references
-                */
-               if (mode & R_SYM) {
-                       if (rindex >= hp->h_nglob) {
-                               fprintf(stderr, "P symbol error\n");
-                               lkerr++;
-                               return;
-                       }
-                       relv = symval(s[rindex]);
-               } else {
-                       if (rindex >= hp->h_narea) {
-                               fprintf(stderr, "P area error\n");
-                               lkerr++;
-                               return;
-                       }
-                       relv = a[rindex]->a_addr;
-               }
-               adw_w(relv, rtp);
-       }
-
-       /*
-        * Paged values
-        */
-       aindex = adw_w(0,2);
-       if (aindex >= hp->h_narea) {
-               fprintf(stderr, "P area error\n");
-               lkerr++;
-               return;
-       }
-       sdp.s_areax = a[aindex];
-       sdp.s_area = sdp.s_areax->a_bap;
-       sdp.s_addr = adw_w(0,4);
-       if (sdp.s_area->a_addr & 0xFF || sdp.s_addr & 0xFF)
-               relerp("Page Definition Boundary Error");
+        register int aindex, rindex;
+        int mode, rtp;
+        Addr_T relv;
+        struct areax **a;
+        struct sym **s;
+
+        /*
+         * Get area and symbol lists
+         */
+        a = hp->a_list;
+        s = hp->s_list;
+
+        /*
+         * Verify Area Mode
+         */
+        if (eval() != (R_WORD | R_AREA) || eval()) {
+                fprintf(stderr, "P input error\n");
+                lkerr++;
+        }
+
+        /*
+         * Get area pointer
+         */
+        aindex = evword();
+        if (aindex >= hp->h_narea) {
+                fprintf(stderr, "P area error\n");
+                lkerr++;
+                return;
+        }
+
+        /*
+         * Do remaining relocations
+         */
+        while (more()) {
+                mode = eval();
+                rtp = eval();
+                rindex = evword();
+
+                /*
+                 * R_SYM or R_AREA references
+                 */
+                if (mode & R_SYM) {
+                        if (rindex >= hp->h_nglob) {
+                                fprintf(stderr, "P symbol error\n");
+                                lkerr++;
+                                return;
+                        }
+                        relv = symval(s[rindex]);
+                } else {
+                        if (rindex >= hp->h_narea) {
+                                fprintf(stderr, "P area error\n");
+                                lkerr++;
+                                return;
+                        }
+                        relv = a[rindex]->a_addr;
+                }
+                adw_w(relv, rtp);
+        }
+
+        /*
+         * Paged values
+         */
+        aindex = adw_w(0,2);
+        if (aindex >= hp->h_narea) {
+                fprintf(stderr, "P area error\n");
+                lkerr++;
+                return;
+        }
+        sdp.s_areax = a[aindex];
+        sdp.s_area = sdp.s_areax->a_bap;
+        sdp.s_addr = adw_w(0,4);
+        if (sdp.s_area->a_addr & 0xFF || sdp.s_addr & 0xFF)
+                relerp("Page Definition Boundary Error");
 }
 
-/*)Function    VOID    rele()
+/*)Function     VOID    rele()
  *
- *     The function rele() closes all open output files
- *     at the end of the linking process.
+ *      The function rele() closes all open output files
+ *      at the end of the linking process.
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             int     oflag           output type flag
- *             int     uflag           relocation listing flag
+ *      global variables:
+ *              int     oflag           output type flag
+ *              int     uflag           relocation listing flag
  *
- *     called functions:
- *             VOID    elf()           lkelf.c
- *             VOID    ihx()           lkihx.c
- *             VOID    lkulist()       lklist.c
- *             VOID    s19()           lks19.c
+ *      called functions:
+ *              VOID    elf()           lkelf.c
+ *              VOID    ihx()           lkihx.c
+ *              VOID    lkulist()       lklist.c
+ *              VOID    s19()           lks19.c
  *
- *     side effects:
- *             All open output files are closed.
+ *      side effects:
+ *              All open output files are closed.
  *
  */
 
 VOID rele(VOID)
 {
-       if (uflag != 0) {
-               lkulist(0);
-       }
-       if (oflag == 1) {
-               ihx(0);
-       } else
-       if (oflag == 2) {
-               s19(0);
-       } else
-       if (oflag == 3) {
-               elf(0);
-       }
+        if (uflag != 0) {
+                lkulist(0);
+        }
+        if (oflag == 1) {
+                ihx(0);
+        } else
+        if (oflag == 2) {
+                s19(0);
+        } else
+        if (oflag == 3) {
+                elf(0);
+        }
 }
 
-/*)Function    Addr_T          evword()
+/*)Function     Addr_T          evword()
  *
- *     The function evword() combines two byte values
- *     into a single word value.
+ *      The function evword() combines two byte values
+ *      into a single word value.
  *
- *     local variable:
- *             Addr_T  v               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  v               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             int     eval()          lkeval.c
+ *      called functions:
+ *              int     eval()          lkeval.c
  *
- *     side effects:
- *             Relocation text line is scanned to combine
- *             two byte values into a single word value.
+ *      side effects:
+ *              Relocation text line is scanned to combine
+ *              two byte values into a single word value.
  *
  */
 
 Addr_T evword(VOID)
 {
-       register Addr_T v;
-
-       if (hilo) {
-               v =  (eval() << 8);
-               v +=  eval();
-       } else {
-               v =   eval();
-               v += (eval() << 8);
-       }
-       return(v);
+        register Addr_T v;
+
+        if (hilo) {
+                v =  (eval() << 8);
+                v +=  eval();
+        } else {
+                v =   eval();
+                v += (eval() << 8);
+        }
+        return(v);
 }
 
-/*)Function    Addr_T          adb_b(v, i)
+/*)Function     Addr_T          adb_b(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adb_b() adds the value of v to
- *     the single byte value contained in rtval[i].
- *     The new value of rtval[i] is returned.
+ *      The function adb_b() adds the value of v to
+ *      the single byte value contained in rtval[i].
+ *      The new value of rtval[i] is returned.
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
+ *      side effects:
+ *              The value of rtval[] is changed.
  *
  */
 
 Addr_T adb_b(register Addr_T v, register int i)
 {
-       return(rtval[i] += v);
+        return(rtval[i] += v);
 }
 
-/*)Function    Addr_T          adb_lo(v, i)
+/*)Function     Addr_T          adb_lo(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adb_lo() adds the value of v to the
- *     double byte value contained in rtval[i] and rtval[i+1].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The MSB rtflg[] is cleared.
+ *      The function adb_lo() adds the value of v to the
+ *      double byte value contained in rtval[i] and rtval[i+1].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The MSB rtflg[] is cleared.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The rtflg[] value corresponding to the
- *             MSB of the word value is cleared to reflect
- *             the fact that the LSB is the selected byte.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The rtflg[] value corresponding to the
+ *              MSB of the word value is cleared to reflect
+ *              the fact that the LSB is the selected byte.
  *
  */
 
 Addr_T adb_lo(Addr_T  v, int i)
 {
-       register Addr_T j;
-
-       j = adw_w(v, i);
-       /*
-        * Remove Hi byte
-        */
-       if (hilo) {
-               rtflg[i] = 0;
-       } else {
-               rtflg[i+1] = 0;
-       }
-       return (j);
+        register Addr_T j;
+
+        j = adw_w(v, i);
+        /*
+         * Remove Hi byte
+         */
+        if (hilo) {
+                rtflg[i] = 0;
+        } else {
+                rtflg[i+1] = 0;
+        }
+        return (j);
 }
 
-/*)Function    Addr_T          adb_hi(v, i)
+/*)Function     Addr_T          adb_hi(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adb_hi() adds the value of v to the
- *     double byte value contained in rtval[i] and rtval[i+1].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The LSB rtflg[] is cleared.
+ *      The function adb_hi() adds the value of v to the
+ *      double byte value contained in rtval[i] and rtval[i+1].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The LSB rtflg[] is cleared.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The rtflg[] value corresponding to the
- *             LSB of the word value is cleared to reflect
- *             the fact that the MSB is the selected byte.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The rtflg[] value corresponding to the
+ *              LSB of the word value is cleared to reflect
+ *              the fact that the MSB is the selected byte.
  *
  */
 
 Addr_T adb_hi(Addr_T  v, int i)
 {
-       register Addr_T j;
-
-       j = adw_w(v, i);
-       /*
-        * Remove Lo byte
-        */
-       if (hilo) {
-               rtflg[i+1] = 0;
-       } else {
-               rtflg[i] = 0;
-       }
-       return (j);
+        register Addr_T j;
+
+        j = adw_w(v, i);
+        /*
+         * Remove Lo byte
+         */
+        if (hilo) {
+                rtflg[i+1] = 0;
+        } else {
+                rtflg[i] = 0;
+        }
+        return (j);
 }
 
-/*)Function    Addr_T          adb_24_hi(v, i)
+/*)Function     Addr_T          adb_24_hi(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adb_24_hi() adds the value of v to the
- *     24 bit value contained in rtval[i] - rtval[i+2].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The LSB & middle byte rtflg[] is cleared.
+ *      The function adb_24_hi() adds the value of v to the
+ *      24 bit value contained in rtval[i] - rtval[i+2].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The LSB & middle byte rtflg[] is cleared.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The rtflg[] value corresponding to the
- *             LSB & middle byte of the word value is cleared to
- *             reflect the fact that the MSB is the selected byte.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The rtflg[] value corresponding to the
+ *              LSB & middle byte of the word value is cleared to
+ *              reflect the fact that the MSB is the selected byte.
  *
  */
 
 Addr_T adb_24_hi(Addr_T v, int i)
 {
-       register Addr_T j;
-
-       j = adw_24(v, i);
-
-       /* Remove the lower two bytes. */
-       if (hilo)
-       {
-           rtflg[i+2] = 0;
-       }
-       else
-       {
-           rtflg[i] = 0;
-       }
-       rtflg[i+1] = 0;
-
-       return (j);
+        register Addr_T j;
+
+        j = adw_24(v, i);
+
+        /* Remove the lower two bytes. */
+        if (hilo)
+        {
+            rtflg[i+2] = 0;
+        }
+        else
+        {
+            rtflg[i] = 0;
+        }
+        rtflg[i+1] = 0;
+
+        return (j);
 }
 
-/*)Function    Addr_T          adb_24_mid(v, i)
+/*)Function     Addr_T          adb_24_mid(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adb_24_mid() adds the value of v to the
- *     24 bit value contained in rtval[i] - rtval[i+2].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The LSB & MSB byte rtflg[] is cleared.
+ *      The function adb_24_mid() adds the value of v to the
+ *      24 bit value contained in rtval[i] - rtval[i+2].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The LSB & MSB byte rtflg[] is cleared.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The rtflg[] value corresponding to the
- *             LSB & MSB of the 24 bit value is cleared to reflect
- *             the fact that the middle byte is the selected byte.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The rtflg[] value corresponding to the
+ *              LSB & MSB of the 24 bit value is cleared to reflect
+ *              the fact that the middle byte is the selected byte.
  *
  */
 
 Addr_T adb_24_mid(Addr_T v, int i)
 {
-       register Addr_T j;
+        register Addr_T j;
 
-       j = adw_24(v, i);
+        j = adw_24(v, i);
 
-       /* remove the MSB & LSB. */
-       rtflg[i+2] = 0;
-       rtflg[i] = 0;
+        /* remove the MSB & LSB. */
+        rtflg[i+2] = 0;
+        rtflg[i] = 0;
 
-       return (j);
+        return (j);
 }
 
-/*)Function    Addr_T          adb_24_lo(v, i)
+/*)Function     Addr_T          adb_24_lo(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adb_24_lo() adds the value of v to the
- *     24 bit value contained in rtval[i] - rtval[i+2].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The MSB & middle byte rtflg[] is cleared.
+ *      The function adb_24_lo() adds the value of v to the
+ *      24 bit value contained in rtval[i] - rtval[i+2].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The MSB & middle byte rtflg[] is cleared.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The rtflg[] value corresponding to the
- *             MSB & middle byte  of the word value is cleared to
- *             reflect the fact that the LSB is the selected byte.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The rtflg[] value corresponding to the
+ *              MSB & middle byte  of the word value is cleared to
+ *              reflect the fact that the LSB is the selected byte.
  *
  */
 
 Addr_T adb_24_lo(Addr_T v, int i)
 {
-       register Addr_T j;
-
-       j = adw_24(v, i);
-
-       /* Remove the upper two bytes. */
-       if (hilo)
-       {
-           rtflg[i] = 0;
-       }
-       else
-       {
-           rtflg[i+2] = 0;
-       }
-       rtflg[i+1] = 0;
-
-       return (j);
+        register Addr_T j;
+
+        j = adw_24(v, i);
+
+        /* Remove the upper two bytes. */
+        if (hilo)
+        {
+            rtflg[i] = 0;
+        }
+        else
+        {
+            rtflg[i+2] = 0;
+        }
+        rtflg[i+1] = 0;
+
+        return (j);
 }
 
-/*)Function    Addr_T          adw_w(v, i)
+/*)Function     Addr_T          adw_w(v, i)
  *
- *             int     v               value to add to word
- *             int     i               rtval[] index
+ *              int     v               value to add to word
+ *              int     i               rtval[] index
  *
- *     The function adw_w() adds the value of v to the
- *     word value contained in rtval[i] and rtval[i+1].
- *     The new value of rtval[i] / rtval[i+1] is returned.
+ *      The function adw_w() adds the value of v to the
+ *      word value contained in rtval[i] and rtval[i+1].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The word value of rtval[] is changed.
+ *      side effects:
+ *              The word value of rtval[] is changed.
  *
  */
 
 Addr_T adw_w(register Addr_T v, register int i)
 {
-       register Addr_T j;
-
-       if (hilo) {
-               j = v + (rtval[i] << 8) + (rtval[i+1] & 0xff);
-               rtval[i] = (j >> 8) & 0xff;
-               rtval[i+1] = j & 0xff;
-       } else {
-               j = v + (rtval[i] & 0xff) + (rtval[i+1] << 8);
-               rtval[i] = j & 0xff;
-               rtval[i+1] = (j >> 8) & 0xff;
-       }
-       return(j);
+        register Addr_T j;
+
+        if (hilo) {
+                j = v + (rtval[i] << 8) + (rtval[i+1] & 0xff);
+                rtval[i] = (j >> 8) & 0xff;
+                rtval[i+1] = j & 0xff;
+        } else {
+                j = v + (rtval[i] & 0xff) + (rtval[i+1] << 8);
+                rtval[i] = j & 0xff;
+                rtval[i+1] = (j >> 8) & 0xff;
+        }
+        return(j);
 }
 
-/*)Function    Addr_T          adw_24(v, i)
+/*)Function     Addr_T          adw_24(v, i)
  *
- *             int     v               value to add to word
- *             int     i               rtval[] index
+ *              int     v               value to add to word
+ *              int     i               rtval[] index
  *
- *     The function adw_w() adds the value of v to the
- *     24 bit value contained in rtval[i] - rtval[i+2].
- *     The new value of rtval[i] - rtval[i+2] is returned.
+ *      The function adw_w() adds the value of v to the
+ *      24 bit value contained in rtval[i] - rtval[i+2].
+ *      The new value of rtval[i] - rtval[i+2] is returned.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The word value of rtval[] is changed.
+ *      side effects:
+ *              The word value of rtval[] is changed.
  *
  */
 Addr_T adw_24(Addr_T v, int i)
 {
-       register Addr_T j;
-
-       if (hilo) {
-               j = v + ((rtval[i] & 0xff) << 16) 
-                     + ((rtval[i+1] & 0xff) << 8)
-                     + (rtval[i+2] & 0xff);
-               rtval[i] = (j >> 16) & 0xff;
-               rtval[i+1] = (j >> 8) & 0xff;
-               rtval[i+2] = j & 0xff;
-       } else {
-               j = v + (rtval[i] & 0xff) 
-                     + ((rtval[i+1] & 0xff) << 8)
-                     + ((rtval[i+2] & 0xff) << 16);
-               rtval[i] = j & 0xff;
-               rtval[i+1] = (j >> 8) & 0xff;
-               rtval[i+2] = (j >> 16) & 0xff;
-       }
-       return(j);
+        register Addr_T j;
+
+        if (hilo) {
+                j = v + ((rtval[i] & 0xff) << 16)
+                      + ((rtval[i+1] & 0xff) << 8)
+                      + (rtval[i+2] & 0xff);
+                rtval[i] = (j >> 16) & 0xff;
+                rtval[i+1] = (j >> 8) & 0xff;
+                rtval[i+2] = j & 0xff;
+        } else {
+                j = v + (rtval[i] & 0xff)
+                      + ((rtval[i+1] & 0xff) << 8)
+                      + ((rtval[i+2] & 0xff) << 16);
+                rtval[i] = j & 0xff;
+                rtval[i+1] = (j >> 8) & 0xff;
+                rtval[i+2] = (j >> 16) & 0xff;
+        }
+        return(j);
 }
 
-/*)Function    Addr_T          adw_lo(v, i)
+/*)Function     Addr_T          adw_lo(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adw_lo() adds the value of v to the
- *     double byte value contained in rtval[i] and rtval[i+1].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The MSB rtval[] is zeroed.
+ *      The function adw_lo() adds the value of v to the
+ *      double byte value contained in rtval[i] and rtval[i+1].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The MSB rtval[] is zeroed.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The MSB of the word value is cleared to reflect
- *             the fact that the LSB is the selected byte.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The MSB of the word value is cleared to reflect
+ *              the fact that the LSB is the selected byte.
  *
  */
 
 Addr_T adw_lo(Addr_T  v, int i)
 {
-       register Addr_T j;
-
-       j = adw_w(v, i);
-       /*
-        * Clear Hi byte
-        */
-       if (hilo) {
-               rtval[i] = 0;
-       } else {
-               rtval[i+1] = 0;
-       }
-       return (j);
+        register Addr_T j;
+
+        j = adw_w(v, i);
+        /*
+         * Clear Hi byte
+         */
+        if (hilo) {
+                rtval[i] = 0;
+        } else {
+                rtval[i+1] = 0;
+        }
+        return (j);
 }
 
-/*)Function    Addr_T          adw_hi(v, i)
+/*)Function     Addr_T          adw_hi(v, i)
  *
- *             int     v               value to add to byte
- *             int     i               rtval[] index
+ *              int     v               value to add to byte
+ *              int     i               rtval[] index
  *
- *     The function adw_hi() adds the value of v to the
- *     double byte value contained in rtval[i] and rtval[i+1].
- *     The new value of rtval[i] / rtval[i+1] is returned.
- *     The MSB and LSB values are interchanged.
- *     The MSB rtval[] is zeroed.
+ *      The function adw_hi() adds the value of v to the
+ *      double byte value contained in rtval[i] and rtval[i+1].
+ *      The new value of rtval[i] / rtval[i+1] is returned.
+ *      The MSB and LSB values are interchanged.
+ *      The MSB rtval[] is zeroed.
  *
- *     local variable:
- *             Addr_T  j               temporary evaluation variable
+ *      local variable:
+ *              Addr_T  j               temporary evaluation variable
  *
- *     global variables:
- *             hilo                    byte ordering parameter
+ *      global variables:
+ *              hilo                    byte ordering parameter
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             The value of rtval[] is changed.
- *             The MSB and LSB values are interchanged and
- *             then the MSB cleared.
+ *      side effects:
+ *              The value of rtval[] is changed.
+ *              The MSB and LSB values are interchanged and
+ *              then the MSB cleared.
  *
  */
 
 Addr_T adw_hi(Addr_T  v, int i)
 {
-       register Addr_T j;
-
-       j = adw_w(v, i);
-       /*
-        * LSB = MSB, Clear MSB
-        */
-       if (hilo) {
-               rtval[i+1] = rtval[i];
-               rtval[i] = 0;
-       } else {
-               rtval[i] = rtval[i+1];
-               rtval[i+1] = 0;
-       }
-       return (j);
+        register Addr_T j;
+
+        j = adw_w(v, i);
+        /*
+         * LSB = MSB, Clear MSB
+         */
+        if (hilo) {
+                rtval[i+1] = rtval[i];
+                rtval[i] = 0;
+        } else {
+                rtval[i] = rtval[i+1];
+                rtval[i+1] = 0;
+        }
+        return (j);
 }
 
-/*)Function    VOID    relerr(str)
+/*)Function     VOID    relerr(str)
  *
- *             char    *str            error string
+ *              char    *str            error string
  *
- *     The function relerr() outputs the error string to
- *     stderr and to the map file (if it is open).
+ *      The function relerr() outputs the error string to
+ *      stderr and to the map file (if it is open).
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             FILE    *mfp            handle for the map file
+ *      global variables:
+ *              FILE    *mfp            handle for the map file
  *
- *     called functions:
- *             VOID    errdmp()        lkrloc.c
+ *      called functions:
+ *              VOID    errdmp()        lkrloc.c
  *
- *     side effects:
- *             Error message inserted into map file.
+ *      side effects:
+ *              Error message inserted into map file.
  *
  */
 
 VOID relerr(char *str)
 {
-       errdmp(stderr, str);
-       if (mfp)
-               errdmp(mfp, str);
+        errdmp(stderr, str);
+        if (mfp)
+                errdmp(mfp, str);
 }
 
-/*)Function    VOID    errdmp(fptr, str)
+/*)Function     VOID    errdmp(fptr, str)
  *
- *             FILE    *fptr           output file handle
- *             char    *str            error string
+ *              FILE    *fptr           output file handle
+ *              char    *str            error string
  *
- *     The function errdmp() outputs the error string str
- *     to the device specified by fptr.  Additional information
- *     is output about the definition and referencing of
- *     the symbol / area error.
+ *      The function errdmp() outputs the error string str
+ *      to the device specified by fptr.  Additional information
+ *      is output about the definition and referencing of
+ *      the symbol / area error.
  *
- *     local variable:
- *             int     mode            error mode
- *             int     aindex          area index
- *             int     lkerr           error flag
- *             int     rindex          error index
- *             sym     **s             pointer to array of symbol pointers
- *             areax   **a             pointer to array of area pointers
- *             areax   *raxp           error area extension pointer
+ *      local variable:
+ *              int     mode            error mode
+ *              int     aindex          area index
+ *              int     lkerr           error flag
+ *              int     rindex          error index
+ *              sym     **s             pointer to array of symbol pointers
+ *              areax   **a             pointer to array of area pointers
+ *              areax   *raxp           error area extension pointer
  *
- *     global variables:
- *             sdp     sdp             base page structure
+ *      global variables:
+ *              sdp     sdp             base page structure
  *
- *     called functions:
- *             int     fprintf()       c_library
- *             VOID    prntval()       lkrloc.c
+ *      called functions:
+ *              int     fprintf()       c_library
+ *              VOID    prntval()       lkrloc.c
  *
- *     side effects:
- *             Error reported.
+ *      side effects:
+ *              Error reported.
  *
  */
 
 VOID errdmp(FILE *fptr, char *str)
 {
-       int mode, aindex, rindex;
-       struct sym **s;
-       struct areax **a;
-       struct areax *raxp;
-
-       a = hp->a_list;
-       s = hp->s_list;
-
-       mode = rerr.mode;
-       aindex = rerr.aindex;
-       rindex = rerr.rindex;
-
-       /*
-        * Print Error
-        */
-       fprintf(fptr, "\n?ASlink-Warning-%s", str);
-       lkerr++;
-
-       /*
-        * Print symbol if symbol based
-        */
-       if (mode & R_SYM) {
-               fprintf(fptr, " for symbol %s\n",
-                       &s[rindex]->s_id[0]);
-       } else {
-               fprintf(fptr, "\n");
-       }
-
-       /*
-        * Print Ref Info
-        */
-       fprintf(fptr,
-               "         file        module      area        offset\n");
-       fprintf(fptr,
-               "  Refby  %-8.8s    %-8.8s    %-8.8s    ",
-                       hp->h_lfile->f_idp,
-                       &hp->m_id[0],
-                       &a[aindex]->a_bap->a_id[0]);
-       prntval(fptr, rerr.rtbase);
-
-       /*
-        * Print Def Info
-        */
-       if (mode & R_SYM) {
-               raxp = s[rindex]->s_axp;
-       } else {
-               raxp = a[rindex];
-       }
-       fprintf(fptr,
-               "  Defin  %-8.8s    %-8.8s    %-8.8s    ",
-                       raxp->a_bhp->h_lfile->f_idp,
-                       &raxp->a_bhp->m_id[0],
-                       &raxp->a_bap->a_id[0]);
-       if (mode & R_SYM) {
-               prntval(fptr, s[rindex]->s_addr);
-       } else {
-               prntval(fptr, rerr.rval);
-       }
+        int mode, aindex, rindex;
+        struct sym **s;
+        struct areax **a;
+        struct areax *raxp;
+
+        a = hp->a_list;
+        s = hp->s_list;
+
+        mode = rerr.mode;
+        aindex = rerr.aindex;
+        rindex = rerr.rindex;
+
+        /*
+         * Print Error
+         */
+        fprintf(fptr, "\n?ASlink-Warning-%s", str);
+        lkerr++;
+
+        /*
+         * Print symbol if symbol based
+         */
+        if (mode & R_SYM) {
+                fprintf(fptr, " for symbol %s\n",
+                        &s[rindex]->s_id[0]);
+        } else {
+                fprintf(fptr, "\n");
+        }
+
+        /*
+         * Print Ref Info
+         */
+        fprintf(fptr,
+                "         file        module      area        offset\n");
+        fprintf(fptr,
+                "  Refby  %-8.8s    %-8.8s    %-8.8s    ",
+                        hp->h_lfile->f_idp,
+                        &hp->m_id[0],
+                        &a[aindex]->a_bap->a_id[0]);
+        prntval(fptr, rerr.rtbase);
+
+        /*
+         * Print Def Info
+         */
+        if (mode & R_SYM) {
+                raxp = s[rindex]->s_axp;
+        } else {
+                raxp = a[rindex];
+        }
+        fprintf(fptr,
+                "  Defin  %-8.8s    %-8.8s    %-8.8s    ",
+                        raxp->a_bhp->h_lfile->f_idp,
+                        &raxp->a_bhp->m_id[0],
+                        &raxp->a_bap->a_id[0]);
+        if (mode & R_SYM) {
+                prntval(fptr, s[rindex]->s_addr);
+        } else {
+                prntval(fptr, rerr.rval);
+        }
 }
 
-/*)Function    VOID prntval(fptr, v)
+/*)Function     VOID prntval(fptr, v)
  *
- *             FILE    *fptr   output file handle
- *             Addr_T  v               value to output
+ *              FILE    *fptr   output file handle
+ *              Addr_T  v               value to output
  *
- *     The function prntval() outputs the value v, in the
- *     currently selected radix, to the device specified
- *     by fptr.
+ *      The function prntval() outputs the value v, in the
+ *      currently selected radix, to the device specified
+ *      by fptr.
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             int     xflag           current radix
+ *      global variables:
+ *              int     xflag           current radix
  *
- *     called functions:
- *             int     fprintf()       c_library
+ *      called functions:
+ *              int     fprintf()       c_library
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  *
  */
 
 VOID prntval(FILE *fptr, Addr_T v)
 {
-       if (xflag == 0) {
-               fprintf(fptr, "%04X\n", v);
-       } else
-       if (xflag == 1) {
-               fprintf(fptr, "%06o\n", v);
-       } else
-       if (xflag == 2) {
-               fprintf(fptr, "%05u\n", v);
-       }
+        if (xflag == 0) {
+                fprintf(fptr, "%04X\n", v);
+        } else
+        if (xflag == 1) {
+                fprintf(fptr, "%06o\n", v);
+        } else
+        if (xflag == 2) {
+                fprintf(fptr, "%05u\n", v);
+        }
 }
 
-/*)Function    VOID    relerp(str)
+/*)Function     VOID    relerp(str)
  *
- *             char    *str            error string
+ *              char    *str            error string
  *
- *     The function relerp() outputs the paging error string to
- *     stderr and to the map file (if it is open).
+ *      The function relerp() outputs the paging error string to
+ *      stderr and to the map file (if it is open).
  *
- *     local variable:
- *             none
+ *      local variable:
+ *              none
  *
- *     global variables:
- *             FILE    *mfp            handle for the map file
+ *      global variables:
+ *              FILE    *mfp            handle for the map file
  *
- *     called functions:
- *             VOID    erpdmp()        lkrloc.c
+ *      called functions:
+ *              VOID    erpdmp()        lkrloc.c
  *
- *     side effects:
- *             Error message inserted into map file.
+ *      side effects:
+ *              Error message inserted into map file.
  *
  */
 
 VOID relerp(char *str)
 {
-       erpdmp(stderr, str);
-       if (mfp)
-               erpdmp(mfp, str);
+        erpdmp(stderr, str);
+        if (mfp)
+                erpdmp(mfp, str);
 }
 
-/*)Function    VOID    erpdmp(fptr, str)
+/*)Function     VOID    erpdmp(fptr, str)
  *
- *             FILE    *fptr           output file handle
- *             char    *str            error string
+ *              FILE    *fptr           output file handle
+ *              char    *str            error string
  *
- *     The function erpdmp() outputs the error string str
- *     to the device specified by fptr.
+ *      The function erpdmp() outputs the error string str
+ *      to the device specified by fptr.
  *
- *     local variable:
- *             head    *thp            pointer to head structure
+ *      local variable:
+ *              head    *thp            pointer to head structure
  *
- *     global variables:
- *             int             lkerr           error flag
- *             sdp             sdp                     base page structure
+ *      global variables:
+ *              int             lkerr           error flag
+ *              sdp             sdp                     base page structure
  *
- *     called functions:
- *             int     fprintf()               c_library
- *             VOID    prntval()       lkrloc.c
+ *      called functions:
+ *              int     fprintf()               c_library
+ *              VOID    prntval()       lkrloc.c
  *
- *     side effects:
- *             Error reported.
+ *      side effects:
+ *              Error reported.
  *
  */
 
 VOID erpdmp(FILE *fptr, char *str)
 {
-       register struct head *thp;
-
-       thp = sdp.s_areax->a_bhp;
-
-       /*
-        * Print Error
-        */
-       fprintf(fptr, "\n?ASlink-Warning-%s\n", str);
-       lkerr++;
-
-       /*
-        * Print PgDef Info
-        */
-       fprintf(fptr,
-               "         file        module      pgarea      pgoffset\n");
-       fprintf(fptr,
-               "  PgDef  %-8.8s    %-8.8s    %-8.8s    ",
-                       thp->h_lfile->f_idp,
-                       &thp->m_id[0],
-                       &sdp.s_area->a_id[0]);
-       prntval(fptr, sdp.s_area->a_addr + sdp.s_addr);
+        register struct head *thp;
+
+        thp = sdp.s_areax->a_bhp;
+
+        /*
+         * Print Error
+         */
+        fprintf(fptr, "\n?ASlink-Warning-%s\n", str);
+        lkerr++;
+
+        /*
+         * Print PgDef Info
+         */
+        fprintf(fptr,
+                "         file        module      pgarea      pgoffset\n");
+        fprintf(fptr,
+                "  PgDef  %-8.8s    %-8.8s    %-8.8s    ",
+                        thp->h_lfile->f_idp,
+                        &thp->m_id[0],
+                        &sdp.s_area->a_id[0]);
+        prntval(fptr, sdp.s_area->a_addr + sdp.s_addr);
 }
index d50a41ea3472e6d5ff506b813d0908b691e4b7b3..891839617bd948e7c608a97a81cb9eebff7e6d78 100644 (file)
-/* 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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #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 (ap->a_flag & A_NOLOAD)
-                       return;
-               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 (ap->a_flag & A_NOLOAD)
+                        return;
+                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");
+        }
 }
index 80284782c1044765bb1c6f4e02ad5d4ae66735ef..3213bce0b04bdf30355565065a1a30c246be81ec 100644 (file)
@@ -1,22 +1,19 @@
-/*-------------------------------------------------------------------------
-  lkaomf51.c - Create an absolute object memory format 51 file
+/* lkaomf51.c - Create an absolute object memory format 51 file
 
-   Written By -  Jesus Calvino-Fraga, jesusc@ieee.org (2002)
+   Copyright (C) 2002 Jesus Calvino-Fraga, jesusc at ieee dot org
 
-   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 2, or (at your option) any
-   later version.
+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.
+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, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------*/
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <ctype.h>
 #include <stdio.h>
@@ -30,8 +27,8 @@
 
 typedef struct
 {
-       char PathName[PATH_MAX];
-       char ModuleName[PATH_MAX];
+        char PathName[PATH_MAX];
+        char ModuleName[PATH_MAX];
 } _infn;
 
 int numin=0;
@@ -77,36 +74,36 @@ _linenum * linenum=NULL;
 #if 0
 typedef struct
 {
-       char * name;
-       int usage;
+        char * name;
+        int usage;
 }
 _UsageType;
 
 _UsageType UsageType[]=
 {
-       {"CSEG",                0},
-       {"GSINIT",              0},
-       {"GSINIT0",             0},
-       {"GSINIT1",             0},
-       {"GSINIT2",             0},
-       {"GSINIT3",             0},
-       {"GSINIT4",             0},
-       {"GSINIT5",             0},
-       {"GSFINAL",             0},
-       {"HOME",                0},
-       {"XINIT",               0},
-       {"XSEG",                1},
-       {"XISEG",               1},
-       {"REG_BANK_0",  2},
-       {"REG_BANK_1",  2},
-       {"REG_BANK_2",  2},
-       {"REG_BANK_3",  2},
-       {"DSEG",                2},
-       {"OSEG",                2},
-       {"SSEG",                2},
-       {"ISEG",                3},
-       {"BSEG",                4},
-       {"",                    5} /*A typeless number?*/
+        {"CSEG",                0},
+        {"GSINIT",              0},
+        {"GSINIT0",             0},
+        {"GSINIT1",             0},
+        {"GSINIT2",             0},
+        {"GSINIT3",             0},
+        {"GSINIT4",             0},
+        {"GSINIT5",             0},
+        {"GSFINAL",             0},
+        {"HOME",                0},
+        {"XINIT",               0},
+        {"XSEG",                1},
+        {"XISEG",               1},
+        {"REG_BANK_0",  2},
+        {"REG_BANK_1",  2},
+        {"REG_BANK_2",  2},
+        {"REG_BANK_3",  2},
+        {"DSEG",                2},
+        {"OSEG",                2},
+        {"SSEG",                2},
+        {"ISEG",                3},
+        {"BSEG",                4},
+        {"",                    5} /*A typeless number?*/
 };
 #endif
 char * UsageTypeName[]={"CODE", "XDATA", "DATA", "IDATA", "BIT", "NUMBER"};
@@ -119,762 +116,762 @@ int HexSize, HexBegin=0x10000;
 
 void GetName(char * filepath, char * name)
 {
-       int j, k;
-       for(j=strlen(filepath); j>0; j--)
-               if( (filepath[j-1]=='/')||(filepath[j-1]=='\\') ) break;
-       for(k=0; (filepath[j]!=0)&&(filepath[j]!='.'); j++, k++)
-               name[k]=filepath[j];
-       name[k]=0;
+        int j, k;
+        for(j=strlen(filepath); j>0; j--)
+                if( (filepath[j-1]=='/')||(filepath[j-1]=='\\') ) break;
+        for(k=0; (filepath[j]!=0)&&(filepath[j]!='.'); j++, k++)
+                name[k]=filepath[j];
+        name[k]=0;
 }
 
-void SaveLinkedFilePath(char * filepath) 
+void SaveLinkedFilePath(char * filepath)
 {
-       int j;
-
-       if((dflag) && (!rflag))
-       {
-               infn=realloc(infn, sizeof(_infn)*(numin+1));
-
-               strcpy(infn[numin].PathName, filepath);
-               j=strlen(infn[numin].PathName);
-               
-               /*If there is an extension remove it*/
-               if(j>=4)
-               {
-                       if(EQ(&infn[numin].PathName[j-4], ".rel"))
-                       {
-                               infn[numin].PathName[j-4]=0;
-                       }
-               }
-
-               /*Get the module name=filename, no drive, no dir, no ext*/
-               GetName(infn[numin].PathName, infn[numin].ModuleName);
-               //printf("%s, %s\n", infn[numin].PathName, infn[numin].ModuleName);
-               
-               /*Check if this filename is already in*/
-               for(j=0; j<numin; j++)
-               {
-                       if(EQ(infn[numin].PathName, infn[j].PathName)) break;
-               }
-               if(j==numin) numin++;
-       }
+        int j;
+
+        if((dflag) && (!rflag))
+        {
+                infn=realloc(infn, sizeof(_infn)*(numin+1));
+
+                strcpy(infn[numin].PathName, filepath);
+                j=strlen(infn[numin].PathName);
+
+                /*If there is an extension remove it*/
+                if(j>=4)
+                {
+                        if(EQ(&infn[numin].PathName[j-4], ".rel"))
+                        {
+                                infn[numin].PathName[j-4]=0;
+                        }
+                }
+
+                /*Get the module name=filename, no drive, no dir, no ext*/
+                GetName(infn[numin].PathName, infn[numin].ModuleName);
+                //printf("%s, %s\n", infn[numin].PathName, infn[numin].ModuleName);
+
+                /*Check if this filename is already in*/
+                for(j=0; j<numin; j++)
+                {
+                        if(EQ(infn[numin].PathName, infn[j].PathName)) break;
+                }
+                if(j==numin) numin++;
+        }
 }
 
 void FreeAll(void)
 {
-       if(infn!=NULL)
-       {
-               free(infn);
-               numin=0;
-               infn=NULL;
-       }
-
-       if(symbol!=NULL)
-       {
-               free(symbol);
-               numsym=0;
-               symbol=NULL;
-       }
-
-       if(procedure!=NULL)
-       {
-               free(procedure);
-               numproc=0;
-               procedure=NULL;
-
-       }
-       if(linenum!=NULL)
-       {
-               free(linenum);
-               numlinenum=0;
-               linenum=NULL;
-       }
-
-       if(ihxBuff!=NULL)
-       {
-               free(ihxBuff);
-               ihxBuff=NULL;
-       }
+        if(infn!=NULL)
+        {
+                free(infn);
+                numin=0;
+                infn=NULL;
+        }
+
+        if(symbol!=NULL)
+        {
+                free(symbol);
+                numsym=0;
+                symbol=NULL;
+        }
+
+        if(procedure!=NULL)
+        {
+                free(procedure);
+                numproc=0;
+                procedure=NULL;
+
+        }
+        if(linenum!=NULL)
+        {
+                free(linenum);
+                numlinenum=0;
+                linenum=NULL;
+        }
+
+        if(ihxBuff!=NULL)
+        {
+                free(ihxBuff);
+                ihxBuff=NULL;
+        }
 }
 
 void OutputByte(unsigned char value)
 {
-       GlobalChkSum+=value;
-       fwrite( &value, 1, 1, aomf51out );
+        GlobalChkSum+=value;
+        fwrite( &value, 1, 1, aomf51out );
 }
 
 void OutputWord(int value)
 {
-       OutputByte((unsigned char)(value%0x100));
-       OutputByte((unsigned char)(value/0x100));
+        OutputByte((unsigned char)(value%0x100));
+        OutputByte((unsigned char)(value/0x100));
 }
 
 void OutputName(char * name)
 {
-       int k;
-       OutputByte((unsigned char)strlen(name));
-       for(k=0; name[k]!=0; k++)
-               OutputByte((unsigned char)toupper(name[k]));
+        int k;
+        OutputByte((unsigned char)strlen(name));
+        for(k=0; name[k]!=0; k++)
+                OutputByte((unsigned char)toupper(name[k]));
 }
 
 void OutputChkSum(void)
 {
-       OutputByte((unsigned char)(0x100-(GlobalChkSum%0x100)));
-       GlobalChkSum=0;
+        OutputByte((unsigned char)(0x100-(GlobalChkSum%0x100)));
+        GlobalChkSum=0;
 }
 
 #ifdef DODUMP
 void DumpForDebug (void)
 {
-       char DumpFileName[PATH_MAX];
-       FILE * DumpFile;
-       int j, k;
-
-       strcpy(DumpFileName, infn[0].PathName);
-       strcat(DumpFileName, ".d51");
-
-       DumpFile=fopen(DumpFileName, "wb");
-       if(DumpFile==NULL)
-       {
-               printf("Couldn't create file %s\n", DumpFileName);
-               return;
-       }
-
-       fprintf(DumpFile,"SYMBOLS:\n");
-
-       for(j=0; j<numsym; j++)
-       {
-               k=symbol[j].UsageType&0xf;
-               fprintf(DumpFile, "%s, %s, %s, 0x%04x, %s\n",
-                       symbol[j].name,
-                       infn[symbol[j].FileNameNumber].PathName,
-                       (symbol[j].Procedure>=0)?procedure[symbol[j].Procedure].name:"GLOBAL",
-                       symbol[j].Address,
-                       k<6?UsageTypeName[k]:"???");
-       }
-       
-       fprintf(DumpFile,"\nPROCEDURES:\n");
-       for(j=0; j<numproc; j++)
-       {
-               fprintf(DumpFile, "%s, %s, 0x%04x-0x%04x\n",
-                       procedure[j].name,
-                       infn[procedure[j].FileNameNumber].PathName,
-                       procedure[j].BeginAdd,
-                       procedure[j].EndAdd);
-       }
-
-       fprintf(DumpFile,"\nLINE NUMBERS:\n");
-       for(j=0; j<numlinenum; j++)
-       {
-               fprintf(DumpFile, "%d:0x%04x, %s -> %s\n",
-                       linenum[j].Number,
-                       linenum[j].Address,
-                       infn[linenum[j].FileNameNumber].PathName,
-                       (linenum[j].Procedure>=0)?procedure[linenum[j].Procedure].name:"I don't know");
-       }
-
-       fclose(DumpFile);
+        char DumpFileName[PATH_MAX];
+        FILE * DumpFile;
+        int j, k;
+
+        strcpy(DumpFileName, infn[0].PathName);
+        strcat(DumpFileName, ".d51");
+
+        DumpFile=fopen(DumpFileName, "wb");
+        if(DumpFile==NULL)
+        {
+                printf("Couldn't create file %s\n", DumpFileName);
+                return;
+        }
+
+        fprintf(DumpFile,"SYMBOLS:\n");
+
+        for(j=0; j<numsym; j++)
+        {
+                k=symbol[j].UsageType&0xf;
+                fprintf(DumpFile, "%s, %s, %s, 0x%04x, %s\n",
+                        symbol[j].name,
+                        infn[symbol[j].FileNameNumber].PathName,
+                        (symbol[j].Procedure>=0)?procedure[symbol[j].Procedure].name:"GLOBAL",
+                        symbol[j].Address,
+                        k<6?UsageTypeName[k]:"???");
+        }
+
+        fprintf(DumpFile,"\nPROCEDURES:\n");
+        for(j=0; j<numproc; j++)
+        {
+                fprintf(DumpFile, "%s, %s, 0x%04x-0x%04x\n",
+                        procedure[j].name,
+                        infn[procedure[j].FileNameNumber].PathName,
+                        procedure[j].BeginAdd,
+                        procedure[j].EndAdd);
+        }
+
+        fprintf(DumpFile,"\nLINE NUMBERS:\n");
+        for(j=0; j<numlinenum; j++)
+        {
+                fprintf(DumpFile, "%d:0x%04x, %s -> %s\n",
+                        linenum[j].Number,
+                        linenum[j].Address,
+                        infn[linenum[j].FileNameNumber].PathName,
+                        (linenum[j].Procedure>=0)?procedure[linenum[j].Procedure].name:"I don't know");
+        }
+
+        fclose(DumpFile);
 }
 #endif
 
 void OutputAOEMF51(void)
 {
-       int i, j, k, recsize;
-       char MHRname[0x100], Mname[0x100];
-
-       strcpy(aomf51FileName, infn[0].PathName);
-
-       aomf51out=fopen(aomf51FileName, "wb");
-       if(aomf51out==NULL)
-       {
-               printf("Couldn't create file %s\n", aomf51FileName);
-               return;
-       }
-
-       GetName(infn[0].PathName, MHRname);
-       GlobalChkSum=0;
-       
-       /*Module header record*/
-       OutputByte(0x02);/*REC TYPE*/
-       OutputWord((strlen(MHRname)+1)+3);/*Record Length*/
-       OutputName(MHRname);/*Module Name*/
-       OutputByte(0xff);/*TRN ID: RL51?*/
-       OutputByte(0x00);
-       OutputChkSum();
-
-       for(j=0; j<numin; j++)
-       {
-               GetName(infn[j].PathName, Mname);
-
-               /*Scope Definition record: begin module block*/
-               OutputByte(0x10);/*REC TYPE*/
-               OutputWord((strlen(Mname)+1)+2);/*Record Length*/
-               OutputByte(0x00);/*BLK TYP: module block*/
-               OutputName(Mname);/*Module Name*/
-               OutputChkSum();
-
-               /*Public symbols defined in this module*/
-               recsize=2;
-               for(k=0; k<numsym; k++)/*Compute the record length*/
-                       if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
-                                (symbol[k].Procedure==-1) &&
-                                (symbol[k].Static==-1) ) recsize+=((strlen(symbol[k].name)+1)+5);
-
-               if(recsize>2) /*If there are any symbols*/
-               {
-                       OutputByte(0x12);       /*REC TYPE*/
-                       OutputWord(recsize);/*Record Length*/
-                       OutputByte(0x01);       /*DEF TYPE: Public symbols*/
-                       for(k=0; k<numsym; k++)
-                       {
-                               if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
-                                        (symbol[k].Procedure==-1) &&
-                                        (symbol[k].Static==-1) )
-                               {
-                                       OutputByte(0x00);/*SEG ID*/
-                                       OutputByte((unsigned char)symbol[k].UsageType);/*SYM INFO*/
-                                       OutputWord(symbol[k].Address);/*Offset*/
-                                       OutputByte(0x00);
-                                       OutputName(symbol[k].name);/*Symbol name*/
-                               }
-                       }
-                       OutputChkSum();
-               }
-
-               /*Local symbols defined in this module*/
-               recsize=2;
-               for(k=0; k<numsym; k++)/*Compute the record length*/
-                       if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
-                                (symbol[k].Procedure==-1) &&
-                                (symbol[k].Static==j) ) recsize+=((strlen(symbol[k].name)+1)+5);
-
-               if(recsize>2) /*If there are any symbols*/
-               {
-                       OutputByte(0x12);       /*REC TYPE*/
-                       OutputWord(recsize);/*Record Length*/
-                       OutputByte(0x00);       /*DEF TYPE: Local symbols*/
-                       for(k=0; k<numsym; k++)
-                       {
-                               if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
-                                        (symbol[k].Procedure==-1) &&
-                                        (symbol[k].Static==j) )
-                               {
-                                       OutputByte(0x00);/*SEG ID*/
-                                       OutputByte((unsigned char)symbol[k].UsageType);/*SYM INFO*/
-                                       OutputWord(symbol[k].Address);/*Offset*/
-                                       OutputByte(0x00);
-                                       OutputName(symbol[k].name);/*Symbol name*/
-                               }
-                       }
-                       OutputChkSum();
-               }
-
-               /*Output the procedures of this module*/
-
-               for(k=0; k<numproc; k++)
-               {
-                       if(procedure[k].FileNameNumber==j)
-                       {
-                               /*Scope Definition record: begin PROCEDURE block*/
-                               OutputByte(0x10);/*REC TYPE*/
-                               OutputWord((strlen(procedure[k].name)+1)+2);/*Record Length*/
-                               OutputByte(0x02);/*BLK TYP: PROCEDURE block*/
-                               OutputName(procedure[k].name);/*Module Name*/
-                               OutputChkSum();
-
-                               /*Content Record*/
-                               OutputByte(0x06);/*REC TYPE*/
-                               if(procedure[k].EndAdd==-1) procedure[k].EndAdd=HexSize;
-                               recsize=procedure[k].EndAdd-procedure[k].BeginAdd+1+4;
-                               OutputWord(recsize);/*Record Length*/
-                               OutputByte(0x00);/*SEG ID*/
-                               OutputWord(procedure[k].BeginAdd); /*Offset*/
-                               for(i=procedure[k].BeginAdd; i<=procedure[k].EndAdd; i++)
-                                       OutputByte(ihxBuff[i]);
-                               OutputChkSum();
-
-                               /*Local Symbols*/
-                               
-                               recsize=2;
-                               for(i=0; i<numsym; i++)/*Get the record length*/
-                                       if(symbol[i].Procedure==k)
-                                               recsize+=((strlen(symbol[i].name)+1)+5);
-
-                               if(recsize>2) /*If there are any symbols*/
-                               {
-                                       OutputByte(0x12);       /*REC TYPE*/
-                                       OutputWord(recsize);/*Record Length*/
-                                       OutputByte(0x00);       /*DEF TYPE: Local symbols*/
-                                       for(i=0; i<numsym; i++)
-                                       {
-                                               if ( (symbol[i].Procedure==k) )
-                                               {
-                                                       OutputByte(0x00);/*SEG ID*/
-                                                       OutputByte((unsigned char)symbol[i].UsageType);/*SYM INFO*/
-                                                       OutputWord(symbol[i].Address);/*Offset*/
-                                                       OutputByte(0x00);
-                                                       OutputName(symbol[i].name);/*Symbol name*/
-                                               }
-                                       }
-                                       OutputChkSum();
-                               }
-
-                               /*Line Numbers*/
-                               recsize=2;
-                               for(i=0; i<numlinenum; i++)/*Get the record length*/
-                                       if(linenum[i].Procedure==k) recsize+=5;
-                               
-                               if(recsize>2) /*If there are any line numbers*/
-                               {
-                                       OutputByte(0x12);       /*REC TYPE*/
-                                       OutputWord(recsize);/*Record Length*/
-                                       OutputByte(0x03);       /*DEF TYPE: Line numbers*/
-                                       for(i=0; i<numlinenum; i++)
-                                       {
-                                               if ( (linenum[i].Procedure==k) )
-                                               {
-                                                       OutputByte(0x00);/*SEG ID*/
-                                                       OutputWord(linenum[i].Address);/*Offset*/
-                                                       OutputWord(linenum[i].Number);/*Line Number*/
-                                               }
-                                       }
-                                       OutputChkSum();
-                               }
-                       
-                               /*Scope Definition record: end PROCEDURE block*/
-                               OutputByte(0x10);/*REC TYPE*/
-                               OutputWord((strlen(procedure[k].name)+1)+2);/*Record Length*/
-                               OutputByte(0x05);/*BLK TYP: PROCEDURE end block*/
-                               OutputName(procedure[k].name);/*Module Name*/
-                               OutputChkSum();
-                       }
-               }
-
-               /*Scope Definition record: end module block*/
-               OutputByte(0x10);/*REC TYPE*/
-               OutputWord((strlen(Mname)+1)+2);/*Record Length*/
-               OutputByte(0x03);/*BLK TYP: module end*/
-               OutputName(Mname);/*Module Name*/
-               OutputChkSum();
-       }
-
-       /*Content records for everything that is not in the above procedures*/
-       strcpy(Mname, "OTHER_SDCC_STUF");
-
-       /*Scope Definition record: begin module block*/
-       OutputByte(0x10);/*REC TYPE*/
-       OutputWord((strlen(Mname)+1)+2);/*Record Length*/
-       OutputByte(0x00);/*BLK TYP: module block*/
-       OutputName(Mname);/*Module Name*/
-       OutputChkSum();
-
-       for(j=-1; j<numproc; j++)
-       {
-               if(numproc)
-               {
-                       if(j==-1)
-                       {
-                               i=HexBegin;
-                               k=procedure[0].BeginAdd;
-                       }
-                       else if(j==(numproc-1))
-                       {
-                               i=procedure[j].EndAdd+1;
-                               k=HexSize;
-                       }
-                       else
-                       {
-                               i=procedure[j].EndAdd+1;
-                               k=procedure[j+1].BeginAdd;
-                       }
-               }
-               else /*What, no procedures??? Ok, here it is the whole hex file*/
-               {
-                       i=HexBegin;
-                       k=HexSize;
-               }
-
-               if(i<k)
-               {
-                       /*Content Record*/
-                       OutputByte(0x06);/*REC TYPE*/
-                       OutputWord(k-i+4);/*Record Length*/
-                       OutputByte(0x00);/*SEG ID*/
-                       OutputWord(i); /*Offset*/
-                       for(; i<k; i++) OutputByte(ihxBuff[i]);
-                       OutputChkSum();
-               }
-       }
-       
-       /*Scope Definition record: end module block*/
-       OutputByte(0x10);/*REC TYPE*/
-       OutputWord((strlen(Mname)+1)+2);/*Record Length*/
-       OutputByte(0x03);/*BLK TYP: module end*/
-       OutputName(Mname);/*Module Name*/
-       OutputChkSum();
-
-       /*Module end record*/
-       OutputByte(0x04);/*REC TYPE*/
-       OutputWord((strlen(MHRname)+1)+5);/*Record Length*/
-       OutputName(MHRname);/*Module Name*/
-       OutputWord(0x00);
-       OutputByte(0x0f);/*REG MSK: All the register banks?*/
-       OutputByte(0x00);
-       OutputChkSum();
-
-       fclose(aomf51out);
+        int i, j, k, recsize;
+        char MHRname[0x100], Mname[0x100];
+
+        strcpy(aomf51FileName, infn[0].PathName);
+
+        aomf51out=fopen(aomf51FileName, "wb");
+        if(aomf51out==NULL)
+        {
+                printf("Couldn't create file %s\n", aomf51FileName);
+                return;
+        }
+
+        GetName(infn[0].PathName, MHRname);
+        GlobalChkSum=0;
+
+        /*Module header record*/
+        OutputByte(0x02);/*REC TYPE*/
+        OutputWord((strlen(MHRname)+1)+3);/*Record Length*/
+        OutputName(MHRname);/*Module Name*/
+        OutputByte(0xff);/*TRN ID: RL51?*/
+        OutputByte(0x00);
+        OutputChkSum();
+
+        for(j=0; j<numin; j++)
+        {
+                GetName(infn[j].PathName, Mname);
+
+                /*Scope Definition record: begin module block*/
+                OutputByte(0x10);/*REC TYPE*/
+                OutputWord((strlen(Mname)+1)+2);/*Record Length*/
+                OutputByte(0x00);/*BLK TYP: module block*/
+                OutputName(Mname);/*Module Name*/
+                OutputChkSum();
+
+                /*Public symbols defined in this module*/
+                recsize=2;
+                for(k=0; k<numsym; k++)/*Compute the record length*/
+                        if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
+                                 (symbol[k].Procedure==-1) &&
+                                 (symbol[k].Static==-1) ) recsize+=((strlen(symbol[k].name)+1)+5);
+
+                if(recsize>2) /*If there are any symbols*/
+                {
+                        OutputByte(0x12);       /*REC TYPE*/
+                        OutputWord(recsize);/*Record Length*/
+                        OutputByte(0x01);       /*DEF TYPE: Public symbols*/
+                        for(k=0; k<numsym; k++)
+                        {
+                                if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
+                                         (symbol[k].Procedure==-1) &&
+                                         (symbol[k].Static==-1) )
+                                {
+                                        OutputByte(0x00);/*SEG ID*/
+                                        OutputByte((unsigned char)symbol[k].UsageType);/*SYM INFO*/
+                                        OutputWord(symbol[k].Address);/*Offset*/
+                                        OutputByte(0x00);
+                                        OutputName(symbol[k].name);/*Symbol name*/
+                                }
+                        }
+                        OutputChkSum();
+                }
+
+                /*Local symbols defined in this module*/
+                recsize=2;
+                for(k=0; k<numsym; k++)/*Compute the record length*/
+                        if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
+                                 (symbol[k].Procedure==-1) &&
+                                 (symbol[k].Static==j) ) recsize+=((strlen(symbol[k].name)+1)+5);
+
+                if(recsize>2) /*If there are any symbols*/
+                {
+                        OutputByte(0x12);       /*REC TYPE*/
+                        OutputWord(recsize);/*Record Length*/
+                        OutputByte(0x00);       /*DEF TYPE: Local symbols*/
+                        for(k=0; k<numsym; k++)
+                        {
+                                if ( (symbol[k].FileNameNumber==j) && (symbol[k].Address!=-1) &&
+                                         (symbol[k].Procedure==-1) &&
+                                         (symbol[k].Static==j) )
+                                {
+                                        OutputByte(0x00);/*SEG ID*/
+                                        OutputByte((unsigned char)symbol[k].UsageType);/*SYM INFO*/
+                                        OutputWord(symbol[k].Address);/*Offset*/
+                                        OutputByte(0x00);
+                                        OutputName(symbol[k].name);/*Symbol name*/
+                                }
+                        }
+                        OutputChkSum();
+                }
+
+                /*Output the procedures of this module*/
+
+                for(k=0; k<numproc; k++)
+                {
+                        if(procedure[k].FileNameNumber==j)
+                        {
+                                /*Scope Definition record: begin PROCEDURE block*/
+                                OutputByte(0x10);/*REC TYPE*/
+                                OutputWord((strlen(procedure[k].name)+1)+2);/*Record Length*/
+                                OutputByte(0x02);/*BLK TYP: PROCEDURE block*/
+                                OutputName(procedure[k].name);/*Module Name*/
+                                OutputChkSum();
+
+                                /*Content Record*/
+                                OutputByte(0x06);/*REC TYPE*/
+                                if(procedure[k].EndAdd==-1) procedure[k].EndAdd=HexSize;
+                                recsize=procedure[k].EndAdd-procedure[k].BeginAdd+1+4;
+                                OutputWord(recsize);/*Record Length*/
+                                OutputByte(0x00);/*SEG ID*/
+                                OutputWord(procedure[k].BeginAdd); /*Offset*/
+                                for(i=procedure[k].BeginAdd; i<=procedure[k].EndAdd; i++)
+                                        OutputByte(ihxBuff[i]);
+                                OutputChkSum();
+
+                                /*Local Symbols*/
+
+                                recsize=2;
+                                for(i=0; i<numsym; i++)/*Get the record length*/
+                                        if(symbol[i].Procedure==k)
+                                                recsize+=((strlen(symbol[i].name)+1)+5);
+
+                                if(recsize>2) /*If there are any symbols*/
+                                {
+                                        OutputByte(0x12);       /*REC TYPE*/
+                                        OutputWord(recsize);/*Record Length*/
+                                        OutputByte(0x00);       /*DEF TYPE: Local symbols*/
+                                        for(i=0; i<numsym; i++)
+                                        {
+                                                if ( (symbol[i].Procedure==k) )
+                                                {
+                                                        OutputByte(0x00);/*SEG ID*/
+                                                        OutputByte((unsigned char)symbol[i].UsageType);/*SYM INFO*/
+                                                        OutputWord(symbol[i].Address);/*Offset*/
+                                                        OutputByte(0x00);
+                                                        OutputName(symbol[i].name);/*Symbol name*/
+                                                }
+                                        }
+                                        OutputChkSum();
+                                }
+
+                                /*Line Numbers*/
+                                recsize=2;
+                                for(i=0; i<numlinenum; i++)/*Get the record length*/
+                                        if(linenum[i].Procedure==k) recsize+=5;
+
+                                if(recsize>2) /*If there are any line numbers*/
+                                {
+                                        OutputByte(0x12);       /*REC TYPE*/
+                                        OutputWord(recsize);/*Record Length*/
+                                        OutputByte(0x03);       /*DEF TYPE: Line numbers*/
+                                        for(i=0; i<numlinenum; i++)
+                                        {
+                                                if ( (linenum[i].Procedure==k) )
+                                                {
+                                                        OutputByte(0x00);/*SEG ID*/
+                                                        OutputWord(linenum[i].Address);/*Offset*/
+                                                        OutputWord(linenum[i].Number);/*Line Number*/
+                                                }
+                                        }
+                                        OutputChkSum();
+                                }
+
+                                /*Scope Definition record: end PROCEDURE block*/
+                                OutputByte(0x10);/*REC TYPE*/
+                                OutputWord((strlen(procedure[k].name)+1)+2);/*Record Length*/
+                                OutputByte(0x05);/*BLK TYP: PROCEDURE end block*/
+                                OutputName(procedure[k].name);/*Module Name*/
+                                OutputChkSum();
+                        }
+                }
+
+                /*Scope Definition record: end module block*/
+                OutputByte(0x10);/*REC TYPE*/
+                OutputWord((strlen(Mname)+1)+2);/*Record Length*/
+                OutputByte(0x03);/*BLK TYP: module end*/
+                OutputName(Mname);/*Module Name*/
+                OutputChkSum();
+        }
+
+        /*Content records for everything that is not in the above procedures*/
+        strcpy(Mname, "OTHER_SDCC_STUF");
+
+        /*Scope Definition record: begin module block*/
+        OutputByte(0x10);/*REC TYPE*/
+        OutputWord((strlen(Mname)+1)+2);/*Record Length*/
+        OutputByte(0x00);/*BLK TYP: module block*/
+        OutputName(Mname);/*Module Name*/
+        OutputChkSum();
+
+        for(j=-1; j<numproc; j++)
+        {
+                if(numproc)
+                {
+                        if(j==-1)
+                        {
+                                i=HexBegin;
+                                k=procedure[0].BeginAdd;
+                        }
+                        else if(j==(numproc-1))
+                        {
+                                i=procedure[j].EndAdd+1;
+                                k=HexSize;
+                        }
+                        else
+                        {
+                                i=procedure[j].EndAdd+1;
+                                k=procedure[j+1].BeginAdd;
+                        }
+                }
+                else /*What, no procedures??? Ok, here it is the whole hex file*/
+                {
+                        i=HexBegin;
+                        k=HexSize;
+                }
+
+                if(i<k)
+                {
+                        /*Content Record*/
+                        OutputByte(0x06);/*REC TYPE*/
+                        OutputWord(k-i+4);/*Record Length*/
+                        OutputByte(0x00);/*SEG ID*/
+                        OutputWord(i); /*Offset*/
+                        for(; i<k; i++) OutputByte(ihxBuff[i]);
+                        OutputChkSum();
+                }
+        }
+
+        /*Scope Definition record: end module block*/
+        OutputByte(0x10);/*REC TYPE*/
+        OutputWord((strlen(Mname)+1)+2);/*Record Length*/
+        OutputByte(0x03);/*BLK TYP: module end*/
+        OutputName(Mname);/*Module Name*/
+        OutputChkSum();
+
+        /*Module end record*/
+        OutputByte(0x04);/*REC TYPE*/
+        OutputWord((strlen(MHRname)+1)+5);/*Record Length*/
+        OutputName(MHRname);/*Module Name*/
+        OutputWord(0x00);
+        OutputByte(0x0f);/*REG MSK: All the register banks?*/
+        OutputByte(0x00);
+        OutputChkSum();
+
+        fclose(aomf51out);
 }
 
 void CollectInfoFromCDB(void)
 {
-       int i, j, k, CurrentModule;
-       FILE * CDBin;
-       char buff[0x1000];
-       char SourceName[PATH_MAX];
-
-       //"S:{G|F<filename>|L<functionName>}$<name>$<level>$<block>(<type info>),<Address Space>,<on Stack?>,<stack offset>"
-       char Sfmt[]="%[^$] %c %[^$] %c %[^$] %c %s";
-       char c;
-       char scope[0x100];
-       char name[0x100];
-       char level[0x100];
-       char block[0x100];
-       char Bfmt[]="%[^)] %c %c %c %c %d %c %d";
-       char TypeInfo[0x100];
-       char AddressSpace;
-       int OnStack;
-       int StackOffset;
-       int Address, CLine;
-       
-       if(numin==0) return;
-
-       if (dfp != NULL)
-       {
-               fclose(dfp);
-               dfp=NULL;
-       }
-
-       /*Build the source filename*/
-       strcpy(SourceName, infn[0].PathName);
-       strcat(SourceName, ".cdb");
-       CDBin=fopen(SourceName, "r");
-       if(CDBin==NULL)
-       {
-               printf("Couldn't open file '%s'\n", SourceName);
-               lkexit(1);
-       }
-
-       CurrentModule=0; /*Set the active module as the first one*/
-       while(!feof(CDBin))
-       {
-               fgets(buff, sizeof(buff)-1, CDBin);
-
-               if(!feof(CDBin)) switch(buff[0])
-               {
-                       /*Example: "M:adq"*/
-                       case 'M':
-                               sscanf(&buff[2], "%s", name);
-                               for(j=0; j<numin; j++)
-                                       if(EQ(infn[j].ModuleName, name)) break;
-                               if(j<numin) CurrentModule=j;
-                       break;
-
-                       /* Example:
-                       "S:G$actual$0$0({7}ST__00010000:S),E,0,0"
-                       "S:Lmain$j$1$1({2}SI:S),E,0,0"
-                       "S:G$DS1306_Reset_SPI$0$0({2}DF,SV:S),C,0,0"
-                       "S:G$main$0$0({2}DF,SV:S),C,0,0"
-                       */
-
-                       case 'S':
-                               sscanf(buff, Sfmt,
-                                       scope, &c,
-                                       name, &c,
-                                       level, &c,
-                                       block);
-                               
-                               /*<block>(<type info>),<Address Space>,<on Stack?>,<stack offset>*/
-                               sscanf(block, Bfmt,
-                                          TypeInfo, &c, &c,
-                                          &AddressSpace, &c,
-                                          &OnStack, &c, 
-                                          &StackOffset);
-
-                               i=-1; k=-1;
-                               switch(scope[2])
-                               {
-                                       case 'G': /*Global symbol*/
-                                       break;
-                                       case 'L': /*Local symbol of a procedure*/
-                                               for(j=0; j<numproc; j++)
-                                               {
-                                                       if(EQ(&scope[3], procedure[j].name)) break;
-                                               }
-                                               if(j<numproc) k=j; /*Local symbol*/
-                                       break;
-                                       case 'F': /*Local symbol to a module*/
-                                               for(j=0; j<numin; j++)
-                                               {
-                                                       if(EQ(&scope[3], infn[j].ModuleName)) break;
-                                               }
-                                               if(j<numin) i=j;
-                                       break;
-                               }
-
-                               /*This symbol may have been already defined*/
-                               for(j=0; j<numsym; j++)
-                               {
-                                       if( EQ(name, symbol[j].name) && 
-                                               (symbol[j].Procedure==k) &&
-                                               (symbol[j].Static==i) ) break;
-                               }
-                               if(j==numsym) /*New symbol*/
-                               {
-                                       symbol=realloc(symbol, sizeof(_symbol)*(numsym+1));
-                                       symbol[numsym].FileNameNumber=CurrentModule;
-                                       strcpy(symbol[numsym].name, name);
-                                       symbol[numsym].Procedure=k;
-                                       symbol[numsym].Static=i;
-                                       symbol[numsym].Address=-1;/*Collected later*/
-
-                                       switch(AddressSpace)
-                                       {
-                                               case 'C': /*Code*/ 
-                                               case 'D': /*Code/static segment*/ 
-                                               case 'Z': /*Functions and undefined code space*/ 
-                                                       symbol[numsym].UsageType=0x40;
-                                               break;
-
-                                               case 'F': /*External ram*/ 
-                                               case 'A': /*External stack*/
-                                               case 'P': /*External Pdata*/
-                                                       symbol[numsym].UsageType=0x41;
-                                               break;
-
-                                               case 'E': /*Internal ram (lower 128) bytes*/ 
-                                               case 'I': /*SFR space*/ 
-                                               case 'R': /*Register Space*/ 
-                                                       symbol[numsym].UsageType=0x42;
-                                               break;
-
-                                               case 'B': /*Internal stack*/ 
-                                               case 'G': /*Internal ram*/ 
-                                                       symbol[numsym].UsageType=0x43;
-                                               break;
-
-                                               case 'H': /*Bit addressable*/ 
-                                               case 'J': /*SBIT space*/ 
-                                                       symbol[numsym].UsageType=0x44;
-                                               break;
-                                               
-                                               default:
-                                                       printf("Unknown scope information for: %s, AddressSpace:%c\n", symbol[numsym].name, AddressSpace);
-                                               break;
-                                       }
-                                       numsym++;
-                               }
-                       break;
-
-                       /*Examples:
-                       F:G$AsciiToHex$0$0({2}DF,SC:U),C,0,0,0,0,0
-                       F:G$main$0$0({2}DF,SV:S),C,0,0,0,0,0   */
-
-                       case 'F':
-                               sscanf(buff, "%[^$] %c %[^$]", scope, &c, name);
-                               /*The same may have been already defined */
-                               for(j=0; j<numproc; j++)
-                               {
-                                       if(EQ(name, procedure[j].name)) break;
-                               }
-                               if(j==numproc)
-                               {
-                                       procedure=realloc(procedure, sizeof(_procedure)*(numproc+1));
-                                       strcpy(procedure[numproc].name, name);
-                                       procedure[numproc].FileNameNumber=CurrentModule;
-                                       procedure[numproc].BeginAdd=-1;/*To be collected latter*/
-                                       procedure[numproc].EndAdd=-1;/*To be collected latter*/
-                                       numproc++;
-                               }
-                               
-                               /*This function name is also a global symbol*/
-                               for(j=0; j<numsym; j++)/*A global symbol may have been already defined*/
-                               {
-                                       if( EQ(name, symbol[j].name) && (symbol[j].Procedure==-1) ) break;
-                               }
-                               if(j==numsym)
-                               {
-                                       symbol=realloc(symbol, sizeof(_symbol)*(numsym+1));
-                                       symbol[numsym].FileNameNumber=CurrentModule;
-                                       strcpy(symbol[numsym].name, name);
-                                       symbol[numsym].UsageType=0x00;/*A procedure name symbol*/
-                                       symbol[numsym].Procedure=-1; /*Global symbol*/
-                                       symbol[numsym].Address=-1;/*Collected later*/
-                                       symbol[numsym].Static=-1; // o_gloom
-                                       numsym++;
-                               }
-                       break;
-
-                       case 'L':
-                               switch(buff[2])
-                               {
-                                       case 'G': /*Example L:G$P0$0$0:80*/
-                                               sscanf(buff, "%[^$] %c %[^$] %c %[^:] %c %x",
-                                                       scope, &c, name, &c, level, &c, &Address);
-
-                                               for(j=0; j<numsym; j++)
-                                               {
-                                                       if(EQ(symbol[j].name, name))
-                                                       {
-                                                               if( (symbol[j].Address==-1) && (symbol[j].Procedure==-1) )
-                                                               {
-                                                                       symbol[j].Address=Address;
-                                                               }
-                                                               
-                                                               /*If the symbol is the name of a procedure, the address is also
-                                                               the begining of such procedure*/
-                                                               if((symbol[j].UsageType&0x0f)==0x00)
-                                                               {
-                                                                       for(k=0; k<numproc; k++)
-                                                                       {
-                                                                               if(EQ(symbol[j].name, procedure[k].name))
-                                                                               {
-                                                                                       if(procedure[k].BeginAdd==-1)
-                                                                                               procedure[k].BeginAdd=Address;
-                                                                                       break;
-                                                                               }
-                                                                       }
-                                                               }
-                                                               
-                                                               break;
-                                                       }
-                                               }
-                                       break;
-                                       
-                                       case 'F': /*Example L:Fadq$_str_2$0$0:57A*/
-                                               sscanf(buff, "%[^$] %c %[^$] %c %[^:] %c %x",
-                                                       scope, &c, name, &c, level, &c, &Address);
-                                               
-                                               for(j=0; j<numsym; j++)
-                                               {
-                                                       if(EQ(symbol[j].name, name))
-                                                       {
-                                                               if( (symbol[j].Address==-1) ) symbol[j].Address=Address;
-                                                               break;
-                                                       }
-                                               }
-                                               
-                                               /*It could be also a static function*/
-                                               for(j=0; j<numproc; j++)
-                                               {
-                                                       if(EQ(procedure[j].name, name))
-                                                       {
-                                                               if( (procedure[j].BeginAdd==-1) ) procedure[j].BeginAdd=Address;
-                                                               break;
-                                                       }
-                                               }
-
-                                       break;
-                                       
-                                       case 'L': /*Example L:Lmain$j$1$1:29*/
-
-                                               /*
-                                               L:LDS1306_Write$Value$1$1:34
-                                               L:LDS1306_Burst_Read$count$1$1:35
-                                               L:LDS1306_Burst_Read$address$1$1:36
-                                               L:LDS1306_Burst_Write$count$1$1:37
-                                               L:LDS1306_Burst_Write$address$1$1:38
-                                               */
-                                               sscanf(&buff[3], "%[^$] %c %[^$] %c %[^:] %c %x",
-                                                       scope, &c, name, &c, level, &c, &Address);
-                                               
-                                               for(k=0; k<numproc; k++)
-                                               {
-                                                       if(EQ(procedure[k].name, scope)) break;
-                                               }
-                                               
-                                               if(k<numproc) for(j=0; j<numsym; j++)
-                                               {
-                                                       if( EQ(symbol[j].name, name) && (symbol[j].Procedure==k) )
-                                                       {
-                                                               if(symbol[j].Address==-1) symbol[j].Address=Address;
-                                                               break;
-                                                       }
-                                               }
-                                       break;
-                                       
-                                       /*Line Numbers*/
-                                       case 'C': /*Example L:C$adq.c$38$1$1:3E*/  /*L:C$hwinit.c$29$1$1:7AD*/
-                                               sscanf(&buff[4], "%[^.] %[^$] %c %d %[^:] %c %x",
-                                                       name, level, &c, &CLine, level, &c, &Address);
-
-                                               for(j=0; j<numin; j++)
-                                                       if(EQ(infn[j].ModuleName, name)) break;
-                                               if(j<numin)
-                                               {
-                                                       /*Check if this line is already defined*/
-                                                       for(k=0; k<numlinenum; k++)
-                                                       {
-                                                               if( (linenum[k].Number==CLine) &&
-                                                                       (linenum[k].FileNameNumber==j) )break;
-                                                       }
-                                                       if(k==numlinenum) /*New line number*/
-                                                       {
-                                                               linenum=realloc(linenum, sizeof(_linenum)*(numlinenum+1));
-                                                               linenum[numlinenum].Number=CLine;
-                                                               linenum[numlinenum].FileNameNumber=j;
-                                                               linenum[numlinenum].Procedure=-1;/*To be asigned later*/
-                                                               linenum[numlinenum].Address=Address;
-                                                               numlinenum++;
-                                                       }
-                                               }
-                                       break;
-                                       
-                                       case 'A': /*Example L:A$adq$424:40*/
-                                               /*No use for this one*/
-                                       break;
-                                       
-                                       /*The end of a procedure*/
-                                       case 'X': /*Example L:XG$AsciiToHex$0$0:88*/
-                                               sscanf(&buff[3], "%[^$] %c %[^$] %c %[^:] %c %x",
-                                                       scope, &c, name, &c, level, &c, &Address);
-
-                                               for(k=0; k<numproc; k++)
-                                               {
-                                                       if(EQ(procedure[k].name, name))
-                                                       {
-                                                               if(procedure[k].EndAdd==-1) procedure[k].EndAdd=Address;
-                                                               break;
-                                                       }
-                                               }
-                                       break;
-                               }
-                       break;
-
-                       default:
-                       break;
-               }
-       }
-
-       /*Make sure each procedure has an end*/
-       for(k=0; k<(numproc-1); k++)
-       {
-               if (procedure[k].EndAdd==-1) procedure[k].EndAdd=procedure[k+1].BeginAdd-1;
-       }
-       /*Asign each line number to a procedure*/
-       for(j=0; j<numlinenum; j++)
-       {
-               for(k=0; k<numproc; k++)
-               {
-                       if ( (linenum[j].Address>=procedure[k].BeginAdd) &&
-                                (linenum[j].Address<=procedure[k].EndAdd) &&
-                                (linenum[j].FileNameNumber==procedure[k].FileNameNumber) )
-                       {
-                               linenum[j].Procedure=k;
-                       }
-               }
-       }
-
-       fclose(CDBin);
+        int i, j, k, CurrentModule;
+        FILE * CDBin;
+        char buff[0x1000];
+        char SourceName[PATH_MAX];
+
+        //"S:{G|F<filename>|L<functionName>}$<name>$<level>$<block>(<type info>),<Address Space>,<on Stack?>,<stack offset>"
+        char Sfmt[]="%[^$] %c %[^$] %c %[^$] %c %s";
+        char c;
+        char scope[0x100];
+        char name[0x100];
+        char level[0x100];
+        char block[0x100];
+        char Bfmt[]="%[^)] %c %c %c %c %d %c %d";
+        char TypeInfo[0x100];
+        char AddressSpace;
+        int OnStack;
+        int StackOffset;
+        int Address, CLine;
+
+        if(numin==0) return;
+
+        if (dfp != NULL)
+        {
+                fclose(dfp);
+                dfp=NULL;
+        }
+
+        /*Build the source filename*/
+        strcpy(SourceName, infn[0].PathName);
+        strcat(SourceName, ".cdb");
+        CDBin=fopen(SourceName, "r");
+        if(CDBin==NULL)
+        {
+                printf("Couldn't open file '%s'\n", SourceName);
+                lkexit(1);
+        }
+
+        CurrentModule=0; /*Set the active module as the first one*/
+        while(!feof(CDBin))
+        {
+                fgets(buff, sizeof(buff)-1, CDBin);
+
+                if(!feof(CDBin)) switch(buff[0])
+                {
+                        /*Example: "M:adq"*/
+                        case 'M':
+                                sscanf(&buff[2], "%s", name);
+                                for(j=0; j<numin; j++)
+                                        if(EQ(infn[j].ModuleName, name)) break;
+                                if(j<numin) CurrentModule=j;
+                        break;
+
+                        /* Example:
+                        "S:G$actual$0$0({7}ST__00010000:S),E,0,0"
+                        "S:Lmain$j$1$1({2}SI:S),E,0,0"
+                        "S:G$DS1306_Reset_SPI$0$0({2}DF,SV:S),C,0,0"
+                        "S:G$main$0$0({2}DF,SV:S),C,0,0"
+                        */
+
+                        case 'S':
+                                sscanf(buff, Sfmt,
+                                        scope, &c,
+                                        name, &c,
+                                        level, &c,
+                                        block);
+
+                                /*<block>(<type info>),<Address Space>,<on Stack?>,<stack offset>*/
+                                sscanf(block, Bfmt,
+                                           TypeInfo, &c, &c,
+                                           &AddressSpace, &c,
+                                           &OnStack, &c,
+                                           &StackOffset);
+
+                                i=-1; k=-1;
+                                switch(scope[2])
+                                {
+                                        case 'G': /*Global symbol*/
+                                        break;
+                                        case 'L': /*Local symbol of a procedure*/
+                                                for(j=0; j<numproc; j++)
+                                                {
+                                                        if(EQ(&scope[3], procedure[j].name)) break;
+                                                }
+                                                if(j<numproc) k=j; /*Local symbol*/
+                                        break;
+                                        case 'F': /*Local symbol to a module*/
+                                                for(j=0; j<numin; j++)
+                                                {
+                                                        if(EQ(&scope[3], infn[j].ModuleName)) break;
+                                                }
+                                                if(j<numin) i=j;
+                                        break;
+                                }
+
+                                /*This symbol may have been already defined*/
+                                for(j=0; j<numsym; j++)
+                                {
+                                        if( EQ(name, symbol[j].name) &&
+                                                (symbol[j].Procedure==k) &&
+                                                (symbol[j].Static==i) ) break;
+                                }
+                                if(j==numsym) /*New symbol*/
+                                {
+                                        symbol=realloc(symbol, sizeof(_symbol)*(numsym+1));
+                                        symbol[numsym].FileNameNumber=CurrentModule;
+                                        strcpy(symbol[numsym].name, name);
+                                        symbol[numsym].Procedure=k;
+                                        symbol[numsym].Static=i;
+                                        symbol[numsym].Address=-1;/*Collected later*/
+
+                                        switch(AddressSpace)
+                                        {
+                                                case 'C': /*Code*/
+                                                case 'D': /*Code/static segment*/
+                                                case 'Z': /*Functions and undefined code space*/
+                                                        symbol[numsym].UsageType=0x40;
+                                                break;
+
+                                                case 'F': /*External ram*/
+                                                case 'A': /*External stack*/
+                                                case 'P': /*External Pdata*/
+                                                        symbol[numsym].UsageType=0x41;
+                                                break;
+
+                                                case 'E': /*Internal ram (lower 128) bytes*/
+                                                case 'I': /*SFR space*/
+                                                case 'R': /*Register Space*/
+                                                        symbol[numsym].UsageType=0x42;
+                                                break;
+
+                                                case 'B': /*Internal stack*/
+                                                case 'G': /*Internal ram*/
+                                                        symbol[numsym].UsageType=0x43;
+                                                break;
+
+                                                case 'H': /*Bit addressable*/
+                                                case 'J': /*SBIT space*/
+                                                        symbol[numsym].UsageType=0x44;
+                                                break;
+
+                                                default:
+                                                        printf("Unknown scope information for: %s, AddressSpace:%c\n", symbol[numsym].name, AddressSpace);
+                                                break;
+                                        }
+                                        numsym++;
+                                }
+                        break;
+
+                        /*Examples:
+                        F:G$AsciiToHex$0$0({2}DF,SC:U),C,0,0,0,0,0
+                        F:G$main$0$0({2}DF,SV:S),C,0,0,0,0,0   */
+
+                        case 'F':
+                                sscanf(buff, "%[^$] %c %[^$]", scope, &c, name);
+                                /*The same may have been already defined */
+                                for(j=0; j<numproc; j++)
+                                {
+                                        if(EQ(name, procedure[j].name)) break;
+                                }
+                                if(j==numproc)
+                                {
+                                        procedure=realloc(procedure, sizeof(_procedure)*(numproc+1));
+                                        strcpy(procedure[numproc].name, name);
+                                        procedure[numproc].FileNameNumber=CurrentModule;
+                                        procedure[numproc].BeginAdd=-1;/*To be collected latter*/
+                                        procedure[numproc].EndAdd=-1;/*To be collected latter*/
+                                        numproc++;
+                                }
+
+                                /*This function name is also a global symbol*/
+                                for(j=0; j<numsym; j++)/*A global symbol may have been already defined*/
+                                {
+                                        if( EQ(name, symbol[j].name) && (symbol[j].Procedure==-1) ) break;
+                                }
+                                if(j==numsym)
+                                {
+                                        symbol=realloc(symbol, sizeof(_symbol)*(numsym+1));
+                                        symbol[numsym].FileNameNumber=CurrentModule;
+                                        strcpy(symbol[numsym].name, name);
+                                        symbol[numsym].UsageType=0x00;/*A procedure name symbol*/
+                                        symbol[numsym].Procedure=-1; /*Global symbol*/
+                                        symbol[numsym].Address=-1;/*Collected later*/
+                                        symbol[numsym].Static=-1; // o_gloom
+                                        numsym++;
+                                }
+                        break;
+
+                        case 'L':
+                                switch(buff[2])
+                                {
+                                        case 'G': /*Example L:G$P0$0$0:80*/
+                                                sscanf(buff, "%[^$] %c %[^$] %c %[^:] %c %x",
+                                                        scope, &c, name, &c, level, &c, &Address);
+
+                                                for(j=0; j<numsym; j++)
+                                                {
+                                                        if(EQ(symbol[j].name, name))
+                                                        {
+                                                                if( (symbol[j].Address==-1) && (symbol[j].Procedure==-1) )
+                                                                {
+                                                                        symbol[j].Address=Address;
+                                                                }
+
+                                                                /*If the symbol is the name of a procedure, the address is also
+                                                                the begining of such procedure*/
+                                                                if((symbol[j].UsageType&0x0f)==0x00)
+                                                                {
+                                                                        for(k=0; k<numproc; k++)
+                                                                        {
+                                                                                if(EQ(symbol[j].name, procedure[k].name))
+                                                                                {
+                                                                                        if(procedure[k].BeginAdd==-1)
+                                                                                                procedure[k].BeginAdd=Address;
+                                                                                        break;
+                                                                                }
+                                                                        }
+                                                                }
+
+                                                                break;
+                                                        }
+                                                }
+                                        break;
+
+                                        case 'F': /*Example L:Fadq$_str_2$0$0:57A*/
+                                                sscanf(buff, "%[^$] %c %[^$] %c %[^:] %c %x",
+                                                        scope, &c, name, &c, level, &c, &Address);
+
+                                                for(j=0; j<numsym; j++)
+                                                {
+                                                        if(EQ(symbol[j].name, name))
+                                                        {
+                                                                if( (symbol[j].Address==-1) ) symbol[j].Address=Address;
+                                                                break;
+                                                        }
+                                                }
+
+                                                /*It could be also a static function*/
+                                                for(j=0; j<numproc; j++)
+                                                {
+                                                        if(EQ(procedure[j].name, name))
+                                                        {
+                                                                if( (procedure[j].BeginAdd==-1) ) procedure[j].BeginAdd=Address;
+                                                                break;
+                                                        }
+                                                }
+
+                                        break;
+
+                                        case 'L': /*Example L:Lmain$j$1$1:29*/
+
+                                                /*
+                                                L:LDS1306_Write$Value$1$1:34
+                                                L:LDS1306_Burst_Read$count$1$1:35
+                                                L:LDS1306_Burst_Read$address$1$1:36
+                                                L:LDS1306_Burst_Write$count$1$1:37
+                                                L:LDS1306_Burst_Write$address$1$1:38
+                                                */
+                                                sscanf(&buff[3], "%[^$] %c %[^$] %c %[^:] %c %x",
+                                                        scope, &c, name, &c, level, &c, &Address);
+
+                                                for(k=0; k<numproc; k++)
+                                                {
+                                                        if(EQ(procedure[k].name, scope)) break;
+                                                }
+
+                                                if(k<numproc) for(j=0; j<numsym; j++)
+                                                {
+                                                        if( EQ(symbol[j].name, name) && (symbol[j].Procedure==k) )
+                                                        {
+                                                                if(symbol[j].Address==-1) symbol[j].Address=Address;
+                                                                break;
+                                                        }
+                                                }
+                                        break;
+
+                                        /*Line Numbers*/
+                                        case 'C': /*Example L:C$adq.c$38$1$1:3E*/  /*L:C$hwinit.c$29$1$1:7AD*/
+                                                sscanf(&buff[4], "%[^.] %[^$] %c %d %[^:] %c %x",
+                                                        name, level, &c, &CLine, level, &c, &Address);
+
+                                                for(j=0; j<numin; j++)
+                                                        if(EQ(infn[j].ModuleName, name)) break;
+                                                if(j<numin)
+                                                {
+                                                        /*Check if this line is already defined*/
+                                                        for(k=0; k<numlinenum; k++)
+                                                        {
+                                                                if( (linenum[k].Number==CLine) &&
+                                                                        (linenum[k].FileNameNumber==j) )break;
+                                                        }
+                                                        if(k==numlinenum) /*New line number*/
+                                                        {
+                                                                linenum=realloc(linenum, sizeof(_linenum)*(numlinenum+1));
+                                                                linenum[numlinenum].Number=CLine;
+                                                                linenum[numlinenum].FileNameNumber=j;
+                                                                linenum[numlinenum].Procedure=-1;/*To be asigned later*/
+                                                                linenum[numlinenum].Address=Address;
+                                                                numlinenum++;
+                                                        }
+                                                }
+                                        break;
+
+                                        case 'A': /*Example L:A$adq$424:40*/
+                                                /*No use for this one*/
+                                        break;
+
+                                        /*The end of a procedure*/
+                                        case 'X': /*Example L:XG$AsciiToHex$0$0:88*/
+                                                sscanf(&buff[3], "%[^$] %c %[^$] %c %[^:] %c %x",
+                                                        scope, &c, name, &c, level, &c, &Address);
+
+                                                for(k=0; k<numproc; k++)
+                                                {
+                                                        if(EQ(procedure[k].name, name))
+                                                        {
+                                                                if(procedure[k].EndAdd==-1) procedure[k].EndAdd=Address;
+                                                                break;
+                                                        }
+                                                }
+                                        break;
+                                }
+                        break;
+
+                        default:
+                        break;
+                }
+        }
+
+        /*Make sure each procedure has an end*/
+        for(k=0; k<(numproc-1); k++)
+        {
+                if (procedure[k].EndAdd==-1) procedure[k].EndAdd=procedure[k+1].BeginAdd-1;
+        }
+        /*Asign each line number to a procedure*/
+        for(j=0; j<numlinenum; j++)
+        {
+                for(k=0; k<numproc; k++)
+                {
+                        if ( (linenum[j].Address>=procedure[k].BeginAdd) &&
+                                 (linenum[j].Address<=procedure[k].EndAdd) &&
+                                 (linenum[j].FileNameNumber==procedure[k].FileNameNumber) )
+                        {
+                                linenum[j].Procedure=k;
+                        }
+                }
+        }
+
+        fclose(CDBin);
 }
 
 int hex2dec (unsigned char hex_digit)
@@ -887,102 +884,102 @@ int hex2dec (unsigned char hex_digit)
 
 unsigned char GetByte(char * buffer)
 {
-       return hex2dec(buffer[0])*0x10+hex2dec(buffer[1]);
+        return hex2dec(buffer[0])*0x10+hex2dec(buffer[1]);
 }
 
 unsigned short GetWord(char * buffer)
 {
-       return  hex2dec(buffer[0])*0x1000+
-                       hex2dec(buffer[1])*0x100+
-                       hex2dec(buffer[2])*0x10+
-                       hex2dec(buffer[3]);
+        return  hex2dec(buffer[0])*0x1000+
+                        hex2dec(buffer[1])*0x100+
+                        hex2dec(buffer[2])*0x10+
+                        hex2dec(buffer[3]);
 }
 
 int ReadHexFile(int * Begin)
 {
-       char buffer[1024];
-       FILE * filein;
-       int j;
-       unsigned char linesize, recordtype, rchksum, value;
-       unsigned short address;
-       int MaxAddress=0;
-       int chksum;
-
-       /*If the hexfile is already open, close it*/
-       if(ofp!=NULL)
-       {
-               fclose(ofp);
-               ofp=NULL;
-       }
-       
-       strcpy(ihxFileName, infn[0].PathName);
-       strcat(ihxFileName, ".ihx");
-
-       if ( (filein=fopen(ihxFileName, "r")) == NULL )
-       {
-          printf("Error: Can't open file `%s`.\r\n", ihxFileName);
-          return 0;
-       }
-   
-       ihxBuff=calloc(MEMSIZE, sizeof(unsigned char));
-       if(ihxBuff==NULL)
-       {
-               printf("Insufficient memory\n");
-               fclose(filein);
-               return -1;
-       }
-
-       for(j=0; j<MEMSIZE; j++) ihxBuff[j]=0xff;
+        char buffer[1024];
+        FILE * filein;
+        int j;
+        unsigned char linesize, recordtype, rchksum, value;
+        unsigned short address;
+        int MaxAddress=0;
+        int chksum;
+
+        /*If the hexfile is already open, close it*/
+        if(ofp!=NULL)
+        {
+                fclose(ofp);
+                ofp=NULL;
+        }
+
+        strcpy(ihxFileName, infn[0].PathName);
+        strcat(ihxFileName, ".ihx");
+
+        if ( (filein=fopen(ihxFileName, "r")) == NULL )
+        {
+           printf("Error: Can't open file `%s`.\r\n", ihxFileName);
+           return 0;
+        }
+
+        ihxBuff=calloc(MEMSIZE, sizeof(unsigned char));
+        if(ihxBuff==NULL)
+        {
+                printf("Insufficient memory\n");
+                fclose(filein);
+                return -1;
+        }
+
+        for(j=0; j<MEMSIZE; j++) ihxBuff[j]=0xff;
 
     while(1)
     {
-               if(fgets(buffer, sizeof(buffer), filein)==NULL)
-               {
-                       printf("Error reading file '%s'\n", ihxFileName);
-                       break;
-               }
-       if(buffer[0]==':')
-       {
-                       linesize = GetByte(&buffer[1]);
-                       address = GetWord(&buffer[3]);
-                       recordtype = GetByte(&buffer[7]);
-                       rchksum = GetByte(&buffer[9]+(linesize*2));
-                       chksum=linesize+(address/0x100)+(address%0x100)+recordtype+rchksum;
-
-                       if (recordtype==1) break; /*End of record*/
-
-                       for(j=0; j<linesize; j++)
-                       {
-                               value=GetByte(&buffer[9]+(j*2));
-                               chksum+=value;
-                               ihxBuff[address+j]=value;
-                       }
-                       if(MaxAddress<(address+linesize-1)) MaxAddress=(address+linesize-1);
-                       if(address<*Begin) *Begin=address;
-
-                       if((chksum%0x100)!=0)
-                       {
-                               printf("ERROR: Bad checksum in file %s\n", ihxFileName);
-                               fclose(filein);
-                               return -1;
-                       }
-               }
+                if(fgets(buffer, sizeof(buffer), filein)==NULL)
+                {
+                        printf("Error reading file '%s'\n", ihxFileName);
+                        break;
+                }
+        if(buffer[0]==':')
+        {
+                        linesize = GetByte(&buffer[1]);
+                        address = GetWord(&buffer[3]);
+                        recordtype = GetByte(&buffer[7]);
+                        rchksum = GetByte(&buffer[9]+(linesize*2));
+                        chksum=linesize+(address/0x100)+(address%0x100)+recordtype+rchksum;
+
+                        if (recordtype==1) break; /*End of record*/
+
+                        for(j=0; j<linesize; j++)
+                        {
+                                value=GetByte(&buffer[9]+(j*2));
+                                chksum+=value;
+                                ihxBuff[address+j]=value;
+                        }
+                        if(MaxAddress<(address+linesize-1)) MaxAddress=(address+linesize-1);
+                        if(address<*Begin) *Begin=address;
+
+                        if((chksum%0x100)!=0)
+                        {
+                                printf("ERROR: Bad checksum in file %s\n", ihxFileName);
+                                fclose(filein);
+                                return -1;
+                        }
+                }
     }
     fclose(filein);
-       
+
     return MaxAddress;
 }
 
 void CreateAOMF51(void)
 {
-       if((dflag) && (!rflag))
-       {
-               CollectInfoFromCDB();
-               #ifdef DODUMP
-               DumpForDebug();
-               #endif
-               HexSize=ReadHexFile(&HexBegin)+1;
-               OutputAOEMF51();
-               FreeAll();
-       }
+        if((dflag) && (!rflag))
+        {
+                CollectInfoFromCDB();
+                #ifdef DODUMP
+                DumpForDebug();
+                #endif
+                HexSize=ReadHexFile(&HexBegin)+1;
+                OutputAOEMF51();
+                FreeAll();
+        }
 }
index efd7246110f30c1d6dfedf83181f20c9b4715e1b..4f621616e6b152d5896897abbc8606751dacd96c 100644 (file)
@@ -1,13 +1,22 @@
-/* lkdata.c */
+/* lkdata.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH:
  *           - change s_id from [NCPS] to pointer (comment)
  * 31-Oct-97 JLH:
index 230c40baed3b2164a946968c21ea12971ffd57b8..433edbcd057a4ec403995a8059643bdda5f052a0 100644 (file)
-/* lkeval.c */
+/* lkeval.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include "aslink.h"
 
-/*)Module      lkeval.c
- *
- *     The module lkeval.c contains the routines to evaluate
- *     arithmetic/numerical expressions.  The functions in
- *     lkeval.c perform a recursive evaluation of the arithmetic
- *     expression read from the input text line.
- *     The expression may include binary/unary operators, brackets,
- *     symbols, labels, and constants in hexadecimal, decimal, octal
- *     and binary.  Arithmetic operations are prioritized and
- *     evaluated by normal arithmetic conventions.
- *
- *     lkeval.c contains the following functions:
- *             int     digit()
- *             Addr_T  eval()
- *             Addr_T  expr()
- *             int     oprio()
- *             Addr_T  term()
- *
- *     lkeval.c contains no local/static variables
+/*)Module       lkeval.c
+ *
+ *      The module lkeval.c contains the routines to evaluate
+ *      arithmetic/numerical expressions.  The functions in
+ *      lkeval.c perform a recursive evaluation of the arithmetic
+ *      expression read from the input text line.
+ *      The expression may include binary/unary operators, brackets,
+ *      symbols, labels, and constants in hexadecimal, decimal, octal
+ *      and binary.  Arithmetic operations are prioritized and
+ *      evaluated by normal arithmetic conventions.
+ *
+ *      lkeval.c contains the following functions:
+ *              int     digit()
+ *              Addr_T  eval()
+ *              Addr_T  expr()
+ *              int     oprio()
+ *              Addr_T  term()
+ *
+ *      lkeval.c contains no local/static variables
  */
 
-/*)Function    Addr_T  eval()
+/*)Function     Addr_T  eval()
  *
- *     The function eval() evaluates a character string to a
- *     numerical value.
+ *      The function eval() evaluates a character string to a
+ *      numerical value.
  *
- *     local variables:
- *             int     c               character from input string
- *             int     v               value of character in current radix
- *             Addr_T  n               evaluation value
+ *      local variables:
+ *              int     c               character from input string
+ *              int     v               value of character in current radix
+ *              Addr_T  n               evaluation value
  *
- *     global variables:
- *             int     radix           current number conversion radix
+ *      global variables:
+ *              int     radix           current number conversion radix
  *
- *     functions called:
- *             int     digit()         lkeval.c
- *             char    get()           lklex.c
- *             char    getnb()         lklex.c
- *             VOID    unget()         lklex.c
+ *      functions called:
+ *              int     digit()         lkeval.c
+ *              char    get()           lklex.c
+ *              char    getnb()         lklex.c
+ *              VOID    unget()         lklex.c
  *
- *     side effects:
- *             Input test is scanned and evaluated to a
- *             numerical value.
+ *      side effects:
+ *              Input test is scanned and evaluated to a
+ *              numerical value.
  */
 
 Addr_T
 eval()
 {
-       register int c, v;
-       register Addr_T n;
+        register int c, v;
+        register Addr_T n;
 
-       c = getnb();
-       n = 0;
-       while ((v = digit(c, radix)) >= 0) {
-               n = n*radix + v;
-               c = get();
-       }
-       unget(c);
-       return(n);
+        c = getnb();
+        n = 0;
+        while ((v = digit(c, radix)) >= 0) {
+                n = n*radix + v;
+                c = get();
+        }
+        unget(c);
+        return(n);
 }
 
-/*)Function    Addr_T  expr(n)
- *
- *             int     n               a firewall priority; all top
- *                                     level calls (from the user)
- *                                     should be made with n set to 0.
- *
- *     The function expr() evaluates an expression and
- *     returns the value.
- *
- *     local variables:
- *             int     c               current input text character
- *             int     p               current operator priority
- *             Addr_T  v               value returned by term()
- *             Addr_T  ve              value returned by a
- *                                     recursive call to expr()
- *
- *     global variables:
- *             char    ctype[]         array of character types, one per
- *                                     ASCII character
- *             int     lkerr           error flag
- *             FILE *  stderr          c_library
- *
- *     functions called:
- *             VOID    expr()          lkeval.c
- *             int     fprintf()       c_library
- *             int     getnb()         lklex.c
- *             int     oprio()         lkeval.c
- *             VOID    term()          lkeval.c
- *             VOID    unget()         lklex.c
- *
- *
- *     side effects:
- *             An expression is evaluated by scanning the input
- *             text string.
+/*)Function     Addr_T  expr(n)
+ *
+ *              int     n               a firewall priority; all top
+ *                                      level calls (from the user)
+ *                                      should be made with n set to 0.
+ *
+ *      The function expr() evaluates an expression and
+ *      returns the value.
+ *
+ *      local variables:
+ *              int     c               current input text character
+ *              int     p               current operator priority
+ *              Addr_T  v               value returned by term()
+ *              Addr_T  ve              value returned by a
+ *                                      recursive call to expr()
+ *
+ *      global variables:
+ *              char    ctype[]         array of character types, one per
+ *                                      ASCII character
+ *              int     lkerr           error flag
+ *              FILE *  stderr          c_library
+ *
+ *      functions called:
+ *              VOID    expr()          lkeval.c
+ *              int     fprintf()       c_library
+ *              int     getnb()         lklex.c
+ *              int     oprio()         lkeval.c
+ *              VOID    term()          lkeval.c
+ *              VOID    unget()         lklex.c
+ *
+ *
+ *      side effects:
+ *              An expression is evaluated by scanning the input
+ *              text string.
  */
 
 Addr_T
 expr (n)
 {
-       register int c, p;
-       register Addr_T v, ve;
+        register int c, p;
+        register Addr_T v, ve;
 
-       v = term();
-       while (ctype[c = getnb()] & BINOP) {
-               if ((p = oprio(c)) <= n)
-                       break;
-               if ((c == '>' || c == '<') && c != get()) {
-                       fprintf(stderr, "Invalid expression");
-                       lkerr++;
-                       return(v);
-               }
-               ve = expr(p);
-               if (c == '+') {
-                       v += ve;
-               } else
-               if (c == '-') {
-                       v -= ve;
-               } else {
-                       switch (c) {
+        v = term();
+        while (ctype[c = getnb()] & BINOP) {
+                if ((p = oprio(c)) <= n)
+                        break;
+                if ((c == '>' || c == '<') && c != get()) {
+                        fprintf(stderr, "Invalid expression");
+                        lkerr++;
+                        return(v);
+                }
+                ve = expr(p);
+                if (c == '+') {
+                        v += ve;
+                } else
+                if (c == '-') {
+                        v -= ve;
+                } else {
+                        switch (c) {
 
-                       case '*':
-                               v *= ve;
-                               break;
+                        case '*':
+                                v *= ve;
+                                break;
 
-                       case '/':
-                               v /= ve;
-                               break;
+                        case '/':
+                                v /= ve;
+                                break;
 
-                       case '&':
-                               v &= ve;
-                               break;
+                        case '&':
+                                v &= ve;
+                                break;
 
-                       case '|':
-                               v |= ve;
-                               break;
+                        case '|':
+                                v |= ve;
+                                break;
 
-                       case '%':
-                               v %= ve;
-                               break;
+                        case '%':
+                                v %= ve;
+                                break;
 
-                       case '^':
-                               v ^= ve;
-                               break;
+                        case '^':
+                                v ^= ve;
+                                break;
 
-                       case '<':
-                               v <<= ve;
-                               break;
+                        case '<':
+                                v <<= ve;
+                                break;
 
-                       case '>':
-                               v >>= ve;
-                               break;
-                       }
-               }
-       }
-       unget(c);
-       return(v);
+                        case '>':
+                                v >>= ve;
+                                break;
+                        }
+                }
+        }
+        unget(c);
+        return(v);
 }
 
-/*)Function    Addr_T  term()
- *
- *     The function term() evaluates a single constant
- *     or symbol value prefaced by any unary operator
- *     ( +, -, ~, ', ", >, or < ).
- *
- *     local variables:
- *             int     c               current character
- *             char    id[]            symbol name
- *             int     n               value of digit in current radix
- *             int     r               current evaluation radix
- *             sym *   sp              pointer to a sym structure
- *             Addr_T  v               evaluation value
- *
- *     global variables:
- *             char    ctype[]         array of character types, one per
- *                                     ASCII character
- *             int     lkerr           error flag
- *
- *     functions called:
- *             int     digit()         lkeval.c
- *             VOID    expr()          lkeval.c
- *             int     fprintf()       c_library
- *             int     get()           lklex.c
- *             VOID    getid()         lklex.c
- *             int     getmap()        lklex.c
- *             int     getnb()         lklex.c
- *             sym *   lkpsym()        lksym.c
- *             Addr_T  symval()        lksym.c
- *             VOID    unget()         lklex.c
- *
- *     side effects:
- *             An arithmetic term is evaluated by scanning input text.
+/*)Function     Addr_T  term()
+ *
+ *      The function term() evaluates a single constant
+ *      or symbol value prefaced by any unary operator
+ *      ( +, -, ~, ', ", >, or < ).
+ *
+ *      local variables:
+ *              int     c               current character
+ *              char    id[]            symbol name
+ *              int     n               value of digit in current radix
+ *              int     r               current evaluation radix
+ *              sym *   sp              pointer to a sym structure
+ *              Addr_T  v               evaluation value
+ *
+ *      global variables:
+ *              char    ctype[]         array of character types, one per
+ *                                      ASCII character
+ *              int     lkerr           error flag
+ *
+ *      functions called:
+ *              int     digit()         lkeval.c
+ *              VOID    expr()          lkeval.c
+ *              int     fprintf()       c_library
+ *              int     get()           lklex.c
+ *              VOID    getid()         lklex.c
+ *              int     getmap()        lklex.c
+ *              int     getnb()         lklex.c
+ *              sym *   lkpsym()        lksym.c
+ *              Addr_T  symval()        lksym.c
+ *              VOID    unget()         lklex.c
+ *
+ *      side effects:
+ *              An arithmetic term is evaluated by scanning input text.
  */
 
 Addr_T
 term()
 {
-       register int c, r, n;
-       register Addr_T v;
-       struct sym *sp;
-       char id[NCPS];
+        register int c, r, n;
+        register Addr_T v;
+        struct sym *sp;
+        char id[NCPS];
 
-       c = getnb();
-       if (c == '#') { c = getnb(); }
-       if (c == '(') {
-               v = expr(0);
-               if (getnb() != ')') {
-                       fprintf(stderr, "Missing delimiter");
-                       lkerr++;
-               }
-               return(v);
-       }
-       if (c == '-') {
-               return(0-expr(100));
-       }
-       if (c == '~') {
-               return(~expr(100));
-       }
-       if (c == '\'') {
-               return(getmap(-1)&0377);
-       }
-       if (c == '\"') {
-               if (hilo) {
-                       v  = (getmap(-1)&0377)<<8;
-                       v |=  getmap(-1)&0377;
-               } else {
-                       v  =  getmap(-1)&0377;
-                       v |= (getmap(-1)&0377)<<8;
-               }
-               return(v);
-       }
-       if (c == '>' || c == '<') {
-               v = expr(100);
-               if (c == '>')
-                       v >>= 8;
-               return(v&0377);
-       }
-       if (ctype[c] & DIGIT) {
-               r = 10;
-               if (c == '0') {
-                       c = get();
-                       switch (c) {
-                       case 'b':
-                       case 'B':
-                               r = 2;
-                               c = get();
-                               break;
-                       case '@':
-                       case 'o':
-                       case 'O':
-                       case 'q':
-                       case 'Q':
-                               r = 8;
-                               c = get();
-                               break;
-                       case 'd':
-                       case 'D':
-                               r = 10;
-                               c = get();
-                               break;
-                       case 'h':
-                       case 'H':
-                       case 'x':
-                       case 'X':
-                               r = 16;
-                               c = get();
-                               break;
-                       default:
-                               break;
-                       }
-               }
-               v = 0;
-               while ((n = digit(c, r)) >= 0) {
-                       v = r*v + n;
-                       c = get();
-               }
-               unget(c);
-               return(v);
-       }
-       if (ctype[c] & LETTER) {
-               getid(id, c);
-               if ((sp = lkpsym(id, 0)) == NULL) {
-                       fprintf(stderr, "Undefined symbol %8s\n", id);
-                       lkerr++;
-                       return(0);
-               } else {
-                       return(symval(sp));
-               }
-       }
-       /* Shouldn't get here. */
-       return(0);
+        c = getnb();
+        if (c == '#') { c = getnb(); }
+        if (c == '(') {
+                v = expr(0);
+                if (getnb() != ')') {
+                        fprintf(stderr, "Missing delimiter");
+                        lkerr++;
+                }
+                return(v);
+        }
+        if (c == '-') {
+                return(0-expr(100));
+        }
+        if (c == '~') {
+                return(~expr(100));
+        }
+        if (c == '\'') {
+                return(getmap(-1)&0377);
+        }
+        if (c == '\"') {
+                if (hilo) {
+                        v  = (getmap(-1)&0377)<<8;
+                        v |=  getmap(-1)&0377;
+                } else {
+                        v  =  getmap(-1)&0377;
+                        v |= (getmap(-1)&0377)<<8;
+                }
+                return(v);
+        }
+        if (c == '>' || c == '<') {
+                v = expr(100);
+                if (c == '>')
+                        v >>= 8;
+                return(v&0377);
+        }
+        if (ctype[c] & DIGIT) {
+                r = 10;
+                if (c == '0') {
+                        c = get();
+                        switch (c) {
+                        case 'b':
+                        case 'B':
+                                r = 2;
+                                c = get();
+                                break;
+                        case '@':
+                        case 'o':
+                        case 'O':
+                        case 'q':
+                        case 'Q':
+                                r = 8;
+                                c = get();
+                                break;
+                        case 'd':
+                        case 'D':
+                                r = 10;
+                                c = get();
+                                break;
+                        case 'h':
+                        case 'H':
+                        case 'x':
+                        case 'X':
+                                r = 16;
+                                c = get();
+                                break;
+                        default:
+                                break;
+                        }
+                }
+                v = 0;
+                while ((n = digit(c, r)) >= 0) {
+                        v = r*v + n;
+                        c = get();
+                }
+                unget(c);
+                return(v);
+        }
+        if (ctype[c] & LETTER) {
+                getid(id, c);
+                if ((sp = lkpsym(id, 0)) == NULL) {
+                        fprintf(stderr, "Undefined symbol %8s\n", id);
+                        lkerr++;
+                        return(0);
+                } else {
+                        return(symval(sp));
+                }
+        }
+        /* Shouldn't get here. */
+        return(0);
 }
 
-/*)Function    int     digit(c, r)
+/*)Function     int     digit(c, r)
  *
- *             int     c               digit character
- *             int     r               current radix
+ *              int     c               digit character
+ *              int     r               current radix
  *
- *     The function digit() returns the value of c
- *     in the current radix r.  If the c value is not
- *     a number of the current radix then a -1 is returned.
+ *      The function digit() returns the value of c
+ *      in the current radix r.  If the c value is not
+ *      a number of the current radix then a -1 is returned.
  *
- *     local variables:
- *             none
+ *      local variables:
+ *              none
  *
- *     global variables:
- *             char    ctype[]         array of character types, one per
- *                                     ASCII character
+ *      global variables:
+ *              char    ctype[]         array of character types, one per
+ *                                      ASCII character
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  */
 
 int
 digit(c, r)
 register int c, r;
 {
-       if (r == 16) {
-               if (ctype[c] & RAD16) {
-                       if (c >= 'A' && c <= 'F')
-                               return (c - 'A' + 10);
-                       if (c >= 'a' && c <= 'f')
-                               return (c - 'a' + 10);
-                       return (c - '0');
-               }
-       } else
-       if (r == 10) {
-               if (ctype[c] & RAD10)
-                       return (c - '0');
-       } else
-       if (r == 8) {
-               if (ctype[c] & RAD8)
-                       return (c - '0');
-       } else
-       if (r == 2) {
-               if (ctype[c] & RAD2)
-                       return (c - '0');
-       }
-       return (-1);
+        if (r == 16) {
+                if (ctype[c] & RAD16) {
+                        if (c >= 'A' && c <= 'F')
+                                return (c - 'A' + 10);
+                        if (c >= 'a' && c <= 'f')
+                                return (c - 'a' + 10);
+                        return (c - '0');
+                }
+        } else
+        if (r == 10) {
+                if (ctype[c] & RAD10)
+                        return (c - '0');
+        } else
+        if (r == 8) {
+                if (ctype[c] & RAD8)
+                        return (c - '0');
+        } else
+        if (r == 2) {
+                if (ctype[c] & RAD2)
+                        return (c - '0');
+        }
+        return (-1);
 }
 
-/*)Function    int     oprio(c)
+/*)Function     int     oprio(c)
  *
- *             int     c               operator character
+ *              int     c               operator character
  *
- *     The function oprio() returns a relative priority
- *     for all valid unary and binary operators.
+ *      The function oprio() returns a relative priority
+ *      for all valid unary and binary operators.
  *
- *     local variables:
- *             none
+ *      local variables:
+ *              none
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  */
+
 int
 oprio(c)
 register int c;
 {
-       if (c == '*' || c == '/' || c == '%')
-               return (10);
-       if (c == '+' || c == '-')
-               return (7);
-       if (c == '<' || c == '>')
-               return (5);
-       if (c == '^')
-               return (4);
-       if (c == '&')
-               return (3);
-       if (c == '|')
-               return (1);
-       return (0);
+        if (c == '*' || c == '/' || c == '%')
+                return (10);
+        if (c == '+' || c == '-')
+                return (7);
+        if (c == '<' || c == '>')
+                return (5);
+        if (c == '^')
+                return (4);
+        if (c == '&')
+                return (3);
+        if (c == '|')
+                return (1);
+        return (0);
 }
index b9c5541a8c6fd0f247e1cb81604c4c6676530a26..0dd2f5d86ea37d21156282bb05632bc6ff64783c 100644 (file)
@@ -1,65 +1,72 @@
-/* lkhead.c */
+/* lkhead.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include "aslink.h"
 
-/*Module       lkhead.c
+/*Module        lkhead.c
  *
- *     The module lkhead.c contains the function newhead() which
- *     creates a head structure and the function module() which
- *     loads the module name into the current head structure.
+ *      The module lkhead.c contains the function newhead() which
+ *      creates a head structure and the function module() which
+ *      loads the module name into the current head structure.
  *
- *     lkhead.c contains the following functions:
- *             VOID    newhead()
- *             VOID    module()
+ *      lkhead.c contains the following functions:
+ *              VOID    newhead()
+ *              VOID    module()
  *
- *     lkhead.c contains no local variables.
+ *      lkhead.c contains no local variables.
  */
 
-/*)Function    VOID    newhead()
- *
- *     The function newhead() creates a head structure.  All head
- *     structures are linked to form a linked list of head structures
- *     with the current head structure at the tail of the list.
- *
- *     local variables:
- *             int     i               evaluation value
- *             head *  thp             temporary pointer
- *                                     to a header structure
- *
- *     global variables:
- *             area    *ap             Pointer to the current
- *                                     area structure
- *             lfile   *cfp            The pointer *cfp points to the
- *                                     current lfile structure
- *             head    *headp          The pointer to the first
- *                                     head structure of a linked list
- *             head    *hp             Pointer to the current
- *                                     head structure
- *
- *     functions called:
- *             Addr_T  expr()          lkeval.c
- *             VOID *  new()           lksym.c
- *             VOID    lkparea()       lkarea.c
- *
- *     side effects:
- *             A new head structure is created and linked to any
- *             existing linked head structure.  The head structure
- *             parameters of file handle, number of areas, and number
- *             of global symbols are loaded into the structure.
- *             The default area "_abs_" is created when the first
- *             head structure is created and an areax structure is
- *             created for every head structure called.
+/*)Function     VOID    newhead()
+ *
+ *      The function newhead() creates a head structure.  All head
+ *      structures are linked to form a linked list of head structures
+ *      with the current head structure at the tail of the list.
+ *
+ *      local variables:
+ *              int     i               evaluation value
+ *              head *  thp             temporary pointer
+ *                                      to a header structure
+ *
+ *      global variables:
+ *              area    *ap             Pointer to the current
+ *                                      area structure
+ *              lfile   *cfp            The pointer *cfp points to the
+ *                                      current lfile structure
+ *              head    *headp          The pointer to the first
+ *                                      head structure of a linked list
+ *              head    *hp             Pointer to the current
+ *                                      head structure
+ *
+ *      functions called:
+ *              Addr_T  expr()          lkeval.c
+ *              VOID *  new()           lksym.c
+ *              VOID    lkparea()       lkarea.c
+ *
+ *      side effects:
+ *              A new head structure is created and linked to any
+ *              existing linked head structure.  The head structure
+ *              parameters of file handle, number of areas, and number
+ *              of global symbols are loaded into the structure.
+ *              The default area "_abs_" is created when the first
+ *              head structure is created and an areax structure is
+ *              created for every head structure called.
  */
 
 /*
 VOID
 newhead()
 {
-       register int i;
-       struct head *thp;
+        register int i;
+        struct head *thp;
 
-       hp = (struct head *) new (sizeof(struct head));
-       if (headp == NULL) {
-               headp = hp;
-       } else {
-               thp = headp;
-               while (thp->h_hp)
-                       thp = thp->h_hp;
-               thp->h_hp = hp;
-       }
-       /*
-        * Set file pointer
-        */
-       hp->h_lfile = cfp;
-       /*
-        * Evaluate and build Area pointer list
-        */
-       i = hp->h_narea = eval();
-       if (i)
-               hp->a_list = (struct areax **) new (i*sizeof(struct areax *));
-       /*
-        * Evaluate and build Global symbol pointer list
-        */
-       skip(-1);
-       i = hp->h_nglob = eval();
-       if (i)
-               hp->s_list = (struct sym **) new (i*sizeof(struct sym *));
-       /*
-        * Setup Absolute DEF linkage.
-        */
-       lkparea(_abs_);
-       ap->a_flag = A_ABS;
+        hp = (struct head *) new (sizeof(struct head));
+        if (headp == NULL) {
+                headp = hp;
+        } else {
+                thp = headp;
+                while (thp->h_hp)
+                        thp = thp->h_hp;
+                thp->h_hp = hp;
+        }
+        /*
+         * Set file pointer
+         */
+        hp->h_lfile = cfp;
+        /*
+         * Evaluate and build Area pointer list
+         */
+        i = hp->h_narea = eval();
+        if (i)
+                hp->a_list = (struct areax **) new (i*sizeof(struct areax *));
+        /*
+         * Evaluate and build Global symbol pointer list
+         */
+        skip(-1);
+        i = hp->h_nglob = eval();
+        if (i)
+                hp->s_list = (struct sym **) new (i*sizeof(struct sym *));
+        /*
+         * Setup Absolute DEF linkage.
+         */
+        lkparea(_abs_);
+        ap->a_flag = A_ABS;
     axp->a_addr = 0;
 }
 
-/*)Function    VOID    module()
+/*)Function     VOID    module()
  *
- *     The function module() copies the module name into
- *     the current head structure.
+ *      The function module() copies the module name into
+ *      the current head structure.
  *
- *     local variables:
- *             char    id[]            module id string
+ *      local variables:
+ *              char    id[]            module id string
  *
- *     global variables:
- *             head    *headp          The pointer to the first
- *                                     head structure of a linked list
- *             head    *hp             Pointer to the current
- *                                     head structure
- *             int     lkerr           error flag
- *             FILE *  stderr          c_library
+ *      global variables:
+ *              head    *headp          The pointer to the first
+ *                                      head structure of a linked list
+ *              head    *hp             Pointer to the current
+ *                                      head structure
+ *              int     lkerr           error flag
+ *              FILE *  stderr          c_library
  *
- *     functions called:
- *             int     fprintf()       c_library
- *             VOID    getid()         lklex.c
- *             char *  strncpy()       c_library
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              VOID    getid()         lklex.c
+ *              char *  strncpy()       c_library
  *
- *     side effects:
- *             The module name is copied into the head structure.
+ *      side effects:
+ *              The module name is copied into the head structure.
  */
 
 /*
@@ -142,13 +149,13 @@ newhead()
 VOID
 module()
 {
-       char id[NCPS];
+        char id[NCPS];
 
-       if (headp) {
-               getid(id, -1);
-               strncpy(hp->m_id, id, NCPS);
-       } else {
-               fprintf(stderr, "No header defined\n");
-               lkerr++;
-       }
+        if (headp) {
+                getid(id, -1);
+                strncpy(hp->m_id, id, NCPS);
+        } else {
+                fprintf(stderr, "No header defined\n");
+                lkerr++;
+        }
 }
index 67c297a1dcda2df8661306ae00ae0007d2a312ef..8d373a9f72e9bff5e57f1eb7d914ebdefd0953a1 100644 (file)
@@ -1,78 +1,85 @@
-/* lklex.c */
+/* lklex.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include "aslink.h"
 
-/*)Module      lklex.c
- *
- *     The module lklex.c contains the general lexical analysis
- *     functions used to scan the text lines from the .rel files.
- *
- *     lklex.c contains the fllowing functions:
- *             char    endline()
- *             char    get()
- *             VOID    getfid()
- *             VOID    getid()
- *             VOID    getSid()
- *             int     lk_getline()
- *             int     getmap()
- *             char    getnb()
- *             int     more()
- *             VOID    skip()
- *             VOID    unget()
- *
- *     lklex.c contains no local variables.
+/*)Module       lklex.c
+ *
+ *      The module lklex.c contains the general lexical analysis
+ *      functions used to scan the text lines from the .rel files.
+ *
+ *      lklex.c contains the fllowing functions:
+ *              char    endline()
+ *              char    get()
+ *              VOID    getfid()
+ *              VOID    getid()
+ *              VOID    getSid()
+ *              int     lk_getline()
+ *              int     getmap()
+ *              char    getnb()
+ *              int     more()
+ *              VOID    skip()
+ *              VOID    unget()
+ *
+ *      lklex.c contains no local variables.
  */
 
-/*)Function    VOID    getid(id,c)
- *
- *             char *  id              a pointer to a string of
- *                                     maximum length NCPS
- *             int     c               mode flag
- *                                     >=0     this is first character to
- *                                             copy to the string buffer
- *                                     <0      skip white space
- *
- *     The function getid() scans the current input text line
- *     from the current position copying the next LETTER | DIGIT string
- *     into the external string buffer (id).  The string ends when a non
- *     LETTER or DIGIT character is found. The maximum number of
- *     characters copied is NCPS.  If the input string is larger than
- *     NCPS characters then the string is truncated, if the input string
- *     is shorter than NCPS characters then the string is NULL filled.
- *     If the mode argument (c) is >=0 then (c) is the first character
- *     copied to the string buffer, if (c) is <0 then intervening white
- *     space (SPACES and TABS) are skipped.
- *
- *     local variables:
- *             char *  p               pointer to external string buffer
- *             int     c               current character value
- *
- *     global variables:
- *             char    ctype[]         a character array which defines the
- *                                     type of character being processed.
- *                                     This index is the character
- *                                     being processed.
- *
- *     called functions:
- *             char    get()           lklex.c
- *             char    getnb()         lklex.c
- *             VOID    unget()         lklex.c
- *
- *     side effects:
- *             use of getnb(), get(), and unget() updates the
- *             global pointer ip the position in the current
- *             input text line.
+/*)Function     VOID    getid(id,c)
+ *
+ *              char *  id              a pointer to a string of
+ *                                      maximum length NCPS
+ *              int     c               mode flag
+ *                                      >=0     this is first character to
+ *                                              copy to the string buffer
+ *                                      <0      skip white space
+ *
+ *      The function getid() scans the current input text line
+ *      from the current position copying the next LETTER | DIGIT string
+ *      into the external string buffer (id).  The string ends when a non
+ *      LETTER or DIGIT character is found. The maximum number of
+ *      characters copied is NCPS.  If the input string is larger than
+ *      NCPS characters then the string is truncated, if the input string
+ *      is shorter than NCPS characters then the string is NULL filled.
+ *      If the mode argument (c) is >=0 then (c) is the first character
+ *      copied to the string buffer, if (c) is <0 then intervening white
+ *      space (SPACES and TABS) are skipped.
+ *
+ *      local variables:
+ *              char *  p               pointer to external string buffer
+ *              int     c               current character value
+ *
+ *      global variables:
+ *              char    ctype[]         a character array which defines the
+ *                                      type of character being processed.
+ *                                      This index is the character
+ *                                      being processed.
+ *
+ *      called functions:
+ *              char    get()           lklex.c
+ *              char    getnb()         lklex.c
+ *              VOID    unget()         lklex.c
+ *
+ *      side effects:
+ *              use of getnb(), get(), and unget() updates the
+ *              global pointer ip the position in the current
+ *              input text line.
  */
 
 VOID
@@ -80,556 +87,556 @@ getid(id, c)
 register int c;
 char *id;
 {
-       register char *p;
-
-       if (c < 0) {
-               c = getnb();
-       }
-       p = id;
-       do {
-               if (p < &id[NCPS])
-                       *p++ = c;
-       } while (ctype[c=get()] & (LETTER|DIGIT));
-       unget(c);
-       while (p < &id[NCPS])
-               *p++ = 0;
+        register char *p;
+
+        if (c < 0) {
+                c = getnb();
+        }
+        p = id;
+        do {
+                if (p < &id[NCPS])
+                        *p++ = c;
+        } while (ctype[c=get()] & (LETTER|DIGIT));
+        unget(c);
+        while (p < &id[NCPS])
+                *p++ = 0;
 }
 
-/*)Function    VOID    getSid (char *id)
+/*)Function     VOID    getSid (char *id)
  *
- *             char *  id              a pointer to a string of
- *                                     maximum length NCPS
+ *              char *  id              a pointer to a string of
+ *                                      maximum length NCPS
  *
  *  getSid is derived from getid. It is called from newsym()
  *  in lksym.c, when an S-record has to be scanned. getSid accepts
  *  much more characters than getid, which is necessary for SDCC.
  *
- *     The function getSid() scans the current input text line
- *     from the current position copying the next string
- *     into the external string buffer (id).  The string ends when a space
+ *      The function getSid() scans the current input text line
+ *      from the current position copying the next string
+ *      into the external string buffer (id).  The string ends when a space
  *  character (space, tab, \0) is found. The maximum number of
- *     characters copied is NCPS.  If the input string is larger than
- *     NCPS characters then the string is truncated, if the input string
- *     is shorter than NCPS characters then the string is NULL filled.
- *     Intervening white space (SPACES and TABS) are skipped.
- *
- *     local variables:
- *             char *  p               pointer to external string buffer
- *             int     c               current character value
- *
- *     global variables:
- *             char    ctype[]         a character array which defines the
- *                                     type of character being processed.
- *                                     This index is the character
- *                                     being processed.
- *
- *     called functions:
- *             char    get()           lklex.c
- *             char    getnb()         lklex.c
- *             VOID    unget()         lklex.c
- *
- *     side effects:
- *             use of getnb(), get(), and unget() updates the
- *             global pointer ip the position in the current
- *             input text line.
+ *      characters copied is NCPS.  If the input string is larger than
+ *      NCPS characters then the string is truncated, if the input string
+ *      is shorter than NCPS characters then the string is NULL filled.
+ *      Intervening white space (SPACES and TABS) are skipped.
+ *
+ *      local variables:
+ *              char *  p               pointer to external string buffer
+ *              int     c               current character value
+ *
+ *      global variables:
+ *              char    ctype[]         a character array which defines the
+ *                                      type of character being processed.
+ *                                      This index is the character
+ *                                      being processed.
+ *
+ *      called functions:
+ *              char    get()           lklex.c
+ *              char    getnb()         lklex.c
+ *              VOID    unget()         lklex.c
+ *
+ *      side effects:
+ *              use of getnb(), get(), and unget() updates the
+ *              global pointer ip the position in the current
+ *              input text line.
  */
 
 VOID
 getSid (char *id)
 {
-       register int c;
-       register char *p;
-
-       c = getnb();
-       p = id;
-       do {
-               if (p < &id[NCPS])
-                       *p++ = c;
-               c = get();
-       } while (c != '\0' && c != ' ' && c != '\t');
-       unget(c);
-       while (p < &id[NCPS])
-               *p++ = 0;
+        register int c;
+        register char *p;
+
+        c = getnb();
+        p = id;
+        do {
+                if (p < &id[NCPS])
+                        *p++ = c;
+                c = get();
+        } while (c != '\0' && c != ' ' && c != '\t');
+        unget(c);
+        while (p < &id[NCPS])
+                *p++ = 0;
 }
 
-/*)Function    VOID    getfid(fid,c)
- *
- *             char *  str             a pointer to a string of
- *                                     maximum length PATH_MAX
- *             int     c               this is first character to
- *                                     copy to the string buffer
- *
- *     The function getfid() scans the current input text line from
- *     the current position copying the next string into the external
- *     string buffer (str).  The string ends when end of line is found.
- *     Trailing spaces are removed. The maximum number of characters
- *     copied is PATH_MAX. If the input string is larger than PATH_MAX
- *     characters then the string is truncated. The string is NULL
- *     terminated.
- *
- *     local variables:
- *             char *  p               pointer to external string buffer
- *             int     c               current character value
- *
- *     global variables:
- *             char    ctype[]         a character array which defines the
- *                                     type of character being processed.
- *                                     This index is the character
- *                                     being processed.
- *
- *     called functions:
- *             char    get()           lklex.c
- *
- *     side effects:
- *             use of get() updates the global pointer ip
- *             the position in the current input text line.
+/*)Function     VOID    getfid(fid,c)
+ *
+ *              char *  str             a pointer to a string of
+ *                                      maximum length PATH_MAX
+ *              int     c               this is first character to
+ *                                      copy to the string buffer
+ *
+ *      The function getfid() scans the current input text line from
+ *      the current position copying the next string into the external
+ *      string buffer (str).  The string ends when end of line is found.
+ *      Trailing spaces are removed. The maximum number of characters
+ *      copied is PATH_MAX. If the input string is larger than PATH_MAX
+ *      characters then the string is truncated. The string is NULL
+ *      terminated.
+ *
+ *      local variables:
+ *              char *  p               pointer to external string buffer
+ *              int     c               current character value
+ *
+ *      global variables:
+ *              char    ctype[]         a character array which defines the
+ *                                      type of character being processed.
+ *                                      This index is the character
+ *                                      being processed.
+ *
+ *      called functions:
+ *              char    get()           lklex.c
+ *
+ *      side effects:
+ *              use of get() updates the global pointer ip
+ *              the position in the current input text line.
  */
 
 VOID
 getfid(char *str, register int c)
 {
-       register char *p;
-
-       p = str;
-       do
-       {
-               if (p < &str[PATH_MAX-1])
-                       *p++ = c;
-               c = get();
-               if (c == ';')
-                       while (c)
-                               c = get();
-       } while (c);
-       /* trim trailing spaces */
-       --p;
-       while (p >= str && ctype[(int)*p] == SPACE)
-               --p;
-       /* terminate the string */
-       *(++p) = '\0';
+        register char *p;
+
+        p = str;
+        do
+        {
+                if (p < &str[PATH_MAX-1])
+                        *p++ = c;
+                c = get();
+                if (c == ';')
+                        while (c)
+                                c = get();
+        } while (c);
+        /* trim trailing spaces */
+        --p;
+        while (p >= str && ctype[(int)*p] == SPACE)
+                --p;
+        /* terminate the string */
+        *(++p) = '\0';
 }
 
-/*)Function    char    getnb()
+/*)Function     char    getnb()
  *
- *     The function getnb() scans the current input text
- *     line returning the first character not a SPACE or TAB.
+ *      The function getnb() scans the current input text
+ *      line returning the first character not a SPACE or TAB.
  *
- *     local variables:
- *             int     c               current character from input
+ *      local variables:
+ *              int     c               current character from input
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     called functions:
- *             char    get()           lklex.c
+ *      called functions:
+ *              char    get()           lklex.c
  *
- *     side effects:
- *             use of get() updates the global pointer ip, the position
- *             in the current input text line
+ *      side effects:
+ *              use of get() updates the global pointer ip, the position
+ *              in the current input text line
  */
 
 char
 getnb()
 {
-       register int c;
+        register int c;
 
-       while ((c=get())==' ' || c=='\t')
-               ;
-       return (c);
+        while ((c=get())==' ' || c=='\t')
+                ;
+        return (c);
 }
 
-/*)Function    VOID    skip()
+/*)Function     VOID    skip()
  *
- *     The function skip() scans the input text skipping all
- *     letters and digits.
+ *      The function skip() scans the input text skipping all
+ *      letters and digits.
  *
- *     local variables:
- *             none
+ *      local variables:
+ *              none
  *
- *     global variables:
- *             char    ctype[]         array of character types, one per
- *                                     ASCII character
+ *      global variables:
+ *              char    ctype[]         array of character types, one per
+ *                                      ASCII character
  *
- *     functions called:
- *             char    get()           lklex.c
- *             char    getnb()         lklex.c
- *             VOID    unget()         lklex.c
+ *      functions called:
+ *              char    get()           lklex.c
+ *              char    getnb()         lklex.c
+ *              VOID    unget()         lklex.c
  *
- *     side effects:
- *             Input letters and digits are skipped.
+ *      side effects:
+ *              Input letters and digits are skipped.
  */
 
 VOID
 skip(register int c)
 {
-       if (c < 0)
-               c = getnb();
-       while (ctype[c=get()] & (LETTER|DIGIT)) { ; }
-       unget(c);
+        if (c < 0)
+                c = getnb();
+        while (ctype[c=get()] & (LETTER|DIGIT)) { ; }
+        unget(c);
 }
 
-/*)Function    char    get()
+/*)Function     char    get()
  *
- *     The function get() returns the next character in the
- *     input text line, at the end of the line a
- *     NULL character is returned.
+ *      The function get() returns the next character in the
+ *      input text line, at the end of the line a
+ *      NULL character is returned.
  *
- *     local variables:
- *             int     c               current character from
- *                                     input text line
+ *      local variables:
+ *              int     c               current character from
+ *                                      input text line
  *
- *     global variables:
- *             char *  ip              pointer into the current
- *                                     input text line
+ *      global variables:
+ *              char *  ip              pointer into the current
+ *                                      input text line
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             updates ip to the next character position in the
- *             input text line.  If ip is at the end of the
- *             line, ip is not updated.
+ *      side effects:
+ *              updates ip to the next character position in the
+ *              input text line.  If ip is at the end of the
+ *              line, ip is not updated.
  */
 
 char
 get()
 {
-       register int c;
+        register int c;
 
-       if ((c = *ip) != 0)
-               ++ip;
-       return (c);
+        if ((c = *ip) != 0)
+                ++ip;
+        return (c);
 }
 
-/*)Function    VOID    unget(c)
+/*)Function     VOID    unget(c)
  *
- *             int     c               value of last character
- *                                     read from input text line
+ *              int     c               value of last character
+ *                                      read from input text line
  *
- *     If (c) is not a NULL character then the global pointer ip
- *     is updated to point to the preceeding character in the
- *     input text line.
+ *      If (c) is not a NULL character then the global pointer ip
+ *      is updated to point to the preceeding character in the
+ *      input text line.
  *
- *     NOTE:   This function does not push the character (c)
- *             back into the input text line, only
- *             the pointer ip is changed.
+ *      NOTE:   This function does not push the character (c)
+ *              back into the input text line, only
+ *              the pointer ip is changed.
  *
- *     local variables:
- *             int     c               last character read
- *                                     from input text line
+ *      local variables:
+ *              int     c               last character read
+ *                                      from input text line
  *
- *     global variables:
- *             char *  ip              position into the current
- *                                     input text line
+ *      global variables:
+ *              char *  ip              position into the current
+ *                                      input text line
  *
- *     called functions:
- *             none
+ *      called functions:
+ *              none
  *
- *     side effects:
- *             ip decremented by 1 character position
+ *      side effects:
+ *              ip decremented by 1 character position
  */
 
 VOID
 unget(int c)
 {
-       if (c != 0)
-               --ip;
+        if (c != 0)
+                --ip;
 }
 
-/*)Function    int     getmap(d)
+/*)Function     int     getmap(d)
  *
- *             int     d               value to compare with the
- *                                     input text line character
+ *              int     d               value to compare with the
+ *                                      input text line character
  *
- *     The function getmap() converts the 'C' style characters \b, \f,
- *     \n, \r, and \t to their equivalent ascii values and also
- *     converts 'C' style octal constants '\123' to their equivalent
- *     numeric values.  If the first character is equivalent to (d) then
- *     a (-1) is returned, if the end of the line is detected then
- *     a 'q' error terminates the parse for this line, or if the first
- *     character is not a \ then the character value is returned.
+ *      The function getmap() converts the 'C' style characters \b, \f,
+ *      \n, \r, and \t to their equivalent ascii values and also
+ *      converts 'C' style octal constants '\123' to their equivalent
+ *      numeric values.  If the first character is equivalent to (d) then
+ *      a (-1) is returned, if the end of the line is detected then
+ *      a 'q' error terminates the parse for this line, or if the first
+ *      character is not a \ then the character value is returned.
  *
- *     local variables:
- *             int     c               value of character
- *                                     from input text line
- *             int     n               looping counter
- *             int     v               current value of numeric conversion
+ *      local variables:
+ *              int     c               value of character
+ *                                      from input text line
+ *              int     n               looping counter
+ *              int     v               current value of numeric conversion
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     called functions:
- *             char    get()           lklex.c
- *             VOID    unget()         lklex.c
+ *      called functions:
+ *              char    get()           lklex.c
+ *              VOID    unget()         lklex.c
  *
- *     side effects:
- *             use of get() updates the global pointer ip the position
- *             in the current input text line
+ *      side effects:
+ *              use of get() updates the global pointer ip the position
+ *              in the current input text line
  */
 
 int
 getmap(int d)
 {
-       register int c, n, v;
-
-       if ((c = get()) == '\0')
-               return (-1);
-       if (c == d)
-               return (-1);
-       if (c == '\\') {
-               c = get();
-               switch (c) {
-
-               case 'b':
-                       c = '\b';
-                       break;
-
-               case 'f':
-                       c = '\f';
-                       break;
-
-               case 'n':
-                       c = '\n';
-                       break;
-
-               case 'r':
-                       c = '\r';
-                       break;
-
-               case 't':
-                       c = '\t';
-                       break;
-
-               case '0':
-               case '1':
-               case '2':
-               case '3':
-               case '4':
-               case '5':
-               case '6':
-               case '7':
-                       n = 0;
-                       v = 0;
-                       while (++n<=3 && c>='0' && c<='7') {
-                               v = (v<<3) + c - '0';
-                               c = get();
-                       }
-                       unget(c);
-                       c = v;
-                       break;
-               }
-       }
-       return (c);
+        register int c, n, v;
+
+        if ((c = get()) == '\0')
+                return (-1);
+        if (c == d)
+                return (-1);
+        if (c == '\\') {
+                c = get();
+                switch (c) {
+
+                case 'b':
+                        c = '\b';
+                        break;
+
+                case 'f':
+                        c = '\f';
+                        break;
+
+                case 'n':
+                        c = '\n';
+                        break;
+
+                case 'r':
+                        c = '\r';
+                        break;
+
+                case 't':
+                        c = '\t';
+                        break;
+
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                        n = 0;
+                        v = 0;
+                        while (++n<=3 && c>='0' && c<='7') {
+                                v = (v<<3) + c - '0';
+                                c = get();
+                        }
+                        unget(c);
+                        c = v;
+                        break;
+                }
+        }
+        return (c);
 }
 
-/*)Function    int     lk_getline()
- *
- *     The function lk_getline() reads a line of input text from a
- *     .rel source text file, a .lnk command file or from stdin.
- *     Lines of text are processed from a single .lnk file or
- *     multiple .rel files until all files have been read.
- *     The input text line is copied into the global string ib[]
- *     and converted to a NULL terminated string.  The function
- *     lk_getline() returns a (1) after succesfully reading a line
- *     or a (0) if all files have been read.
- *     This function also opens each input .lst file and output
- *     .rst file as each .rel file is processed.
- *
- *     local variables:
- *             int     i               string length
- *             int     ftype           file type
- *             char *  fid             file name
- *
- *     global variables:
- *             lfile   *cfp            The pointer *cfp points to the
- *                                     current lfile structure
- *             lfile   *filep          The pointer *filep points to the
- *                                     beginning of a linked list of
- *                                     lfile structures.
- *             int     gline           get a line from the LST file
- *                                     to translate for the RST file
- *             char    ib[NINPUT]      REL file text line
- *             int     pass            linker pass number
- *             int     pflag           print linker command file flag
- *             FILE    *rfp            The file handle to the current
- *                                     output RST file
- *             FILE    *sfp            The file handle sfp points to the
- *                                     currently open file
- *             FILE *  stdin           c_library
- *             FILE *  stdout          c_library
- *             FILE    *tfp            The file handle to the current
- *                                     LST file being scanned
- *             int     uflag           update listing flag
- *
- *     called functions:
- *             FILE *  afile()         lkmain.c
- *             int     fclose()        c_library
- *             char *  fgets()         c_library
- *             int     fprintf()       c_library
- *             VOID    lkulist()       lklist.c
- *             VOID    lkexit()        lkmain.c
- *             int     strlen()        c_library
- *
- *     side effects:
- *             The input stream is scanned.  The .rel files will be
- *             opened and closed sequentially scanning each in turn.
+/*)Function     int     lk_getline()
+ *
+ *      The function lk_getline() reads a line of input text from a
+ *      .rel source text file, a .lnk command file or from stdin.
+ *      Lines of text are processed from a single .lnk file or
+ *      multiple .rel files until all files have been read.
+ *      The input text line is copied into the global string ib[]
+ *      and converted to a NULL terminated string.  The function
+ *      lk_getline() returns a (1) after succesfully reading a line
+ *      or a (0) if all files have been read.
+ *      This function also opens each input .lst file and output
+ *      .rst file as each .rel file is processed.
+ *
+ *      local variables:
+ *              int     i               string length
+ *              int     ftype           file type
+ *              char *  fid             file name
+ *
+ *      global variables:
+ *              lfile   *cfp            The pointer *cfp points to the
+ *                                      current lfile structure
+ *              lfile   *filep          The pointer *filep points to the
+ *                                      beginning of a linked list of
+ *                                      lfile structures.
+ *              int     gline           get a line from the LST file
+ *                                      to translate for the RST file
+ *              char    ib[NINPUT]      REL file text line
+ *              int     pass            linker pass number
+ *              int     pflag           print linker command file flag
+ *              FILE    *rfp            The file handle to the current
+ *                                      output RST file
+ *              FILE    *sfp            The file handle sfp points to the
+ *                                      currently open file
+ *              FILE *  stdin           c_library
+ *              FILE *  stdout          c_library
+ *              FILE    *tfp            The file handle to the current
+ *                                      LST file being scanned
+ *              int     uflag           update listing flag
+ *
+ *      called functions:
+ *              FILE *  afile()         lkmain.c
+ *              int     fclose()        c_library
+ *              char *  fgets()         c_library
+ *              int     fprintf()       c_library
+ *              VOID    lkulist()       lklist.c
+ *              VOID    lkexit()        lkmain.c
+ *              int     strlen()        c_library
+ *
+ *      side effects:
+ *              The input stream is scanned.  The .rel files will be
+ *              opened and closed sequentially scanning each in turn.
  */
 
 int
 lk_getline()
 {
-       register int ftype;
-       register char *fid;
-
-loop:  if (pflag && cfp && cfp->f_type == F_STD)
-               fprintf(stdout, "ASlink >> ");
-
-       if (sfp == NULL || fgets(ib, sizeof ib, sfp) == NULL) {
-               if (sfp) {
-                       fclose(sfp);
-                       sfp = NULL;
-                       lkulist(0);
-               }
-               if (cfp == NULL) {
-                       cfp = filep;
-               } else {
-                       cfp = cfp->f_flp;
-               }
-               if (cfp) {
-                       ftype = cfp->f_type;
-                       fid = cfp->f_idp;
-                       if (ftype == F_STD) {
-                               sfp = stdin;
-                       } else
-                       if (ftype == F_LNK) {
-                               sfp = afile(fid, "lnk", 0);
-                       } else
-                       if (ftype == F_REL) {
-                               sfp = afile(fid, LKOBJEXT, 0);
-                               /* if a .adb file exists then copy it over */
-                               if (dflag && sfp && dfp && pass == 0) {
-                                       FILE *xfp = afile(fid,"adb",0); //JCF: Nov 30, 2002
-                                       if (xfp) {
-                                               copyfile(dfp,xfp);
-                                               fclose(xfp);
-                                       }
-                               }
-                               if (uflag && pass != 0) {
-                                       SaveLinkedFilePath(fid); //Save the linked path for aomf51
-                                       if ((tfp = afile(fid, "lst", 0)) != NULL) {
-                                               if ((rfp = afile(fid, "rst", 1)) == NULL) {
-                                                       fclose(tfp);
-                                                       tfp = NULL;
-                                               }
-                                       }
-                               }
-                               gline = 1;
-                       } else {
-                               fprintf(stderr, "Invalid file type\n");
-                               lkexit(1);
-                       }
-                       if (sfp == NULL) {
-                               lkexit(1);
-                       }
-                       goto loop;
-               } else {
-                       filep = NULL;
-                       return(0);
-               }
-       }
-       chop_crlf(ib);
-       return (1);
+        register int ftype;
+        register char *fid;
+
+loop:   if (pflag && cfp && cfp->f_type == F_STD)
+                fprintf(stdout, "ASlink >> ");
+
+        if (sfp == NULL || fgets(ib, sizeof ib, sfp) == NULL) {
+                if (sfp) {
+                        fclose(sfp);
+                        sfp = NULL;
+                        lkulist(0);
+                }
+                if (cfp == NULL) {
+                        cfp = filep;
+                } else {
+                        cfp = cfp->f_flp;
+                }
+                if (cfp) {
+                        ftype = cfp->f_type;
+                        fid = cfp->f_idp;
+                        if (ftype == F_STD) {
+                                sfp = stdin;
+                        } else
+                        if (ftype == F_LNK) {
+                                sfp = afile(fid, "lnk", 0);
+                        } else
+                        if (ftype == F_REL) {
+                                sfp = afile(fid, LKOBJEXT, 0);
+                                /* if a .adb file exists then copy it over */
+                                if (dflag && sfp && dfp && pass == 0) {
+                                        FILE *xfp = afile(fid,"adb",0); //JCF: Nov 30, 2002
+                                        if (xfp) {
+                                                copyfile(dfp,xfp);
+                                                fclose(xfp);
+                                        }
+                                }
+                                if (uflag && pass != 0) {
+                                        SaveLinkedFilePath(fid); //Save the linked path for aomf51
+                                        if ((tfp = afile(fid, "lst", 0)) != NULL) {
+                                                if ((rfp = afile(fid, "rst", 1)) == NULL) {
+                                                        fclose(tfp);
+                                                        tfp = NULL;
+                                                }
+                                        }
+                                }
+                                gline = 1;
+                        } else {
+                                fprintf(stderr, "Invalid file type\n");
+                                lkexit(1);
+                        }
+                        if (sfp == NULL) {
+                                lkexit(1);
+                        }
+                        goto loop;
+                } else {
+                        filep = NULL;
+                        return(0);
+                }
+        }
+        chop_crlf(ib);
+        return (1);
 }
 
-/*)Function    int     more()
+/*)Function     int     more()
  *
- *     The function more() scans the input text line
- *     skipping white space (SPACES and TABS) and returns a (0)
- *     if the end of the line or a comment delimeter (;) is found,
- *     or a (1) if their are additional characters in the line.
+ *      The function more() scans the input text line
+ *      skipping white space (SPACES and TABS) and returns a (0)
+ *      if the end of the line or a comment delimeter (;) is found,
+ *      or a (1) if their are additional characters in the line.
  *
- *     local variables:
- *             int     c               next character from
- *                                     the input text line
+ *      local variables:
+ *              int     c               next character from
+ *                                      the input text line
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     called functions:
- *             char    getnb()         lklex.c
- *             VOID    unget()         lklex.c
+ *      called functions:
+ *              char    getnb()         lklex.c
+ *              VOID    unget()         lklex.c
  *
- *     side effects:
- *             use of getnb() and unget() updates the global pointer ip
- *             the position in the current input text line
+ *      side effects:
+ *              use of getnb() and unget() updates the global pointer ip
+ *              the position in the current input text line
  */
 
 int
 more()
 {
-       register int c;
+        register int c;
 
-       c = getnb();
-       unget(c);
-       return( (c == '\0' || c == ';') ? 0 : 1 );
+        c = getnb();
+        unget(c);
+        return( (c == '\0' || c == ';') ? 0 : 1 );
 }
 
-/*)Function    char    endline()
+/*)Function     char    endline()
  *
- *     The function endline() scans the input text line
- *     skipping white space (SPACES and TABS) and returns the next
- *     character or a (0) if the end of the line is found or a
- *     comment delimiter (;) is found.
+ *      The function endline() scans the input text line
+ *      skipping white space (SPACES and TABS) and returns the next
+ *      character or a (0) if the end of the line is found or a
+ *      comment delimiter (;) is found.
  *
- *     local variables:
- *             int     c               next character from
- *                                     the input text line
+ *      local variables:
+ *              int     c               next character from
+ *                                      the input text line
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     called functions:
- *             char    getnb()         lklex.c
+ *      called functions:
+ *              char    getnb()         lklex.c
  *
- *     side effects:
- *             Use of getnb() updates the global pointer ip the
- *             position in the current input text line.
+ *      side effects:
+ *              Use of getnb() updates the global pointer ip the
+ *              position in the current input text line.
  */
 
 char
 endline()
 {
-       register int c;
+        register int c;
 
-       c = getnb();
-       return( (c == '\0' || c == ';') ? 0 : c );
+        c = getnb();
+        return( (c == '\0' || c == ';') ? 0 : c );
 }
 
-/*)Function    VOID    chop_crlf(str)
+/*)Function     VOID    chop_crlf(str)
  *
- *             char    *str            string to chop
+ *              char    *str            string to chop
  *
- *     The function chop_crlf() removes trailing LF or CR/LF from
- *     str, if present.
+ *      The function chop_crlf() removes trailing LF or CR/LF from
+ *      str, if present.
  *
- *     local variables:
- *             int     i               string length
+ *      local variables:
+ *              int     i               string length
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  */
 
 VOID
 chop_crlf(char *str)
 {
-       register int i;
+        register int i;
 
-       i = strlen(str);
-       if (i >= 1 && str[i-1] == '\n') str[i-1] = 0;
-       if (i >= 2 && str[i-2] == '\r') str[i-2] = 0;
+        i = strlen(str);
+        if (i >= 1 && str[i-1] == '\n') str[i-1] = 0;
+        if (i >= 2 && str[i-2] == '\r') str[i-2] = 0;
 }
index cab38d9a03c87c6ed13694bd8c393348436203ea..66ff0be2690ddfa22e2d6cb6116a403aaec3edf1 100644 (file)
@@ -6,7 +6,7 @@
 
 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 2, or (at your option) any
+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,
@@ -15,8 +15,7 @@ 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, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
  * With contributions for the
index 219e7e339083658fe2704f5e399922fdfbea3107..93ac1df6f240925d1ce0c1c1fae0e9bebe166261 100644 (file)
@@ -6,7 +6,7 @@
 
 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 2, or (at your option) any
+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,
@@ -15,8 +15,7 @@ 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, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
  * With contributions for the
index 040fc17bb28eeaca3570f9ccdab3c3dc747b7f5b..49659a0103ff964ae7651392ca5a9472b8f708ca 100644 (file)
@@ -6,7 +6,7 @@
 
 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 2, or (at your option) any
+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,
@@ -15,8 +15,7 @@ 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, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
  * With contributions for the
index 68d041c1118042319f744ea0fa162e87580de67d..3448539e615faccf0e75357e636bfdae99a75576 100644 (file)
@@ -1,14 +1,23 @@
-/* lklist.c */
+/* lklist.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
- * 28-Oct-97 JLH: 
+ * 28-Oct-97 JLH:
  *           - lstarea: show s_id as string rather than array [NCPS]
  *           - lstarea: show a_id as string rather than array [NCPS]
  * 31-Oct-97 JLH: add NoICE output file genration in lstarea
 #include <stdlib.h>
 #include "aslink.h"
 
-/*)Module      lklist.c
+/*)Module       lklist.c
  *
- *     The module lklist.c contains the functions which
- *     output the linker .map file and produce a relocated
- *     listing .rst file.
+ *      The module lklist.c contains the functions which
+ *      output the linker .map file and produce a relocated
+ *      listing .rst file.
  *
- *     lklist.c contains the following functions:
- *             int     dgt()
- *             VOID    lstarea()
- *             VOID    lkulist()
- *             VOID    lkalist()
- *             VOID    lkglist()
- *             VOID    newpag()
- *             VOID    slew()
+ *      lklist.c contains the following functions:
+ *              int     dgt()
+ *              VOID    lstarea()
+ *              VOID    lkulist()
+ *              VOID    lkalist()
+ *              VOID    lkglist()
+ *              VOID    newpag()
+ *              VOID    slew()
  *
- *     lklist.c contains no local variables.
+ *      lklist.c contains no local variables.
  */
 
-/*)Function    VOID    slew(fp)
+/*)Function     VOID    slew(fp)
  *
- *             FILE *  fp              output file handle
+ *              FILE *  fp              output file handle
  *
- *     The function slew() increments the page line counter.
- *     If the number of lines exceeds the maximum number of
- *     lines per page then a page skip and a page header are
- *     output.
+ *      The function slew() increments the page line counter.
+ *      If the number of lines exceeds the maximum number of
+ *      lines per page then a page skip and a page header are
+ *      output.
  *
- *     local variables:
- *             int     i               loop counter
+ *      local variables:
+ *              int     i               loop counter
  *
- *     global variables:
- *             int     lop             current line number on page
- *             int     xflag           Map file radix type flag
+ *      global variables:
+ *              int     lop             current line number on page
+ *              int     xflag           Map file radix type flag
  *
- *     functions called:
- *             int     fprintf()       c_library
- *             VOID    newpag()        lklist.c
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              VOID    newpag()        lklist.c
  *
- *     side effects:
- *             The page line and the page count may be updated.
+ *      side effects:
+ *              The page line and the page count may be updated.
  */
 
 VOID
 slew(fp)
 FILE *fp;
 {
-       register int i;
-
-       if (lop++ >= NLPP) {
-               newpag(fp);
-               if (xflag == 0) {
-                       fprintf(fp, "Hexadecimal\n\n");
-               } else
-               if (xflag == 1) {
-                       fprintf(fp, "Octal\n\n");
-               } else
-               if (xflag == 2) {
-                       fprintf(fp, "Decimal\n\n");
-               }
-               fprintf(fp, "Area       Addr   Size");
-               fprintf(fp, "   Decimal Bytes (Attributes)\n");
-               for(i=0;i<4;++i)
-                       fprintf(fp, "      Value--Global");
-               fprintf(fp, "\n\n");
-               lop += 6;
-       }
+        register int i;
+
+        if (lop++ >= NLPP) {
+                newpag(fp);
+                if (xflag == 0) {
+                        fprintf(fp, "Hexadecimal\n\n");
+                } else
+                if (xflag == 1) {
+                        fprintf(fp, "Octal\n\n");
+                } else
+                if (xflag == 2) {
+                        fprintf(fp, "Decimal\n\n");
+                }
+                fprintf(fp, "Area       Addr   Size");
+                fprintf(fp, "   Decimal Bytes (Attributes)\n");
+                for(i=0;i<4;++i)
+                        fprintf(fp, "      Value--Global");
+                fprintf(fp, "\n\n");
+                lop += 6;
+        }
 }
 
-/*)Function    VOID    newpag()
+/*)Function     VOID    newpag()
  *
- *     The function newpag() outputs a page skip, writes the
- *     first page header line, sets the line count to 1, and
- *     increments the page counter.
+ *      The function newpag() outputs a page skip, writes the
+ *      first page header line, sets the line count to 1, and
+ *      increments the page counter.
  *
- *     local variables:
- *             none
+ *      local variables:
+ *              none
  *
- *     global variables:
- *             int     lop             current line number on page
- *             int     page            current page number
+ *      global variables:
+ *              int     lop             current line number on page
+ *              int     page            current page number
  *
- *     functions called:
- *             int     fprintf()       c_library
+ *      functions called:
+ *              int     fprintf()       c_library
  *
- *     side effects:
- *             The page and line counters are updated.
+ *      side effects:
+ *              The page and line counters are updated.
  */
 
 VOID
 newpag(fp)
 FILE *fp;
 {
-       fprintf(fp, "\fASxxxx Linker %s,  page %u.\n", VERSION, ++page);
-       lop = 1;
+        fprintf(fp, "\fASxxxx Linker %s,  page %u.\n", VERSION, ++page);
+        lop = 1;
 }
 
 /* Used for qsort call in lstsym */
@@ -122,431 +131,431 @@ static int _cmpSymByAddr(const void *p1, const void *p2)
     struct sym **s1 = (struct sym **)(p1);
     struct sym **s2 = (struct sym **)(p2);
     int delta = ((*s1)->s_addr + (*s1)->s_axp->a_addr) -
-               ((*s2)->s_addr + (*s2)->s_axp->a_addr);
+                ((*s2)->s_addr + (*s2)->s_axp->a_addr);
 
     /* Sort first by address, then by name. */
     if (delta)
     {
-       return delta;
+        return delta;
     }
-    return strcmp((*s1)->s_id,(*s2)->s_id);    
+    return strcmp((*s1)->s_id,(*s2)->s_id);
 }
 
 
-#if    NCPS-8
+#if     NCPS-8
 
 /* NCPS != 8 */
-/*)Function    VOID    lstarea(xp)
+/*)Function     VOID    lstarea(xp)
  *
- *             area *  xp              pointer to an area structure
+ *              area *  xp              pointer to an area structure
  *
- *     The function lstarea() creates the linker map output for
- *     the area specified by pointer xp.  The generated output
- *     area header includes the area name, starting address,
- *     size of area, number of words (in decimal), and the
- *     area attributes.  The symbols defined in this area are
- *     sorted by ascending address and output one per line
- *     in the selected radix.
+ *      The function lstarea() creates the linker map output for
+ *      the area specified by pointer xp.  The generated output
+ *      area header includes the area name, starting address,
+ *      size of area, number of words (in decimal), and the
+ *      area attributes.  The symbols defined in this area are
+ *      sorted by ascending address and output one per line
+ *      in the selected radix.
  *
- *     local variables:
- *             areax * oxp             pointer to an area extension structure
- *             int     c               character value
- *             int     i               loop counter
- *             char *  ptr             pointer to an id string
- *             int     nmsym           number of symbols in area
- *             Addr_T  ai              temporary
- *             Addr_T  aj              temporary
- *             sym *   sp              pointer to a symbol structure
- *             sym **  p               pointer to an array of
- *                                     pointers to symbol structures
+ *      local variables:
+ *              areax * oxp             pointer to an area extension structure
+ *              int     c               character value
+ *              int     i               loop counter
+ *              char *  ptr             pointer to an id string
+ *              int     nmsym           number of symbols in area
+ *              Addr_T  ai              temporary
+ *              Addr_T  aj              temporary
+ *              sym *   sp              pointer to a symbol structure
+ *              sym **  p               pointer to an array of
+ *                                      pointers to symbol structures
  *
- *     global variables:
- *             FILE    *mfp            Map output file handle
- *             sym *symhash[NHASH]     array of pointers to NHASH
- *                                     linked symbol lists
- *             int     xflag           Map file radix type flag
+ *      global variables:
+ *              FILE    *mfp            Map output file handle
+ *              sym *symhash[NHASH]     array of pointers to NHASH
+ *                                      linked symbol lists
+ *              int     xflag           Map file radix type flag
  *
- *     functions called:
- *             int     fprintf()       c_library
- *             VOID    free()          c_library
- *             char *  malloc()        c_library
- *             char    putc()          c_library
- *             VOID    slew()          lklist.c
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              VOID    free()          c_library
+ *              char *  malloc()        c_library
+ *              char    putc()          c_library
+ *              VOID    slew()          lklist.c
  *
- *     side effects:
- *             Map output generated.
+ *      side effects:
+ *              Map output generated.
  */
 
 VOID
 lstarea(struct area *xp)
 {
-       register struct areax *oxp;
-       register int i;
-       register char *ptr;
-       int nmsym;
-       Addr_T     ai, aj;
-       struct sym *sp;
-       struct sym **p;
-       int memPage;
-
-       putc('\n', mfp);
-
-       /*
-        * Find number of symbols in area
-        */
-       nmsym = 0;
-       oxp = xp->a_axp;
-       while (oxp) {
-               for (i=0; i<NHASH; i++) {
-                       sp = symhash[i];
-                       while (sp != NULL) {
-                               if (oxp == sp->s_axp)
-                                       ++nmsym;
-                               sp = sp->s_sp;
-                       }
-               }
-               oxp = oxp->a_axp;
-       }
-       if (nmsym == 0) {
-               return;
-       }
-
-       if (xflag == 0) {
-               fprintf(mfp, "Hexadecimal\n\n");
-       } else
-       if (xflag == 1) {
-               fprintf(mfp, "Octal\n\n");
-       } else
-       if (xflag == 2) {
-               fprintf(mfp, "Decimal\n\n");
-       }
-       fprintf(mfp, "Area                               ");
-       fprintf(mfp, "Addr   Size   Decimal %s (Attributes)\n",
-               (xp->a_flag & A_BIT)?"Bits ":"Bytes");/* JCF: For BIT print bits...*/
-       fprintf(mfp, "--------------------------------   ");
-       fprintf(mfp, "----   ----   ------- ----- ------------\n");
-       /*
-        * Output Area Header
-        */
-       ptr = &xp->a_id[0];
-       fprintf(mfp, "%-32s", ptr );    /* JLH: width matches --- above */
-       ai = xp->a_addr;
-       aj = xp->a_size;
-       if (xflag == 0) {
-               fprintf(mfp, "   %04X   %04X", ai, aj);
-       } else
-       if (xflag == 1) {
-               fprintf(mfp, " %06o %06o", ai, aj);
-       } else
-       if (xflag == 2) {
-               fprintf(mfp, "  %05u  %05u", ai, aj);
-       }
-       fprintf(mfp, " = %6u. %s ", aj,
-               (xp->a_flag & A_BIT)?"bits ":"bytes"); /* JCF: For BIT print bits...*/
-       if (xp->a_flag & A_ABS) {
-               fprintf(mfp, "(ABS");
-       } else {
-               fprintf(mfp, "(REL");
-       }
-       if (xp->a_flag & A_OVR) {
-               fprintf(mfp, ",OVR");
-       } else {
-               fprintf(mfp, ",CON");
-       }
-       if (xp->a_flag & A_PAG) {
-               fprintf(mfp, ",PAG");
-       }
-
-       memPage = 0x00;
-       if (xp->a_flag & A_CODE) {
-               fprintf(mfp, ",CODE");
-               memPage = 0x0C;
-       }
-       if (xp->a_flag & A_XDATA) {
-               fprintf(mfp, ",XDATA");
-               memPage = 0x0D;
-       }
-       if (xp->a_flag & A_BIT) {
-               fprintf(mfp, ",BIT");
-               memPage = 0x0B;
-       }
-       fprintf(mfp, ")");
-       if (xp->a_flag & A_PAG) {
-               ai = (ai & 0xFF);
-               aj = (aj > 256);
-               if (ai || aj) { fprintf(mfp, "  "); }
-               if (ai)      { fprintf(mfp, " Boundary"); }
-               if (ai & aj)  { fprintf(mfp, " /"); }
-               if (aj)      { fprintf(mfp, " Length"); }
-               if (ai || aj) { fprintf(mfp, " Error"); }
-       }
-
-       /*
-        * Allocate space for an array of pointers to symbols
-        * and load array.
-        */
-       if ( (p = (struct sym **) malloc(nmsym*sizeof(struct sym *)))
-               == NULL) {
-               fprintf(mfp, "\nInsufficient space to build Map Segment.\n");
-               return;
-       }
-       nmsym = 0;
-       oxp = xp->a_axp;
-       while (oxp) {
-               for (i=0; i<NHASH; i++) {
-                       sp = symhash[i];
-                       while (sp != NULL) {
-                               if (oxp == sp->s_axp) {
-                                       p[nmsym++] = sp;
-                               }
-                               sp = sp->s_sp;
-                       }
-               }
-               oxp = oxp->a_axp;
-       }
-
-       qsort(p, nmsym, sizeof(struct sym *), _cmpSymByAddr);
-
-       /*
-        * Symbol Table Output
-        */
-
-       i = 0;
-       fprintf(mfp, "\n\n");
-       fprintf(mfp, "      Value  Global\n");
-       fprintf(mfp, "   --------  --------------------------------");
-       while (i < nmsym) {
-               fprintf(mfp, "\n");
-               if (memPage != 0) 
-                       fprintf(mfp, "  %02X:", memPage);
-               else
-                       fprintf(mfp, "     ");
-
-               sp = p[i];
-               aj = sp->s_addr + sp->s_axp->a_addr;
-               if (xflag == 0) {
-                       fprintf(mfp, "%04X    ", aj);
-               } else
-               if (xflag == 1) {
-                       fprintf(mfp, "%06o  ", aj);
-               } else
-               if (xflag == 2) {
-                       fprintf(mfp, "%05u   ", aj);
-               }
-               ptr = &sp->s_id[0];
-               fprintf(mfp, "%s", ptr );
-               
-               /* if cdb flag set the output cdb Information 
-                  and the symbol has a '$' sign in it then */
-               if (dflag &&
-                   strchr(ptr,'$'))
-                   fprintf(dfp,"L:%s:%X\n",ptr,aj);
-
-               /* NoICE output of symbol */
-               if (jflag) DefineNoICE( ptr, aj, memPage );
-
-               i++;
-       }
-       putc('\n', mfp);
-       free(p);
+        register struct areax *oxp;
+        register int i;
+        register char *ptr;
+        int nmsym;
+        Addr_T     ai, aj;
+        struct sym *sp;
+        struct sym **p;
+        int memPage;
+
+        putc('\n', mfp);
+
+        /*
+         * Find number of symbols in area
+         */
+        nmsym = 0;
+        oxp = xp->a_axp;
+        while (oxp) {
+                for (i=0; i<NHASH; i++) {
+                        sp = symhash[i];
+                        while (sp != NULL) {
+                                if (oxp == sp->s_axp)
+                                        ++nmsym;
+                                sp = sp->s_sp;
+                        }
+                }
+                oxp = oxp->a_axp;
+        }
+        if (nmsym == 0) {
+                return;
+        }
+
+        if (xflag == 0) {
+                fprintf(mfp, "Hexadecimal\n\n");
+        } else
+        if (xflag == 1) {
+                fprintf(mfp, "Octal\n\n");
+        } else
+        if (xflag == 2) {
+                fprintf(mfp, "Decimal\n\n");
+        }
+        fprintf(mfp, "Area                               ");
+        fprintf(mfp, "Addr   Size   Decimal %s (Attributes)\n",
+                (xp->a_flag & A_BIT)?"Bits ":"Bytes");/* JCF: For BIT print bits...*/
+        fprintf(mfp, "--------------------------------   ");
+        fprintf(mfp, "----   ----   ------- ----- ------------\n");
+        /*
+         * Output Area Header
+         */
+        ptr = &xp->a_id[0];
+        fprintf(mfp, "%-32s", ptr );    /* JLH: width matches --- above */
+        ai = xp->a_addr;
+        aj = xp->a_size;
+        if (xflag == 0) {
+                fprintf(mfp, "   %04X   %04X", ai, aj);
+        } else
+        if (xflag == 1) {
+                fprintf(mfp, " %06o %06o", ai, aj);
+        } else
+        if (xflag == 2) {
+                fprintf(mfp, "  %05u  %05u", ai, aj);
+        }
+        fprintf(mfp, " = %6u. %s ", aj,
+                (xp->a_flag & A_BIT)?"bits ":"bytes"); /* JCF: For BIT print bits...*/
+        if (xp->a_flag & A_ABS) {
+                fprintf(mfp, "(ABS");
+        } else {
+                fprintf(mfp, "(REL");
+        }
+        if (xp->a_flag & A_OVR) {
+                fprintf(mfp, ",OVR");
+        } else {
+                fprintf(mfp, ",CON");
+        }
+        if (xp->a_flag & A_PAG) {
+                fprintf(mfp, ",PAG");
+        }
+
+        memPage = 0x00;
+        if (xp->a_flag & A_CODE) {
+                fprintf(mfp, ",CODE");
+                memPage = 0x0C;
+        }
+        if (xp->a_flag & A_XDATA) {
+                fprintf(mfp, ",XDATA");
+                memPage = 0x0D;
+        }
+        if (xp->a_flag & A_BIT) {
+                fprintf(mfp, ",BIT");
+                memPage = 0x0B;
+        }
+        fprintf(mfp, ")");
+        if (xp->a_flag & A_PAG) {
+                ai = (ai & 0xFF);
+                aj = (aj > 256);
+                if (ai || aj) { fprintf(mfp, "  "); }
+                if (ai)      { fprintf(mfp, " Boundary"); }
+                if (ai & aj)  { fprintf(mfp, " /"); }
+                if (aj)      { fprintf(mfp, " Length"); }
+                if (ai || aj) { fprintf(mfp, " Error"); }
+        }
+
+        /*
+         * Allocate space for an array of pointers to symbols
+         * and load array.
+         */
+        if ( (p = (struct sym **) malloc(nmsym*sizeof(struct sym *)))
+                == NULL) {
+                fprintf(mfp, "\nInsufficient space to build Map Segment.\n");
+                return;
+        }
+        nmsym = 0;
+        oxp = xp->a_axp;
+        while (oxp) {
+                for (i=0; i<NHASH; i++) {
+                        sp = symhash[i];
+                        while (sp != NULL) {
+                                if (oxp == sp->s_axp) {
+                                        p[nmsym++] = sp;
+                                }
+                                sp = sp->s_sp;
+                        }
+                }
+                oxp = oxp->a_axp;
+        }
+
+        qsort(p, nmsym, sizeof(struct sym *), _cmpSymByAddr);
+
+        /*
+         * Symbol Table Output
+         */
+
+        i = 0;
+        fprintf(mfp, "\n\n");
+        fprintf(mfp, "      Value  Global\n");
+        fprintf(mfp, "   --------  --------------------------------");
+        while (i < nmsym) {
+                fprintf(mfp, "\n");
+                if (memPage != 0)
+                        fprintf(mfp, "  %02X:", memPage);
+                else
+                        fprintf(mfp, "     ");
+
+                sp = p[i];
+                aj = sp->s_addr + sp->s_axp->a_addr;
+                if (xflag == 0) {
+                        fprintf(mfp, "%04X    ", aj);
+                } else
+                if (xflag == 1) {
+                        fprintf(mfp, "%06o  ", aj);
+                } else
+                if (xflag == 2) {
+                        fprintf(mfp, "%05u   ", aj);
+                }
+                ptr = &sp->s_id[0];
+                fprintf(mfp, "%s", ptr );
+
+                /* if cdb flag set the output cdb Information
+                   and the symbol has a '$' sign in it then */
+                if (dflag &&
+                    strchr(ptr,'$'))
+                    fprintf(dfp,"L:%s:%X\n",ptr,aj);
+
+                /* NoICE output of symbol */
+                if (jflag) DefineNoICE( ptr, aj, memPage );
+
+                i++;
+        }
+        putc('\n', mfp);
+        free(p);
 }
 
 #else
 
 /* NCPS == 8 */
-/*)Function    VOID    lstarea(xp)
+/*)Function     VOID    lstarea(xp)
  *
- *             area *  xp              pointer to an area structure
+ *              area *  xp              pointer to an area structure
  *
- *     The function lstarea() creates the linker map output for
- *     the area specified by pointer xp.  The generated output
- *     area header includes the area name, starting address,
- *     size of area, number of words (in decimal), and the
- *     area attributes.  The symbols defined in this area are
- *     sorted by ascending address and output four per line
- *     in the selected radix.
+ *      The function lstarea() creates the linker map output for
+ *      the area specified by pointer xp.  The generated output
+ *      area header includes the area name, starting address,
+ *      size of area, number of words (in decimal), and the
+ *      area attributes.  The symbols defined in this area are
+ *      sorted by ascending address and output four per line
+ *      in the selected radix.
  *
- *     local variables:
- *             areax * oxp             pointer to an area extension structure
- *             int     c               character value
- *             int     i               loop counter
- *             char *  ptr             pointer to an id string
- *             int     nmsym           number of symbols in area
- *             Addr_T  ai              temporary
- *             Addr_T  aj              temporary
- *             sym *   sp              pointer to a symbol structure
- *             sym **  p               pointer to an array of
- *                                     pointers to symbol structures
+ *      local variables:
+ *              areax * oxp             pointer to an area extension structure
+ *              int     c               character value
+ *              int     i               loop counter
+ *              char *  ptr             pointer to an id string
+ *              int     nmsym           number of symbols in area
+ *              Addr_T  ai              temporary
+ *              Addr_T  aj              temporary
+ *              sym *   sp              pointer to a symbol structure
+ *              sym **  p               pointer to an array of
+ *                                      pointers to symbol structures
  *
- *     global variables:
- *             FILE    *mfp            Map output file handle
- *             sym *symhash[NHASH]     array of pointers to NHASH
- *                                     linked symbol lists
- *             int     xflag           Map file radix type flag
+ *      global variables:
+ *              FILE    *mfp            Map output file handle
+ *              sym *symhash[NHASH]     array of pointers to NHASH
+ *                                      linked symbol lists
+ *              int     xflag           Map file radix type flag
  *
- *     functions called:
- *             int     fprintf()       c_library
- *             VOID    free()          c_library
- *             char *  malloc()        c_library
- *             char    putc()          c_library
- *             VOID    slew()          lklist.c
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              VOID    free()          c_library
+ *              char *  malloc()        c_library
+ *              char    putc()          c_library
+ *              VOID    slew()          lklist.c
  *
- *     side effects:
- *             Map output generated.
+ *      side effects:
+ *              Map output generated.
  */
 
 VOID
 lstarea(struct area *xp)
 {
-       register struct areax *oxp;
-       register int c, i;
-       register char *ptr;
-       int nmsym;
-       Addr_T ai, aj;
-       struct sym *sp;
-       struct sym **p;
-       int page;
-
-       putc('\n', mfp);
-       slew(mfp);
-       /*
-        * Output Area Header
-        */
-       ptr = &xp->a_id[0];
-       while (ptr < &xp->a_id[NCPS]) {
-               if ((c = *ptr++) != 0) {
-                       putc(c, mfp);
-               } else {
-                       putc(' ', mfp);
-               }
-       }
-       ai = xp->a_addr;
-       aj = xp->a_size;
-       if (xflag == 0) {
-               fprintf(mfp, "   %04X   %04X", ai, aj);
-       } else
-       if (xflag == 1) {
-               fprintf(mfp, " %06o %06o", ai, aj);
-       } else
-       if (xflag == 2) {
-               fprintf(mfp, "  %05u  %05u", ai, aj);
-       }
-       fprintf(mfp, " = %6u. bytes ", aj);
-       if (xp->a_flag & A_ABS) {
-               fprintf(mfp, "(ABS");
-       } else {
-               fprintf(mfp, "(REL");
-       }
-       if (xp->a_flag & A_OVR) {
-               fprintf(mfp, ",OVR");
-       } else {
-               fprintf(mfp, ",CON");
-       }
-       if (xp->a_flag & A_PAG) {
-               fprintf(mfp, ",PAG");
-       }
-
-       page = 0x00;
-       if (xp->a_flag & A_CODE) {
-               fprintf(mfp, ",CODE");
-               memPage = 0x0C;
-       }
-       if (xp->a_flag & A_XDATA) {
-               fprintf(mfp, ",XDATA");
-               memPage = 0x0D;
-       }
-       if (xp->a_flag & A_BIT) {
-               fprintf(mfp, ",BIT");
-               memPage = 0x0B;
-       }
-       fprintf(mfp, ")");
-       if (xp->a_flag & A_PAG) {
-               ai = (ai & 0xFF);
-               aj = (aj > 256);
-               if (ai || aj) { fprintf(mfp, "  "); }
-               if (ai)      { fprintf(mfp, " Boundary"); }
-               if (ai & aj)  { fprintf(mfp, " /"); }
-               if (aj)      { fprintf(mfp, " Length"); }
-               if (ai || aj) { fprintf(mfp, " Error"); }
-       }
-
-       /*
-        * Find number of symbols in area
-        */
-       nmsym = 0;
-       oxp = xp->a_axp;
-       while (oxp) {
-               for (i=0; i<NHASH; i++) {
-                       sp = symhash[i];
-                       while (sp != NULL) {
-                               if (oxp == sp->s_axp)
-                                       ++nmsym;
-                               sp = sp->s_sp;
-                       }
-               }
-               oxp = oxp->a_axp;
-       }
-       if (nmsym == 0) {
-               putc('\n', mfp);
-               slew(mfp);
-               return;
-       }
-
-       /*
-        * Allocate space for an array of pointers to symbols
-        * and load array.
-        */
-       if ( (p = (struct sym **) malloc(nmsym*sizeof(struct sym *)))
-               == NULL) {
-               fprintf(mfp, "\nInsufficient space to build Map Segment.\n");
-               slew(mfp);
-               return;
-       }
-       nmsym = 0;
-       oxp = xp->a_axp;
-       while (oxp) {
-               for (i=0; i<NHASH; i++) {
-                       sp = symhash[i];
-                       while (sp != NULL) {
-                               if (oxp == sp->s_axp) {
-                                       p[nmsym++] = sp;
-                               }
-                               sp = sp->s_sp;
-                       }
-               }
-               oxp = oxp->a_axp;
-       }
-
-       qsort(p, nmsym, sizeof(struct sym *), _cmpSymByAddr);
-
-       /*
-        * Symbol Table Output
-        */
-       i = 0;
-       while (i < nmsym) {
-               fprintf(mfp, "\n");
-               slew(mfp);
-               fprintf(mfp, "     ");
-               sp = p[i];
-               aj = sp->s_addr + sp->s_axp->a_addr;
-               if (xflag == 0) {
-                       fprintf(mfp, "  %04X  ", aj);
-               } else
-               if (xflag == 1) {
-                       fprintf(mfp, "%06o  ", aj);
-               } else
-               if (xflag == 2) {
-                       fprintf(mfp, " %05u  ", aj);
-               }
-               ptr = &sp->s_id[0];
-               fprintf(mfp, "%*s", NCPS, ptr );
-
-               /* NoICE output of symbol */
-               if (jflag) DefineNoICE( ptr, aj, memPage );
-       }
-       putc('\n', mfp);
-       free(p);
-       slew(mfp);
+        register struct areax *oxp;
+        register int c, i;
+        register char *ptr;
+        int nmsym;
+        Addr_T ai, aj;
+        struct sym *sp;
+        struct sym **p;
+        int page;
+
+        putc('\n', mfp);
+        slew(mfp);
+        /*
+         * Output Area Header
+         */
+        ptr = &xp->a_id[0];
+        while (ptr < &xp->a_id[NCPS]) {
+                if ((c = *ptr++) != 0) {
+                        putc(c, mfp);
+                } else {
+                        putc(' ', mfp);
+                }
+        }
+        ai = xp->a_addr;
+        aj = xp->a_size;
+        if (xflag == 0) {
+                fprintf(mfp, "   %04X   %04X", ai, aj);
+        } else
+        if (xflag == 1) {
+                fprintf(mfp, " %06o %06o", ai, aj);
+        } else
+        if (xflag == 2) {
+                fprintf(mfp, "  %05u  %05u", ai, aj);
+        }
+        fprintf(mfp, " = %6u. bytes ", aj);
+        if (xp->a_flag & A_ABS) {
+                fprintf(mfp, "(ABS");
+        } else {
+                fprintf(mfp, "(REL");
+        }
+        if (xp->a_flag & A_OVR) {
+                fprintf(mfp, ",OVR");
+        } else {
+                fprintf(mfp, ",CON");
+        }
+        if (xp->a_flag & A_PAG) {
+                fprintf(mfp, ",PAG");
+        }
+
+        page = 0x00;
+        if (xp->a_flag & A_CODE) {
+                fprintf(mfp, ",CODE");
+                memPage = 0x0C;
+        }
+        if (xp->a_flag & A_XDATA) {
+                fprintf(mfp, ",XDATA");
+                memPage = 0x0D;
+        }
+        if (xp->a_flag & A_BIT) {
+                fprintf(mfp, ",BIT");
+                memPage = 0x0B;
+        }
+        fprintf(mfp, ")");
+        if (xp->a_flag & A_PAG) {
+                ai = (ai & 0xFF);
+                aj = (aj > 256);
+                if (ai || aj) { fprintf(mfp, "  "); }
+                if (ai)      { fprintf(mfp, " Boundary"); }
+                if (ai & aj)  { fprintf(mfp, " /"); }
+                if (aj)      { fprintf(mfp, " Length"); }
+                if (ai || aj) { fprintf(mfp, " Error"); }
+        }
+
+        /*
+         * Find number of symbols in area
+         */
+        nmsym = 0;
+        oxp = xp->a_axp;
+        while (oxp) {
+                for (i=0; i<NHASH; i++) {
+                        sp = symhash[i];
+                        while (sp != NULL) {
+                                if (oxp == sp->s_axp)
+                                        ++nmsym;
+                                sp = sp->s_sp;
+                        }
+                }
+                oxp = oxp->a_axp;
+        }
+        if (nmsym == 0) {
+                putc('\n', mfp);
+                slew(mfp);
+                return;
+        }
+
+        /*
+         * Allocate space for an array of pointers to symbols
+         * and load array.
+         */
+        if ( (p = (struct sym **) malloc(nmsym*sizeof(struct sym *)))
+                == NULL) {
+                fprintf(mfp, "\nInsufficient space to build Map Segment.\n");
+                slew(mfp);
+                return;
+        }
+        nmsym = 0;
+        oxp = xp->a_axp;
+        while (oxp) {
+                for (i=0; i<NHASH; i++) {
+                        sp = symhash[i];
+                        while (sp != NULL) {
+                                if (oxp == sp->s_axp) {
+                                        p[nmsym++] = sp;
+                                }
+                                sp = sp->s_sp;
+                        }
+                }
+                oxp = oxp->a_axp;
+        }
+
+        qsort(p, nmsym, sizeof(struct sym *), _cmpSymByAddr);
+
+        /*
+         * Symbol Table Output
+         */
+        i = 0;
+        while (i < nmsym) {
+                fprintf(mfp, "\n");
+                slew(mfp);
+                fprintf(mfp, "     ");
+                sp = p[i];
+                aj = sp->s_addr + sp->s_axp->a_addr;
+                if (xflag == 0) {
+                        fprintf(mfp, "  %04X  ", aj);
+                } else
+                if (xflag == 1) {
+                        fprintf(mfp, "%06o  ", aj);
+                } else
+                if (xflag == 2) {
+                        fprintf(mfp, " %05u  ", aj);
+                }
+                ptr = &sp->s_id[0];
+                fprintf(mfp, "%*s", NCPS, ptr );
+
+                /* NoICE output of symbol */
+                if (jflag) DefineNoICE( ptr, aj, memPage );
+        }
+        putc('\n', mfp);
+        free(p);
+        slew(mfp);
 }
 #endif
 
@@ -635,492 +644,492 @@ VOID lstareatosym(struct area *xp)
 }
 #endif
 
-/*)Function    VOID    lkulist(i)
+/*)Function     VOID    lkulist(i)
  *
- *             int     i       i # 0   process LST to RST file
- *                             i = 0   copy remainder of LST file
- *                                     to RST file and close files
+ *              int     i       i # 0   process LST to RST file
+ *                              i = 0   copy remainder of LST file
+ *                                      to RST file and close files
  *
- *     The function lkulist() creates a relocated listing (.rst)
- *     output file from the ASxxxx assembler listing (.lst)
- *     files.  The .lst file's program address and code bytes
- *     are changed to reflect the changes made by ASlink as
- *     the .rel files are combined into a single relocated
- *     output file.
+ *      The function lkulist() creates a relocated listing (.rst)
+ *      output file from the ASxxxx assembler listing (.lst)
+ *      files.  The .lst file's program address and code bytes
+ *      are changed to reflect the changes made by ASlink as
+ *      the .rel files are combined into a single relocated
+ *      output file.
  *
- *     local variables:
- *             Addr_T  pc              current program counter address
+ *      local variables:
+ *              Addr_T  pc              current program counter address
  *
- *     global variables:
- *             int     hilo            byte order
- *             int     gline           get a line from the LST file
- *                                     to translate for the RST file
- *             char    rb[]            read listing file text line
- *             FILE    *rfp            The file handle to the current
- *                                     output RST file
- *             int     rtcnt           count of data words
- *             int     rtflg[]         output the data flag
- *             Addr_T  rtval[]         relocated data
- *             FILE    *tfp            The file handle to the current
- *                                     LST file being scanned
+ *      global variables:
+ *              int     hilo            byte order
+ *              int     gline           get a line from the LST file
+ *                                      to translate for the RST file
+ *              char    rb[]            read listing file text line
+ *              FILE    *rfp            The file handle to the current
+ *                                      output RST file
+ *              int     rtcnt           count of data words
+ *              int     rtflg[]         output the data flag
+ *              Addr_T  rtval[]         relocated data
+ *              FILE    *tfp            The file handle to the current
+ *                                      LST file being scanned
  *
- *     functions called:
- *             int     fclose()        c_library
- *             int     fgets()         c_library
- *             int     fprintf()       c_library
- *             VOID    lkalist()       lklist.c
- *             VOID    lkglist()       lklist.c
+ *      functions called:
+ *              int     fclose()        c_library
+ *              int     fgets()         c_library
+ *              int     fprintf()       c_library
+ *              VOID    lkalist()       lklist.c
+ *              VOID    lkglist()       lklist.c
  *
- *     side effects:
- *             A .rst file is created for each available .lst
- *             file associated with a .rel file.
+ *      side effects:
+ *              A .rst file is created for each available .lst
+ *              file associated with a .rel file.
  */
 
 VOID
 lkulist(int i)
 {
-       Addr_T pc;
-
-       /*
-        * Exit if listing file is not open
-        */
-       if (tfp == NULL)
-               return;
-
-       /*
-        * Normal processing of LST to RST
-        */
-       if (i) {
-               /*
-                * Evaluate current code address
-                */
-               if (hilo == 0) {
-                       pc = ((rtval[1] & 0xFF) << 8) + (rtval[0] & 0xFF);
-               } else {
-                       pc = ((rtval[0] & 0xFF) << 8) + (rtval[1] & 0xFF);
-               }
-
-               /*
-                * Line with only address
-                */
-               if (rtcnt == 2) {
-                       lkalist(pc);
-
-               /*
-                * Line with address and code
-                */
-               } else {
-                       for (i=2; i < rtcnt; i++) {
-                               if (rtflg[i]) {
-                                       lkglist(pc++, rtval[i] & 0xFF);
-                               }
-                       }
-               }
-
-       /*
-        * Copy remainder of LST to RST
-        */
-       } else {
-               if (gline == 0)
-                       fprintf(rfp, "%s", rb);
-
-               while (fgets(rb, sizeof(rb), tfp) != 0) {
-                       fprintf(rfp, "%s", rb);
-               }
-               fclose(tfp);
-               tfp = NULL;
-               fclose(rfp);
-               rfp = NULL;
-       }
+        Addr_T pc;
+
+        /*
+         * Exit if listing file is not open
+         */
+        if (tfp == NULL)
+                return;
+
+        /*
+         * Normal processing of LST to RST
+         */
+        if (i) {
+                /*
+                 * Evaluate current code address
+                 */
+                if (hilo == 0) {
+                        pc = ((rtval[1] & 0xFF) << 8) + (rtval[0] & 0xFF);
+                } else {
+                        pc = ((rtval[0] & 0xFF) << 8) + (rtval[1] & 0xFF);
+                }
+
+                /*
+                 * Line with only address
+                 */
+                if (rtcnt == 2) {
+                        lkalist(pc);
+
+                /*
+                 * Line with address and code
+                 */
+                } else {
+                        for (i=2; i < rtcnt; i++) {
+                                if (rtflg[i]) {
+                                        lkglist(pc++, rtval[i] & 0xFF);
+                                }
+                        }
+                }
+
+        /*
+         * Copy remainder of LST to RST
+         */
+        } else {
+                if (gline == 0)
+                        fprintf(rfp, "%s", rb);
+
+                while (fgets(rb, sizeof(rb), tfp) != 0) {
+                        fprintf(rfp, "%s", rb);
+                }
+                fclose(tfp);
+                tfp = NULL;
+                fclose(rfp);
+                rfp = NULL;
+        }
 }
 
-/*)Function    VOID    lkalist(pc)
+/*)Function     VOID    lkalist(pc)
  *
- *             int     pc              current program counter value
+ *              int     pc              current program counter value
  *
- *     The function lkalist() performs the following functions:
+ *      The function lkalist() performs the following functions:
  *
- *     (1)     if the value of gline = 0 then the current listing
- *             file line is copied to the relocated listing file output.
+ *      (1)     if the value of gline = 0 then the current listing
+ *              file line is copied to the relocated listing file output.
  *
- *     (2)     the listing file is read line by line and copied to
- *             the relocated listing file until a valid source
- *             line number and a program counter value of the correct
- *             radix is found.  The new relocated pc value is substituted
- *             and the line is written to the RST file.
+ *      (2)     the listing file is read line by line and copied to
+ *              the relocated listing file until a valid source
+ *              line number and a program counter value of the correct
+ *              radix is found.  The new relocated pc value is substituted
+ *              and the line is written to the RST file.
  *
- *     local variables:
- *             int     i               loop counter
- *             char    str[]           temporary string
+ *      local variables:
+ *              int     i               loop counter
+ *              char    str[]           temporary string
  *
- *     global variables:
- *             int     gcntr           data byte counter
- *             int     gline           get a line from the LST file
- *                                     to translate for the RST file
- *             char    rb[]            read listing file text line
- *             char    *rp             pointer to listing file text line
- *             FILE    *rfp            The file handle to the current
- *                                     output RST file
- *             FILE    *tfp            The file handle to the current
- *                                     LST file being scanned
+ *      global variables:
+ *              int     gcntr           data byte counter
+ *              int     gline           get a line from the LST file
+ *                                      to translate for the RST file
+ *              char    rb[]            read listing file text line
+ *              char    *rp             pointer to listing file text line
+ *              FILE    *rfp            The file handle to the current
+ *                                      output RST file
+ *              FILE    *tfp            The file handle to the current
+ *                                      LST file being scanned
  *
- *     functions called:
- *             int     dgt()           lklist.c
- *             int     fclose()        c_library
- *             int     fgets()         c_library
- *             int     fprintf()       c_library
- *             int     sprintf()       c_library
- *             char *  strncpy()       c_library
+ *      functions called:
+ *              int     dgt()           lklist.c
+ *              int     fclose()        c_library
+ *              int     fgets()         c_library
+ *              int     fprintf()       c_library
+ *              int     sprintf()       c_library
+ *              char *  strncpy()       c_library
  *
- *     side effects:
- *             Lines of the LST file are copied to the RST file,
- *             the last line copied has the code address
- *             updated to reflect the program relocation.
+ *      side effects:
+ *              Lines of the LST file are copied to the RST file,
+ *              the last line copied has the code address
+ *              updated to reflect the program relocation.
  */
 
 VOID
 lkalist(Addr_T pc)
 {
-       char str[8];
-       int i;
-
-       /*
-        * Exit if listing file is not open
-        */
-loop:  if (tfp == NULL)
-               return;
-
-       /*
-        * Copy current LST to RST
-        */
-       if (gline == 0) {
-               fprintf(rfp, "%s", rb);
-               gline = 1;
-       }
-
-       /*
-        * Clear text line buffer
-        */
-       for (i=0,rp=rb; i<sizeof(rb); i++) {
-               *rp++ = 0;
-       }
-
-       /*
-        * Get next LST text line
-        */
-       if (fgets(rb, sizeof(rb), tfp) == NULL) {
-               fclose(tfp);
-               tfp = NULL;
-               fclose(rfp);
-               rfp = NULL;
-               return;
-       }
-
-       /*
-        * Must have an ASxxxx Listing line number
-        */
-       if (!dgt(RAD10, &rb[30], 1)) {
-               fprintf(rfp, "%s", rb);
-               goto loop;
-       }
-
-       /*
-        * Must have an address in the expected radix
-        */
-       if (radix == 16) {
-               if (!dgt(RAD16, &rb[3], 4)) {
-                       fprintf(rfp, "%s", rb);
-                       goto loop;
-               }
-               sprintf(str, "%04X", pc);
-               strncpy(&rb[3], str, 4);
-       } else
-       if (radix == 10) {
-               if (!dgt(RAD10, &rb[3], 5)) {
-                       fprintf(rfp, "%s", rb);
-                       goto loop;
-               }
-               sprintf(str, "%05d", pc);
-               strncpy(&rb[3], str, 5);
-       } else
-       if (radix == 8) {
-               if (!dgt(RAD8, &rb[3], 6)) {
-                       fprintf(rfp, "%s", rb);
-                       goto loop;
-               }
-               sprintf(str, "%06o", pc);
-               strncpy(&rb[3], str, 6);
-       }
-
-       /*
-        * Copy updated LST text line to RST
-        */
-       fprintf(rfp, "%s", rb);
-       gcntr = 0;
+        char str[8];
+        int i;
+
+        /*
+         * Exit if listing file is not open
+         */
+loop:   if (tfp == NULL)
+                return;
+
+        /*
+         * Copy current LST to RST
+         */
+        if (gline == 0) {
+                fprintf(rfp, "%s", rb);
+                gline = 1;
+        }
+
+        /*
+         * Clear text line buffer
+         */
+        for (i=0,rp=rb; i<sizeof(rb); i++) {
+                *rp++ = 0;
+        }
+
+        /*
+         * Get next LST text line
+         */
+        if (fgets(rb, sizeof(rb), tfp) == NULL) {
+                fclose(tfp);
+                tfp = NULL;
+                fclose(rfp);
+                rfp = NULL;
+                return;
+        }
+
+        /*
+         * Must have an ASxxxx Listing line number
+         */
+        if (!dgt(RAD10, &rb[30], 1)) {
+                fprintf(rfp, "%s", rb);
+                goto loop;
+        }
+
+        /*
+         * Must have an address in the expected radix
+         */
+        if (radix == 16) {
+                if (!dgt(RAD16, &rb[3], 4)) {
+                        fprintf(rfp, "%s", rb);
+                        goto loop;
+                }
+                sprintf(str, "%04X", pc);
+                strncpy(&rb[3], str, 4);
+        } else
+        if (radix == 10) {
+                if (!dgt(RAD10, &rb[3], 5)) {
+                        fprintf(rfp, "%s", rb);
+                        goto loop;
+                }
+                sprintf(str, "%05d", pc);
+                strncpy(&rb[3], str, 5);
+        } else
+        if (radix == 8) {
+                if (!dgt(RAD8, &rb[3], 6)) {
+                        fprintf(rfp, "%s", rb);
+                        goto loop;
+                }
+                sprintf(str, "%06o", pc);
+                strncpy(&rb[3], str, 6);
+        }
+
+        /*
+         * Copy updated LST text line to RST
+         */
+        fprintf(rfp, "%s", rb);
+        gcntr = 0;
 }
 
-/*)Function    VOID    lkglist(pc,v)
+/*)Function     VOID    lkglist(pc,v)
  *
- *             int     pc              current program counter value
- *             int     v               value of byte at this address
+ *              int     pc              current program counter value
+ *              int     v               value of byte at this address
  *
- *     The function lkglist() performs the following functions:
+ *      The function lkglist() performs the following functions:
  *
- *     (1)     if the value of gline = 1 then the listing file
- *             is read line by line and copied to the
- *             relocated listing file until a valid source
- *             line number and a program counter value of the correct
- *             radix is found.
+ *      (1)     if the value of gline = 1 then the listing file
+ *              is read line by line and copied to the
+ *              relocated listing file until a valid source
+ *              line number and a program counter value of the correct
+ *              radix is found.
  *
- *     (2)     The new relocated values and code address are
- *             substituted and the line may be written to the RST file.
+ *      (2)     The new relocated values and code address are
+ *              substituted and the line may be written to the RST file.
  *
- *     local variables:
- *             int     i               loop counter
- *             char    str[]           temporary string
+ *      local variables:
+ *              int     i               loop counter
+ *              char    str[]           temporary string
  *
- *     global variables:
- *             int     gcntr           data byte counter
- *                                     set to -1 for a continuation line
- *             int     gline           get a line from the LST file
- *                                     to translate for the RST file
- *             char    rb[]            read listing file text line
- *             char    *rp             pointer to listing file text line
- *             FILE    *rfp            The file handle to the current
- *                                     output RST file
- *             FILE    *tfp            The file handle to the current
- *                                     LST file being scanned
+ *      global variables:
+ *              int     gcntr           data byte counter
+ *                                      set to -1 for a continuation line
+ *              int     gline           get a line from the LST file
+ *                                      to translate for the RST file
+ *              char    rb[]            read listing file text line
+ *              char    *rp             pointer to listing file text line
+ *              FILE    *rfp            The file handle to the current
+ *                                      output RST file
+ *              FILE    *tfp            The file handle to the current
+ *                                      LST file being scanned
  *
- *     functions called:
- *             int     dgt()           lklist.c
- *             int     fclose()        c_library
- *             int     fgets()         c_library
- *             int     fprintf()       c_library
- *             int     sprintf()       c_library
- *             char *  strncpy()       c_library
+ *      functions called:
+ *              int     dgt()           lklist.c
+ *              int     fclose()        c_library
+ *              int     fgets()         c_library
+ *              int     fprintf()       c_library
+ *              int     sprintf()       c_library
+ *              char *  strncpy()       c_library
  *
- *     side effects:
- *             Lines of the LST file are copied to the RST file
- *             with updated data values and code addresses.
+ *      side effects:
+ *              Lines of the LST file are copied to the RST file
+ *              with updated data values and code addresses.
  */
 
 VOID
 lkglist(Addr_T pc, int v)
 {
-       char str[8];
-       int i;
-
-       /*
-        * Exit if listing file is not open
-        */
-loop:  if (tfp == NULL)
-               return;
-
-       /*
-        * Get next LST text line
-        */
-       if (gline) {
-               /*
-                * Clear text line buffer
-                */
-               for (i=0,rp=rb; i<sizeof(rb); i++) {
-                       *rp++ = 0;
-               }
-
-               /*
-                * Get next LST text line
-                */
-               if (fgets(rb, sizeof(rb), tfp) == NULL) {
-                       fclose(tfp);
-                       tfp = NULL;
-                       fclose(rfp);
-                       rfp = NULL;
-                       return;
-               }
-
-               /*
-                * Check for a listing line number if required
-                */
-               if (gcntr != -1) {
-                       if (!dgt(RAD10, &rb[30], 1)) {
-                               fprintf(rfp, "%s", rb);
-                               goto loop;
-                       }
-                       gcntr = 0;
-               }
-               gline = 0;
-       }
-
-       /*
-        * Hex Listing
-        */
-       if (radix == 16) {
-               /*
-                * Data Byte Pointer
-                */
-               if (gcntr == -1) {
-                       rp = &rb[8];
-               } else {
-                       rp = &rb[8 + (3 * gcntr)];
-               }
-               /*
-                * Number must be of proper radix
-                */
-               if (!dgt(RAD16, rp, 2)) {
-                       fprintf(rfp, "%s", rb);
-                       gline = 1;
-                       goto loop;
-               }
-               /*
-                * Output new data value, overwrite relocation codes
-                */
-               sprintf(str, " %02X", v);
-               strncpy(rp-1, str, 3);
-               if (gcntr == -1) {
-                       gcntr = 0;
-               }
-               /*
-                * Output relocated code address
-                */
-               if (gcntr == 0) {
-                       if (dgt(RAD16, &rb[3], 4)) {
-                               sprintf(str, "%04X", pc);
-                               strncpy(&rb[3], str, 4);
-                       }
-               }
-               /*
-                * Output text line when updates finished
-                */
-               if (++gcntr == 6) {
-                       fprintf(rfp, "%s", rb);
-                       gline = 1;
-                       gcntr = -1;
-               }
-       } else
-       /*
-        * Decimal Listing
-        */
-       if (radix == 10) {
-               /*
-                * Data Byte Pointer
-                */
-               if (gcntr == -1) {
-                       rp = &rb[9];
-               } else {
-                       rp = &rb[9 + (3 * gcntr)];
-               }
-               /*
-                * Number must be of proper radix
-                */
-               if (!dgt(RAD10, rp, 3)) {
-                       fprintf(rfp, "%s", rb);
-                       gline = 1;
-                       goto loop;
-               }
-               /*
-                * Output new data value, overwrite relocation codes
-                */
-               sprintf(str, " %03d", v);
-               strncpy(rp-1, str, 4);
-               if (gcntr == -1) {
-                       gcntr = 0;
-               }
-               /*
-                * Output relocated code address
-                */
-               if (gcntr == 0) {
-                       if (dgt(RAD10, &rb[3], 5)) {
-                               sprintf(str, "%05d", pc);
-                               strncpy(&rb[3], str, 5);
-                       }
-               }
-               /*
-                * Output text line when updates finished
-                */
-               if (++gcntr == 4) {
-                       fprintf(rfp, "%s", rb);
-                       gline = 1;
-                       gcntr = -1;
-               }
-       } else
-       /*
-        * Octal Listing
-        */
-       if (radix == 8) {
-               /*
-                * Data Byte Pointer
-                */
-               if (gcntr == -1) {
-                       rp = &rb[10];
-               } else {
-                       rp = &rb[10 + (3 * gcntr)];
-               }
-               /*
-                * Number must be of proper radix
-                */
-               if (!dgt(RAD8, rp, 3)) {
-                       fprintf(rfp, "%s", rb);
-                       gline = 1;
-                       goto loop;
-               }
-               /*
-                * Output new data value, overwrite relocation codes
-                */
-               sprintf(str, " %03o", v);
-               strncpy(rp-1, str, 4);
-               if (gcntr == -1) {
-                       gcntr = 0;
-               }
-               /*
-                * Output relocated code address
-                */
-               if (gcntr == 0) {
-                       if (dgt(RAD8, &rb[3], 6)) {
-                               sprintf(str, "%06o", pc);
-                               strncpy(&rb[3], str, 6);
-                       }
-               }
-               /*
-                * Output text line when updates finished
-                */
-               if (++gcntr == 4) {
-                       fprintf(rfp, "%s", rb);
-                       gline = 1;
-                       gcntr = -1;
-               }
-       }
+        char str[8];
+        int i;
+
+        /*
+         * Exit if listing file is not open
+         */
+loop:   if (tfp == NULL)
+                return;
+
+        /*
+         * Get next LST text line
+         */
+        if (gline) {
+                /*
+                 * Clear text line buffer
+                 */
+                for (i=0,rp=rb; i<sizeof(rb); i++) {
+                        *rp++ = 0;
+                }
+
+                /*
+                 * Get next LST text line
+                 */
+                if (fgets(rb, sizeof(rb), tfp) == NULL) {
+                        fclose(tfp);
+                        tfp = NULL;
+                        fclose(rfp);
+                        rfp = NULL;
+                        return;
+                }
+
+                /*
+                 * Check for a listing line number if required
+                 */
+                if (gcntr != -1) {
+                        if (!dgt(RAD10, &rb[30], 1)) {
+                                fprintf(rfp, "%s", rb);
+                                goto loop;
+                        }
+                        gcntr = 0;
+                }
+                gline = 0;
+        }
+
+        /*
+         * Hex Listing
+         */
+        if (radix == 16) {
+                /*
+                 * Data Byte Pointer
+                 */
+                if (gcntr == -1) {
+                        rp = &rb[8];
+                } else {
+                        rp = &rb[8 + (3 * gcntr)];
+                }
+                /*
+                 * Number must be of proper radix
+                 */
+                if (!dgt(RAD16, rp, 2)) {
+                        fprintf(rfp, "%s", rb);
+                        gline = 1;
+                        goto loop;
+                }
+                /*
+                 * Output new data value, overwrite relocation codes
+                 */
+                sprintf(str, " %02X", v);
+                strncpy(rp-1, str, 3);
+                if (gcntr == -1) {
+                        gcntr = 0;
+                }
+                /*
+                 * Output relocated code address
+                 */
+                if (gcntr == 0) {
+                        if (dgt(RAD16, &rb[3], 4)) {
+                                sprintf(str, "%04X", pc);
+                                strncpy(&rb[3], str, 4);
+                        }
+                }
+                /*
+                 * Output text line when updates finished
+                 */
+                if (++gcntr == 6) {
+                        fprintf(rfp, "%s", rb);
+                        gline = 1;
+                        gcntr = -1;
+                }
+        } else
+        /*
+         * Decimal Listing
+         */
+        if (radix == 10) {
+                /*
+                 * Data Byte Pointer
+                 */
+                if (gcntr == -1) {
+                        rp = &rb[9];
+                } else {
+                        rp = &rb[9 + (3 * gcntr)];
+                }
+                /*
+                 * Number must be of proper radix
+                 */
+                if (!dgt(RAD10, rp, 3)) {
+                        fprintf(rfp, "%s", rb);
+                        gline = 1;
+                        goto loop;
+                }
+                /*
+                 * Output new data value, overwrite relocation codes
+                 */
+                sprintf(str, " %03d", v);
+                strncpy(rp-1, str, 4);
+                if (gcntr == -1) {
+                        gcntr = 0;
+                }
+                /*
+                 * Output relocated code address
+                 */
+                if (gcntr == 0) {
+                        if (dgt(RAD10, &rb[3], 5)) {
+                                sprintf(str, "%05d", pc);
+                                strncpy(&rb[3], str, 5);
+                        }
+                }
+                /*
+                 * Output text line when updates finished
+                 */
+                if (++gcntr == 4) {
+                        fprintf(rfp, "%s", rb);
+                        gline = 1;
+                        gcntr = -1;
+                }
+        } else
+        /*
+         * Octal Listing
+         */
+        if (radix == 8) {
+                /*
+                 * Data Byte Pointer
+                 */
+                if (gcntr == -1) {
+                        rp = &rb[10];
+                } else {
+                        rp = &rb[10 + (3 * gcntr)];
+                }
+                /*
+                 * Number must be of proper radix
+                 */
+                if (!dgt(RAD8, rp, 3)) {
+                        fprintf(rfp, "%s", rb);
+                        gline = 1;
+                        goto loop;
+                }
+                /*
+                 * Output new data value, overwrite relocation codes
+                 */
+                sprintf(str, " %03o", v);
+                strncpy(rp-1, str, 4);
+                if (gcntr == -1) {
+                        gcntr = 0;
+                }
+                /*
+                 * Output relocated code address
+                 */
+                if (gcntr == 0) {
+                        if (dgt(RAD8, &rb[3], 6)) {
+                                sprintf(str, "%06o", pc);
+                                strncpy(&rb[3], str, 6);
+                        }
+                }
+                /*
+                 * Output text line when updates finished
+                 */
+                if (++gcntr == 4) {
+                        fprintf(rfp, "%s", rb);
+                        gline = 1;
+                        gcntr = -1;
+                }
+        }
 }
 
-/*)Function    int     dgt(rdx,str,n)
+/*)Function     int     dgt(rdx,str,n)
  *
- *             int     rdx             radix bit code
- *             char    *str            pointer to the test string
- *             int     n               number of characters to check
+ *              int     rdx             radix bit code
+ *              char    *str            pointer to the test string
+ *              int     n               number of characters to check
  *
- *     The function dgt() verifies that the string under test
- *     is of the specified radix.
+ *      The function dgt() verifies that the string under test
+ *      is of the specified radix.
  *
- *     local variables:
- *             int     i               loop counter
+ *      local variables:
+ *              int     i               loop counter
  *
- *     global variables:
- *             ctype[]                 array of character types
+ *      global variables:
+ *              ctype[]                 array of character types
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  */
 
 int
 dgt(int rdx, char *str, int n)
 {
-       int i;
+        int i;
 
-       for (i=0; i<n; i++) {
-               if ((ctype[(unsigned char)(*str++)] & rdx) == 0)
-                       return(0);
-       }
-       return(1);
+        for (i=0; i<n; i++) {
+                if ((ctype[(unsigned char)(*str++)] & rdx) == 0)
+                        return(0);
+        }
+        return(1);
 }
index d9209b6bfb105dfe39d2cf94e41383df87d153f5..0f57e2659aac91acb86c804dfe20cadf5dcb7d9f 100644 (file)
@@ -1,4 +1,20 @@
-/* lknoice.c */
+/* lknoice.c - Extensions to CUG 292 linker ASLINK to produce NoICE debug files
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions to CUG 292 linker ASLINK to produce NoICE debug files
@@ -30,85 +46,85 @@ static void PagedAddress( Addr_T value, int page );
  */
 void DefineNoICE( char *name, Addr_T value, int page )
 {
-       char token1[NCPS];                      /* parse for file.function.symbol */
-       char token2[NCPS];
-       char token3[NCPS];
-       //      char token4[NCPS];
-       char sep1, sep2;
-       int  j, level;
+        char token1[NCPS];                      /* parse for file.function.symbol */
+        char token2[NCPS];
+        char token3[NCPS];
+        //      char token4[NCPS];
+        char sep1, sep2;
+        int  j, level;
 
-       /* no output if file is not open */
-       if (jfp == NULL) return;
+        /* no output if file is not open */
+        if (jfp == NULL) return;
 
         j = sscanf( name, "%[^.]%c%[^.]%c%s",
-                   token1, &sep1, token2, &sep2, token3 );
+                    token1, &sep1, token2, &sep2, token3 );
         switch (j)
-       {
-               /* file.function.symbol, or file.function..SPECIAL */
-               case 5:
-                       DefineFile( token1, 0, 0 );
-                       if (token3[0] == '.')
-                       {
-                               if (strcmp( token3, ".FN" ) == 0)
-                               {
-                                       /* Global function */
+        {
+                /* file.function.symbol, or file.function..SPECIAL */
+                case 5:
+                        DefineFile( token1, 0, 0 );
+                        if (token3[0] == '.')
+                        {
+                                if (strcmp( token3, ".FN" ) == 0)
+                                {
+                                        /* Global function */
                                         DefineFunction( token2, value, page );
-                               }
-                               else if (strcmp( token3, ".SFN" ) == 0)
-                               {
-                                       /* Static (file-scope) function */
-                                       DefineStaticFunction( token2, value, page );
-                               }
-                               else if (strcmp( token3, ".EFN" ) == 0)
-                               {
-                                       /* End of function */
+                                }
+                                else if (strcmp( token3, ".SFN" ) == 0)
+                                {
+                                        /* Static (file-scope) function */
+                                        DefineStaticFunction( token2, value, page );
+                                }
+                                else if (strcmp( token3, ".EFN" ) == 0)
+                                {
+                                        /* End of function */
                                         DefineEndFunction( value, page );
                                 }
-                       }
-                       else
-                       {
-                               /* Function-scope var. */
-                               DefineFunction( token2, 0, 0 );
+                        }
+                        else
+                        {
+                                /* Function-scope var. */
+                                DefineFunction( token2, 0, 0 );
 
                                 /* Look for optional level integer */
-                               j = sscanf( token3, "%[^.]%c%u", token1, &sep1, &level );
+                                j = sscanf( token3, "%[^.]%c%u", token1, &sep1, &level );
                                 if ((j == 3) && (level != 0))
                                 {
-                                       sprintf( &token1[ strlen(token1) ], "_%u", level );
-                               }
-                                       DefineScoped( token1, value, page );
+                                        sprintf( &token1[ strlen(token1) ], "_%u", level );
+                                }
+                                DefineScoped( token1, value, page );
                         }
-                       break;
-
-               /* file.func. is illegal */
-               case 4:
-                       break;
-
-               /* either file.symbol or file.line# */
-               case 3:
-                       DefineFile( token1, 0, 0 );
-                       if ((token2[0] >= '0') && (token2[0] <= '9'))
-                       {
-                               /* Line number */
+                        break;
+
+                /* file.func. is illegal */
+                case 4:
+                        break;
+
+                /* either file.symbol or file.line# */
+                case 3:
+                        DefineFile( token1, 0, 0 );
+                        if ((token2[0] >= '0') && (token2[0] <= '9'))
+                        {
+                                /* Line number */
                                 DefineLine( token2, value, page );
                         }
-                       else
-                       {
-                               /* File-scope symbol.  (Kill any function) */
-                               DefineEndFunction( 0, 0 );
+                        else
+                        {
+                                /* File-scope symbol.  (Kill any function) */
+                                DefineEndFunction( 0, 0 );
                                 DefineScoped( token2, value, page );
                         }
-                       break;
+                        break;
 
-               /* symbol. is illegal */
-               case 2:
-                       break;
+                /* symbol. is illegal */
+                case 2:
+                        break;
 
-               /* just a symbol */
-               case 1:
+                /* just a symbol */
+                case 1:
                         DefineGlobal( token1, value, page );
                         break;
-       }
+        }
 }
 
 static char currentFile[NCPS];
@@ -120,8 +136,8 @@ static char currentFunction[NCPS];
  */
 void DefineGlobal( char *name, Addr_T value, int page )
 {
-       fprintf( jfp, "DEF %s ", name );
-       PagedAddress( value, page );
+        fprintf( jfp, "DEF %s ", name );
+        PagedAddress( value, page );
 }
 
 /*
@@ -130,8 +146,8 @@ void DefineGlobal( char *name, Addr_T value, int page )
  */
 void DefineScoped( char *name, Addr_T value, int page )
 {
-       fprintf( jfp, "DEFS %s ", name );
-       PagedAddress( value, page );
+        fprintf( jfp, "DEFS %s ", name );
+        PagedAddress( value, page );
 }
 
 /*
@@ -140,19 +156,19 @@ void DefineScoped( char *name, Addr_T value, int page )
  */
 void DefineFile( char *name, Addr_T value, int page )
 {
-       if (as_strcmpi( name, currentFile ) != 0)
-       {
-               strcpy( currentFile, name );
-               if (value != 0)
-               {
-                       fprintf( jfp, "FILE %s ", name );
-                       PagedAddress( value, page );
-               }
-               else
-               {
-                       fprintf( jfp, "FILE %s\n", name );
-               }
-       }
+        if (as_strcmpi( name, currentFile ) != 0)
+        {
+                strcpy( currentFile, name );
+                if (value != 0)
+                {
+                        fprintf( jfp, "FILE %s ", name );
+                        PagedAddress( value, page );
+                }
+                else
+                {
+                        fprintf( jfp, "FILE %s\n", name );
+                }
+        }
 }
 
 /*
@@ -161,21 +177,21 @@ void DefineFile( char *name, Addr_T value, int page )
  */
 void DefineFunction( char *name, Addr_T value, int page )
 {
-       if (as_strcmpi( name, currentFunction ) != 0)
-       {
-               strcpy( currentFunction, name );
+        if (as_strcmpi( name, currentFunction ) != 0)
+        {
+                strcpy( currentFunction, name );
                 if (value != 0)
                 {
                         fprintf( jfp, "DEF %s ", name );
-                       PagedAddress( value, page );
+                        PagedAddress( value, page );
                         fprintf( jfp, "FUNC %s ", name );
-                       PagedAddress( value, page );
+                        PagedAddress( value, page );
                 }
                 else
                 {
                         fprintf( jfp, "FUNC %s\n", name );
-               }
-       }
+                }
+        }
 }
 
 /*
@@ -184,21 +200,21 @@ void DefineFunction( char *name, Addr_T value, int page )
  */
 void DefineStaticFunction( char *name, Addr_T value, int page )
 {
-       if (as_strcmpi( name, currentFunction ) != 0)
-       {
-               strcpy( currentFunction, name );
-               if (value != 0)
-               {
+        if (as_strcmpi( name, currentFunction ) != 0)
+        {
+                strcpy( currentFunction, name );
+                if (value != 0)
+                {
                         fprintf( jfp, "DEFS %s ", name );
-                       PagedAddress( value, page );
-                       fprintf( jfp, "SFUNC %s ", name );
-                       PagedAddress( value, page );
-               }
-               else
-               {
-                       fprintf( jfp, "SFUNC %s\n", name );
-               }
-       }
+                        PagedAddress( value, page );
+                        fprintf( jfp, "SFUNC %s ", name );
+                        PagedAddress( value, page );
+                }
+                else
+                {
+                        fprintf( jfp, "SFUNC %s\n", name );
+                }
+        }
 }
 
 /*
@@ -207,20 +223,20 @@ void DefineStaticFunction( char *name, Addr_T value, int page )
  */
 void DefineEndFunction( Addr_T value, int page )
 {
-       if (currentFunction[0] != 0)
-       {
-               if (value != 0)
-               {
-                       fprintf( jfp, "ENDF " );
-                       PagedAddress( value, page );
-               }
-               else
-               {
-                       fprintf( jfp, "ENDF\n" );
-               }
-
-               currentFunction[0] = 0;
-       }
+        if (currentFunction[0] != 0)
+        {
+                if (value != 0)
+                {
+                        fprintf( jfp, "ENDF " );
+                        PagedAddress( value, page );
+                }
+                else
+                {
+                        fprintf( jfp, "ENDF\n" );
+                }
+
+                currentFunction[0] = 0;
+        }
 }
 
 /*
@@ -229,17 +245,17 @@ void DefineEndFunction( Addr_T value, int page )
  */
 void DefineLine( char *lineString, Addr_T value, int page )
 {
-       int indigit, lineNumber = 0;
+        int indigit, lineNumber = 0;
 
-       while( (indigit=digit( *lineString++, 10 )) >= 0)
-       {
-               lineNumber = 10*lineNumber + indigit;
-       }
-       fprintf( jfp, "LINE %u ", lineNumber );
+        while( (indigit=digit( *lineString++, 10 )) >= 0)
+        {
+                lineNumber = 10*lineNumber + indigit;
+        }
+        fprintf( jfp, "LINE %u ", lineNumber );
         PagedAddress( value, page );
 }
 
 void PagedAddress( Addr_T value, int page )
 {
-       fprintf( jfp, "%X:0x%X\n", page, value );
+        fprintf( jfp, "%X:0x%X\n", page, value );
 }
index 7b5a931cfa02c68b2761a99dbaa9159a2b780498..5aae61edf3d6484cb3e567c90ebd411f8fc5aa2f 100644 (file)
@@ -6,7 +6,7 @@
 
 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 2, or (at your option) any
+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,
@@ -15,8 +15,7 @@ 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, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
  * With contributions for the
index 3d88d63a4e2f0dd926024567e25c7dee37a5b31a..ec846e85d10c221d6a18419381f8b38dcf148c7c 100644 (file)
@@ -6,7 +6,7 @@
 
 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 2, or (at your option) any
+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,
@@ -15,8 +15,7 @@ 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, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
  * With contributions for the
index d45c0c39e1e8d11d9d20d64de2fecdd66a1d69c6..6f4dc46b010459234d32f40f346263e8f7fa01d4 100644 (file)
@@ -6,7 +6,7 @@
 
 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 2, or (at your option) any
+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,
@@ -15,8 +15,7 @@ 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, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
  * With contributions for the
index 063e89c4d88cca7f6345bf14fe817cf4ea620b76..08e981b7e007c5f00a1332b64aa57620179ecd32 100644 (file)
@@ -1,6 +1,22 @@
-/* lkstore.c */
+/* lkstore.c - Allocated string storage module.
 
-/* 
+   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 <http://www.gnu.org/licenses/>. */
+
+/*
  * Allocated string storage module.
  *
  * 31-Oct-1997 by John Hartman
@@ -24,11 +40,11 @@ char *StoreString( char *str )
    #define STR_STORE_HUNK 2000
    static char *pNextFree = NULL;
    static int  bytesLeft = 0;
-   
+
    int  length;
    char *pStoredString;
-   
-   length = strlen( str ) + 1; /* what we need, including null */
+
+   length = strlen( str ) + 1;  /* what we need, including null */
 
    if (length > bytesLeft)
    {
index e04080506c461c2124715583d35fe7f910a40051..d3cacbe3ceb7dc26e51d4406f595aa13e0e91afe 100644 (file)
@@ -1,17 +1,26 @@
-/* lksym.c */
+/* lksym.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
- * 28-Oct-97 JLH: 
- *          - lkpsym: Use StoreString for sym construction
- *          - change symeq() to do length-independent string compare
- *          - change hash() to do length-independent hash calculation
+ * 28-Oct-97 JLH:
+ *           - lkpsym: Use StoreString for sym construction
+ *           - change symeq() to do length-independent string compare
+ *           - change hash() to do length-independent hash calculation
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include "aslink.h"
 
-/*)Module      lksym.c
- *
- *     The module lksym.c contains the functions that operate
- *     on the symbol structures.
- *
- *     lksym.c contains the following functions:
- *             int     hash()
- *             sym *   lkpsym()
- *             VOID *  new()
- *             sym *   newsym()
- *             VOID    symdef()
- *             int     symeq()
- *             VOID    syminit()
- *             VOID    symmod()
- *             Addr_T  symval()
- *
- *     lksym.c contains no local/static variables.
+/*)Module       lksym.c
+ *
+ *      The module lksym.c contains the functions that operate
+ *      on the symbol structures.
+ *
+ *      lksym.c contains the following functions:
+ *              int     hash()
+ *              sym *   lkpsym()
+ *              VOID *  new()
+ *              sym *   newsym()
+ *              VOID    symdef()
+ *              int     symeq()
+ *              VOID    syminit()
+ *              VOID    symmod()
+ *              Addr_T  symval()
+ *
+ *      lksym.c contains no local/static variables.
  */
 
-/*)Function    VOID    syminit()
+/*)Function     VOID    syminit()
  *
- *     The function syminit() is called to clear the hashtable.
+ *      The function syminit() is called to clear the hashtable.
  *
- *     local variables:
- *             int     h               computed hash value
- *             sym **  spp             pointer to an array of
- *                                     sym structure pointers
+ *      local variables:
+ *              int     h               computed hash value
+ *              sym **  spp             pointer to an array of
+ *                                      sym structure pointers
  *
- *     global variables:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
+ *      global variables:
+ *              sym * symhash[]         array of pointers to NHASH
+ *                                      linked symbol lists
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             (1)     The symbol hash tables are cleared
+ *      side effects:
+ *              (1)     The symbol hash tables are cleared
  */
 
 VOID
 syminit(void)
 {
-       struct sym **spp;
+        struct sym **spp;
 
-       spp = &symhash[0];
-       while (spp < &symhash[NHASH])
-               *spp++ = NULL;
+        spp = &symhash[0];
+        while (spp < &symhash[NHASH])
+                *spp++ = NULL;
 }
 
-/*)Function    sym *   newsym()
- *
- *     The function newsym() is called to evaluate the symbol
- *     definition/reference directive from the .rel file(s).
- *     If the symbol is not found in the symbol table a new
- *     symbol structure is created.  Evaluation of the
- *     directive determines if this is a reference or a definition.
- *     Multiple definitions of the same variable will be flagged
- *     as an error if the values are not identical.  A symbol
- *     definition places the symbol value and area extension
- *     into the symbols data structure.  And finally, a pointer
- *     to the symbol structure is placed into the head structure
- *     symbol list.  Refer to the description of the header, symbol,
- *     area, and areax structures in lkdata.c for structure and
- *     linkage details.
- *
- *     local variables:
- *             int     c               character from input text
- *             int     i               evaluation value
- *             char    id[]            symbol name
- *             int     nglob           number of symbols in this header
- *             sym *   tsp             pointer to symbol structure
- *             sym **  s               list of pointers to symbol structures
- *
- *     global variables:
- *             areax   *axp            Pointer to the current
- *                                     areax structure
- *             head    *headp          The pointer to the first
- *                                     head structure of a linked list
- *             int     lkerr           error flag
- *
- *     functions called:
- *             Addr_T  eval()          lkeval.c
- *             VOID    exit()          c_library
- *             int     fprintf()       c_library
- *             char    getSid()        lklex.c
- *             char    get()           lklex.c
- *             char    getnb()         lklex.c
- *             sym *   lkpsym()        lksym.c
- *
- *     side effects:
- *             A symbol structure is created and/or modified.
- *             If structure space allocation fails linker will abort.
- *             Several severe errors (these are internal errors
- *             indicating a corrupted .rel file or corrupted
- *             assembler or linker) will terminated the linker.
+/*)Function     sym *   newsym()
+ *
+ *      The function newsym() is called to evaluate the symbol
+ *      definition/reference directive from the .rel file(s).
+ *      If the symbol is not found in the symbol table a new
+ *      symbol structure is created.  Evaluation of the
+ *      directive determines if this is a reference or a definition.
+ *      Multiple definitions of the same variable will be flagged
+ *      as an error if the values are not identical.  A symbol
+ *      definition places the symbol value and area extension
+ *      into the symbols data structure.  And finally, a pointer
+ *      to the symbol structure is placed into the head structure
+ *      symbol list.  Refer to the description of the header, symbol,
+ *      area, and areax structures in lkdata.c for structure and
+ *      linkage details.
+ *
+ *      local variables:
+ *              int     c               character from input text
+ *              int     i               evaluation value
+ *              char    id[]            symbol name
+ *              int     nglob           number of symbols in this header
+ *              sym *   tsp             pointer to symbol structure
+ *              sym **  s               list of pointers to symbol structures
+ *
+ *      global variables:
+ *              areax   *axp            Pointer to the current
+ *                                      areax structure
+ *              head    *headp          The pointer to the first
+ *                                      head structure of a linked list
+ *              int     lkerr           error flag
+ *
+ *      functions called:
+ *              Addr_T  eval()          lkeval.c
+ *              VOID    exit()          c_library
+ *              int     fprintf()       c_library
+ *              char    getSid()        lklex.c
+ *              char    get()           lklex.c
+ *              char    getnb()         lklex.c
+ *              sym *   lkpsym()        lksym.c
+ *
+ *      side effects:
+ *              A symbol structure is created and/or modified.
+ *              If structure space allocation fails linker will abort.
+ *              Several severe errors (these are internal errors
+ *              indicating a corrupted .rel file or corrupted
+ *              assembler or linker) will terminated the linker.
  */
 
 /*
@@ -131,348 +140,348 @@ newsym(void)
 {
   register unsigned i ;
   register unsigned nglob ;
-       register int c ;
-       struct sym *tsp;
-       struct sym **s;
-       char id[NCPS];
-
-       getSid(id);     // old: getid(id, -1);
-       tsp = lkpsym(id, 1);
-       c = getnb();get();get();
-       if (c == 'R') {
-               tsp->s_type |= S_REF;
-               if (eval()) {
-                       fprintf(stderr, "Non zero S_REF\n");
-                       lkerr++;
-               }
-       } else
-       if (c == 'D') {
-               i = eval();
-               if (tsp->s_type & S_DEF && tsp->s_addr != i) {
-                       fprintf(stderr, "Multiple definition of %s\n", id);
-                       lkerr++;
-               }
-               tsp->s_type |= S_DEF;
-               /*
-                * Set value and area extension link.
-                */
-               tsp->s_addr = i;
-               tsp->s_axp = axp;
-       } else {
-               fprintf(stderr, "Invalid symbol type %c for %s\n", c, id);
-               lkexit(1);
-       }
-       /*
-        * Place pointer in header symbol list
-        */
-       if (headp == NULL) {
-               fprintf(stderr, "No header defined\n");
-               lkexit(1);
-       }
-       nglob = hp->h_nglob;
-       s = hp->s_list;
-       for (i=0; i < nglob ;++i) {
-               if (s[i] == NULL) {
-                       s[i] = tsp;
-                       return(tsp);
-               }
-       }
-       fprintf(stderr, "Header symbol list overflow\n");
-       lkexit(1);
-
-       /* Never reached */
-       return(0);
+        register int c ;
+        struct sym *tsp;
+        struct sym **s;
+        char id[NCPS];
+
+        getSid(id);     // old: getid(id, -1);
+        tsp = lkpsym(id, 1);
+        c = getnb();get();get();
+        if (c == 'R') {
+                tsp->s_type |= S_REF;
+                if (eval()) {
+                        fprintf(stderr, "Non zero S_REF\n");
+                        lkerr++;
+                }
+        } else
+        if (c == 'D') {
+                i = eval();
+                if (tsp->s_type & S_DEF && tsp->s_addr != i) {
+                        fprintf(stderr, "Multiple definition of %s\n", id);
+                        lkerr++;
+                }
+                tsp->s_type |= S_DEF;
+                /*
+                 * Set value and area extension link.
+                 */
+                tsp->s_addr = i;
+                tsp->s_axp = axp;
+        } else {
+                fprintf(stderr, "Invalid symbol type %c for %s\n", c, id);
+                lkexit(1);
+        }
+        /*
+         * Place pointer in header symbol list
+         */
+        if (headp == NULL) {
+                fprintf(stderr, "No header defined\n");
+                lkexit(1);
+        }
+        nglob = hp->h_nglob;
+        s = hp->s_list;
+        for (i=0; i < nglob ;++i) {
+                if (s[i] == NULL) {
+                        s[i] = tsp;
+                        return(tsp);
+                }
+        }
+        fprintf(stderr, "Header symbol list overflow\n");
+        lkexit(1);
+
+        /* Never reached */
+        return(0);
 }
 
-/*)Function    sym *   lkpsym(id,f)
- *
- *             char *  id              symbol name string
- *             int     f               f == 0, lookup only
- *                                     f != 0, create if not found
- *
- *     The function lookup() searches the symbol hash tables for
- *     a symbol name match returning a pointer to the sym structure.
- *     If the symbol is not found then a sym structure is created,
- *     initialized, and linked to the appropriate hash table if f != 0.
- *     A pointer to this new sym structure is returned or a NULL
- *     pointer is returned if f == 0.
- *
- *     local variables:
- *             int     h               computed hash value
- *             sym *   sp              pointer to a sym structure
- *
- *     global varaibles:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             int     hash()          lksym.c
- *             VOID *  new()           lksym.c
- *             int     symeq()         lksym.c
- *
- *     side effects:
- *             If the function new() fails to allocate space
- *             for the new sym structure the linker terminates.
+/*)Function     sym *   lkpsym(id,f)
+ *
+ *              char *  id              symbol name string
+ *              int     f               f == 0, lookup only
+ *                                      f != 0, create if not found
+ *
+ *      The function lookup() searches the symbol hash tables for
+ *      a symbol name match returning a pointer to the sym structure.
+ *      If the symbol is not found then a sym structure is created,
+ *      initialized, and linked to the appropriate hash table if f != 0.
+ *      A pointer to this new sym structure is returned or a NULL
+ *      pointer is returned if f == 0.
+ *
+ *      local variables:
+ *              int     h               computed hash value
+ *              sym *   sp              pointer to a sym structure
+ *
+ *      global varaibles:
+ *              sym * symhash[]         array of pointers to NHASH
+ *                                      linked symbol lists
+ *
+ *      functions called:
+ *              int     hash()          lksym.c
+ *              VOID *  new()           lksym.c
+ *              int     symeq()         lksym.c
+ *
+ *      side effects:
+ *              If the function new() fails to allocate space
+ *              for the new sym structure the linker terminates.
  */
 
 struct sym *
 lkpsym(char *id, int f)
 {
-       register struct sym *sp;
-       register int h;
-
-       h = hash(id);
-       sp = symhash[h];
-       while (sp != NULL) {
-               if (symeq(id, sp->s_id))
-                       return (sp);
-               sp = sp->s_sp;
-       }
-       if (f == 0)
-               return (NULL);
-       sp = (struct sym *) new (sizeof(struct sym));
-       sp->s_sp = symhash[h];
-       symhash[h] = sp;
-       sp->s_id = StoreString( id );   /* JLH */
-       return (sp);
+        register struct sym *sp;
+        register int h;
+
+        h = hash(id);
+        sp = symhash[h];
+        while (sp != NULL) {
+                if (symeq(id, sp->s_id))
+                        return (sp);
+                sp = sp->s_sp;
+        }
+        if (f == 0)
+                return (NULL);
+        sp = (struct sym *) new (sizeof(struct sym));
+        sp->s_sp = symhash[h];
+        symhash[h] = sp;
+        sp->s_id = StoreString( id );   /* JLH */
+        return (sp);
 }
 
-/*)Function    Addr_T  symval(tsp)
+/*)Function     Addr_T  symval(tsp)
  *
- *             sym *   tsp             pointer to a symbol structure
+ *              sym *   tsp             pointer to a symbol structure
  *
- *     The function symval() returns the value of the
- *     relocated symbol by adding the variable definition
- *     value to the areax base address.
+ *      The function symval() returns the value of the
+ *      relocated symbol by adding the variable definition
+ *      value to the areax base address.
  *
- *     local variables:
- *             Addr_T  val             relocated address value
+ *      local variables:
+ *              Addr_T  val             relocated address value
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  */
 
 Addr_T
 symval(register struct sym *tsp)
 {
-       register Addr_T val;
+        register Addr_T val;
 
-       val = tsp->s_addr;
-       if (tsp->s_axp) {
-               val += tsp->s_axp->a_addr;
-       }
-       return(val);
+        val = tsp->s_addr;
+        if (tsp->s_axp) {
+                val += tsp->s_axp->a_addr;
+        }
+        return(val);
 }
 
-/*)Function    VOID    symdef(fp)
+/*)Function     VOID    symdef(fp)
  *
- *             FILE *  fp              file handle for output
+ *              FILE *  fp              file handle for output
  *
- *     The function symdef() scans the hashed symbol table
- *     searching for variables referenced but not defined.
- *     Undefined variables are linked to the default
- *     area "_CODE" and reported as referenced by the
- *     appropriate module.
+ *      The function symdef() scans the hashed symbol table
+ *      searching for variables referenced but not defined.
+ *      Undefined variables are linked to the default
+ *      area "_CODE" and reported as referenced by the
+ *      appropriate module.
  *
- *     local variables:
- *             int     i               hash table index loop variable
- *             sym *   sp              pointer to linked symbol structure
+ *      local variables:
+ *              int     i               hash table index loop variable
+ *              sym *   sp              pointer to linked symbol structure
  *
- *     global variables:
- *             area    *areap          The pointer to the first
- *                                     area structure of a linked list
- *             sym *symhash[NHASH]     array of pointers to NHASH
- *                                     linked symbol lists
+ *      global variables:
+ *              area    *areap          The pointer to the first
+ *                                      area structure of a linked list
+ *              sym *symhash[NHASH]     array of pointers to NHASH
+ *                                      linked symbol lists
  *
- *     functions called:
- *             symmod()                lksym.c
+ *      functions called:
+ *              symmod()                lksym.c
  *
- *     side effects:
- *             Undefined variables have their areas set to "_CODE".
+ *      side effects:
+ *              Undefined variables have their areas set to "_CODE".
  */
 
 VOID
 symdef(FILE *fp)
 {
-       register struct sym *sp;
-       register int i;
-
-       for (i=0; i<NHASH; ++i) {
-               sp = symhash[i];
-               while (sp) {
-                       if (sp->s_axp == NULL)
-                               sp->s_axp = areap->a_axp;
-                       if ((sp->s_type & S_DEF) == 0)
-                               symmod(fp, sp);
-                       sp = sp->s_sp;
-               }
-       }
+        register struct sym *sp;
+        register int i;
+
+        for (i=0; i<NHASH; ++i) {
+                sp = symhash[i];
+                while (sp) {
+                        if (sp->s_axp == NULL)
+                                sp->s_axp = areap->a_axp;
+                        if ((sp->s_type & S_DEF) == 0)
+                                symmod(fp, sp);
+                        sp = sp->s_sp;
+                }
+        }
 }
 
-/*)Function    VOID    symmod(fp,tsp)
- *
- *             FILE *  fp              output file handle
- *             sym *   tsp             pointer to a symbol structure
- *
- *     The function symmod() scans the header structures
- *     searching for a reference to the symbol structure
- *     pointer to by tsp.  The function then generates an error
- *     message whichs names the module having referenced the
- *     undefined variable.
- *
- *     local variables:
- *             int     i               loop counter
- *             sym **  p               pointer to a list of pointers
- *                                     to symbol structures
- *
- *     global variables:
- *             head    *headp          The pointer to the first
- *                                     head structure of a linked list
- *             head    *hp             Pointer to the current
- *                                     head structure
- *             int     lkerr           error flag
- *
- *     functions called:
- *             int     fprintf()       c_library
- *
- *     side effects:
- *             Error output generated.
+/*)Function     VOID    symmod(fp,tsp)
+ *
+ *              FILE *  fp              output file handle
+ *              sym *   tsp             pointer to a symbol structure
+ *
+ *      The function symmod() scans the header structures
+ *      searching for a reference to the symbol structure
+ *      pointer to by tsp.  The function then generates an error
+ *      message whichs names the module having referenced the
+ *      undefined variable.
+ *
+ *      local variables:
+ *              int     i               loop counter
+ *              sym **  p               pointer to a list of pointers
+ *                                      to symbol structures
+ *
+ *      global variables:
+ *              head    *headp          The pointer to the first
+ *                                      head structure of a linked list
+ *              head    *hp             Pointer to the current
+ *                                      head structure
+ *              int     lkerr           error flag
+ *
+ *      functions called:
+ *              int     fprintf()       c_library
+ *
+ *      side effects:
+ *              Error output generated.
  */
 
 VOID
 symmod(FILE *fp, struct sym *tsp)
 {
-       register int i;
-       struct sym **p;
-
-       if ((hp = headp) != NULL) {
-               while(hp) {
-                       p = hp->s_list;
-                       for (i=0; i<hp->h_nglob; ++i) {
-                               if (p[i] == tsp) {
-                                       fprintf(fp, "\n?ASlink-Warning-Undefined Global '%s' ", tsp->s_id);
-                                       fprintf(fp, "referenced by module '%s'\n", hp->m_id);
-                                       lkerr++;
-                               }
-                       }
-                       hp = hp->h_hp;
-               }
-       }
+        register int i;
+        struct sym **p;
+
+        if ((hp = headp) != NULL) {
+                while(hp) {
+                        p = hp->s_list;
+                        for (i=0; i<hp->h_nglob; ++i) {
+                                if (p[i] == tsp) {
+                                        fprintf(fp, "\n?ASlink-Warning-Undefined Global '%s' ", tsp->s_id);
+                                        fprintf(fp, "referenced by module '%s'\n", hp->m_id);
+                                        lkerr++;
+                                }
+                        }
+                        hp = hp->h_hp;
+                }
+        }
 }
 
-/*)Function    int     symeq(p1, p2)
+/*)Function     int     symeq(p1, p2)
  *
- *             char *  p1              name string
- *             char *  p2              name string
+ *              char *  p1              name string
+ *              char *  p2              name string
  *
- *     The function symeq() compares the two name strings for a match.
- *     The return value is 1 for a match and 0 for no match.
+ *      The function symeq() compares the two name strings for a match.
+ *      The return value is 1 for a match and 0 for no match.
  *
- *     local variables:
- *             int     h               loop counter
+ *      local variables:
+ *              int     h               loop counter
  *
- *     global variables:
- *             char    ccase[]         an array of characters which
- *                                     perform the case translation function
+ *      global variables:
+ *              char    ccase[]         an array of characters which
+ *                                      perform the case translation function
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  *
  */
 
 int
 symeq(register char *p1, register char *p2)
 {
-#if    CASE_SENSITIVE
-               return (strncmp( p1, p2, NCPS ) == 0);
+#if     CASE_SENSITIVE
+                return (strncmp( p1, p2, NCPS ) == 0);
 #else
-               return (as_strncmpi( p1, p2, NCPS ) == 0);
+                return (as_strncmpi( p1, p2, NCPS ) == 0);
 #endif
 }
 
-/*)Function    int     hash(p)
+/*)Function     int     hash(p)
  *
- *             char *  p               pointer to string to hash
+ *              char *  p               pointer to string to hash
  *
- *     The function hash() computes a hash code using the sum
- *     of all characters mod table size algorithm.
+ *      The function hash() computes a hash code using the sum
+ *      of all characters mod table size algorithm.
  *
- *     local variables:
- *             int     h               accumulated character sum
- *             int     n               loop counter
+ *      local variables:
+ *              int     h               accumulated character sum
+ *              int     n               loop counter
  *
- *     global variables:
- *             char    ccase[]         an array of characters which
- *                                     perform the case translation function
+ *      global variables:
+ *              char    ccase[]         an array of characters which
+ *                                      perform the case translation function
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             none
+ *      side effects:
+ *              none
  *
  */
+
 int
 hash(register char *p)
 {
-       register int h, n;
+        register int h, n;
 
-       h = 0;
-       n = NCPS;
-       while (*p && n--) {
+        h = 0;
+        n = NCPS;
+        while (*p && n--) {
 
-#if    CASE_SENSITIVE
-               h += *p++;
+#if     CASE_SENSITIVE
+                h += *p++;
 #else
-               h += ccase[(unsigned char)(*p++)];
+                h += ccase[(unsigned char)(*p++)];
 #endif
 
-       }
-       return (h&HMASK);
+        }
+        return (h&HMASK);
 }
 
-/*)Function    VOID *  new(n)
+/*)Function     VOID *  new(n)
  *
- *             unsigned int    n       allocation size in bytes
+ *              unsigned int    n       allocation size in bytes
  *
- *     The function new() allocates n bytes of space and returns
- *     a pointer to this memory.  If no space is available the
- *     linker is terminated.
+ *      The function new() allocates n bytes of space and returns
+ *      a pointer to this memory.  If no space is available the
+ *      linker is terminated.
  *
- *     local variables:
- *             char *  p               a general pointer
- *             char *  q               a general pointer
+ *      local variables:
+ *              char *  p               a general pointer
+ *              char *  q               a general pointer
  *
- *     global variables:
- *             none
+ *      global variables:
+ *              none
  *
- *     functions called:
- *             int     fprintf()       c_library
- *             VOID *  malloc()        c_library
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              VOID *  malloc()        c_library
  *
- *     side effects:
- *             Memory is allocated, if allocation fails
- *             the linker is terminated.
+ *      side effects:
+ *              Memory is allocated, if allocation fails
+ *              the linker is terminated.
  */
 
 VOID *
 new(unsigned int n)
 {
-       register char *p;
+        register char *p;
 
-       if ((p = (char *) calloc(n, 1)) == NULL) {
-               fprintf(stderr, "Out of space!\n");
-               lkexit(1);
-       }
-       return (p);
+        if ((p = (char *) calloc(n, 1)) == NULL) {
+                fprintf(stderr, "Out of space!\n");
+                lkexit(1);
+        }
+        return (p);
 }
index 1135e83ea30d83defdd97354717229ba3ce18e22..d8097c54e4a456c4d169f9dcd2a6bcf2c93d1b5a 100644 (file)
@@ -1,13 +1,22 @@
-/* lkarea.c */
+/* lkarea.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  *  3-Nov-97 JLH:
  *           - change lkparea to use a_type == 0 as "virgin area" flag
  * 02-Apr-98 JLH: add code to link 8051 data spaces
index 415408fc47f964940c7a2074c6e724198ed7ddb5..cce29ff4ec16de338f4a48e4181062af76b42ddf 100644 (file)
@@ -1,13 +1,20 @@
-/* lkihx.c */
+/* lkihx.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
index 89ce6a18a2a024a03403f4b3234aaf9cfd31e1c3..cb0d05e0d2aa620a1e8faaa97c6e4dbc4a6bdd41 100644 (file)
@@ -1,13 +1,22 @@
-/* lkmain.c */
+/* lkmain.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 31-Oct-97 JLH:
  *           - add jflag and jfp to control NoICE output file generation
  *  3-Nov-97 JLH:
index 2f5ef4432fc21ce7f3ec256c9966d37a3b2d66ac..24b2ff9d297eb3b202f58f5e35a5340cf3d26a49 100644 (file)
@@ -1,22 +1,19 @@
-/*-------------------------------------------------------------------------
-  lkmem.c - Create a memory summary file with extension .mem
+/* lkmem.c - Create a memory summary file with extension .mem
 
-   Written By -  Jesus Calvino-Fraga, jesusc@ieee.org (2002)
+   Copyright (C) 2002 Jesus Calvino-Fraga, jesusc at ieee dot org
 
-   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 2, or (at your option) any
-   later version.
+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.
+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, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------*/
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
@@ -498,7 +495,7 @@ int summary2(struct area * areap)
         if(j%16==0) fprintf(of, "\n0x%02x:|", j);
         fprintf(of, "%c|", idatamap[j]);
     }
-       fprintf(of, "\n0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack, A:Absolute\n");
+        fprintf(of, "\n0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack, A:Absolute\n");
 
     for(j=0; j<256; j++)
     {
index fc50964af1791ec18988120456b7d0ee8bcdf47a..92fd8e1139a1ed9f868bad1495dd234acdbb1762 100644 (file)
@@ -1,13 +1,22 @@
-/* lkrloc.c */
+/* lkrloc.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 29-Oct-97 JLH:
  *       - errdmp: show s_id as string rather than array [NCPS]
  *       - relr: add support for 11 bit 8051 addressing
index 26d8892e850de128e3d1d929b5c66fab5db3c7de..e4a297f7d6bbfaf91a3b247bc253d2aefaeb47a5 100644 (file)
-/* 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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #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");
+        }
 }
index 95e5a8aca30342737811bd3a0a0e60a261837160..7292d9541e0289141b8b5abe745e2bcd5ac4578a 100644 (file)
@@ -1,89 +1,96 @@
-/* lkarea.c */
+/* lkarea.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include "aslink.h"
 
-/*)Module      lkarea.c
+/*)Module       lkarea.c
  *
- *     The module lkarea.c contains the functions which
- *     create and link together all area definitions read
- *     from the .rel file(s).
+ *      The module lkarea.c contains the functions which
+ *      create and link together all area definitions read
+ *      from the .rel file(s).
  *
- *     lkarea.c contains the following functions:
- *             VOID    lnkarea()
- *             VOID    lnksect()
- *             VOID    lkparea()
- *             VOID    newarea()
+ *      lkarea.c contains the following functions:
+ *              VOID    lnkarea()
+ *              VOID    lnksect()
+ *              VOID    lkparea()
+ *              VOID    newarea()
  *
- *     lkarea.c contains no global variables.
+ *      lkarea.c contains no global variables.
  */
 
-/*)Function    VOID    newarea()
- * 
- *     The function newarea() creates and/or modifies area
- *     and areax structures for each A directive read from
- *     the .rel file(s).  The function lkparea() is called
- *     to find the area structure associated with this name.
- *     If the area does not yet exist then a new area
- *     structure is created and linked to any existing
- *     linked area structures. The area flags are copied
- *     into the area flag variable.  For each occurence of
- *     an A directive an areax structure is created and
- *     linked to the areax structures associated with this
- *     area.  The size of this area section is placed into
- *     the areax structure.  The flag value for all subsequent
- *     area definitions for the same area are compared and
- *     flagged as an error if they are not identical.
- *     The areax structure created for every occurence of
- *     an A directive is loaded with a pointer to the base
- *     area structure and a pointer to the associated
- *     head structure.  And finally, a pointer to this
- *     areax structure is loaded into the list of areax
- *     structures in the head structure.  Refer to lkdata.c
- *     for details of the structures and their linkage.
- *
- *     local variables:
- *             areax **halp            pointer to an array of pointers
- *             int     i               counter, loop variable, value
- *             char    id[]            id string
- *             int     narea           number of areas in this head structure
- *             areax * taxp            pointer to an areax structure
- *                                     to areax structures
- *
- *     global variables:
- *             area    *ap             Pointer to the current
- *                                     area structure
- *             areax   *axp            Pointer to the current
- *                                     areax structure
- *             head    *hp             Pointer to the current
- *                                     head structure
- *             int     lkerr           error flag
- *
- *     functions called:
- *             Addr_T  eval()          lkeval.c
- *             VOID    exit()          c_library
- *             int     fprintf()       c_library
- *             VOID    getid()         lklex.c
- *             VOID    lkparea()       lkarea.c
- *             VOID    skip()          lklex.c
- *
- *     side effects:
- *             The area and areax structures are created and
- *             linked with the appropriate head structures.
- *             Failure to allocate area or areax structure
- *             space will terminate the linker.  Other internal
- *             errors most likely caused by corrupted .rel
- *             files will also terminate the linker.
+/*)Function     VOID    newarea()
+ *
+ *      The function newarea() creates and/or modifies area
+ *      and areax structures for each A directive read from
+ *      the .rel file(s).  The function lkparea() is called
+ *      to find the area structure associated with this name.
+ *      If the area does not yet exist then a new area
+ *      structure is created and linked to any existing
+ *      linked area structures. The area flags are copied
+ *      into the area flag variable.  For each occurence of
+ *      an A directive an areax structure is created and
+ *      linked to the areax structures associated with this
+ *      area.  The size of this area section is placed into
+ *      the areax structure.  The flag value for all subsequent
+ *      area definitions for the same area are compared and
+ *      flagged as an error if they are not identical.
+ *      The areax structure created for every occurence of
+ *      an A directive is loaded with a pointer to the base
+ *      area structure and a pointer to the associated
+ *      head structure.  And finally, a pointer to this
+ *      areax structure is loaded into the list of areax
+ *      structures in the head structure.  Refer to lkdata.c
+ *      for details of the structures and their linkage.
+ *
+ *      local variables:
+ *              areax **halp            pointer to an array of pointers
+ *              int     i               counter, loop variable, value
+ *              char    id[]            id string
+ *              int     narea           number of areas in this head structure
+ *              areax * taxp            pointer to an areax structure
+ *                                      to areax structures
+ *
+ *      global variables:
+ *              area    *ap             Pointer to the current
+ *                                      area structure
+ *              areax   *axp            Pointer to the current
+ *                                      areax structure
+ *              head    *hp             Pointer to the current
+ *                                      head structure
+ *              int     lkerr           error flag
+ *
+ *      functions called:
+ *              Addr_T  eval()          lkeval.c
+ *              VOID    exit()          c_library
+ *              int     fprintf()       c_library
+ *              VOID    getid()         lklex.c
+ *              VOID    lkparea()       lkarea.c
+ *              VOID    skip()          lklex.c
+ *
+ *      side effects:
+ *              The area and areax structures are created and
+ *              linked with the appropriate head structures.
+ *              Failure to allocate area or areax structure
+ *              space will terminate the linker.  Other internal
+ *              errors most likely caused by corrupted .rel
+ *              files will also terminate the linker.
  */
 
 /*
 VOID
 newarea()
 {
-       register int i, narea;
-       struct areax *taxp;
-       struct areax **halp;
-       char id[NCPS];
+        register int i, narea;
+        struct areax *taxp;
+        struct areax **halp;
+        char id[NCPS];
 
-       /*
-        * Create Area entry
-        */
-       getid(id, -1);
-       lkparea(id);
-       /*
-        * Evaluate area size
-        */
-       skip(-1);
-       axp->a_size = eval();
-       /*
-        * Evaluate flags
-        */
-       skip(-1);
-       i = 0;
-       taxp = ap->a_axp;
-       while (taxp->a_axp) {
-               ++i;
-               taxp = taxp->a_axp;
-       }
-       if (i == 0) {
-               ap->a_flag = eval();
-       } else {
-               i = eval();
-               if (i && (ap->a_flag != i)) {
-                   fprintf(stderr, "Conflicting flags in area %.8s\n", id);
-                   lkerr++;
-               }
-       }
-       /*
-        * Place pointer in header area list
-        */
-       if (headp == NULL) {
-               fprintf(stderr, "No header defined\n");
-               lkexit(1);
-       }
-       narea = hp->h_narea;
-       halp = hp->a_list;
-       for (i=0; i < narea ;++i) {
-               if (halp[i] == NULL) {
-                       halp[i] = taxp;
-                       return;
-               }
-       }
-       fprintf(stderr, "Header area list overflow\n");
-       lkexit(1);
+        /*
+         * Create Area entry
+         */
+        getid(id, -1);
+        lkparea(id);
+        /*
+         * Evaluate area size
+         */
+        skip(-1);
+        axp->a_size = eval();
+        /*
+         * Evaluate flags
+         */
+        skip(-1);
+        i = 0;
+        taxp = ap->a_axp;
+        while (taxp->a_axp) {
+                ++i;
+                taxp = taxp->a_axp;
+        }
+        if (i == 0) {
+                ap->a_flag = eval();
+        } else {
+                i = eval();
+                if (i && (ap->a_flag != i)) {
+                    fprintf(stderr, "Conflicting flags in area %.8s\n", id);
+                    lkerr++;
+                }
+        }
+        /*
+         * Place pointer in header area list
+         */
+        if (headp == NULL) {
+                fprintf(stderr, "No header defined\n");
+                lkexit(1);
+        }
+        narea = hp->h_narea;
+        halp = hp->a_list;
+        for (i=0; i < narea ;++i) {
+                if (halp[i] == NULL) {
+                        halp[i] = taxp;
+                        return;
+                }
+        }
+        fprintf(stderr, "Header area list overflow\n");
+        lkexit(1);
 }
 
-/*)Function    VOID    lkparea(id)
- *
- *             char *  id              pointer to the area name string
- *
- *     The function lkparea() searches the linked area structures
- *     for a name match.  If the name is not found then an area
- *     structure is created.  An areax structure is created and
- *     appended to the areax structures linked to the area structure.
- *     The associated base area and head structure pointers are
- *     loaded into the areax structure.
- *
- *     local variables:
- *             area *  tap             pointer to an area structure
- *             areax * taxp            pointer to an areax structure
- *
- *     global variables:
- *             area    *ap             Pointer to the current
- *                                     area structure
- *             area    *areap          The pointer to the first
- *                                     area structure of a linked list
- *             areax   *axp            Pointer to the current
- *                                     areax structure
- *
- *     functions called:
- *             VOID *  new()           lksym()
- *             char *  strcpy()        c_library
- *             int     symeq()         lksym.c
- *
- *     side effects:
- *             Area and/or areax structures are created.
- *             Failure to allocate space for created structures
- *             will terminate the linker.
+/*)Function     VOID    lkparea(id)
+ *
+ *              char *  id              pointer to the area name string
+ *
+ *      The function lkparea() searches the linked area structures
+ *      for a name match.  If the name is not found then an area
+ *      structure is created.  An areax structure is created and
+ *      appended to the areax structures linked to the area structure.
+ *      The associated base area and head structure pointers are
+ *      loaded into the areax structure.
+ *
+ *      local variables:
+ *              area *  tap             pointer to an area structure
+ *              areax * taxp            pointer to an areax structure
+ *
+ *      global variables:
+ *              area    *ap             Pointer to the current
+ *                                      area structure
+ *              area    *areap          The pointer to the first
+ *                                      area structure of a linked list
+ *              areax   *axp            Pointer to the current
+ *                                      areax structure
+ *
+ *      functions called:
+ *              VOID *  new()           lksym()
+ *              char *  strcpy()        c_library
+ *              int     symeq()         lksym.c
+ *
+ *      side effects:
+ *              Area and/or areax structures are created.
+ *              Failure to allocate space for created structures
+ *              will terminate the linker.
  */
 
 VOID
 lkparea(char *id)
 {
-       register struct area *tap;
-       register struct areax *taxp;
+        register struct area *tap;
+        register struct areax *taxp;
 
-       ap = areap;
-       axp = (struct areax *) new (sizeof(struct areax));
-       while (ap) {
-               if (symeq(id, ap->a_id)) {
-                       taxp = ap->a_axp;
-                       while (taxp->a_axp)
-                               taxp = taxp->a_axp;
-                       taxp->a_axp = axp;
-                       axp->a_bap = ap;
-                       axp->a_bhp = hp;
-                       return;
-               }
-               ap = ap->a_ap;
-       }
-       ap = (struct area *) new (sizeof(struct area));
-       if (areap == NULL) {
-               areap = ap;
-       } else {
-               tap = areap;
-               while (tap->a_ap)
-                       tap = tap->a_ap;
-               tap->a_ap = ap;
-       }
-       ap->a_axp = axp;
-       axp->a_bap = ap;
-       axp->a_bhp = hp;
-       strncpy(ap->a_id, id, NCPS);
+        ap = areap;
+        axp = (struct areax *) new (sizeof(struct areax));
+        while (ap) {
+                if (symeq(id, ap->a_id)) {
+                        taxp = ap->a_axp;
+                        while (taxp->a_axp)
+                                taxp = taxp->a_axp;
+                        taxp->a_axp = axp;
+                        axp->a_bap = ap;
+                        axp->a_bhp = hp;
+                        return;
+                }
+                ap = ap->a_ap;
+        }
+        ap = (struct area *) new (sizeof(struct area));
+        if (areap == NULL) {
+                areap = ap;
+        } else {
+                tap = areap;
+                while (tap->a_ap)
+                        tap = tap->a_ap;
+                tap->a_ap = ap;
+        }
+        ap->a_axp = axp;
+        axp->a_bap = ap;
+        axp->a_bhp = hp;
+        strncpy(ap->a_id, id, NCPS);
         ap->a_addr = 0;
 }
 
-/*)Function    VOID    lnkarea()
- *
- *     The function lnkarea() resolves all area addresses.
- *     The function evaluates each area structure (and all
- *     the associated areax structures) in sequence.  The
- *     linking process supports four (4) possible area types:
- *
- *     ABS/OVR -       All sections (each individual areax
- *                     section) starts at the identical base
- *                     area address overlaying all other
- *                     areax sections for this area.  The
- *                     size of the area is largest of the area
- *                     sections.
- *
- *     ABS/CON -       All sections (each individual areax
- *                     section) are concatenated with the
- *                     first section starting at the base
- *                     area address.  The size of the area
- *                     is the sum of the section sizes.
- *
- *             NOTE:   Multiple absolute (ABS) areas are
- *                     never concatenated with each other,
- *                     thus absolute area A and absolute area
- *                     B will overlay each other if they begin
- *                     at the same location (the default is
- *                     always address 0 for absolute areas).
- *
- *     REL/OVR -       All sections (each individual areax
- *                     section) starts at the identical base
- *                     area address overlaying all other
- *                     areax sections for this area.  The
- *                     size of the area is largest of the area
- *                     sections.
- *
- *     REL/CON -       All sections (each individual areax
- *                     section) are concatenated with the
- *                     first section starting at the base
- *                     area address.  The size of the area
- *                     is the sum of the section sizes.
- *
- *             NOTE:   Relocatable (REL) areas are always concatenated
- *                     with each other, thus relocatable area B
- *                     (defined after area A) will follow
- *                     relocatable area A independent of the
- *                     starting address of area A.  Within a
- *                     specific area each areax section may be
- *                     overlayed or concatenated with other
- *                     areax sections.
- *
- *
- *     If a base address for an area is specified then the
- *     area will start at that address.  Any relocatable
- *     areas defined subsequently will be concatenated to the
- *     previous relocatable area if it does not have a base
- *     address specified.
- *
- *     The names s_<areaname> and l_<areaname> are created to
- *     define the starting address and length of each area.
- *
- *     local variables:
- *             Addr_T  rloc            ;current relocation address
- *             char    temp[]          ;temporary string
- *             struct symbol   *sp     ;symbol structure
- *
- *     global variables:
- *             area    *ap             Pointer to the current
- *                                     area structure
- *             area    *areap          The pointer to the first
- *                                     area structure of a linked list
- *
- *     functions called:
- *             int     fprintf()       c_library
- *             VOID    lnksect()       lkarea.c
- *             symbol *lkpsym()        lksym.c
- *             char *  strncpy()       c_library
- *             int     symeq()         lksym.c
- *
- *     side effects:
- *             All area and areax addresses and sizes are
- *             determined and saved in their respective
- *             structures.
+/*)Function     VOID    lnkarea()
+ *
+ *      The function lnkarea() resolves all area addresses.
+ *      The function evaluates each area structure (and all
+ *      the associated areax structures) in sequence.  The
+ *      linking process supports four (4) possible area types:
+ *
+ *      ABS/OVR -       All sections (each individual areax
+ *                      section) starts at the identical base
+ *                      area address overlaying all other
+ *                      areax sections for this area.  The
+ *                      size of the area is largest of the area
+ *                      sections.
+ *
+ *      ABS/CON -       All sections (each individual areax
+ *                      section) are concatenated with the
+ *                      first section starting at the base
+ *                      area address.  The size of the area
+ *                      is the sum of the section sizes.
+ *
+ *              NOTE:   Multiple absolute (ABS) areas are
+ *                      never concatenated with each other,
+ *                      thus absolute area A and absolute area
+ *                      B will overlay each other if they begin
+ *                      at the same location (the default is
+ *                      always address 0 for absolute areas).
+ *
+ *      REL/OVR -       All sections (each individual areax
+ *                      section) starts at the identical base
+ *                      area address overlaying all other
+ *                      areax sections for this area.  The
+ *                      size of the area is largest of the area
+ *                      sections.
+ *
+ *      REL/CON -       All sections (each individual areax
+ *                      section) are concatenated with the
+ *                      first section starting at the base
+ *                      area address.  The size of the area
+ *                      is the sum of the section sizes.
+ *
+ *              NOTE:   Relocatable (REL) areas are always concatenated
+ *                      with each other, thus relocatable area B
+ *                      (defined after area A) will follow
+ *                      relocatable area A independent of the
+ *                      starting address of area A.  Within a
+ *                      specific area each areax section may be
+ *                      overlayed or concatenated with other
+ *                      areax sections.
+ *
+ *
+ *      If a base address for an area is specified then the
+ *      area will start at that address.  Any relocatable
+ *      areas defined subsequently will be concatenated to the
+ *      previous relocatable area if it does not have a base
+ *      address specified.
+ *
+ *      The names s_<areaname> and l_<areaname> are created to
+ *      define the starting address and length of each area.
+ *
+ *      local variables:
+ *              Addr_T  rloc            ;current relocation address
+ *              char    temp[]          ;temporary string
+ *              struct symbol   *sp     ;symbol structure
+ *
+ *      global variables:
+ *              area    *ap             Pointer to the current
+ *                                      area structure
+ *              area    *areap          The pointer to the first
+ *                                      area structure of a linked list
+ *
+ *      functions called:
+ *              int     fprintf()       c_library
+ *              VOID    lnksect()       lkarea.c
+ *              symbol *lkpsym()        lksym.c
+ *              char *  strncpy()       c_library
+ *              int     symeq()         lksym.c
+ *
+ *      side effects:
+ *              All area and areax addresses and sizes are
+ *              determined and saved in their respective
+ *              structures.
  */
 
 //unsigned long codemap[2048];
@@ -316,8 +323,8 @@ lnkarea()
 {
         register Addr_T rloc = 0;
 //        Addr_T gs_size = 0;
-       char temp[NCPS];
-       struct sym *sp;
+        char temp[NCPS];
+        struct sym *sp;
 #if 0
         struct area *abs_ap = NULL;
         struct area *gs0_ap = NULL;
@@ -370,50 +377,50 @@ lnkarea()
         if (gs0_ap)
                 gs0_ap->a_size = gs_size;
 #endif
-       ap = areap;
+        ap = areap;
         while (ap)
         {
                 if (ap->a_flag & A_ABS) {
-                       /*
-                        * Absolute sections
-                        */
-                       lnksect(ap);
-               } else {
-                       /*
-                        * Relocatable sections
-                        */
-                       if (ap->a_addr == 0)
-                               ap->a_addr = rloc;
+                        /*
+                         * Absolute sections
+                         */
+                        lnksect(ap);
+                } else {
+                        /*
+                         * Relocatable sections
+                         */
+                        if (ap->a_addr == 0)
+                                ap->a_addr = rloc;
 //                        rloc = lnksect(ap);
-                       lnksect(ap);
-                       rloc = ap->a_addr + ap->a_size;
-               }
+                        lnksect(ap);
+                        rloc = ap->a_addr + ap->a_size;
+                }
 
-               /*
-                * Create symbols called:
-                *      s_<areaname>    the start address of the area
-                *      l_<areaname>    the length of the area
-                */
+                /*
+                 * Create symbols called:
+                 *      s_<areaname>    the start address of the area
+                 *      l_<areaname>    the length of the area
+                 */
 
                 if (! symeq(ap->a_id, _abs_))
                 {
-                       strncpy(temp+2,ap->a_id,NCPS-2);
-                       *(temp+1) = '_';
+                        strncpy(temp+2,ap->a_id,NCPS-2);
+                        *(temp+1) = '_';
 
-                       *temp = 's';
-                       sp = lkpsym(temp, 1);
-                       sp->s_addr = ap->a_addr;
-                       sp->s_axp = NULL;
-                       sp->s_type |= S_DEF;
+                        *temp = 's';
+                        sp = lkpsym(temp, 1);
+                        sp->s_addr = ap->a_addr;
+                        sp->s_axp = NULL;
+                        sp->s_type |= S_DEF;
 
-                       *temp = 'l';
-                       sp = lkpsym(temp, 1);
-                       sp->s_addr = ap->a_size;
-                       sp->s_axp = NULL;
-                       sp->s_type |= S_DEF;
-               }
-               ap = ap->a_ap;
-       }
+                        *temp = 'l';
+                        sp = lkpsym(temp, 1);
+                        sp->s_addr = ap->a_size;
+                        sp->s_axp = NULL;
+                        sp->s_type |= S_DEF;
+                }
+                ap = ap->a_ap;
+        }
 }
 #if 0
 static
@@ -495,57 +502,57 @@ Addr_T allocate_space(Addr_T start, Addr_T size, char* id, unsigned long *map)
     return start;
 }
 #endif
-/*)Function    VOID    lnksect()
+/*)Function     VOID    lnksect()
  *
- *             area *  tap             pointer to an area structure
+ *              area *  tap             pointer to an area structure
  *
- *     The function lnksect() is the function called by
- *     lnkarea() to resolve the areax addresses.  Refer
- *     to the function lnkarea() for more detail. Pageing
- *     boundary and length errors will be reported by this
- *     function.
+ *      The function lnksect() is the function called by
+ *      lnkarea() to resolve the areax addresses.  Refer
+ *      to the function lnkarea() for more detail. Pageing
+ *      boundary and length errors will be reported by this
+ *      function.
  *
- *     local variables:
- *             Addr_T  size            size of area
- *             Addr_T  addr            address of area
- *             areax * taxp            pointer to an areax structure
+ *      local variables:
+ *              Addr_T  size            size of area
+ *              Addr_T  addr            address of area
+ *              areax * taxp            pointer to an areax structure
  *
- *     global variables:
- *             int     lkerr           error flag
+ *      global variables:
+ *              int     lkerr           error flag
  *
- *     functions called:
- *             none
+ *      functions called:
+ *              none
  *
- *     side effects:
- *             All area and areax addresses and sizes area determined
- *             and linked into the structures.
+ *      side effects:
+ *              All area and areax addresses and sizes area determined
+ *              and linked into the structures.
  */
 
 VOID lnksect(register struct area *tap)
 //Addr_T lnksect(register struct area *tap)
 {
-       register Addr_T size, addr;
-       register struct areax *taxp;
+        register Addr_T size, addr;
+        register struct areax *taxp;
 
-       size = 0;
-       addr = tap->a_addr;
-       if ((tap->a_flag&A_PAG) && (addr & 0xFF)) {
-           fprintf(stderr,
-           "\n?ASlink-Warning-Paged Area %.8s Boundary Error\n", tap->a_id);
-           lkerr++;
-       }
+        size = 0;
+        addr = tap->a_addr;
+        if ((tap->a_flag&A_PAG) && (addr & 0xFF)) {
+            fprintf(stderr,
+            "\n?ASlink-Warning-Paged Area %.8s Boundary Error\n", tap->a_id);
+            lkerr++;
+        }
 
-       taxp = tap->a_axp;
+        taxp = tap->a_axp;
         if (tap->a_flag & A_OVR) {
-               /*
-                * Overlayed sections
-                */
-               while (taxp) {
-                       taxp->a_addr = addr;
-                       if (taxp->a_size > size)
-                               size = taxp->a_size;
-                       taxp = taxp->a_axp;
-               }
+                /*
+                 * Overlayed sections
+                 */
+                while (taxp) {
+                        taxp->a_addr = addr;
+                        if (taxp->a_size > size)
+                                size = taxp->a_size;
+                        taxp = taxp->a_axp;
+                }
         }
 #if 0
         else if (tap->a_flag & A_ABS)
@@ -564,15 +571,15 @@ VOID lnksect(register struct area *tap)
 #endif
         else
         {
-               /*
-                * Concatenated sections
-                */
+                /*
+                 * Concatenated sections
+                 */
 /*
                 if (tap->a_size) {
                         addr = find_empty_space(addr, tap->a_size, codemap);
                 }
 */
-               while (taxp) {
+                while (taxp) {
 /*
                         //find next unused address now
                         if (taxp->a_size)
@@ -581,19 +588,19 @@ VOID lnksect(register struct area *tap)
                                 allocate_space(addr, taxp->a_size, tap->a_id, codemap);
                         }
 */
-                       taxp->a_addr = addr;
-                       addr += taxp->a_size;
-                       size += taxp->a_size;
-                       taxp = taxp->a_axp;
-               }
-       }
-       tap->a_size = size;
+                        taxp->a_addr = addr;
+                        addr += taxp->a_size;
+                        size += taxp->a_size;
+                        taxp = taxp->a_axp;
+                }
+        }
+        tap->a_size = size;
 
         if ((tap->a_flag & A_PAG) && (size > 256))
         {
-           fprintf(stderr,
-           "\n?ASlink-Warning-Paged Area %.8s Length Error\n", tap->a_id);
-           lkerr++;
-       }
+            fprintf(stderr,
+            "\n?ASlink-Warning-Paged Area %.8s Length Error\n", tap->a_id);
+            lkerr++;
+        }
 //        return addr;
 }
index 55ae41ff7b020bc64f88c3742f8a5f5681c0edf2..b20299a8e4ae9bad07d13ea4f68b562f382444fc 100644 (file)
@@ -1,4 +1,20 @@
-/* lkgb.c */
+/* lkgb.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
  * P. Felber
@@ -14,7 +30,7 @@
 
 /* Value used to fill the unused portions of the image */
 /* FFh puts less stress on a EPROM/Flash */
-#define FILLVALUE      0xFF
+#define FILLVALUE       0xFF
 
 #define CARTSIZE ((unsigned long)nb_rom_banks*16UL*1024UL)
 #define NBSEG 8UL
@@ -44,8 +60,8 @@ VOID gb(int in)
   if(first) {
     for(i = 0; i < NBSEG; i++) {
       if((cart[i] = malloc(SEGSIZE)) == NULL) {
-       fprintf(stderr, "ERROR: can't allocate %dth segment of memory (%d bytes)\n", i, (int)SEGSIZE);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: can't allocate %dth segment of memory (%d bytes)\n", i, (int)SEGSIZE);
+        exit(EXIT_FAILURE);
       }
       memset(cart[i], FILLVALUE, SEGSIZE);
     }
@@ -54,58 +70,58 @@ VOID gb(int in)
   if(in) {
     if(rtcnt > 2) {
       if(hilo == 0)
-       pos = rtval[0] | (rtval[1]<<8);
+        pos = rtval[0] | (rtval[1]<<8);
       else
-       pos = rtval[1] | (rtval[0]<<8);
+        pos = rtval[1] | (rtval[0]<<8);
 
       /* Perform some validity checks */
       if(pos >= ROMSIZE) {
-       fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE);
+        exit(EXIT_FAILURE);
       }
       if(current_rom_bank >= nb_rom_banks) {
-       fprintf(stderr, "ERROR: bank overflow (addr %x > %x)\n", current_rom_bank, nb_rom_banks);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: bank overflow (addr %x > %x)\n", current_rom_bank, nb_rom_banks);
+        exit(EXIT_FAILURE);
       }
       if(current_rom_bank > 0 && pos < BANKSTART) {
-       fprintf(stderr, "ERROR: address underflow (addr %lx < %lx)\n", pos, BANKSTART);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: address underflow (addr %lx < %lx)\n", pos, BANKSTART);
+        exit(EXIT_FAILURE);
       }
       if(nb_rom_banks == 2 && current_rom_bank > 0) {
-       fprintf(stderr, "ERROR: only 1 32kB segment with 2 bank\n");
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: only 1 32kB segment with 2 bank\n");
+        exit(EXIT_FAILURE);
       }
       if(current_rom_bank > 1)
-       pos += (current_rom_bank-1)*BANKSIZE;
+        pos += (current_rom_bank-1)*BANKSIZE;
       for(i = 2; i < rtcnt; i++) {
-       if(rtflg[i]) {
-         if(pos < CARTSIZE) {
-           if(cart[pos/SEGSIZE][pos%SEGSIZE] != FILLVALUE)
-             fprintf(stderr, "WARNING: possibly wrote twice at addr %lx (%02X->%02X)\n", pos, rtval[i], cart[pos/SEGSIZE][pos%SEGSIZE]);
-           cart[pos/SEGSIZE][pos%SEGSIZE] = rtval[i];
-         } else {
-           fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE);
-           exit(EXIT_FAILURE);
-         }
-         pos++;
-       }
+        if(rtflg[i]) {
+          if(pos < CARTSIZE) {
+            if(cart[pos/SEGSIZE][pos%SEGSIZE] != FILLVALUE)
+              fprintf(stderr, "WARNING: possibly wrote twice at addr %lx (%02X->%02X)\n", pos, rtval[i], cart[pos/SEGSIZE][pos%SEGSIZE]);
+            cart[pos/SEGSIZE][pos%SEGSIZE] = rtval[i];
+          } else {
+            fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE);
+            exit(EXIT_FAILURE);
+          }
+          pos++;
+        }
       }
     }
   } else {
     /* EOF */
     if(cart_name[0] == 0 && linkp->f_idp != NULL) {
       for(i = strlen(linkp->f_idp);
-         i > 0 && (isalnum((unsigned char)linkp->f_idp[i-1]) || linkp->f_idp[i-1] == '.');
-         i--)
-       ;
+          i > 0 && (isalnum((unsigned char)linkp->f_idp[i-1]) || linkp->f_idp[i-1] == '.');
+          i--)
+        ;
       for(pos = 0; pos < 16 && linkp->f_idp[i] != '.'; pos++, i++)
-       cart_name[pos] = toupper((unsigned char)linkp->f_idp[i]);
+        cart_name[pos] = toupper((unsigned char)linkp->f_idp[i]);
       if(pos < 16)
-       cart_name[pos] = 0;
+        cart_name[pos] = 0;
     }
     for(pos = 0x0134, i = 0;
-       pos < 0x0144 && cart_name[i];
-       pos++, i++)
+        pos < 0x0144 && cart_name[i];
+        pos++, i++)
       cart[pos/SEGSIZE][pos%SEGSIZE] = cart_name[i];
     for(; pos < 0x0144; pos++)
       cart[pos/SEGSIZE][pos%SEGSIZE] = 0;
@@ -165,7 +181,7 @@ VOID gb(int in)
     /* Patch before calculating the checksum */
     if(patches)
       for(p = patches; p; p = p->next)
-       cart[p->addr/SEGSIZE][p->addr%SEGSIZE] = p->value;
+        cart[p->addr/SEGSIZE][p->addr%SEGSIZE] = p->value;
 
     /* Update complement checksum */
     chk = 0;
@@ -178,7 +194,7 @@ VOID gb(int in)
     cart[0x014F/SEGSIZE][0x014F%SEGSIZE] = 0;
     for(i = 0; i < NBSEG; i++)
       for(pos = 0; pos < SEGSIZE; pos++)
-       chk += cart[i][pos];
+        chk += cart[i][pos];
     cart[0x014E/SEGSIZE][0x014E%SEGSIZE] = (unsigned char)((chk>>8)&0xFF);
     cart[0x014F/SEGSIZE][0x014F%SEGSIZE] = (unsigned char)(chk&0xFF);
 
index 3e8bb37a2e03577fd07afc5fefd1cab2f56d10ba..3c3842b2012151fb5cba05da2038c75670c366a3 100644 (file)
@@ -1,4 +1,20 @@
-/* lkgg.c */
+/* lkgg.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
  * P. Felber
@@ -32,8 +48,8 @@ VOID gg(int in)
   if(first) {
     for(i = 0; i < NBSEG; i++) {
       if((cart[i] = malloc(SEGSIZE)) == NULL) {
-       fprintf(stderr, "ERROR: can't allocate %dth segment of memory (%d bytes)\n", i, (int)SEGSIZE);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: can't allocate %dth segment of memory (%d bytes)\n", i, (int)SEGSIZE);
+        exit(EXIT_FAILURE);
       }
       memset(cart[i], 0, SEGSIZE);
     }
@@ -42,29 +58,29 @@ VOID gg(int in)
   if(in) {
     if(rtcnt > 2) {
       if(hilo == 0)
-       pos = rtval[0] | (rtval[1]<<8);
+        pos = rtval[0] | (rtval[1]<<8);
       else
-       pos = rtval[1] | (rtval[0]<<8);
+        pos = rtval[1] | (rtval[0]<<8);
 
       /* Perform some validity checks */
       if(pos >= ROMSIZE) {
-       fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE);
+        exit(EXIT_FAILURE);
       }
       if(current_rom_bank > 1)
-       pos += (current_rom_bank-1)*BANKSIZE;
+        pos += (current_rom_bank-1)*BANKSIZE;
       for(i = 2; i < rtcnt; i++) {
-       if(rtflg[i]) {
-         if(pos < CARTSIZE) {
-           if(cart[pos/SEGSIZE][pos%SEGSIZE] != 0)
-             fprintf(stderr, "WARNING: wrote twice at addr %lx (%02X->%02X)\n", pos, rtval[i], cart[pos/SEGSIZE][pos%SEGSIZE]);
-           cart[pos/SEGSIZE][pos%SEGSIZE] = rtval[i];
-         } else {
-           fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE);
-           exit(EXIT_FAILURE);
-         }
-         pos++;
-       }
+        if(rtflg[i]) {
+          if(pos < CARTSIZE) {
+            if(cart[pos/SEGSIZE][pos%SEGSIZE] != 0)
+              fprintf(stderr, "WARNING: wrote twice at addr %lx (%02X->%02X)\n", pos, rtval[i], cart[pos/SEGSIZE][pos%SEGSIZE]);
+            cart[pos/SEGSIZE][pos%SEGSIZE] = rtval[i];
+          } else {
+            fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE);
+            exit(EXIT_FAILURE);
+          }
+          pos++;
+        }
       }
     }
   } else {
index a3d3b0200a6cac84f231bd2b987eb61ce2a541b5..812e446e96b36e926ebfce6a2b0bae74ea0760a4 100644 (file)
@@ -1,34 +1,41 @@
-/* lkihx.c */
+/* lkihx.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #include "aslink.h"
 
-/*)Module      lkihx.c
+/*)Module       lkihx.c
  *
- *     The module lkihx.c contains the function to
- *     output the relocated object code in the
- *     Intel Hex format.
+ *      The module lkihx.c contains the function to
+ *      output the relocated object code in the
+ *      Intel Hex format.
  *
- *     lkihx.c contains the following functions:
- *             VOID    ihx(i)
+ *      lkihx.c contains the following functions:
+ *              VOID    ihx(i)
  *
- *     lkihx.c contains no local variables.
+ *      lkihx.c contains no local variables.
  */
 
 /*Intel Hex Format
  *      Record Mark Field    -  This  field  signifies  the  start  of a
  *                              record, and consists of an  ascii  colon
- *                              (:).  
+ *                              (:).
  *
  *      Record Length Field  -  This   field   consists   of  two  ascii
  *                              characters which indicate the number  of
  *                              the  number  of  bytes  in binary to two
  *                              ascii characters, high digit first.   An
  *                              End  of  File  record contains two ascii
- *                              zeros in this field.  
+ *                              zeros in this field.
  *
  *      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.
  *
  *      Record Type Field    -  This  field  identifies the record type,
  *                              which is either 0 for data records or  1
  *                              for  an End of File record.  It consists
  *                              of two ascii characters, with  the  high
  *                              digit of the record type first, followed
- *                              by the low digit of the record type.  
+ *                              by the low digit of the record type.
  *
  *      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
  *                              and the data field.  This  sum  is  then
  *                              negated  (2's  complement) and converted
  *                              to  two  ascii  characters,  high  digit
- *                              first.  
+ *                              first.
  */
 
-/*)Function    ihx(i)
+/*)Function     ihx(i)
  *
- *             int     i               0 - process data
- *                                     1 - end of data
+ *              int     i               0 - process data
+ *                                      1 - end of data
  *
- *     The function ihx() outputs the relocated data
- *     in the standard Intel Hex format.
+ *      The function ihx() outputs the relocated data
+ *      in the standard Intel Hex 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
 ihx(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 = -2; i < rtcnt; i++) {
-                       if (rtflg[i])
-                               chksum++;
-               }
-               fprintf(ofp, ":%02X", chksum);
-               for (i = 0; i < rtcnt ; i++) {
-                       if (rtflg[i]) {
-                               fprintf(ofp, "%02X", rtval[i]);
-                               chksum += rtval[i];
-                       }
-                       if (i == 1) {
-                               fprintf(ofp, "00");
-                       }
-               }
-               fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
-       } else {
-               fprintf(ofp, ":00000001FF\n");
-       }
+        if (i) {
+                if (hilo == 0) {
+                        chksum = rtval[0];
+                        rtval[0] = rtval[1];
+                        rtval[1] = chksum;
+                }
+                for (i = 0, chksum = -2; i < rtcnt; i++) {
+                        if (rtflg[i])
+                                chksum++;
+                }
+                fprintf(ofp, ":%02X", chksum);
+                for (i = 0; i < rtcnt ; i++) {
+                        if (rtflg[i]) {
+                                fprintf(ofp, "%02X", rtval[i]);
+                                chksum += rtval[i];
+                        }
+                        if (i == 1) {
+                                fprintf(ofp, "00");
+                        }
+                }
+                fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
+        } else {
+                fprintf(ofp, ":00000001FF\n");
+        }
 }
index c7cbfcc1684b3d445e21fb5095f89619eb25955f..70404c2f5b0985785dd30228c5eb3ccd1b2b9590 100644 (file)
@@ -1,14 +1,20 @@
-/* lkmain.c */
+/* lkmain.c
 
-/*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- * 31-Feb-2008 AD added -y to create cdb file for non gameboy
- */
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index 5e97dae336120fdceefcba2a0bd5b60a014b1c85..063793df7c56144b8b070bb8c42035207237084b 100644 (file)
@@ -1,13 +1,20 @@
-/* lkrloc.c */
+/* lkrloc.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index 26d8892e850de128e3d1d929b5c66fab5db3c7de..e4a297f7d6bbfaf91a3b247bc253d2aefaeb47a5 100644 (file)
-/* 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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <string.h>
 #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");
+        }
 }
index 8af9a4197fc8fb0130eb0d11d823edf1683cc90f..c6cd1a66982822ca99f1b068f1bd49a3da8844e4 100644 (file)
@@ -1,13 +1,22 @@
-/* asdata.c */
+/* asdata.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH:
  *           - change s_id from [NCPS] to pointer (comment)
  *  2-Nov-97 JLH:
index a424d144b45eb38dbb8e30f90090cd297dbb09ec..edf70aeae2546e56f4bd08a032c96b625050a993 100644 (file)
@@ -1,13 +1,20 @@
-/* asexpr.c */
+/* asexpr.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 2224403a2a4be921578b19029d3aacd5a97dfbc3..af165f1c734ae67d2bc8f5a875055eb48af2ed2b 100644 (file)
@@ -1,13 +1,22 @@
-/* aslist.c */
+/* aslist.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH: 
  *          - lstsym: show s_id as string rather than array [NCPS]
  */
index dab0e5f6d0551094bb387d03ad4be149bc477fe6..681a81dd93baf24e528c020be3ba40c9dd773284 100644 (file)
@@ -1,13 +1,22 @@
-/* asm.h */
+/* asm.h
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH:
  *           - add proto for StoreString
  *           - change s_id from [NCPS] to pointer
index 34598db87de6b89d756467d00f330ddf75235299..817f83f729ba8758f7edd6caed29c632fbe75bee 100644 (file)
@@ -1,13 +1,22 @@
-/* asmain.c */
+/* asmain.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 29-Oct-97 JLH pass ";!" comments to output file
  */
 
index 3bb683001194542bda2011ce0ea2eb918f4e243b..f65d789b25ffb068efbb86dd3cd4f9b184ddec21 100644 (file)
@@ -1,13 +1,22 @@
-/* asout.c */
+/* asout.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 JLH:
  *           - outsym: show s_id as string rather than array [NCPS]
  *           - Added outr11 to support 8051's 11 bit destination address
index 1751c29454b02bf39b79786f23b25d22f5a99d79..f21c847fcf4e79dfa02c654473bc6d01c8c79ed3 100644 (file)
@@ -1,13 +1,20 @@
-/* assubr.c */
+/* assubr.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 3657d3c4980b689cdb5f6643dca1c6342d28dafc..87a00af8c4ac2b757910d45caad03e28a0cd2216 100644 (file)
@@ -1,13 +1,22 @@
-/* i51adr.c */
+/* i51adr.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989,1990
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * Ported from 8085 to 8051 by John Hartman 30-Apr-1995
  * Continued, 29-May-95
  */
index ca04fd111b789f9d20c375540e371b26a51097c6..60efc63272eafcfb9f8252d07e53f6c4ebf3fcc6 100644 (file)
@@ -1,13 +1,22 @@
-/* i51ext.c */
+/* i51ext.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989,1990
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * Ported from 8085 to 8051 by John Hartman 30-Apr-1995
  */
 
index 9e7b2900766053cb7b3b529a4e2d551e4260028c..df73096e655a12f6d5d3d859a6859c1ac8f3be96 100644 (file)
@@ -1,13 +1,22 @@
-/* i85mch.c */
+/* i85mch.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989,1990
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 Ported from 8085 to 8051 by John Hartman
  */
 
index 2e1908dee0e23a3126fe1d2c7a168fd2276751bf..08225d8d5caa2c2abfff26ed014f36510190d90c 100644 (file)
@@ -1,13 +1,22 @@
-/* i85pst.c */
+/* i85pst.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989,1990
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 28-Oct-97 Ported from 8085 to 8051 by John Hartman
  * 30-Jan-98 JLH: add memory-space flags for .AREA
  */
index 890fb8492dd406ede14f7aba092e44f38359bf7a..fba39d8225af52375165dc86bcab6b8f506715ee 100644 (file)
@@ -1,13 +1,22 @@
-/* i8051.h */
+/* i8051.h
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989,1990
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * Ported from 8085 to 8051 by John Hartman 30-Apr-1995
  * Continued, 2-Jun-95
  */
index f9a81c75625b672db32ec99eff87e7d3fcfb75b3..a6823d246765f8272f394fb5266747832df3bc99 100644 (file)
@@ -1,17 +1,22 @@
+/* xa_link.c
+
+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 <http://www.gnu.org/licenses/>. */
+
 /* WORK IN PROGRESS: do not watch this if you don't have the legal
    age in your country to watch this.
 */
 
-/* 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
 /* This is a cheap hack. The xa51 has a couple of ways to scramble
    relocation info into it's opcode that the standard linker can't
    handle, not to mention word allignment. 
index 345ca7e4ec44498a524c0ff0e3430715f88149c7..8717905a2cd8924c6df9f8d1cda66da86991d09e 100644 (file)
@@ -1,18 +1,19 @@
-/* Paul's XA51 Assembler, Copyright 1997,2002 Paul Stoffregen (paul@pjrc.com)
- *
- * Paul's XA51 Assembler 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; version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
+/* xa_main.c - Paul's XA51 Assembler
+
+   Copyright 1997,2002 Paul Stoffregen (paul at pjrc dot com)
+
+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 <http://www.gnu.org/licenses/>. */
 
 /* adapted from the osu8asm project, 1995 */
 /* http://www.pjrc.com/tech/osu8/index.html */
index 400e7dcf9f620fc9ac577cb6e6b142f282b437ca..2b1da79712a03511a459ec159ed77eec43e5a86e 100644 (file)
@@ -1,3 +1,20 @@
+/* xa_main.h - Paul's XA51 Assembler
+
+   Copyright 1997,2002 Paul Stoffregen (paul at pjrc dot com)
+
+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 <http://www.gnu.org/licenses/>. */
+
 #define SIZE8 0
 #define SIZE16 1
 #define SIZE32 2
index 8576b7349bde6b038239b64097d4db05f83c74aa..b72b9e0d0b6038285b98eb77d824a403abaa5c64 100644 (file)
@@ -1,19 +1,20 @@
 %{
-/* This file is part of Paul's XA51 Assembler, Copyright 1997,2002 Paul Stoffregen
- *
- * Paul's XA51 Assembler 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; version 2.
- *
- * Paul's XA51 Assembler 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 Foobar; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
+/* xa_rasm.l - This file is part of Paul's XA51 Assembler
+
+   Copyright 1997,2002 Paul Stoffregen (paul at pjrc dot com)
+
+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 <http://www.gnu.org/licenses/>. */
 
 /* Author contact: paul@pjrc.com */
 
index 5db815552d37a9f1d65034bca43aeb941e173e6c..be78e10153fb81b2bf23d71a31aba2d14ad666c2 100644 (file)
@@ -1,19 +1,20 @@
 %{
-/* This file is part of Paul's XA51 Assembler, Copyright 1997,2002 Paul Stoffregen
- *
- * Paul's XA51 Assembler 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; version 2.
- *
- * Paul's XA51 Assembler 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 Foobar; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
+/* xa_rasm.y - This file is part of Paul's XA51 Assembler
+
+   Copyright 1997,2002 Paul Stoffregen (paul at pjrc dot com)
+
+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 <http://www.gnu.org/licenses/>. */
 
 /* Author contact: paul@pjrc.com */
 
index 167bbf870800366fed6be99fcff7402eb65df22e..66c45b74d26dfbac88904f14beb5fd0e9b9da649 100644 (file)
@@ -1 +1,18 @@
+/* xa_version.h
+
+   Copyright 1997,2002 Paul Stoffregen (paul at pjrc dot com)
+
+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 <http://www.gnu.org/licenses/>. */
+
 #define version 0.1
index 505732acb6605e006cfa77a76c6f190da5094ca2..69c5a3df4b4b2cd2cc5efee39bd63d9e12633304 100644 (file)
@@ -1,13 +1,20 @@
-/* asdata.c */
+/* asdata.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index 58fc0776e135567a185fe48a08cf6969d62df5ec..6d9211c3163817a03d7cd5055df30f0ece1486f8 100644 (file)
@@ -1,13 +1,20 @@
-/* asexpr.c */
+/* asexpr.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 <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
 #include <setjmp.h>
index b4ac09334f77cce62b2724a1274fefe3989aac4e..675ead5750b0d725789c93e1d55f87cb62c87576 100644 (file)
@@ -1,13 +1,20 @@
-/* aslist.c */
+/* aslist.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index a5c3d10964d01c297cac7ab4d2a353fcc179b775..0f5f0af8ed8bf679ab65353c14d3c8ecfdeadcf2 100644 (file)
@@ -1,13 +1,22 @@
-/* asm.h */
+/* asm.h
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1996
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 10-Nov-07 borutr:
  *           - add proto for strsto
  *           - change s_id from [NCPS] to pointer
index 0629710d26e04e30bbe42e34aa278002133ad5ef..b072acc22b574e54e738d7bbbf46f9a6461553e1 100644 (file)
@@ -1,13 +1,20 @@
-/* asmain.c */
+/* asmain.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index df9254e620570b45e6e8bcdf8ae9674c07b9070f..044a37532b48530e3b0481fe4be1f88fe1704318 100644 (file)
@@ -1,13 +1,22 @@
-/* asout.c */
+/* asout.c
+
+   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 <http://www.gnu.org/licenses/>. */
 
 /*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
  * 10-Nov-07 borutr:
  *           - applied changes from 28-Oct-97 JLH:
  *             - outsym: show s_id as string rather than array [NCPS]
index 6423d9fdc01bdf6c7da852b1146e577972b0bf88..ac45e8e4b46eaaf7b84b0bf5a06fd58c1fdfe138 100644 (file)
@@ -1,13 +1,20 @@
-/* assubr.c */
+/* assubr.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber, M. Hope
index 82cf3177ac8eb0f6ce81392e35cc72e00fa36373..3255a81bdc9b06cee506ce66fbb5d032a728c979 100644 (file)
@@ -1,13 +1,20 @@
-/* z80.h */
+/* z80.h
 
-/*
- * (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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index f4b12afc53aebefc3e52192f119a73f070e2e572..cc273c2c0edbf21123c39df08ccc58691b6c5c32 100644 (file)
@@ -1,13 +1,20 @@
-/* z80adr.c */
+/* z80adr.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index 4ae945a9081c7ca58b0cd27c196f32676194fa6b..118d4ad6f5977e6aba724664b9eb998fb20a2af8 100644 (file)
@@ -1,13 +1,20 @@
-/* z80ext.c */
+/* z80ext.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index 7ee7c746fecdc1b90b35c20afeeb3664b2e42487..9a8014f537bfc0ecaa50288c30a17eb080684b1d 100644 (file)
@@ -1,13 +1,20 @@
-/* z80mch.c */
+/* z80mch.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber
index 5915e992606850cbd1efb02037941b73ddab2f73..1c4b431487c8e26401d7f025e969d6b90ef02713 100644 (file)
@@ -1,13 +1,20 @@
-/* z80pst.c */
+/* z80pst.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 <http://www.gnu.org/licenses/>. */
 
 /*
  * Extensions: P. Felber