From 22ec133e94d056a395025c302b6c331c8cd04658 Mon Sep 17 00:00:00 2001 From: borutr Date: Thu, 5 Feb 2009 22:15:19 +0000 Subject: [PATCH] * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5356 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 451 ++++---- as/asxxsrc/aslex.c | 25 +- as/asxxsrc/asnoice.c | 18 +- as/asxxsrc/assym.c | 25 +- as/hc08/asdata.c | 25 +- as/hc08/asexpr.c | 25 +- as/hc08/aslist.c | 25 +- as/hc08/asm.h | 25 +- as/hc08/asmain.c | 25 +- as/hc08/asout.c | 25 +- as/hc08/assubr.c | 25 +- as/hc08/m08adr.c | 25 +- as/hc08/m08ext.c | 25 +- as/hc08/m08mch.c | 25 +- as/hc08/m08pst.c | 27 +- as/hc08/m6808.h | 25 +- as/link/aslink.h | 28 +- as/link/hc08/lkarea.c | 31 +- as/link/hc08/lkelf.c | 27 +- as/link/hc08/lkihx.c | 297 +++--- as/link/hc08/lkmain.c | 25 +- as/link/hc08/lkmem.c | 663 ++++++------ as/link/hc08/lkrloc.c | 2241 ++++++++++++++++++++-------------------- as/link/hc08/lks19.c | 145 +-- as/link/lkaomf51.c | 1679 +++++++++++++++--------------- as/link/lkdata.c | 25 +- as/link/lkeval.c | 659 ++++++------ as/link/lkhead.c | 227 ++-- as/link/lklex.c | 979 +++++++++--------- as/link/lklib.c | 5 +- as/link/lklibr.c | 5 +- as/link/lklibr.h | 5 +- as/link/lklist.c | 1797 ++++++++++++++++---------------- as/link/lknoice.c | 254 ++--- as/link/lkrel.c | 5 +- as/link/lkrel.h | 5 +- as/link/lksdcclib.c | 5 +- as/link/lkstore.c | 26 +- as/link/lksym.c | 703 ++++++------- as/link/mcs51/lkarea.c | 25 +- as/link/mcs51/lkihx.c | 25 +- as/link/mcs51/lkmain.c | 25 +- as/link/mcs51/lkmem.c | 29 +- as/link/mcs51/lkrloc.c | 25 +- as/link/mcs51/lks19.c | 141 +-- as/link/z80/lkarea.c | 717 ++++++------- as/link/z80/lkgb.c | 86 +- as/link/z80/lkgg.c | 54 +- as/link/z80/lkihx.c | 145 +-- as/link/z80/lkmain.c | 26 +- as/link/z80/lkrloc.c | 25 +- as/link/z80/lks19.c | 141 +-- as/mcs51/asdata.c | 25 +- as/mcs51/asexpr.c | 25 +- as/mcs51/aslist.c | 25 +- as/mcs51/asm.h | 25 +- as/mcs51/asmain.c | 25 +- as/mcs51/asout.c | 25 +- as/mcs51/assubr.c | 25 +- as/mcs51/i51adr.c | 25 +- as/mcs51/i51ext.c | 25 +- as/mcs51/i51mch.c | 25 +- as/mcs51/i51pst.c | 25 +- as/mcs51/i8051.h | 25 +- as/xa51/xa_link.c | 25 +- as/xa51/xa_main.c | 31 +- as/xa51/xa_main.h | 17 + as/xa51/xa_rasm.l | 31 +- as/xa51/xa_rasm.y | 31 +- as/xa51/xa_version.h | 17 + as/z80/asdata.c | 25 +- as/z80/asexpr.c | 25 +- as/z80/aslist.c | 25 +- as/z80/asm.h | 25 +- as/z80/asmain.c | 25 +- as/z80/asout.c | 25 +- as/z80/assubr.c | 25 +- as/z80/z80.h | 25 +- as/z80/z80adr.c | 25 +- as/z80/z80ext.c | 25 +- as/z80/z80mch.c | 25 +- as/z80/z80pst.c | 25 +- 82 files changed, 6743 insertions(+), 6130 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5891d3c4..f3286f40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2009-02-05 Borut Razem + + * 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 * asranlib/asranlib.c, link/lkar.h, link/lkar.c: @@ -8728,63 +8761,63 @@ 2005-04-02 Vangelis Rokas - * 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 @@ -8837,82 +8870,82 @@ 2005-03-31 Vangelis Rokas * 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 @@ -11100,17 +11133,17 @@ 2004-07-20 Maarten Brock - * 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 * 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 @@ -11317,8 +11350,8 @@ * 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 @@ -11399,7 +11432,7 @@ 2004-06-02 Vangelis Rokas - * 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 @@ -13767,11 +13800,11 @@ 2003-11-03 Martin Helmling - * 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 - * src/SDCCmain.c (linkEdit): "fixed" again bug #833605 + * src/SDCCmain.c (linkEdit): "fixed" again bug #833605 2003-11-01 Frieder Ferlemann @@ -13908,7 +13941,7 @@ 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 @@ -14271,7 +14304,7 @@ 2003-08-31 Erik Petrich * 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 @@ -14711,13 +14744,13 @@ 2003-07-19 Frieder Ferlemann - * 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 @@ -14725,7 +14758,7 @@ 2003-07-17 Jesus Calvino-Fraga - * 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 @@ -14758,25 +14791,25 @@ 2003-07-13 Jesus Calvino-Fraga - * 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 - * 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 - * 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 - * 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 @@ -14789,7 +14822,7 @@ 2003-07-01 Kevin Vigor - * DS800C400 fun, improved ROM interface and tinibios. + * DS800C400 fun, improved ROM interface and tinibios. 2003-06-27 Kevin Vigor @@ -14892,7 +14925,7 @@ 2003-06-02 Frieder Ferlemann * 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 @@ -14946,10 +14979,10 @@ 2003-05-25 Frieder Ferlemann * 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 @@ -15025,8 +15058,8 @@ 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 @@ -15039,11 +15072,11 @@ 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 - * 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 @@ -15053,9 +15086,9 @@ 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 @@ -15087,8 +15120,8 @@ 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 @@ -15311,10 +15344,10 @@ * 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 @@ -15443,10 +15476,10 @@ 2003-03-28 Borut Razem * 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 @@ -15578,7 +15611,7 @@ 2003-03-11 Bernhard Held - * 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 @@ -15715,8 +15748,8 @@ 2003-02-18 Frieder Ferlemann - * 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 @@ -16065,7 +16098,7 @@ 2003-01-06 * sim/ucsim/cmd.src/command.cc: fixed so "break xram r 0x7654" works again in - regression tests. + regression tests. 2003-01-06 @@ -16080,7 +16113,7 @@ * src/SDCCval.c (getNelements): fixed the initialized array of structures 2002-12-29 Jesus Calvino-Fraga - * 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 * src/mcs51/peeph.def: added rules 234 and 235 from Frieder Ferlemann @@ -16090,21 +16123,21 @@ * src/mcs51/gen.c (aopGetUsesAcc): inserted missing "return FALSE" 2002-12-27 Bernhard Held - * 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 * src/mcs51/main.c: removed {bindir}{sep} from aslink 2002-12-10 Jesus Calvino-Fraga - * 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 @@ -16870,11 +16903,11 @@ * 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 @@ -17336,15 +17369,15 @@ 2001-08-30 Bernhard Held - * sim/ucsim/configure: little improvement of Cygwin-detection - * sim/ucsim/configure.in: little improvement of Cygwin-detection - * sim/ucsim/cmd.src/newcmdcl.h: include 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 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$ diff --git a/as/asxxsrc/aslex.c b/as/asxxsrc/aslex.c index ae316156..d6392094 100644 --- a/as/asxxsrc/aslex.c +++ b/as/asxxsrc/aslex.c @@ -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 . */ /* - * (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 */ diff --git a/as/asxxsrc/asnoice.c b/as/asxxsrc/asnoice.c index 7c182e82..a13fec7d 100644 --- a/as/asxxsrc/asnoice.c +++ b/as/asxxsrc/asnoice.c @@ -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 . */ /* * Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files diff --git a/as/asxxsrc/assym.c b/as/asxxsrc/assym.c index 13d175a8..172ff403 100644 --- a/as/asxxsrc/assym.c +++ b/as/asxxsrc/assym.c @@ -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 . */ /* - * (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 diff --git a/as/hc08/asdata.c b/as/hc08/asdata.c index 5455398f..0349acd7 100644 --- a/as/hc08/asdata.c +++ b/as/hc08/asdata.c @@ -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 . */ /* - * (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: diff --git a/as/hc08/asexpr.c b/as/hc08/asexpr.c index e146a5be..348f4fc9 100644 --- a/as/hc08/asexpr.c +++ b/as/hc08/asexpr.c @@ -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 . */ #include #include diff --git a/as/hc08/aslist.c b/as/hc08/aslist.c index 2224403a..af165f1c 100644 --- a/as/hc08/aslist.c +++ b/as/hc08/aslist.c @@ -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 . */ /* - * (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] */ diff --git a/as/hc08/asm.h b/as/hc08/asm.h index 039fcfe4..9b293ea0 100644 --- a/as/hc08/asm.h +++ b/as/hc08/asm.h @@ -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 . */ /* - * (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 diff --git a/as/hc08/asmain.c b/as/hc08/asmain.c index 0de7a752..d771e773 100644 --- a/as/hc08/asmain.c +++ b/as/hc08/asmain.c @@ -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 . */ /* - * (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 */ diff --git a/as/hc08/asout.c b/as/hc08/asout.c index 6ffbae45..9ba6f4d0 100644 --- a/as/hc08/asout.c +++ b/as/hc08/asout.c @@ -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 . */ /* - * (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 diff --git a/as/hc08/assubr.c b/as/hc08/assubr.c index 1751c294..f21c847f 100644 --- a/as/hc08/assubr.c +++ b/as/hc08/assubr.c @@ -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 . */ #include #include diff --git a/as/hc08/m08adr.c b/as/hc08/m08adr.c index aa904650..1f0821c8 100644 --- a/as/hc08/m08adr.c +++ b/as/hc08/m08adr.c @@ -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 . */ #include #include diff --git a/as/hc08/m08ext.c b/as/hc08/m08ext.c index 88247315..319fde0f 100644 --- a/as/hc08/m08ext.c +++ b/as/hc08/m08ext.c @@ -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 . */ #include #include diff --git a/as/hc08/m08mch.c b/as/hc08/m08mch.c index 5c54496b..155d10a7 100644 --- a/as/hc08/m08mch.c +++ b/as/hc08/m08mch.c @@ -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 . */ #include #include diff --git a/as/hc08/m08pst.c b/as/hc08/m08pst.c index 34b945bb..f1caf1b0 100644 --- a/as/hc08/m08pst.c +++ b/as/hc08/m08pst.c @@ -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 . */ #include #include diff --git a/as/hc08/m6808.h b/as/hc08/m6808.h index 89929a4a..397e6abd 100644 --- a/as/hc08/m6808.h +++ b/as/hc08/m6808.h @@ -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 . */ /*)BUILD $(PROGRAM) = AS6808 diff --git a/as/link/aslink.h b/as/link/aslink.h index 4f21df91..ff45b466 100644 --- a/as/link/aslink.h +++ b/as/link/aslink.h @@ -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 . */ + +/* 28-Oct-97 JLH: * - add proto for StoreString * - change s_id from [NCPS] to pointer * - change NCPS to 80 diff --git a/as/link/hc08/lkarea.c b/as/link/hc08/lkarea.c index b103bc0a..0f44b0ea 100644 --- a/as/link/hc08/lkarea.c +++ b/as/link/hc08/lkarea.c @@ -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 . */ /* - * (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 */ diff --git a/as/link/hc08/lkelf.c b/as/link/hc08/lkelf.c index 827ef48c..e1c191ff 100644 --- a/as/link/hc08/lkelf.c +++ b/as/link/hc08/lkelf.c @@ -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 . */ #include #include diff --git a/as/link/hc08/lkihx.c b/as/link/hc08/lkihx.c index 824e4152..196f1dc2 100644 --- a/as/link/hc08/lkihx.c +++ b/as/link/hc08/lkihx.c @@ -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 . */ #include #include #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 @@ -39,35 +46,35 @@ * 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; } diff --git a/as/link/hc08/lkmain.c b/as/link/hc08/lkmain.c index 88c46c7a..8bab5460 100644 --- a/as/link/hc08/lkmain.c +++ b/as/link/hc08/lkmain.c @@ -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 . */ /* - * (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: diff --git a/as/link/hc08/lkmem.c b/as/link/hc08/lkmem.c index e250f95d..433e9054 100644 --- a/as/link/hc08/lkmem.c +++ b/as/link/hc08/lkmem.c @@ -1,360 +1,357 @@ -/*------------------------------------------------------------------------- - 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 . */ #include #include #include #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_addra_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_addra_addr; - } - - else if (EQ(xp->a_id, "SSEG")) - { - Stack.Size+=xp->a_size; - if(xp->a_addra_addr; - } - - else if (EQ(xp->a_id, "XSEG") || EQ(xp->a_id, "XISEG")) - { - XRam.Size+=xp->a_size; - if(xp->a_addra_addr; - } - - else if (EQ(xp->a_id, "ISEG")) - { - IRam.Size+=xp->a_size; - if(xp->a_addra_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_addra_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_addra_addr; + } + + else if (EQ(xp->a_id, "SSEG")) + { + Stack.Size+=xp->a_size; + if(xp->a_addra_addr; + } + + else if (EQ(xp->a_id, "XSEG") || EQ(xp->a_id, "XISEG")) + { + XRam.Size+=xp->a_size; + if(xp->a_addra_addr; + } + + else if (EQ(xp->a_id, "ISEG")) + { + IRam.Size+=xp->a_size; + if(xp->a_addra_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(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; } diff --git a/as/link/hc08/lkrloc.c b/as/link/hc08/lkrloc.c index cfa15d1e..ca6f3582 100644 --- a/as/link/hc08/lkrloc.c +++ b/as/link/hc08/lkrloc.c @@ -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 . */ /* - * (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 */ @@ -18,31 +27,31 @@ #include #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); } diff --git a/as/link/hc08/lks19.c b/as/link/hc08/lks19.c index d50a41ea..89183961 100644 --- a/as/link/hc08/lks19.c +++ b/as/link/hc08/lks19.c @@ -1,124 +1,131 @@ -/* lks19.c */ +/* lks19.c -/* - * (C) Copyright 1989-1995 - * All Rights Reserved - * - * Alan R. Baldwin - * 721 Berkeley St. - * Kent, Ohio 44240 - */ + Copyright (C) 1989-1995 Alan R. Baldwin + 721 Berkeley St., Kent, Ohio 44240 + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ #include #include #include "aslink.h" -/*)Module lks19.c +/*)Module lks19.c * - * The module lks19.c contains the function to - * output the relocated object code in the - * Motorola S19 format. + * The module lks19.c contains the function to + * output the relocated object code in the + * Motorola S19 format. * - * lks19.c contains the following function: - * VOID s19(i) + * lks19.c contains the following function: + * VOID s19(i) * - * lks19.c contains no local variables. + * lks19.c contains no local variables. */ /*)S19 Format * Record Type Field - This field signifies the start of a * record and identifies the the record - * type as follows: + * type as follows: * - * Ascii S1 - Data Record - * Ascii S9 - End of File Record + * Ascii S1 - Data Record + * Ascii S9 - End of File Record * * Record Length Field - This field specifies the record length * which includes the address, data, and * checksum fields. The 8 bit record * length value is converted to two ascii - * characters, high digit first. + * characters, high digit first. * * Load Address Field - This field consists of the four ascii * characters which result from converting * the the binary value of the address in * which to begin loading this record. The - * order is as follows: + * order is as follows: * - * High digit of high byte of address. - * Low digit of high byte of address. - * High digit of low byte of address. - * Low digit of low byte of address. + * High digit of high byte of address. + * Low digit of high byte of address. + * High digit of low byte of address. + * Low digit of low byte of address. * * In an End of File record this field con- * sists of either four ascii zeros or the * program entry address. Currently the - * entry address option is not supported. + * entry address option is not supported. * * Data Field - This field consists of the actual data, * converted to two ascii characters, high * digit first. There are no data bytes in - * the End of File record. + * the End of File record. * * Checksum Field - The checksum field is the 8 bit binary * sum of the record length field, the load * address field, and the data field. This * sum is then complemented (1's comple- * ment) and converted to two ascii - * characters, high digit first. + * characters, high digit first. */ -/*)Function s19(i) +/*)Function s19(i) * - * int i 0 - process data - * 1 - end of data + * int i 0 - process data + * 1 - end of data * - * The function s19() outputs the relocated data - * in the standard Motorola S19 format. + * The function s19() outputs the relocated data + * in the standard Motorola S19 format. * - * local variables: - * Addr_T chksum byte checksum + * local variables: + * Addr_T chksum byte checksum * - * global variables: - * int hilo byte order - * FILE * ofp output file handle - * int rtcnt count of data words - * int rtflg[] output the data flag - * Addr_T rtval[] relocated data + * global variables: + * int hilo byte order + * FILE * ofp output file handle + * int rtcnt count of data words + * int rtflg[] output the data flag + * Addr_T rtval[] relocated data * - * functions called: - * int fprintf() c_library + * functions called: + * int fprintf() c_library * - * side effects: - * The data is output to the file defined by ofp. + * side effects: + * The data is output to the file defined by ofp. */ VOID s19(i) { - register Addr_T chksum; + register Addr_T chksum; - if (i) { - if (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"); + } } diff --git a/as/link/lkaomf51.c b/as/link/lkaomf51.c index 80284782..3213bce0 100644 --- a/as/link/lkaomf51.c +++ b/as/link/lkaomf51.c @@ -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 . */ #include #include @@ -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=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=0)?procedure[symbol[j].Procedure].name:"GLOBAL", - symbol[j].Address, - k<6?UsageTypeName[k]:"???"); - } - - fprintf(DumpFile,"\nPROCEDURES:\n"); - for(j=0; j %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=0)?procedure[symbol[j].Procedure].name:"GLOBAL", + symbol[j].Address, + k<6?UsageTypeName[k]:"???"); + } + + fprintf(DumpFile,"\nPROCEDURES:\n"); + for(j=0; j %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; j2) /*If there are any symbols*/ - { - OutputByte(0x12); /*REC TYPE*/ - OutputWord(recsize);/*Record Length*/ - OutputByte(0x01); /*DEF TYPE: Public symbols*/ - for(k=0; k2) /*If there are any symbols*/ - { - OutputByte(0x12); /*REC TYPE*/ - OutputWord(recsize);/*Record Length*/ - OutputByte(0x00); /*DEF TYPE: Local symbols*/ - for(k=0; k2) /*If there are any symbols*/ - { - OutputByte(0x12); /*REC TYPE*/ - OutputWord(recsize);/*Record Length*/ - OutputByte(0x00); /*DEF TYPE: Local symbols*/ - for(i=0; i2) /*If there are any line numbers*/ - { - OutputByte(0x12); /*REC TYPE*/ - OutputWord(recsize);/*Record Length*/ - OutputByte(0x03); /*DEF TYPE: Line numbers*/ - for(i=0; i2) /*If there are any symbols*/ + { + OutputByte(0x12); /*REC TYPE*/ + OutputWord(recsize);/*Record Length*/ + OutputByte(0x01); /*DEF TYPE: Public symbols*/ + for(k=0; k2) /*If there are any symbols*/ + { + OutputByte(0x12); /*REC TYPE*/ + OutputWord(recsize);/*Record Length*/ + OutputByte(0x00); /*DEF TYPE: Local symbols*/ + for(k=0; k2) /*If there are any symbols*/ + { + OutputByte(0x12); /*REC TYPE*/ + OutputWord(recsize);/*Record Length*/ + OutputByte(0x00); /*DEF TYPE: Local symbols*/ + for(i=0; i2) /*If there are any line numbers*/ + { + OutputByte(0x12); /*REC TYPE*/ + OutputWord(recsize);/*Record Length*/ + OutputByte(0x03); /*DEF TYPE: Line numbers*/ + for(i=0; i|L}$$$(),
,," - 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(),
,,*/ - 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=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|L}$$$(),
,," + 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(),
,,*/ + 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=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. */ /* - * (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: diff --git a/as/link/lkeval.c b/as/link/lkeval.c index 230c40ba..433edbcd 100644 --- a/as/link/lkeval.c +++ b/as/link/lkeval.c @@ -1,397 +1,404 @@ -/* 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 . */ #include #include #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); } diff --git a/as/link/lkhead.c b/as/link/lkhead.c index b9c5541a..0dd2f5d8 100644 --- a/as/link/lkhead.c +++ b/as/link/lkhead.c @@ -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 . */ #include #include #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. */ /* @@ -74,66 +81,66 @@ 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++; + } } diff --git a/as/link/lklex.c b/as/link/lklex.c index 67c297a1..8d373a9f 100644 --- a/as/link/lklex.c +++ b/as/link/lklex.c @@ -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 . */ #include #include #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; } diff --git a/as/link/lklib.c b/as/link/lklib.c index cab38d9a..66ff0be2 100644 --- a/as/link/lklib.c +++ b/as/link/lklib.c @@ -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 . */ /* * With contributions for the diff --git a/as/link/lklibr.c b/as/link/lklibr.c index 219e7e33..93ac1df6 100644 --- a/as/link/lklibr.c +++ b/as/link/lklibr.c @@ -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 . */ /* * With contributions for the diff --git a/as/link/lklibr.h b/as/link/lklibr.h index 040fc17b..49659a01 100644 --- a/as/link/lklibr.h +++ b/as/link/lklibr.h @@ -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 . */ /* * With contributions for the diff --git a/as/link/lklist.c b/as/link/lklist.c index 68d041c1..3448539e 100644 --- a/as/link/lklist.c +++ b/as/link/lklist.c @@ -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 . */ /* - * (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 @@ -20,100 +29,100 @@ #include #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; is_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; is_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; is_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; is_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; is_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; is_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; is_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; is_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. */ /* * 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 ); } diff --git a/as/link/lkrel.c b/as/link/lkrel.c index 7b5a931c..5aae61ed 100644 --- a/as/link/lkrel.c +++ b/as/link/lkrel.c @@ -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 . */ /* * With contributions for the diff --git a/as/link/lkrel.h b/as/link/lkrel.h index 3d88d63a..ec846e85 100644 --- a/as/link/lkrel.h +++ b/as/link/lkrel.h @@ -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 . */ /* * With contributions for the diff --git a/as/link/lksdcclib.c b/as/link/lksdcclib.c index d45c0c39..6f4dc46b 100644 --- a/as/link/lksdcclib.c +++ b/as/link/lksdcclib.c @@ -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 . */ /* * With contributions for the diff --git a/as/link/lkstore.c b/as/link/lkstore.c index 063e89c4..08e981b7 100644 --- a/as/link/lkstore.c +++ b/as/link/lkstore.c @@ -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 . */ + +/* * 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) { diff --git a/as/link/lksym.c b/as/link/lksym.c index e0408050..d3cacbe3 100644 --- a/as/link/lksym.c +++ b/as/link/lksym.c @@ -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 . */ /* - * (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 @@ -19,101 +28,101 @@ #include #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; is_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; is_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; ih_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; ih_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); } diff --git a/as/link/mcs51/lkarea.c b/as/link/mcs51/lkarea.c index 1135e83e..d8097c54 100644 --- a/as/link/mcs51/lkarea.c +++ b/as/link/mcs51/lkarea.c @@ -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 . */ /* - * (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 diff --git a/as/link/mcs51/lkihx.c b/as/link/mcs51/lkihx.c index 415408fc..cce29ff4 100644 --- a/as/link/mcs51/lkihx.c +++ b/as/link/mcs51/lkihx.c @@ -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 . */ #include #include diff --git a/as/link/mcs51/lkmain.c b/as/link/mcs51/lkmain.c index 89ce6a18..cb0d05e0 100644 --- a/as/link/mcs51/lkmain.c +++ b/as/link/mcs51/lkmain.c @@ -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 . */ /* - * (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: diff --git a/as/link/mcs51/lkmem.c b/as/link/mcs51/lkmem.c index 2f5ef443..24b2ff9d 100644 --- a/as/link/mcs51/lkmem.c +++ b/as/link/mcs51/lkmem.c @@ -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 . */ #include #include @@ -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++) { diff --git a/as/link/mcs51/lkrloc.c b/as/link/mcs51/lkrloc.c index fc50964a..92fd8e11 100644 --- a/as/link/mcs51/lkrloc.c +++ b/as/link/mcs51/lkrloc.c @@ -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 . */ /* - * (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 diff --git a/as/link/mcs51/lks19.c b/as/link/mcs51/lks19.c index 26d8892e..e4a297f7 100644 --- a/as/link/mcs51/lks19.c +++ b/as/link/mcs51/lks19.c @@ -1,122 +1,129 @@ -/* lks19.c */ +/* lks19.c -/* - * (C) Copyright 1989-1995 - * All Rights Reserved - * - * Alan R. Baldwin - * 721 Berkeley St. - * Kent, Ohio 44240 - */ + Copyright (C) 1989-1995 Alan R. Baldwin + 721 Berkeley St., Kent, Ohio 44240 + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ #include #include #include "aslink.h" -/*)Module lks19.c +/*)Module lks19.c * - * The module lks19.c contains the function to - * output the relocated object code in the - * Motorola S19 format. + * The module lks19.c contains the function to + * output the relocated object code in the + * Motorola S19 format. * - * lks19.c contains the following function: - * VOID s19(i) + * lks19.c contains the following function: + * VOID s19(i) * - * lks19.c contains no local variables. + * lks19.c contains no local variables. */ /*)S19 Format * Record Type Field - This field signifies the start of a * record and identifies the the record - * type as follows: + * type as follows: * - * Ascii S1 - Data Record - * Ascii S9 - End of File Record + * Ascii S1 - Data Record + * Ascii S9 - End of File Record * * Record Length Field - This field specifies the record length * which includes the address, data, and * checksum fields. The 8 bit record * length value is converted to two ascii - * characters, high digit first. + * characters, high digit first. * * Load Address Field - This field consists of the four ascii * characters which result from converting * the the binary value of the address in * which to begin loading this record. The - * order is as follows: + * order is as follows: * - * High digit of high byte of address. - * Low digit of high byte of address. - * High digit of low byte of address. - * Low digit of low byte of address. + * High digit of high byte of address. + * Low digit of high byte of address. + * High digit of low byte of address. + * Low digit of low byte of address. * * In an End of File record this field con- * sists of either four ascii zeros or the * program entry address. Currently the - * entry address option is not supported. + * entry address option is not supported. * * Data Field - This field consists of the actual data, * converted to two ascii characters, high * digit first. There are no data bytes in - * the End of File record. + * the End of File record. * * Checksum Field - The checksum field is the 8 bit binary * sum of the record length field, the load * address field, and the data field. This * sum is then complemented (1's comple- * ment) and converted to two ascii - * characters, high digit first. + * characters, high digit first. */ -/*)Function s19(i) +/*)Function s19(i) * - * int i 0 - process data - * 1 - end of data + * int i 0 - process data + * 1 - end of data * - * The function s19() outputs the relocated data - * in the standard Motorola S19 format. + * The function s19() outputs the relocated data + * in the standard Motorola S19 format. * - * local variables: - * Addr_T chksum byte checksum + * local variables: + * Addr_T chksum byte checksum * - * global variables: - * int hilo byte order - * FILE * ofp output file handle - * int rtcnt count of data words - * int rtflg[] output the data flag - * Addr_T rtval[] relocated data + * global variables: + * int hilo byte order + * FILE * ofp output file handle + * int rtcnt count of data words + * int rtflg[] output the data flag + * Addr_T rtval[] relocated data * - * functions called: - * int fprintf() c_library + * functions called: + * int fprintf() c_library * - * side effects: - * The data is output to the file defined by ofp. + * side effects: + * The data is output to the file defined by ofp. */ VOID s19(i) { - register Addr_T chksum; + register Addr_T chksum; - if (i) { - if (hilo == 0) { - chksum = rtval[0]; - rtval[0] = rtval[1]; - rtval[1] = chksum; - } - for (i = 0, chksum = 1; i < rtcnt; i++) { - if (rtflg[i]) - chksum++; - } - fprintf(ofp, "S1%02X", chksum); - for (i = 0; i < rtcnt ; i++) { - if (rtflg[i]) { - fprintf(ofp, "%02X", rtval[i]); - chksum += rtval[i]; - } - } - fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff); - } else { - fprintf(ofp, "S9030000FC\n"); - } + if (i) { + if (hilo == 0) { + chksum = rtval[0]; + rtval[0] = rtval[1]; + rtval[1] = chksum; + } + for (i = 0, chksum = 1; i < rtcnt; i++) { + if (rtflg[i]) + chksum++; + } + fprintf(ofp, "S1%02X", chksum); + for (i = 0; i < rtcnt ; i++) { + if (rtflg[i]) { + fprintf(ofp, "%02X", rtval[i]); + chksum += rtval[i]; + } + } + fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff); + } else { + fprintf(ofp, "S9030000FC\n"); + } } diff --git a/as/link/z80/lkarea.c b/as/link/z80/lkarea.c index 95e5a8ac..7292d954 100644 --- a/as/link/z80/lkarea.c +++ b/as/link/z80/lkarea.c @@ -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 . */ #include #include #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. */ /* @@ -99,210 +106,210 @@ 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_ and l_ 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_ and l_ 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_ the start address of the area - * l_ the length of the area - */ + /* + * Create symbols called: + * s_ the start address of the area + * l_ 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; } diff --git a/as/link/z80/lkgb.c b/as/link/z80/lkgb.c index 55ae41ff..b20299a8 100644 --- a/as/link/z80/lkgb.c +++ b/as/link/z80/lkgb.c @@ -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 . */ /* * 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); diff --git a/as/link/z80/lkgg.c b/as/link/z80/lkgg.c index 3e8bb37a..3c3842b2 100644 --- a/as/link/z80/lkgg.c +++ b/as/link/z80/lkgg.c @@ -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 . */ /* * 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 { diff --git a/as/link/z80/lkihx.c b/as/link/z80/lkihx.c index a3d3b020..812e446e 100644 --- a/as/link/z80/lkihx.c +++ b/as/link/z80/lkihx.c @@ -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 . */ #include #include #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 @@ -37,35 +44,35 @@ * 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 @@ -73,61 +80,61 @@ * 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"); + } } diff --git a/as/link/z80/lkmain.c b/as/link/z80/lkmain.c index c7cbfcc1..70404c2f 100644 --- a/as/link/z80/lkmain.c +++ b/as/link/z80/lkmain.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/link/z80/lkrloc.c b/as/link/z80/lkrloc.c index 5e97dae3..063793df 100644 --- a/as/link/z80/lkrloc.c +++ b/as/link/z80/lkrloc.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/link/z80/lks19.c b/as/link/z80/lks19.c index 26d8892e..e4a297f7 100644 --- a/as/link/z80/lks19.c +++ b/as/link/z80/lks19.c @@ -1,122 +1,129 @@ -/* lks19.c */ +/* lks19.c -/* - * (C) Copyright 1989-1995 - * All Rights Reserved - * - * Alan R. Baldwin - * 721 Berkeley St. - * Kent, Ohio 44240 - */ + Copyright (C) 1989-1995 Alan R. Baldwin + 721 Berkeley St., Kent, Ohio 44240 + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ #include #include #include "aslink.h" -/*)Module lks19.c +/*)Module lks19.c * - * The module lks19.c contains the function to - * output the relocated object code in the - * Motorola S19 format. + * The module lks19.c contains the function to + * output the relocated object code in the + * Motorola S19 format. * - * lks19.c contains the following function: - * VOID s19(i) + * lks19.c contains the following function: + * VOID s19(i) * - * lks19.c contains no local variables. + * lks19.c contains no local variables. */ /*)S19 Format * Record Type Field - This field signifies the start of a * record and identifies the the record - * type as follows: + * type as follows: * - * Ascii S1 - Data Record - * Ascii S9 - End of File Record + * Ascii S1 - Data Record + * Ascii S9 - End of File Record * * Record Length Field - This field specifies the record length * which includes the address, data, and * checksum fields. The 8 bit record * length value is converted to two ascii - * characters, high digit first. + * characters, high digit first. * * Load Address Field - This field consists of the four ascii * characters which result from converting * the the binary value of the address in * which to begin loading this record. The - * order is as follows: + * order is as follows: * - * High digit of high byte of address. - * Low digit of high byte of address. - * High digit of low byte of address. - * Low digit of low byte of address. + * High digit of high byte of address. + * Low digit of high byte of address. + * High digit of low byte of address. + * Low digit of low byte of address. * * In an End of File record this field con- * sists of either four ascii zeros or the * program entry address. Currently the - * entry address option is not supported. + * entry address option is not supported. * * Data Field - This field consists of the actual data, * converted to two ascii characters, high * digit first. There are no data bytes in - * the End of File record. + * the End of File record. * * Checksum Field - The checksum field is the 8 bit binary * sum of the record length field, the load * address field, and the data field. This * sum is then complemented (1's comple- * ment) and converted to two ascii - * characters, high digit first. + * characters, high digit first. */ -/*)Function s19(i) +/*)Function s19(i) * - * int i 0 - process data - * 1 - end of data + * int i 0 - process data + * 1 - end of data * - * The function s19() outputs the relocated data - * in the standard Motorola S19 format. + * The function s19() outputs the relocated data + * in the standard Motorola S19 format. * - * local variables: - * Addr_T chksum byte checksum + * local variables: + * Addr_T chksum byte checksum * - * global variables: - * int hilo byte order - * FILE * ofp output file handle - * int rtcnt count of data words - * int rtflg[] output the data flag - * Addr_T rtval[] relocated data + * global variables: + * int hilo byte order + * FILE * ofp output file handle + * int rtcnt count of data words + * int rtflg[] output the data flag + * Addr_T rtval[] relocated data * - * functions called: - * int fprintf() c_library + * functions called: + * int fprintf() c_library * - * side effects: - * The data is output to the file defined by ofp. + * side effects: + * The data is output to the file defined by ofp. */ VOID s19(i) { - register Addr_T chksum; + register Addr_T chksum; - if (i) { - if (hilo == 0) { - chksum = rtval[0]; - rtval[0] = rtval[1]; - rtval[1] = chksum; - } - for (i = 0, chksum = 1; i < rtcnt; i++) { - if (rtflg[i]) - chksum++; - } - fprintf(ofp, "S1%02X", chksum); - for (i = 0; i < rtcnt ; i++) { - if (rtflg[i]) { - fprintf(ofp, "%02X", rtval[i]); - chksum += rtval[i]; - } - } - fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff); - } else { - fprintf(ofp, "S9030000FC\n"); - } + if (i) { + if (hilo == 0) { + chksum = rtval[0]; + rtval[0] = rtval[1]; + rtval[1] = chksum; + } + for (i = 0, chksum = 1; i < rtcnt; i++) { + if (rtflg[i]) + chksum++; + } + fprintf(ofp, "S1%02X", chksum); + for (i = 0; i < rtcnt ; i++) { + if (rtflg[i]) { + fprintf(ofp, "%02X", rtval[i]); + chksum += rtval[i]; + } + } + fprintf(ofp, "%02X\n", (0-chksum-1) & 0xff); + } else { + fprintf(ofp, "S9030000FC\n"); + } } diff --git a/as/mcs51/asdata.c b/as/mcs51/asdata.c index 8af9a419..c6cd1a66 100644 --- a/as/mcs51/asdata.c +++ b/as/mcs51/asdata.c @@ -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 . */ /* - * (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: diff --git a/as/mcs51/asexpr.c b/as/mcs51/asexpr.c index a424d144..edf70aea 100644 --- a/as/mcs51/asexpr.c +++ b/as/mcs51/asexpr.c @@ -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 . */ #include #include diff --git a/as/mcs51/aslist.c b/as/mcs51/aslist.c index 2224403a..af165f1c 100644 --- a/as/mcs51/aslist.c +++ b/as/mcs51/aslist.c @@ -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 . */ /* - * (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] */ diff --git a/as/mcs51/asm.h b/as/mcs51/asm.h index dab0e5f6..681a81dd 100644 --- a/as/mcs51/asm.h +++ b/as/mcs51/asm.h @@ -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 . */ /* - * (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 diff --git a/as/mcs51/asmain.c b/as/mcs51/asmain.c index 34598db8..817f83f7 100644 --- a/as/mcs51/asmain.c +++ b/as/mcs51/asmain.c @@ -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 . */ /* - * (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 */ diff --git a/as/mcs51/asout.c b/as/mcs51/asout.c index 3bb68300..f65d789b 100644 --- a/as/mcs51/asout.c +++ b/as/mcs51/asout.c @@ -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 . */ /* - * (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 diff --git a/as/mcs51/assubr.c b/as/mcs51/assubr.c index 1751c294..f21c847f 100644 --- a/as/mcs51/assubr.c +++ b/as/mcs51/assubr.c @@ -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 . */ #include #include diff --git a/as/mcs51/i51adr.c b/as/mcs51/i51adr.c index 3657d3c4..87a00af8 100644 --- a/as/mcs51/i51adr.c +++ b/as/mcs51/i51adr.c @@ -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 . */ /* - * (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 */ diff --git a/as/mcs51/i51ext.c b/as/mcs51/i51ext.c index ca04fd11..60efc632 100644 --- a/as/mcs51/i51ext.c +++ b/as/mcs51/i51ext.c @@ -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 . */ /* - * (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 */ diff --git a/as/mcs51/i51mch.c b/as/mcs51/i51mch.c index 9e7b2900..df73096e 100644 --- a/as/mcs51/i51mch.c +++ b/as/mcs51/i51mch.c @@ -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 . */ /* - * (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 */ diff --git a/as/mcs51/i51pst.c b/as/mcs51/i51pst.c index 2e1908de..08225d8d 100644 --- a/as/mcs51/i51pst.c +++ b/as/mcs51/i51pst.c @@ -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 . */ /* - * (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 */ diff --git a/as/mcs51/i8051.h b/as/mcs51/i8051.h index 890fb849..fba39d82 100644 --- a/as/mcs51/i8051.h +++ b/as/mcs51/i8051.h @@ -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 . */ /* - * (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 */ diff --git a/as/xa51/xa_link.c b/as/xa51/xa_link.c index f9a81c75..a6823d24 100644 --- a/as/xa51/xa_link.c +++ b/as/xa51/xa_link.c @@ -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 . */ + /* 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. diff --git a/as/xa51/xa_main.c b/as/xa51/xa_main.c index 345ca7e4..8717905a 100644 --- a/as/xa51/xa_main.c +++ b/as/xa51/xa_main.c @@ -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 . */ /* adapted from the osu8asm project, 1995 */ /* http://www.pjrc.com/tech/osu8/index.html */ diff --git a/as/xa51/xa_main.h b/as/xa51/xa_main.h index 400e7dcf..2b1da797 100644 --- a/as/xa51/xa_main.h +++ b/as/xa51/xa_main.h @@ -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 . */ + #define SIZE8 0 #define SIZE16 1 #define SIZE32 2 diff --git a/as/xa51/xa_rasm.l b/as/xa51/xa_rasm.l index 8576b734..b72b9e0d 100644 --- a/as/xa51/xa_rasm.l +++ b/as/xa51/xa_rasm.l @@ -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 . */ /* Author contact: paul@pjrc.com */ diff --git a/as/xa51/xa_rasm.y b/as/xa51/xa_rasm.y index 5db81555..be78e101 100644 --- a/as/xa51/xa_rasm.y +++ b/as/xa51/xa_rasm.y @@ -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 . */ /* Author contact: paul@pjrc.com */ diff --git a/as/xa51/xa_version.h b/as/xa51/xa_version.h index 167bbf87..66c45b74 100644 --- a/as/xa51/xa_version.h +++ b/as/xa51/xa_version.h @@ -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 . */ + #define version 0.1 diff --git a/as/z80/asdata.c b/as/z80/asdata.c index 505732ac..69c5a3df 100644 --- a/as/z80/asdata.c +++ b/as/z80/asdata.c @@ -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 . */ #include #include diff --git a/as/z80/asexpr.c b/as/z80/asexpr.c index 58fc0776..6d9211c3 100644 --- a/as/z80/asexpr.c +++ b/as/z80/asexpr.c @@ -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 . */ #include #include diff --git a/as/z80/aslist.c b/as/z80/aslist.c index b4ac0933..675ead57 100644 --- a/as/z80/aslist.c +++ b/as/z80/aslist.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/z80/asm.h b/as/z80/asm.h index a5c3d109..0f5f0af8 100644 --- a/as/z80/asm.h +++ b/as/z80/asm.h @@ -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 . */ /* - * (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 diff --git a/as/z80/asmain.c b/as/z80/asmain.c index 0629710d..b072acc2 100644 --- a/as/z80/asmain.c +++ b/as/z80/asmain.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/z80/asout.c b/as/z80/asout.c index df9254e6..044a3753 100644 --- a/as/z80/asout.c +++ b/as/z80/asout.c @@ -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 . */ /* - * (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] diff --git a/as/z80/assubr.c b/as/z80/assubr.c index 6423d9fd..ac45e8e4 100644 --- a/as/z80/assubr.c +++ b/as/z80/assubr.c @@ -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 . */ /* * Extensions: P. Felber, M. Hope diff --git a/as/z80/z80.h b/as/z80/z80.h index 82cf3177..3255a81b 100644 --- a/as/z80/z80.h +++ b/as/z80/z80.h @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/z80/z80adr.c b/as/z80/z80adr.c index f4b12afc..cc273c2c 100644 --- a/as/z80/z80adr.c +++ b/as/z80/z80adr.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/z80/z80ext.c b/as/z80/z80ext.c index 4ae945a9..118d4ad6 100644 --- a/as/z80/z80ext.c +++ b/as/z80/z80ext.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/z80/z80mch.c b/as/z80/z80mch.c index 7ee7c746..9a8014f5 100644 --- a/as/z80/z80mch.c +++ b/as/z80/z80mch.c @@ -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 . */ /* * Extensions: P. Felber diff --git a/as/z80/z80pst.c b/as/z80/z80pst.c index 5915e992..1c4b4314 100644 --- a/as/z80/z80pst.c +++ b/as/z80/z80pst.c @@ -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 . */ /* * Extensions: P. Felber -- 2.30.2