From afe5cd0c74043fc500e839610256e4489b6659fe Mon Sep 17 00:00:00 2001 From: borutr Date: Fri, 14 Mar 2008 16:42:13 +0000 Subject: [PATCH] * as/doc/asmlnk.doc, as/doc/asxhtm.html: updated link-xx and aslink command line options * as/link/hc08/lkmain.c: converted tabs to spaces so that the usage is correctly displayed * as/link/z80/lkmain.c: usage line commented out git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5095 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 + as/doc/asmlnk.doc | 2846 +++++++++++++++++++++-------------------- as/doc/asxhtm.html | 89 +- as/link/hc08/lkmain.c | 2208 ++++++++++++++++---------------- as/link/z80/lkmain.c | 2 + 5 files changed, 2633 insertions(+), 2520 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06d958b6..bb78cf25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-14 Borut Razem + + * as/doc/asmlnk.doc, as/doc/asxhtm.html: updated link-xx and aslink + command line options + * as/link/hc08/lkmain.c: converted tabs to spaces so that the usage + is correctly displayed + * as/link/z80/lkmain.c: usage line commented out + 2008-03-13 Borut Razem * doc/sdccman.lyx: corrected to be able to convert to PDF, diff --git a/as/doc/asmlnk.doc b/as/doc/asmlnk.doc index 17c30e9a..61397ff0 100644 --- a/as/doc/asmlnk.doc +++ b/as/doc/asmlnk.doc @@ -1,6 +1,6 @@ - + @@ -32,276 +32,276 @@ ASLINK Relocating Linker - CHAPTER 1 THE ASSEMBLER 1-1 - 1.1 THE ASXXXX ASSEMBLERS 1-1 - 1.1.1 Assembly Pass 1 1-2 - 1.1.2 Assembly Pass 2 1-2 - 1.1.3 Assembly Pass 3 1-2 - 1.2 SOURCE PROGRAM FORMAT 1-3 - 1.2.1 Statement Format 1-3 - 1.2.1.1 Label Field 1-3 - 1.2.1.2 Operator Field 1-5 - 1.2.1.3 Operand Field 1-5 - 1.2.1.4 Comment Field 1-6 - 1.3 SYMBOLS AND EXPRESSIONS 1-6 - 1.3.1 Character Set 1-6 - 1.3.2 User-Defined Symbols 1-10 - 1.3.3 Local Symbols 1-11 - 1.3.4 Current Location Counter 1-12 - 1.3.5 Numbers 1-14 - 1.3.6 Terms 1-14 - 1.3.7 Expressions 1-15 - 1.4 GENERAL ASSEMBLER DIRECTIVES 1-16 - 1.4.1 .module Directive 1-16 - 1.4.2 .title Directive 1-17 - 1.4.3 .sbttl Directive 1-17 - 1.4.4 .page Directive 1-17 - 1.4.5 .byte and .db Directives 1-17 - 1.4.6 .word and .dw Directives 1-18 - 1.4.7 .blkb, .blkw, and .ds Directives 1-18 - 1.4.8 .ascii Directive 1-18 - 1.4.9 .ascis Directive 1-19 - 1.4.10 .asciz Directive 1-19 - 1.4.11 .radix Directive 1-20 - 1.4.12 .even Directive 1-20 - 1.4.13 .odd Directive 1-20 - 1.4.14 .area Directive 1-21 - 1.4.15 .org Directive 1-22 - 1.4.16 .globl Directive 1-23 - 1.4.17 .if, .else, and .endif Directives 1-23 - 1.4.18 .include Directive 1-24 - 1.4.19 .setdp Directive 1-25 - 1.5 INVOKING ASXXXX 1-27 - 1.6 ERRORS 1-28 - 1.7 LISTING FILE 1-29 - 1.8 SYMBOL TABLE FILE 1-30 - 1.9 OBJECT FILE 1-31 - - CHAPTER 2 THE LINKER 2-1 - 2.1 ASLINK RELOCATING LINKER 2-1 - 2.2 INVOKING ASLINK 2-2 - 2.3 LIBRARY PATH(S) AND FILE(S) 2-3 - 2.4 ASLINK PROCESSING 2-4 - 2.5 LINKER INPUT FORMAT 2-5 - 2.5.1 Object Module Format 2-6 - 2.5.2 Header Line 2-6 - 2.5.3 Module Line 2-6 - 2.5.4 Symbol Line 2-6 - 2.5.5 Area Line 2-7 + CHAPTER 1 THE ASSEMBLER 1-1 + 1.1 THE ASXXXX ASSEMBLERS 1-1 + 1.1.1 Assembly Pass 1 1-2 + 1.1.2 Assembly Pass 2 1-2 + 1.1.3 Assembly Pass 3 1-2 + 1.2 SOURCE PROGRAM FORMAT 1-3 + 1.2.1 Statement Format 1-3 + 1.2.1.1 Label Field 1-3 + 1.2.1.2 Operator Field 1-5 + 1.2.1.3 Operand Field 1-5 + 1.2.1.4 Comment Field 1-6 + 1.3 SYMBOLS AND EXPRESSIONS 1-6 + 1.3.1 Character Set 1-6 + 1.3.2 User-Defined Symbols 1-10 + 1.3.3 Local Symbols 1-11 + 1.3.4 Current Location Counter 1-12 + 1.3.5 Numbers 1-14 + 1.3.6 Terms 1-14 + 1.3.7 Expressions 1-15 + 1.4 GENERAL ASSEMBLER DIRECTIVES 1-16 + 1.4.1 .module Directive 1-16 + 1.4.2 .title Directive 1-17 + 1.4.3 .sbttl Directive 1-17 + 1.4.4 .page Directive 1-17 + 1.4.5 .byte and .db Directives 1-17 + 1.4.6 .word and .dw Directives 1-18 + 1.4.7 .blkb, .blkw, and .ds Directives 1-18 + 1.4.8 .ascii Directive 1-18 + 1.4.9 .ascis Directive 1-19 + 1.4.10 .asciz Directive 1-19 + 1.4.11 .radix Directive 1-20 + 1.4.12 .even Directive 1-20 + 1.4.13 .odd Directive 1-20 + 1.4.14 .area Directive 1-21 + 1.4.15 .org Directive 1-22 + 1.4.16 .globl Directive 1-23 + 1.4.17 .if, .else, and .endif Directives 1-23 + 1.4.18 .include Directive 1-24 + 1.4.19 .setdp Directive 1-25 + 1.5 INVOKING ASXXXX 1-27 + 1.6 ERRORS 1-28 + 1.7 LISTING FILE 1-29 + 1.8 SYMBOL TABLE FILE 1-30 + 1.9 OBJECT FILE 1-31 + + CHAPTER 2 THE LINKER 2-1 + 2.1 ASLINK RELOCATING LINKER 2-1 + 2.2 INVOKING ASLINK 2-2 + 2.3 LIBRARY PATH(S) AND FILE(S) 2-3 + 2.4 ASLINK PROCESSING 2-4 + 2.5 LINKER INPUT FORMAT 2-5 + 2.5.1 Object Module Format 2-6 + 2.5.2 Header Line 2-6 + 2.5.3 Module Line 2-6 + 2.5.4 Symbol Line 2-6 + 2.5.5 Area Line 2-7 Page ii - - - - 2.5.6 T Line 2-7 - 2.5.7 R Line 2-7 - 2.5.8 P Line 2-8 - 2.6 LINKER ERROR MESSAGES 2-8 - 2.7 INTEL HEX OUTPUT FORMAT 2-11 - 2.8 MOTORLA S1-S9 OUTPUT FORMAT 2-12 - - CHAPTER 3 BUILDING ASXXXX AND ASLINK 3-1 - 3.1 BUILDING AN ASSEMBLER 3-1 - 3.2 BUILDING ASLINK 3-2 - - APPENDIX A AS6800 ASSEMBLER A-1 - A.1 6800 REGISTER SET A-1 - A.2 6800 INSTRUCTION SET A-1 - A.2.1 Inherent Instructions A-2 - A.2.2 Branch Instructions A-2 - A.2.3 Single Operand Instructions A-3 - A.2.4 Double Operand Instructions A-4 - A.2.5 Jump and Jump to Subroutine Instructions A-4 - A.2.6 Long Register Instructions A-5 - - APPENDIX B AS6801 ASSEMBLER B-1 - B.1 .hd6303 DIRECTIVE B-1 - B.2 6801 REGISTER SET B-1 - B.3 6801 INSTRUCTION SET B-1 - B.3.1 Inherent Instructions B-2 - B.3.2 Branch Instructions B-2 - B.3.3 Single Operand Instructions B-3 - B.3.4 Double Operand Instructions B-4 - B.3.5 Jump and Jump to Subroutine Instructions B-5 - B.3.6 Long Register Instructions B-5 - B.3.7 6303 Specific Instructions B-5 - - APPENDIX C AS6804 ASSEMBLER C-1 - C.1 6804 REGISTER SET C-1 - C.2 6804 INSTRUCTION SET C-1 - C.2.1 Inherent Instructions C-2 - C.2.2 Branch Instructions C-2 - C.2.3 Single Operand Instructions C-2 - C.2.4 Jump and Jump to Subroutine Instructions C-2 - C.2.5 Bit Test Instructions C-2 - C.2.6 Load Immediate data Instruction C-3 - C.2.7 6804 Derived Instructions C-3 - - APPENDIX D AS6805 ASSEMBLER D-1 - D.1 6805 REGISTER SET D-1 - D.2 6805 INSTRUCTION SET D-1 - D.2.1 Control Instructions D-2 - D.2.2 Bit Manipulation Instructions D-2 - D.2.3 Branch Instructions D-2 - D.2.4 Read-Modify-Write Instructions D-3 - D.2.5 Register\Memory Instructions D-3 + + + + 2.5.6 T Line 2-7 + 2.5.7 R Line 2-7 + 2.5.8 P Line 2-8 + 2.6 LINKER ERROR MESSAGES 2-8 + 2.7 INTEL HEX OUTPUT FORMAT 2-11 + 2.8 MOTORLA S1-S9 OUTPUT FORMAT 2-12 + + CHAPTER 3 BUILDING ASXXXX AND ASLINK 3-1 + 3.1 BUILDING AN ASSEMBLER 3-1 + 3.2 BUILDING ASLINK 3-2 + + APPENDIX A AS6800 ASSEMBLER A-1 + A.1 6800 REGISTER SET A-1 + A.2 6800 INSTRUCTION SET A-1 + A.2.1 Inherent Instructions A-2 + A.2.2 Branch Instructions A-2 + A.2.3 Single Operand Instructions A-3 + A.2.4 Double Operand Instructions A-4 + A.2.5 Jump and Jump to Subroutine Instructions A-4 + A.2.6 Long Register Instructions A-5 + + APPENDIX B AS6801 ASSEMBLER B-1 + B.1 .hd6303 DIRECTIVE B-1 + B.2 6801 REGISTER SET B-1 + B.3 6801 INSTRUCTION SET B-1 + B.3.1 Inherent Instructions B-2 + B.3.2 Branch Instructions B-2 + B.3.3 Single Operand Instructions B-3 + B.3.4 Double Operand Instructions B-4 + B.3.5 Jump and Jump to Subroutine Instructions B-5 + B.3.6 Long Register Instructions B-5 + B.3.7 6303 Specific Instructions B-5 + + APPENDIX C AS6804 ASSEMBLER C-1 + C.1 6804 REGISTER SET C-1 + C.2 6804 INSTRUCTION SET C-1 + C.2.1 Inherent Instructions C-2 + C.2.2 Branch Instructions C-2 + C.2.3 Single Operand Instructions C-2 + C.2.4 Jump and Jump to Subroutine Instructions C-2 + C.2.5 Bit Test Instructions C-2 + C.2.6 Load Immediate data Instruction C-3 + C.2.7 6804 Derived Instructions C-3 + + APPENDIX D AS6805 ASSEMBLER D-1 + D.1 6805 REGISTER SET D-1 + D.2 6805 INSTRUCTION SET D-1 + D.2.1 Control Instructions D-2 + D.2.2 Bit Manipulation Instructions D-2 + D.2.3 Branch Instructions D-2 + D.2.4 Read-Modify-Write Instructions D-3 + D.2.5 Register\Memory Instructions D-3 Page iii - - - - D.2.6 Jump and Jump to Subroutine Instructions D-4 - - APPENDIX E AS68HC08 ASSEMBLER E-1 - E.1 68HC08 REGISTER SET E-1 - E.2 68HC08 INSTRUCTION SET E-1 - E.2.1 Control Instructions E-2 - E.2.2 Bit Manipulation Instructions E-2 - E.2.3 Branch Instructions E-3 - E.2.4 Complex Branch Instructions E-3 - E.2.5 Read-Modify-Write Instructions E-4 - E.2.6 Register\Memory Instructions E-5 - E.2.7 Double Operand Move Instruction E-5 - E.2.8 16-Bit Index Register Instructions E-5 - E.2.9 Jump and Jump to Subroutine Instructions E-5 - - APPENDIX F AS6809 ASSEMBLER F-1 - F.1 6809 REGISTER SET F-1 - F.2 6809 INSTRUCTION SET F-1 - F.2.1 Inherent Instructions F-3 - F.2.2 Short Branch Instructions F-3 - F.2.3 Long Branch Instructions F-3 - F.2.4 Single Operand Instructions F-4 - F.2.5 Double Operand Instructions F-5 - F.2.6 D-register Instructions F-5 - F.2.7 Index/Stack Register Instructions F-5 - F.2.8 Jump and Jump to Subroutine Instructions F-6 - F.2.9 Register - Register Instructions F-6 - F.2.10 Condition Code Register Instructions F-6 - F.2.11 6800 Compatibility Instructions F-6 - - APPENDIX G AS6811 ASSEMBLER G-1 - G.1 6811 REGISTER SET G-1 - G.2 6811 INSTRUCTION SET G-1 - G.2.1 Inherent Instructions G-2 - G.2.2 Branch Instructions G-2 - G.2.3 Single Operand Instructions G-3 - G.2.4 Double Operand Instructions G-4 - G.2.5 Bit Manupulation Instructions G-4 - G.2.6 Jump and Jump to Subroutine Instructions G-5 - G.2.7 Long Register Instructions G-5 - - APPENDIX H AS6816 ASSEMBLER H-1 - H.1 6816 REGISTER SET H-1 - H.2 6816 INSTRUCTION SET H-1 - H.2.1 Inherent Instructions H-2 - H.2.2 Push/Pull Multiple Register Instructions H-3 - H.2.3 Short Branch Instructions H-3 - H.2.4 Long Branch Instructions H-3 - H.2.5 Bit Manipulation Instructions H-3 - H.2.6 Single Operand Instructions H-4 - H.2.7 Double Operand Instructions H-5 - H.2.8 Index/Stack Register Instructions H-5 + + + + D.2.6 Jump and Jump to Subroutine Instructions D-4 + + APPENDIX E AS68HC08 ASSEMBLER E-1 + E.1 68HC08 REGISTER SET E-1 + E.2 68HC08 INSTRUCTION SET E-1 + E.2.1 Control Instructions E-2 + E.2.2 Bit Manipulation Instructions E-2 + E.2.3 Branch Instructions E-3 + E.2.4 Complex Branch Instructions E-3 + E.2.5 Read-Modify-Write Instructions E-4 + E.2.6 Register\Memory Instructions E-5 + E.2.7 Double Operand Move Instruction E-5 + E.2.8 16-Bit Index Register Instructions E-5 + E.2.9 Jump and Jump to Subroutine Instructions E-5 + + APPENDIX F AS6809 ASSEMBLER F-1 + F.1 6809 REGISTER SET F-1 + F.2 6809 INSTRUCTION SET F-1 + F.2.1 Inherent Instructions F-3 + F.2.2 Short Branch Instructions F-3 + F.2.3 Long Branch Instructions F-3 + F.2.4 Single Operand Instructions F-4 + F.2.5 Double Operand Instructions F-5 + F.2.6 D-register Instructions F-5 + F.2.7 Index/Stack Register Instructions F-5 + F.2.8 Jump and Jump to Subroutine Instructions F-6 + F.2.9 Register - Register Instructions F-6 + F.2.10 Condition Code Register Instructions F-6 + F.2.11 6800 Compatibility Instructions F-6 + + APPENDIX G AS6811 ASSEMBLER G-1 + G.1 6811 REGISTER SET G-1 + G.2 6811 INSTRUCTION SET G-1 + G.2.1 Inherent Instructions G-2 + G.2.2 Branch Instructions G-2 + G.2.3 Single Operand Instructions G-3 + G.2.4 Double Operand Instructions G-4 + G.2.5 Bit Manupulation Instructions G-4 + G.2.6 Jump and Jump to Subroutine Instructions G-5 + G.2.7 Long Register Instructions G-5 + + APPENDIX H AS6816 ASSEMBLER H-1 + H.1 6816 REGISTER SET H-1 + H.2 6816 INSTRUCTION SET H-1 + H.2.1 Inherent Instructions H-2 + H.2.2 Push/Pull Multiple Register Instructions H-3 + H.2.3 Short Branch Instructions H-3 + H.2.4 Long Branch Instructions H-3 + H.2.5 Bit Manipulation Instructions H-3 + H.2.6 Single Operand Instructions H-4 + H.2.7 Double Operand Instructions H-5 + H.2.8 Index/Stack Register Instructions H-5 Page iv - - - - H.2.9 Jump and Jump to Subroutine Instructions H-6 - H.2.10 Condition Code Register Instructions H-6 - H.2.11 Multiply and Accumulate Instructions H-6 - - APPENDIX I ASH8 ASSEMBLER I-1 - I.1 H8/3XX REGISTER SET I-1 - I.2 H8/3XX INSTRUCTION SET I-1 - I.2.1 Inherent Instructions I-2 - I.2.2 Branch Instructions I-2 - I.2.3 Single Operand Instructions I-3 - I.2.4 Double Operand Instructions I-4 - I.2.5 Mov Instructions I-5 - I.2.6 Bit Manipulation Instructions I-6 - I.2.7 Extended Bit Manipulation Instructions I-7 - I.2.8 Condition Code Instructions I-7 - I.2.9 Other Instructions I-8 - I.2.10 Jump and Jump to Subroutine Instructions I-8 - - APPENDIX J AS8085 ASSEMBLER J-1 - J.1 8085 REGISTER SET J-1 - J.2 8085 INSTRUCTION SET J-1 - J.2.1 Inherent Instructions J-2 - J.2.2 Register/Memory/Immediate Instructions J-2 - J.2.3 Call and Return Instructions J-2 - J.2.4 Jump Instructions J-2 - J.2.5 Input/Output/Reset Instructions J-3 - J.2.6 Move Instructions J-3 - J.2.7 Other Instructions J-3 - - APPENDIX K ASZ80 ASSEMBLER K-1 - K.1 .hd64 DIRECTIVE K-1 - K.2 Z80 REGISTER SET AND CONDITIONS K-1 - K.3 Z80 INSTRUCTION SET K-2 - K.3.1 Inherent Instructions K-3 - K.3.2 Implicit Operand Instructions K-3 - K.3.3 Load Instruction K-4 - K.3.4 Call/Return Instructions K-4 - K.3.5 Jump and Jump to Subroutine Instructions K-4 - K.3.6 Bit Manipulation Instructions K-5 - K.3.7 Interrupt Mode and Reset Instructions K-5 - K.3.8 Input and Output Instructions K-5 - K.3.9 Register Pair Instructions K-5 - K.3.10 HD64180 Specific Instructions K-6 - - APPENDIX L AS6500 ASSEMBLER L-1 - L.1 ACKNOWLEDGMENT L-1 - L.2 6500 REGISTER SET L-2 - L.3 6500 INSTRUCTION SET L-2 - L.3.1 Processor Specific Directives L-3 - L.3.2 65xx Core Inherent Instructions L-3 - L.3.3 65xx Core Branch Instructions L-3 - L.3.4 65xx Core Single Operand Instructions L-3 + + + + H.2.9 Jump and Jump to Subroutine Instructions H-6 + H.2.10 Condition Code Register Instructions H-6 + H.2.11 Multiply and Accumulate Instructions H-6 + + APPENDIX I ASH8 ASSEMBLER I-1 + I.1 H8/3XX REGISTER SET I-1 + I.2 H8/3XX INSTRUCTION SET I-1 + I.2.1 Inherent Instructions I-2 + I.2.2 Branch Instructions I-2 + I.2.3 Single Operand Instructions I-3 + I.2.4 Double Operand Instructions I-4 + I.2.5 Mov Instructions I-5 + I.2.6 Bit Manipulation Instructions I-6 + I.2.7 Extended Bit Manipulation Instructions I-7 + I.2.8 Condition Code Instructions I-7 + I.2.9 Other Instructions I-8 + I.2.10 Jump and Jump to Subroutine Instructions I-8 + + APPENDIX J AS8085 ASSEMBLER J-1 + J.1 8085 REGISTER SET J-1 + J.2 8085 INSTRUCTION SET J-1 + J.2.1 Inherent Instructions J-2 + J.2.2 Register/Memory/Immediate Instructions J-2 + J.2.3 Call and Return Instructions J-2 + J.2.4 Jump Instructions J-2 + J.2.5 Input/Output/Reset Instructions J-3 + J.2.6 Move Instructions J-3 + J.2.7 Other Instructions J-3 + + APPENDIX K ASZ80 ASSEMBLER K-1 + K.1 .hd64 DIRECTIVE K-1 + K.2 Z80 REGISTER SET AND CONDITIONS K-1 + K.3 Z80 INSTRUCTION SET K-2 + K.3.1 Inherent Instructions K-3 + K.3.2 Implicit Operand Instructions K-3 + K.3.3 Load Instruction K-4 + K.3.4 Call/Return Instructions K-4 + K.3.5 Jump and Jump to Subroutine Instructions K-4 + K.3.6 Bit Manipulation Instructions K-5 + K.3.7 Interrupt Mode and Reset Instructions K-5 + K.3.8 Input and Output Instructions K-5 + K.3.9 Register Pair Instructions K-5 + K.3.10 HD64180 Specific Instructions K-6 + + APPENDIX L AS6500 ASSEMBLER L-1 + L.1 ACKNOWLEDGMENT L-1 + L.2 6500 REGISTER SET L-2 + L.3 6500 INSTRUCTION SET L-2 + L.3.1 Processor Specific Directives L-3 + L.3.2 65xx Core Inherent Instructions L-3 + L.3.3 65xx Core Branch Instructions L-3 + L.3.4 65xx Core Single Operand Instructions L-3 Page v - - L.3.5 65xx Core Double Operand Instructions L-4 + + L.3.5 65xx Core Double Operand Instructions L-4 L.3.6 65xx Core Jump and Jump to Subroutine - Instructions L-4 + Instructions L-4 L.3.7 65xx Core Miscellaneous X and Y Register - Instructions L-4 - L.3.8 65F11 and 65F12 Specific Instructions L-5 - L.3.9 65C00/21 and 65C29 Specific Instructions L-5 + Instructions L-4 + L.3.8 65F11 and 65F12 Specific Instructions L-5 + L.3.9 65C00/21 and 65C29 Specific Instructions L-5 L.3.10 65C02, 65C102, and 65C112 Specific - Instructions L-6 + Instructions L-6 Page vi - - ASxxxx Cross Assemblers, Version 1.7 - Submitted by: - Alan R. Baldwin, - Physics Dept. - Kent State University - Kent, Ohio 44242 + ASxxxx Cross Assemblers, Version 1.7 + + Submitted by: + Alan R. Baldwin, + Physics Dept. + Kent State University + Kent, Ohio 44242 - Operating System: TSX+, RT-11, PDOS, MS/DOS, Windows 3.x - or other supporting K&R C. + Operating System: TSX+, RT-11, PDOS, MS/DOS, Windows 3.x + or other supporting K&R C. - Source Langauge: C + Source Langauge: C The ASxxxx Cross Assembler and Linker package (V1.7 November 1995) contains cross assemblers for the 6800(6802/6808), 6801(hd6303), 6804, 6805, 68HC08, 6809, 6811, 68HC16, 8085(8080), z80(hd64180), H8/3xx, and 6500 series microproces- sors. Complete source code is provided with the assem- - bler/linker submission. + bler/linker submission. @@ -309,14 +309,14 @@ The ASxxxx Cross Assembler and Linker package is available from Kent State University at shop-pdp.kent.edu by "anonymous" - FTP. + FTP. Page vii - - + + @@ -338,34 +338,34 @@ from the DECUS C distribution has been largely rewritten, only the program structure, and C source file organization remains relatively unchanged. However, I wish to thank the author for - his contribution to this set of assemblers. + his contribution to this set of assemblers. The ASLINK program was written as a companion to the ASxxxx assemblers, its design and implementation was not derived from - any other work. + any other work. The ASxxxx assemblers and the ASLINK relocating linker are placed in the Public Domain. Publication or distribution of these programs for non-commercial use is hereby granted with the stipulation that the copyright notice be included with all - copies. + copies. I would greatly appreciate receiving the details of any changes, additions, or errors pertaining to these programs and will attempt to incorporate any fixes or generally useful - changes in a future update to these programs. + changes in a future update to these programs. - Alan R. Baldwin - Kent State University - Physics Department - Kent, Ohio 44242 + Alan R. Baldwin + Kent State University + Physics Department + Kent, Ohio 44242 - baldwin@shop-pdp.kent.edu - tel: (216) 672 2531 - fax: (216) 672 2959 + baldwin@shop-pdp.kent.edu + tel: (216) 672 2531 + fax: (216) 672 2959 @@ -388,41 +388,41 @@ - 1.1 THE ASXXXX ASSEMBLERS + 1.1 THE ASXXXX ASSEMBLERS The ASxxxx assemblers are a series of microprocessor assem- blers written in the C programming language. Each assembler has - a device specific section which includes: + a device specific section which includes: 1. device description, byte order, and file extension in- - formation + formation 2. a table of the assembler general directives, special device directives, assembler mnemonics and associated - operation codes + operation codes 3. machine specific code for processing the device mnemon- - ics, addressing modes, and special directives + ics, addressing modes, and special directives - The device specific information is detailed in the appendices. + The device specific information is detailed in the appendices. The assemblers have a common device independent section which handles the details of file input/output, symbol table genera- tion, program/data areas, expression analysis, and assembler - directive processing. + directive processing. - The assemblers provide the following features: + The assemblers provide the following features: - 1. Command string control of assembly functions + 1. Command string control of assembly functions - 2. Alphabetized, formatted symbol table listing + 2. Alphabetized, formatted symbol table listing - 3. Relocatable object modules + 3. Relocatable object modules - 4. Global symbols for linking object modules + 4. Global symbols for linking object modules - 5. Conditional assembly directives + 5. Conditional assembly directives @@ -430,29 +430,29 @@ THE ASXXXX ASSEMBLERS - 6. Program sectioning directives + 6. Program sectioning directives ASxxxx assembles one or more source files into a single relo- catable ascii object file. The output of the ASxxxx assemblers consists of an ascii relocatable object file(*.rel), an assembly - listing file(*.lst), and a symbol file(*.sym). + listing file(*.lst), and a symbol file(*.sym). - 1.1.1 Assembly Pass 1 + 1.1.1 Assembly Pass 1 During pass 1, ASxxxx opens all source files and performs a rudimenatry assembly of each source statement. During this pro- cess all symbol tables are built, program sections defined, and - number of bytes for each assembled source line is estimated. + number of bytes for each assembled source line is estimated. At the end of pass 1 all undefined symbols may be made global (external) using the ASxxxx switch -g, otherwise undefined sym- - bols will be flagged as errors during succeeding passes. + bols will be flagged as errors during succeeding passes. - 1.1.2 Assembly Pass 2 + 1.1.2 Assembly Pass 2 During pass 2 the ASxxxx assembler resolves forward refer- @@ -461,21 +461,21 @@ struction may depend upon the addressing mode, whether the in- struction allows multiple forms based upon the relative distance to the addressed location, or other factors. Pass 2 resolves - these cases and determines the address of all symbols. + these cases and determines the address of all symbols. - 1.1.3 Assembly Pass 3 + 1.1.3 Assembly Pass 3 Pass 3 by the assembler generates the listing file, the relo- catable output file, and the symbol tables. Also during pass 3 - the errors will be reported. + the errors will be reported. The relocatable object file is an ascii file containing sym- bol references and definitions, program area definitions, and the relocatable assembled code, the linker ASLINK will use this information to generate an absolute load file (Motorola or Intel - formats). + formats). @@ -484,37 +484,37 @@ SOURCE PROGRAM FORMAT - 1.2 SOURCE PROGRAM FORMAT + 1.2 SOURCE PROGRAM FORMAT - 1.2.1 Statement Format + 1.2.1 Statement Format A source program is composed of assembly-language statements. Each statement must be completed on one line. A line may con- tain a maximum of 128 characters, longer lines are truncated and - lost. + lost. An ASxxxx assembler statement may have as many as four fields. These fields are identified by their order within the statement and/or by separating characters between fields. The - general format of the ASxxxx statement is: + general format of the ASxxxx statement is: - [label:] Operator Operand [;Comment(s)] + [label:] Operator Operand [;Comment(s)] The label and comment fields are optional. The operator and operand fields are interdependent. The operator field may be an assembler directive or an assembly mnemonic. The operand field may be optional or required as defined in the context of the - operator. + operator. ASxxxx interprets and processes source statements one at a time. Each statement causes a particular operation to be per- - formed. + formed. - 1.2.1.1 Label Field - + 1.2.1.1 Label Field - A label is a user-defined symbol which is assigned the value of the current location counter and entered into the user de- @@ -522,7 +522,7 @@ ASxxxx to assign memory addresses to the source program state- ments as they are encountered during the assembly process. Thus a label is a means of symbolically referring to a specific - statement. + statement. When a program section is absolute, the value of the current location counter is absolute; its value references an absolute @@ -532,7 +532,7 @@ parent value of the current location counter to establish its effective absolute address at execution time. (The user can also force the linker to relocate sections defined as absolute. - This may be required under special circumstances.) + This may be required under special circumstances.) If present, a label must be the first field in a source statement and must be terminated by a colon (:). For example, @@ -543,53 +543,53 @@ if the value of the current location counter is absolute - 01F0(H), the statement: + 01F0(H), the statement: - abcd: nop + abcd: nop assigns the value 01F0(H) to the label abcd. If the location counter value were relocatable, the final value of abcd would be 01F0(H)+K, where K represents the relocation bias of the program - section, as calculated by the linker at link time. + section, as calculated by the linker at link time. More than one label may appear within a single label field. Each label so specified is assigned the same address value. For example, if the value of the current location counter is 1FF0(H), the multiple labels in the following statement are each - assigned the value 1FF0(H): + assigned the value 1FF0(H): - abcd: aq: $abc: nop + abcd: aq: $abc: nop Multiple labels may also appear on successive lines. For ex- - ample, the statements + ample, the statements - abcd: - aq: - $abc: nop + abcd: + aq: + $abc: nop likewise cause the same value to be assigned to all three la- - bels. + bels. A double colon (::) defines the label as a global symbol. - For example, the statement + For example, the statement - abcd:: nop + abcd:: nop establishes the label abcd as a global symbol. The distinguish- ing attribute of a global symbol is that it can be referenced from within an object module other than the module in which the symbol is defined. References to this label in other modules are resolved when the modules are linked as a composite execut- - able image. + able image. - The legal characters for defining labels are: + The legal characters for defining labels are: - A through Z - a through z - 0 through 9 - . (Period) - $ (Dollar sign) - _ (underscore) + A through Z + a through z + 0 through 9 + . (Period) + $ (Dollar sign) + _ (underscore) A label may be any length, however, only the first eight (8) characters are significant and, therefore must be unique among @@ -605,53 +605,53 @@ in two or more labels are the same. The m code is caused by the redeclaration of the symbol or its reference by another state- ment. The p code is generated because the symbols location is - changing on each pass through the source file. + changing on each pass through the source file. The label must not start with the characters 0-9, as this designates a local symbol with special attributes described in a - later section. + later section. The label must not start with the sequence $$, as this - represents the temporary radix 16 for constants. + represents the temporary radix 16 for constants. - 1.2.1.2 Operator Field - + 1.2.1.2 Operator Field - The operator field specifies the action to be performed. It may consist of an instruction mnemonic (op code) or an assembler - directive. + directive. When the operator is an instruction mnemonic, a machine in- struction is generated and the assembler evaluates the addresses of the operands which follow. When the operator is a directive ASxxxx performs certain control actions or processing operations - during assembly of the source program. + during assembly of the source program. Leading and trailing spaces or tabs in the operator field have no significance; such characters serve only to separate - the operator field from the preceeding and following fields. + the operator field from the preceeding and following fields. - An operator is terminated by a space, tab or end of line. + An operator is terminated by a space, tab or end of line. - 1.2.1.3 Operand Field - + 1.2.1.3 Operand Field - When the operator is an instruction mnemonic (op code), the operand field contains program variables that are to be - evaluated/manipulated by the operator. + evaluated/manipulated by the operator. Operands may be expressions or symbols, depending on the operator. Multiple expressions used in the operand fields may be separated by a comma. An operand should be preceeded by an operator field; if it is not, the statement will give an error (q or o). All operands following instruction mnemonics are - treated as expressions. + treated as expressions. The operand field is terminated by a semicolon when the field is followed by a comment. For example, in the following - statement: + statement: - label: lda abcd,x ;Comment field + label: lda abcd,x ;Comment field THE ASSEMBLER PAGE 1-6 @@ -664,105 +664,105 @@ the operands abcd and x; and a semicolon terminates the operand field and defines the beginning of the comment field. When no comment field follows, the operand field is terminated by the - end of the source line. + end of the source line. - 1.2.1.4 Comment Field - + 1.2.1.4 Comment Field - The comment field begins with a semicolon and extends through the end of the line. This field is optional and may contain any - 7-bit ascii character except null. + 7-bit ascii character except null. Comments do not affect assembly processing or program execu- - tion. + tion. - 1.3 SYMBOLS AND EXPRESSIONS + 1.3 SYMBOLS AND EXPRESSIONS This section describes the generic components of the ASxxxx assemblers: the character set, the conventions observed in con- structing symbols, and the use of numbers, operators, and ex- - pressions. + pressions. - 1.3.1 Character Set + 1.3.1 Character Set - The following characters are legal in ASxxxx source programs: + The following characters are legal in ASxxxx source programs: 1. The letters A through Z. Both upper- and lower-case letters are acceptable. The assemblers are case sensi- tive, i.e. ABCD and abcd are different symbols. (The assemblers can be made case insensitive by recompiling - with the appropriate switches.) + with the appropriate switches.) - 2. The digits 0 through 9 + 2. The digits 0 through 9 3. The characters . (period), $ (dollar sign), and _ (un- - derscore). + derscore). - 4. The special characters listed in Tables 1 through 6. + 4. The special characters listed in Tables 1 through 6. Tables 1 through 6 describe the various ASxxxx label and field terminators, assignment operators, operand separators, as- - sembly, unary, binary, and radix operators. + sembly, unary, binary, and radix operators. THE ASSEMBLER PAGE 1-7 SYMBOLS AND EXPRESSIONS - Table 1 Label Terminators and Assignment Operators - ---------------------------------------------------------------- + Table 1 Label Terminators and Assignment Operators + ---------------------------------------------------------------- - : Colon Label terminator. + : Colon Label terminator. :: Double colon Label Terminator; defines the - label as a global label. + label as a global label. - = Equal sign Direct assignment operator. + = Equal sign Direct assignment operator. - == Double equal Direct assignment operator; + == Double equal Direct assignment operator; sign defines the symbol as a global - symbol. + symbol. - ---------------------------------------------------------------- + ---------------------------------------------------------------- - Table 2 Field Terminators and Operand Separators - ---------------------------------------------------------------- + Table 2 Field Terminators and Operand Separators + ---------------------------------------------------------------- - Tab Item or field terminator. + Tab Item or field terminator. - Space Item or field terminator. + Space Item or field terminator. - , Comma Operand field separator. + , Comma Operand field separator. - ; Semicolon Comment field indicator. + ; Semicolon Comment field indicator. - ---------------------------------------------------------------- + ---------------------------------------------------------------- - Table 3 Assembler Operators - ---------------------------------------------------------------- + Table 3 Assembler Operators + ---------------------------------------------------------------- - # Number sign Immediate expression indicator. + # Number sign Immediate expression indicator. - . Period Current location counter. + . Period Current location counter. - ( Left parenthesis Expression delimiter. + ( Left parenthesis Expression delimiter. - ) Right parenthesis Expression delimeter. + ) Right parenthesis Expression delimeter. - ---------------------------------------------------------------- + ---------------------------------------------------------------- THE ASSEMBLER PAGE 1-8 @@ -774,36 +774,36 @@ - Table 4 Unary Operators - ---------------------------------------------------------------- + Table 4 Unary Operators + ---------------------------------------------------------------- < Left bracket Right bracket >FEDC Produces the upper byte value of the expression. - (FE) + (FE) - + Plus sign +A Positive value of A + + Plus sign +A Positive value of A - Minus sign -A Produces the negative - (2's complement) of A. + (2's complement) of A. ~ Tilde ~A Produces the 1's comple- - ment of A. + ment of A. ' Single quote 'D Produces the value of - the character D. + the character D. " Double quote "AB Produces the double byte - value for AB. + value for AB. - \ Backslash '\n Unix style characters - \b, \f, \n, \r, \t - or '\001 or octal byte values. + \ Backslash '\n Unix style characters + \b, \f, \n, \r, \t + or '\001 or octal byte values. - ---------------------------------------------------------------- + ---------------------------------------------------------------- @@ -815,42 +815,42 @@ SYMBOLS AND EXPRESSIONS - Table 5 Binary Operators - ---------------------------------------------------------------- + Table 5 Binary Operators + ---------------------------------------------------------------- - << Double 0800 << 4 Produces the 4 bit + << Double 0800 << 4 Produces the 4 bit Left bracket left-shifted value of - 0800. (8000) + 0800. (8000) - >> Double 0800 >> 4 Produces the 4 bit + >> Double 0800 >> 4 Produces the 4 bit Right bracket right-shifted value of - 0800. (0080) + 0800. (0080) + Plus sign A + B Arithmetic Addition - operator. + operator. - Minus sign A - B Arithmetic Subtraction - operator. + operator. * Asterisk A * B Arithmetic Multiplica- tion operator. (signed - 16-bit) + 16-bit) / Slash A / B Arithmetic Division operator. (signed - 16-bit quotient) + 16-bit quotient) - & Ampersand A & B Logical AND operator. + & Ampersand A & B Logical AND operator. - | Bar A | B Logical OR operator. + | Bar A | B Logical OR operator. - % Percent sign A % B Modulus operator. - (16-bit value) + % Percent sign A % B Modulus operator. + (16-bit value) - ^ Up arrow or A ^ B EXCLUSIVE OR operator. - circumflex + ^ Up arrow or A ^ B EXCLUSIVE OR operator. + circumflex - ---------------------------------------------------------------- + ---------------------------------------------------------------- @@ -862,16 +862,16 @@ SYMBOLS AND EXPRESSIONS - Table 6 Temporary Radix Operators - ---------------------------------------------------------------- + Table 6 Temporary Radix Operators + ---------------------------------------------------------------- - $%, 0b, 0B Binary radix operator. + $%, 0b, 0B Binary radix operator. - $&, 0o, 0O, 0q, 0Q Octal radix operator. + $&, 0o, 0O, 0q, 0Q Octal radix operator. - $#, 0d, 0D Decimal radix operator. + $#, 0d, 0D Decimal radix operator. - $$, 0h, 0H, 0x, 0X Hexidecimal radix operator. + $$, 0h, 0H, 0x, 0X Hexidecimal radix operator. Potential ambiguities arising from the use of 0b and 0d @@ -879,9 +879,9 @@ ceding all non-prefixed hexidecimal numbers with 00. Leading 0's are required in any case where the first hexidecimal digit is abcdef as the assembler will treat - the letter sequence as a label. + the letter sequence as a label. - ---------------------------------------------------------------- + ---------------------------------------------------------------- @@ -889,29 +889,29 @@ - 1.3.2 User-Defined Symbols + 1.3.2 User-Defined Symbols User-defined symbols are those symbols that are equated to a specific value through a direct assignment statement or appear as labels. These symbols are added to the User Symbol Table as - they are encountered during assembly. + they are encountered during assembly. - The following rules govern the creation of user-defined symbols: + The following rules govern the creation of user-defined symbols: 1. Symbols can be composed of alphanumeric characters, dollar signs ($), periods (.), and underscores (_) - only. + only. 2. The first character of a symbol must not be a number - (except in the case of local symbols). + (except in the case of local symbols). 3. The first eight characters of a symbol must be unique. A symbol can be written with more than eight legal characters, but the ninth and subsequent characters are - ignored. + ignored. - 4. Spaces and Tabs must not be embedded within a symbol. + 4. Spaces and Tabs must not be embedded within a symbol. @@ -920,31 +920,31 @@ SYMBOLS AND EXPRESSIONS - 1.3.3 Local Symbols + 1.3.3 Local Symbols Local symbols are specially formatted symbols used as labels within a block of coding that has been delimited as a local sym- bol block. Local symbols are of the form n$, where n is a decimal integer from 0 to 255, inclusive. Examples of local - symbols are: + symbols are: - 1$ - 27$ - 138$ - 244$ + 1$ + 27$ + 138$ + 244$ The range of a local symbol block consists of those state- ments between two normally constructed symbolic labels. Note - that a statement of the form: + that a statement of the form: - ALPHA = EXPRESSION + ALPHA = EXPRESSION is a direct assignment statement but does not create a label and - thus does not delimit the range of a local symbol block. + thus does not delimit the range of a local symbol block. Note that the range of a local symbol block may extend across - program areas. + program areas. Local symbols provide a convenient means of generating labels for branch instructions and other such references within local @@ -955,24 +955,24 @@ be referenced from outside their respective local symbol blocks. Thus, local symbols of the same name can appear in other local symbol blocks without conflict. Local symbols require less sym- - bol table space than normal symbols. Their use is recommended. + bol table space than normal symbols. Their use is recommended. The use of the same local symbol within a local symbol block - will generate one or both of the m or p errors. + will generate one or both of the m or p errors. THE ASSEMBLER PAGE 1-12 SYMBOLS AND EXPRESSIONS - Example of local symbols: + Example of local symbols: a: ldx #atable ;get table address lda #0d48 ;table length 1$: clr ,x+ ;clear deca bne 1$ - + b: ldx #btable ;get table address lda #0d48 ;table length 1$: clr ,x+ ;clear @@ -980,23 +980,23 @@ bne 1$ - 1.3.4 Current Location Counter + 1.3.4 Current Location Counter The period (.) is the symbol for the current location coun- ter. When used in the operand field of an instruction, the period represents the address of the first byte of the - instruction: + instruction: AS: ldx #. ;The period (.) refers to ;the address of the ldx ;instruction. When used in the operand field of an ASxxxx directive, it - represents the address of the current byte or word: + represents the address of the current byte or word: QK = 0 - + .word 0xFFFE,.+4,QK ;The operand .+4 in the .word ;directive represents a value ;stored in the second of the @@ -1009,13 +1009,13 @@ second value represented by .+4 will be stored at location 0H0202, its value will be 0H0206 ( = 0H0202 + 4). The third value defined by the symbol QK will be placed at location - 0H0204. + 0H0204. At the beginning of each assembly pass, ASxxxx resets the lo- cation counter. Normally, consecutive memory locations are as- signed to each byte of object code generated. However, the value of the location counter can be changed through a direct - assignment statement of the following form: + assignment statement of the following form: @@ -1023,7 +1023,7 @@ SYMBOLS AND EXPRESSIONS - . = . + expression + . = . + expression The new location counter can only be specified relative to @@ -1031,49 +1031,49 @@ program counter along with the expression on the right side of the assignment operator will generate the (.) error. (Absolute program areas may use the .org directive to specify the absolute - location of the current program counter.) + location of the current program counter.) The following coding illustrates the use of the current location - counter: + counter: .area CODE1 (ABS) ;program area CODE1 ;is ABSOLUTE - + .org 0H100 ;set location to ;0H100 absolute - + num1: ldx #.+0H10 ;The label num1 has ;the value 0H100. ;X is loaded with ;0H100 + 0H10 - + .org 0H130 ;location counter ;set to 0H130 - + num2: ldy #. ;The label num2 has ;the value 0H130. ;Y is loaded with ;value 0H130. - - + + .area CODE2 (REL) ;program area CODE2 ;is RELOCATABLE - + . = . + 0H20 ;Set location counter ;to relocatable 0H20 of ;the program section. - + num3: .word 0 ;The label num3 has ;the value ;of relocatable 0H20. - + . = . + 0H40 ;will reserve 0H40 ;bytes of storage as will .blkb 0H40 ;or .blkw 0H20 The .blkb and .blkw directives are the preferred methods of - allocating space. + allocating space. @@ -1081,7 +1081,7 @@ SYMBOLS AND EXPRESSIONS - 1.3.5 Numbers + 1.3.5 Numbers ASxxxx assumes that all numbers in the source program are to @@ -1089,35 +1089,35 @@ .radix directive may be used to specify the default as octal, decimal, or hexidecimal. Individual numbers can be designated as binary, octal, decimal, or hexidecimal through the temporary - radix prefixes shown in table 6. + radix prefixes shown in table 6. Negative numbers must be preceeded by a minus sign; ASxxxx translates such numbers into two's complement form. Positive - numbers may (but need not) be preceeded by a plus sign. + numbers may (but need not) be preceeded by a plus sign. Numbers are always considered to be absolute values, therefor - they are never relocatable. + they are never relocatable. - 1.3.6 Terms + 1.3.6 Terms A term is a component of an expression and may be one of the - following: + following: - 1. A number. + 1. A number. - 2. A symbol: + 2. A symbol: 1. A period (.) specified in an expression causes the - current location counter to be used. - 2. A User-defined symbol. + current location counter to be used. + 2. A User-defined symbol. 3. An undefined symbol is assigned a value of zero and inserted in the User-Defined symbol table as an un- - defined symbol. + defined symbol. 3. A single quote followed by a single ascii character, or - a double quote followed by two ascii characters. + a double quote followed by two ascii characters. 4. An expression enclosed in parenthesis. Any expression so enclosed is evaluated and reduced to a single term @@ -1125,9 +1125,9 @@ pears is evaluated. Parenthesis, for example, may be used to alter the left-to-right evaluation of expres- sions, (as in A*B+C versus A*(B+C)), or to apply a un- - ary operator to an entire expression (as in -(A+B)). + ary operator to an entire expression (as in -(A+B)). - 5. A unary operator followed by a symbol or number. + 5. A unary operator followed by a symbol or number. @@ -1137,7 +1137,7 @@ SYMBOLS AND EXPRESSIONS - 1.3.7 Expressions + 1.3.7 Expressions Expressions are combinations of terms joined together by @@ -1145,44 +1145,44 @@ evaluation of an expression includes the determination of its attributes. A resultant expression value may be one of three types (as described later in this section): relocatable, ab- - solute, and external. + solute, and external. - Expressions are evaluate with an operand hierarchy as follows: + Expressions are evaluate with an operand hierarchy as follows: * / % multiplication, division, and modulus first. - + + - addition and subtraction second. - + << >> left shift and right shift third. - + ^ exclusive or fourth. - + & logical and fifth. - + | logical or last - + except that unary operators take precedence over binary operators. A missing or illegal operator terminates the expression analysis, causing error codes (o) and/or (q) to be generated - depending upon the context of the expression itself. + depending upon the context of the expression itself. At assembly time the value of an external (global) expression is equal to the value of the absolute part of that expression. For example, the expression external+4, where 'external' is an external symbol, has the value of 4. This expression, however, when evaluated at link time takes on the resolved value of the - symbol 'external', plus 4. + symbol 'external', plus 4. Expressions, when evaluated by ASxxxx, are one of three types: relocatable, absolute, or external. The following dis- - tinctions are important: + tinctions are important: 1. An expression is relocatable if its value is fixed re- lative to the base address of the program area in which @@ -1197,7 +1197,7 @@ similarly, a period (.) in a relocatable program area, representing the value of the current program location - counter, will also have a relocatable value. + counter, will also have a relocatable value. 2. An expression is absolute if its value is fixed. An expression whose terms are numbers and ascii characters @@ -1207,31 +1207,31 @@ area, is an absolute expression. This is because every term in a program area has the same relocation bias. When one term is subtracted from the other the reloca- - tion bias is zero. + tion bias is zero. 3. An expression is external (or global) if it contains a single global reference (plus or minus an absolute ex- pression value) that is not defined within the current program. Thus, an external expression is only par- tially defined following assembly and must be resolved - at link time. + at link time. - 1.4 GENERAL ASSEMBLER DIRECTIVES + 1.4 GENERAL ASSEMBLER DIRECTIVES An ASxxxx directive is placed in the operator field of the source line. Only one directive is allowed per source line. Each directive may have a blank operand field or one or more - operands. Legal operands differ with each directive. + operands. Legal operands differ with each directive. - 1.4.1 .module Directive + 1.4.1 .module Directive - Format: + Format: - .module string + .module string The .module directive causes the string to be included in the assemblers output file as an identifier for this particular ob- @@ -1240,7 +1240,7 @@ The main use of this directive is to allow the linker to report a modules' use of undefined symbols. At link time all undefined symbols are reported and the modules referencing them are - listed. + listed. @@ -1249,52 +1249,52 @@ GENERAL ASSEMBLER DIRECTIVES - 1.4.2 .title Directive + 1.4.2 .title Directive - Format: + Format: - .title string + .title string The .title directive provides a character string to be placed - on the second line of each page during listing. + on the second line of each page during listing. - 1.4.3 .sbttl Directive + 1.4.3 .sbttl Directive - Format: + Format: - .sbttl string + .sbttl string The .sbttl directive provides a character string to be placed - on the third line of each page during listing. + on the third line of each page during listing. - 1.4.4 .page Directive + 1.4.4 .page Directive - Format: + Format: - .page + .page The .page directive causes a page ejection with a new heading to be printed. The new page occurs after the next line of the source program is processed, this allows an immediately follow- ing .sbttl directive to appear on the new page. The .page source line will not appear in the file listing. Paging may be - disabled by invoking the -p directive. + disabled by invoking the -p directive. - 1.4.5 .byte and .db Directives + 1.4.5 .byte and .db Directives - Format: + Format: .byte exp ;Stores the binary value .db exp ;of the expression in the ;next byte. - + .byte exp1,exp2,expn ;Stores the binary values .db exp1,exp2,expn ;of the list of expressions ;in successive bytes. - + where: exp, represent expressions that will be exp1, truncated to 8-bits of data. . Each expression will be calculated @@ -1310,21 +1310,21 @@ expn separated by commas. The .byte or .db directives are used to generate successive - bytes of binary data in the object module. + bytes of binary data in the object module. - 1.4.6 .word and .dw Directives + 1.4.6 .word and .dw Directives - Format: + Format: .word exp ;Stores the binary value .dw exp ;of the expression in ;the next word. - + .word exp1,exp2,expn ;Stores the binary values .dw exp1,exp2,expn ;of the list of expressions ;in successive words. - + where: exp, represent expressions that will occupy two exp1, bytes of data. Each expression will be . calculated as a 16-bit word expression. @@ -1332,28 +1332,28 @@ expn separated by commas. The .word or .dw directives are used to generate successive - words of binary data in the object module. + words of binary data in the object module. - 1.4.7 .blkb, .blkw, and .ds Directives + 1.4.7 .blkb, .blkw, and .ds Directives - Format: + Format: .blkb N ;reserve N bytes of space .blkw N ;reserve N words of space .ds N ;reserve N bytes of space The .blkb and .ds directives reserve byte blocks in the ob- - ject module; the .blkw directive reserves word blocks. + ject module; the .blkw directive reserves word blocks. - 1.4.8 .ascii Directive + 1.4.8 .ascii Directive - Format: + Format: - .ascii /string/ + .ascii /string/ - where: string is a string of printable ascii characters. + where: string is a string of printable ascii characters. / / represent the delimiting characters. These delimiters may be any paired printing @@ -1366,51 +1366,51 @@ delimiting characters do not match, the .ascii - directive will give the (q) error. + directive will give the (q) error. The .ascii directive places one binary byte of data for each - character in the string into the object module. + character in the string into the object module. - 1.4.9 .ascis Directive + 1.4.9 .ascis Directive - Format: + Format: - .ascis /string/ + .ascis /string/ - where: string is a string of printable ascii characters. + where: string is a string of printable ascii characters. / / represent the delimiting characters. These delimiters may be any paired printing characters, as long as the characters are not contained within the string itself. If the delimiting characters do not match, the .ascis - directive will give the (q) error. + directive will give the (q) error. The .ascis directive places one binary byte of data for each character in the string into the object module. The last - character in the string will have the high order bit set. + character in the string will have the high order bit set. - 1.4.10 .asciz Directive + 1.4.10 .asciz Directive - Format: + Format: - .asciz /string/ + .asciz /string/ - where: string is a string of printable ascii characters. + where: string is a string of printable ascii characters. / / represent the delimiting characters. These delimiters may be any paired printing characters, as long as the characters are not contained within the string itself. If the delimiting characters do not match, the .asciz - directive will give the (q) error. + directive will give the (q) error. The .asciz directive places one binary byte of data for each character in the string into the object module. Following all the character data a zero byte is inserted to terminate the - character string. + character string. @@ -1419,48 +1419,48 @@ GENERAL ASSEMBLER DIRECTIVES - 1.4.11 .radix Directive + 1.4.11 .radix Directive - Format: + Format: - .radix character + .radix character where: character represents a single character specifying the default radix to be used for succeeding numbers. - The character may be any one of the following: + The character may be any one of the following: B,b Binary - + O,o Octal Q,q - + D,d Decimal 'blank' - + H,h Hexidecimal X,x - 1.4.12 .even Directive + 1.4.12 .even Directive - Format: + Format: - .even + .even The .even directive ensures that the current location counter contains an even boundary value by adding 1 if the current loca- - tion is odd. + tion is odd. - 1.4.13 .odd Directive + 1.4.13 .odd Directive - Format: + Format: - .odd + .odd The .odd directive ensures that the current location counter contains an odd boundary value by adding one if the current lo- - cation is even. + cation is even. @@ -1469,49 +1469,49 @@ GENERAL ASSEMBLER DIRECTIVES - 1.4.14 .area Directive + 1.4.14 .area Directive - Format: + Format: - .area name [(options)] + .area name [(options)] where: name represents the symbolic name of the program sec- tion. This name may be the same as any user-defined symbol as the area names are in- - dependent of all symbols and labels. + dependent of all symbols and labels. - options specify the type of program or data area: - ABS absolute (automatically invokes OVR) - REL relocatable - OVR overlay - CON concatenate - PAG paged area + options specify the type of program or data area: + ABS absolute (automatically invokes OVR) + REL relocatable + OVR overlay + CON concatenate + PAG paged area The .area directive provides a means of defining and separat- ing multiple programming and data sections. The name is the area label used by the assembler and the linker to collect code from various separately assembled modules into one section. The - name may be from 1 to 8 characters in length. + name may be from 1 to 8 characters in length. The options are specified within parenthesis and separated by - commas as shown in the following example: + commas as shown in the following example: .area TEST (REL,CON) ;This section is relocatable ;and concatenated with other ;sections of this program area. - + .area DATA (REL,OVR) ;This section is relocatable ;and overlays other sections ;of this program area. - + .area SYS (ABS,OVR) ;(CON not allowed with ABS) ;This section is defined as ;absolute. Absolute sections ;are always overlayed with ;other sections of this program ;area. - + .area PAGE (PAG) ;This is a paged section. The ;section must be on a 256 byte ;boundary and its length is @@ -1531,43 +1531,43 @@ same area name. The ABS option indicates an absolute area. The OVR and CON options indicate if program sections of the same name will overlay each other (start at the same location) or be - concatenated with each other (appended to each other). + concatenated with each other (appended to each other). Multiple invocations of the .area directive with the same name must specify the same options or leave the options field blank, this defaults to the previously specified options for - this program area. + this program area. The ASxxxx assemblers automatically provide two program - sections: + sections: '. .ABS.' This dumby section contains all absolute - symbols and their values. + symbols and their values. '_CODE' This is the default program/data area. - This program area is of type (REL,CON). + This program area is of type (REL,CON). The ASxxxx assemblers also automatically generate two symbols - for each program area: + for each program area: 's_' This is the starting address of the pro- - gram area. + gram area. indent -16 'l_' This is the - length of the program area. + length of the program area. - 1.4.15 .org Directive + 1.4.15 .org Directive - Format: + Format: - .org exp + .org exp where: exp is an absolute expression that becomes the cur- - rent location counter. + rent location counter. The .org directive is valid only in an absolute program section and will give a (q) error if used in a relocatable program area. The .org directive specifies that the current location counter - is to become the specified absolute value. + is to become the specified absolute value. @@ -1576,37 +1576,37 @@ GENERAL ASSEMBLER DIRECTIVES - 1.4.16 .globl Directive + 1.4.16 .globl Directive - Format: + Format: - .globl sym1,sym2,...,symn + .globl sym1,sym2,...,symn where: sym1, represent legal symbolic names. When sym2,... When multiple symbols are specified, symn they are separated by commas. A .globl directive may also have a label field and/or a com- - ment field. + ment field. The .globl directive is provided to define (and thus provide linkage to) symbols not otherwise defined as global symbols within a module. In defining global symbols the directive - .globl J is similar to: + .globl J is similar to: - J == expression or J:: + J == expression or J:: Because object modules are linked by global symbols, these symbols are vital to a program. All internal symbols appearing within a given program must be defined at the end of pass 1 or they will be considered undefined. The assembly directive (-g) can be be invoked to make all undefined symbols global at the - end of pass 1. + end of pass 1. - 1.4.17 .if, .else, and .endif Directives + 1.4.17 .if, .else, and .endif Directives - Format: + Format: .if expr . ;} @@ -1620,14 +1620,14 @@ The conditional assembly directives allow you to include or exclude blocks of source code during the assembly process, based - on the evaluation of the condition test. + on the evaluation of the condition test. The range of true condition will be processed if the expres- sion 'expr' is not zero (i.e. true) and the range of false con- dition will be processed if the expression 'expr' is zero (i.e false). The range of true condition is optional as is the .else directive and the range of false condition. The following are - all valid .if/.else/.endif constructions: + all valid .if/.else/.endif constructions: THE ASSEMBLER PAGE 1-24 @@ -1638,12 +1638,12 @@ .if A-4 ;evaluate A-4 .byte 1,2 ;insert bytes if A-4 is .endif ;not zero - + .if K+3 ;evaluate K+3 .else .byte 3,4 ;insert bytes if K+3 .endif ;is zero - + .if J&3 ;evaluate J masked by 3 .byte 12 ;insert this byte if J&3 .else ;is not zero @@ -1651,33 +1651,33 @@ .endif ;is zero - The .if/.else/.endif directives may be nested upto 10 levels. + The .if/.else/.endif directives may be nested upto 10 levels. The .page directive is processed within a false condition range to allow extended textual information to be incorporated in the source program with out the need to use the comment - delimiter (;): + delimiter (;): .if 0 - + .page This text will be bypassed during assembly but appear in the listing file. . . . - + .endif - 1.4.18 .include Directive + 1.4.18 .include Directive - Format: + Format: - .include string + .include string where: string represents a delimited string that is the file - specification of an ASxxxx source file. + specification of an ASxxxx source file. The .include directive is used to insert a source file within the source file currently being assembled. When this directive @@ -1685,7 +1685,7 @@ end of the specified source file is reached, an implicit .page directive is issued and input continues from the previous source file. The maximum nesting level of source files specified by a - .include directive is five. + .include directive is five. THE ASSEMBLER PAGE 1-25 @@ -1694,26 +1694,26 @@ The total number of separately specified .include files is unlimited as each .include file is opened and then closed during - each pass made by the assembler. + each pass made by the assembler. - 1.4.19 .setdp Directive + 1.4.19 .setdp Directive - Format: + Format: - .setdp [base [,area]] + .setdp [base [,area]] The set direct page directive has a common format in all the AS68xx assemblers. The .setdp directive is used to inform the assembler of the current direct page region and the offset ad- dress within the selected area. The normal invocation methods - are: + are: .area DIRECT (PAG) .setdp - + or - + .setdp 0,DIRECT for all the 68xx microprocessors (the 6804 has only the paged @@ -1723,22 +1723,22 @@ at address 0 during linking. When the base address and area are not specified, then zero and the current area are the defaults. If a .setdp directive is not issued the assembler defaults the - direct page to the area "_CODE" at offset 0. + direct page to the area "_CODE" at offset 0. The assembler verifies that any local variable used in a direct variable reference is located in this area. Local vari- able and constant value direct access addresses are checked to - be within the address range from 0 to 255. + be within the address range from 0 to 255. External direct references are assumed by the assembler to be in the correct area and have valid offsets. The linker will check all direct page relocations to verify that they are within - the correct area. + the correct area. The 6809 microprocessor allows the selection of the direct page to be on any 256 byte boundary by loading the appropriate value into the dp register. Typically one would like to select - the page boundary at link time, one method follows: + the page boundary at link time, one method follows: THE ASSEMBLER PAGE 1-26 @@ -1756,7 +1756,7 @@ tfr a,dp ; for access to the direct page At link time specify the base and global equates to locate the - direct page: + direct page: -b DIRECT = 0x1000 -g DIRECT = 0x1000 @@ -1764,10 +1764,10 @@ Both the area address and offset value must be specified (area and variable names are independent). The linker will verify that the relocated direct page accesses are within the direct - page. + page. The preceeding sequence could be repeated for multiple paged areas, however an alternate method is to define a non-paged area - and use the .setdp directive to specify the offset value: + and use the .setdp directive to specify the offset value: .area DIRECT ; define non-paged area . @@ -1788,7 +1788,7 @@ are in the specified area and offset address range. It is the programmers responsibility to load the dp register with the cor- rect page segment corresponding to the .setdp base address - specified. + specified. For those cases where a single piece of code must access a defined data structure within a direct page and there are many @@ -1803,39 +1803,39 @@ addressing, where the dp register is the index register and the - direct addressing is the offset. + direct addressing is the offset. - 1.5 INVOKING ASXXXX + 1.5 INVOKING ASXXXX The ASxxxx assemblers are command line oriented. After the assembler is started, enter the option(s) and file(s) to assem- - ble following the 'argv:' prompt: + ble following the 'argv:' prompt: - argv: [-dqxjgalcposf] file1 [file2 file3 ... file6] + argv: [-dqxjgalcposf] file1 [file2 file3 ... file6] - The options are: + The options are: d decimal listing q octal listing x hex listing (default) - + The listing radix affects the .lst, .rel, and .sym files. - + j add line number and debug information to file g undefined symbols made global a all user symbols made global - + l create list output file1.lst o create object output file1.rel s create symbol output file1.sym - + p disable listing pagination - + relocatable reference flagging: - + f by ` in the listing file ff by mode in the listing file @@ -1849,15 +1849,15 @@ ascii text files which may be edited, copied, etc. The output files are the concatenation of all the input files, if files are to be assembled independently invoke the assembler for each - file. + file. The .rel file contains a radix directive so that the linker will use the proper conversion for this file. Linked files may - have different radices. + have different radices. If the list (l) option is specified without the symbol table (s) option, the symbol table is placed at the end of the listing - file. + file. ASXXXX assembles supported by and distributed with SDCC are: asx8051 (Intel 8051) @@ -1870,100 +1870,100 @@ ERRORS - 1.6 ERRORS + 1.6 ERRORS The ASxxxx assemblers provide limited diagnostic error codes during the assembly process, these errors will be noted in the - listing file and printed on the stderr device. + listing file and printed on the stderr device. - The assembler reports the errors on the stderr device as + The assembler reports the errors on the stderr device as ?ASxxxx-Error-<*> in line nnn of filename where * is the error code, nnn is the line number, and filename - is the source/include file. + is the source/include file. - The errors are: + The errors are: (.) This error is caused by an absolute direct assign- - ment of the current location counter - . = expression (incorrect) - rather than the correct - . = . + expression + ment of the current location counter + . = expression (incorrect) + rather than the correct + . = . + expression (a) Indicates a machine specific addressing or address- - ing mode error. + ing mode error. - (b) Indicates a direct page boundary error. + (b) Indicates a direct page boundary error. - (d) Indicates a direct page addressing error. + (d) Indicates a direct page addressing error. (i) Caused by an .include file error or an .if/.endif - mismatch. + mismatch. (m) Multiple definitions of the same label, multiple .module directives, or multiple conflicting attri- - butes in an .area directive. + butes in an .area directive. (o) Directive or mnemonic error or the use of the .org - directive in a relocatable area. + directive in a relocatable area. (p) Phase error: label location changing between passes 2 and 3. Normally caused by having more than one - level of forward referencing. + level of forward referencing. (q) Questionable syntax: missing or improper operators, - terminators, or delimiters. + terminators, or delimiters. (r) Relocation error: logic operation attempted on a relocatable term, addition of two relocatable terms, subtraction of two relocatable terms not within the - same programming area or external symbols. + same programming area or external symbols. - (u) Undefined symbol encountered during assembly. + (u) Undefined symbol encountered during assembly. THE ASSEMBLER PAGE 1-29 LISTING FILE - 1.7 LISTING FILE + 1.7 LISTING FILE The (-l) option produces an ascii output listing file. Each - page of output contains a four line header: + page of output contains a four line header: - 1. The ASxxxx program name and page number + 1. The ASxxxx program name and page number - 2. Title from a .title directive (if any) + 2. Title from a .title directive (if any) - 3. Subtitle from a .sbttl directive (if any) + 3. Subtitle from a .sbttl directive (if any) - 4. Blank line + 4. Blank line - Each succeeding line contains five fields: + Each succeeding line contains five fields: - 1. Error field (first three characters of line) + 1. Error field (first three characters of line) - 2. Current location counter + 2. Current location counter - 3. Generated code in byte format + 3. Generated code in byte format - 4. Source text line number + 4. Source text line number - 5. Source text + 5. Source text The error field may contain upto 2 error flags indicating any - errors encountered while assembling this line of source code. + errors encountered while assembling this line of source code. The current location counter field displays the 16-bit pro- - gram position. This field will be in the selected radix. + gram position. This field will be in the selected radix. The generated code follows the program location. The listing radix determines the number of bytes that will be displayed in @@ -1971,13 +1971,13 @@ the field, decimal and octal allow four bytes within the field. If more than one field of data is generated from the assembly of a single line of source code, then the data field is repeated on - successive lines. + successive lines. The source text line number is printed in decimal and is fol- - lowed by the source text. + lowed by the source text. Two special cases will disable the listing of a line of - source text: + source text: @@ -1985,10 +1985,10 @@ LISTING FILE - 1. Source line with a .page directive is never listed. + 1. Source line with a .page directive is never listed. 2. Source line with a .include file directive is not - listed unless the .include file cannot be opened. + listed unless the .include file cannot be opened. Two data field options are available to flag those bytes @@ -1996,45 +1996,45 @@ specified then each byte to be relocated will be preceeded by the '`' character. If the -ff option is specified then each byte to be relocated will be preceeded by one of the following - characters: + characters: - 1. * paged relocation + 1. * paged relocation - 2. u low byte of unsigned word or unsigned byte + 2. u low byte of unsigned word or unsigned byte - 3. v high byte of unsigned word + 3. v high byte of unsigned word - 4. p PCR low byte of word relocation or PCR byte + 4. p PCR low byte of word relocation or PCR byte - 5. q PCR high byte of word relocation + 5. q PCR high byte of word relocation - 6. r low byte relocation or byte relocation + 6. r low byte relocation or byte relocation - 7. s high byte relocation + 7. s high byte relocation - 1.8 SYMBOL TABLE FILE + 1.8 SYMBOL TABLE FILE - The symbol table has two parts: + The symbol table has two parts: 1. The alphabetically sorted list of symbols and/or labels - defined or referenced in the source program. + defined or referenced in the source program. 2. A list of the program areas defined during assembly of - the source program. + the source program. The sorted list of symbols and/or labels contains the follow- - ing information: + ing information: 1. Program area number (none if absolute value or exter- - nal) + nal) - 2. The symbol or label + 2. The symbol or label - 3. Directly assigned symbol is denoted with an (=) sign + 3. Directly assigned symbol is denoted with an (=) sign @@ -2044,34 +2044,34 @@ 4. The value of a symbol, location of a label relative to the program area base address (=0), or a **** indicat- - ing the symbol or label is undefined. + ing the symbol or label is undefined. 5. The characters: G - global, R - relocatable, and X - - external. + external. The list of program areas provides the correspondence between the program area numbers and the defined program areas, the size - of the program areas, and the area flags (attributes). + of the program areas, and the area flags (attributes). - 1.9 OBJECT FILE + 1.9 OBJECT FILE The object file is an ascii file containing the information needed by the linker to bind multiple object modules into a com- plete loadable memory image. The object module contains the - following designators: + following designators: [XDQ][HL] X Hexidecimal radix D Decimal radix Q Octal radix - + H Most significant byte first L Least significant byte first - - H Header + + H Header M Module A Area S Symbol @@ -2081,7 +2081,7 @@ Refer to the linker for a detailed description of each of the designators and the format of the information contained in the - object file. + object file. @@ -2104,37 +2104,37 @@ - 2.1 ASLINK RELOCATING LINKER + 2.1 ASLINK RELOCATING LINKER - ASLINK is the companion linker for the ASxxxx assemblers. + ASLINK is the companion linker for the ASxxxx assemblers. The program ASLINK is a general relocating linker performing - the following functions: + the following functions: - 1. Bind multiple object modules into a single memory image + 1. Bind multiple object modules into a single memory image - 2. Resolve inter-module symbol references + 2. Resolve inter-module symbol references 3. Combine code belonging to the same area from multiple - object files into a single contiguous memory region + object files into a single contiguous memory region 4. Search and import object module libraries for undefined - global variables + global variables 5. Perform byte and word program counter relative - (pc or pcr) addressing calculations + (pc or pcr) addressing calculations - 6. Define absolute symbol values at link time + 6. Define absolute symbol values at link time - 7. Define absolute area base address values at link time + 7. Define absolute area base address values at link time - 8. Produce Intel Hex or Motorola S19 output file + 8. Produce Intel Hex or Motorola S19 output file - 9. Produce a map of the linked memory image + 9. Produce a map of the linked memory image 10. Produce an updated listing file with the relocated ad- - dresses and data + dresses and data @@ -2144,58 +2144,59 @@ INVOKING ASLINK - 2.2 INVOKING ASLINK + 2.2 INVOKING ASLINK The linker may run in the command line mode or command file - modes. The allowed startup linker commands are: + modes. The allowed startup linker commands are: - -c/-f command line / command file modes + -c/-f command line / command file modes - -p/-n enable/disable echo file.lnk input to stdout + -p/-n enable/disable echo file.lnk input to stdout If command line mode is selected, all linker commands come from stdin, if the command file mode is selected the commands - are input from the specified file (extension must be .lnk). + are input from the specified file (extension must be .lnk). - The linker is started via + The linker is started via - ASLINK -(cfpn) + ASLINK -(cfpn) - After invoking the linker the valid options are: + After invoking the linker the valid options are: 1. -i/-s Intel Hex (file.ihx) or Motorola S19 (file.s19) - image output file. + image output file. 2. -m Generate a map file (file.map). This file con- tains a list of the symbols (by area) with absolute ad- dresses, sizes of linked areas, and other linking - information. + information. 3. -u Generate an updated listing file (file.rst) derived from the relocated addresses and data from the - linker + linker 4. -xdq Specifies the number radix for the map file - (Hexidecimal, Decimal, or Octal). + (Hexidecimal, Decimal, or Octal). 5. fileN Files to be linked. Files may be on the same line as the above options or on a separate line(s) one file per line or multiple files separated by spaces or - tabs. + tabs. - 6. -b area = expression (one definition per line) + 6. -b area = expression (one definition per line) This specifies an area base address where the expres- sion may contain constants and/or defined symbols from - the linked files. + the linked files. - 7. -g symbol = expression (one definition per line) + 7. -g symbol = expression (one definition per line) This specifies the value for the symbol where the ex- pression may contain constants and/or defined symbols - from the linked files. + from the linked files. - 8. -k library directory path + 8. -k library directory path (one definition per line) This specifies one possible + THE LINKER PAGE 2-3 @@ -2203,17 +2204,70 @@ path to an object library. More than one path is al- - lowed. + lowed. - 9. -l library file specification + 9. -l library file specification (one definition per line) This specifies a possible - library file. More than one file is allowed. + library file. More than one file is allowed. + + 10. -e or null line, terminates input to the linker. + + aslink (msc51) specific options: + + Output: + -j Produce NoICE debug as file[NOI] + -z Produce SDCdb debug as file[cdb] + -u Update listing file(s) with link data as file(s)[.RST] + Miscellaneous: + -a [iram-size] Check for internal RAM overflow + -v [xram-size] Check for external RAM overflow + -w [code-size] Check for code overflow + -y Generate memory usage summary file[mem] + -Y Pack internal ram + -A [stack-size] Allocate space for stack + + + link-z80 (Z80) specific options: + + Map format: + -j no$gmb symbol file generated as file[SYM] + Output: + -z Produce SDCdb debug as file[cdb] + -Z Gameboy image as file[GB] + List: + -u Update listing file(s) with link data as file(s)[.RST] + + + link-gbz80 (GBZ80) specific options: - 10. -e or null line, terminates input to the linker. + Relocation: + -yo Number of rom banks (default: 2) + -ya Number of ram banks (default: 0) + -yt MBC type (default: no MBC) + -yn Name of program (default: name of output file) + -yp# Patch one byte in the output GB file (# is: addr=byte) + Map format: + -j no$gmb symbol file generated as file[SYM] + Output: + -Z Gameboy image as file[GB] + List: + -u Update listing file(s) with link data as file(s)[.RST] + link-hc08 (HC08) specific options: + Output: + -t ELF executable as file[elf] + -j Produce NoICE debug as file[NOI] + -z Produce SDCdb debug as file[cdb] + -u Update listing file(s) with link data as file(s)[.RST] + Miscellaneous: + -a [iram-size] Check for internal RAM overflow + -v [xram-size] Check for external RAM overflow + -w [code-size] Check for code overflow - 2.3 LIBRARY PATH(S) AND FILE(S) + + + 2.3 LIBRARY PATH(S) AND FILE(S) The process of resolving undefined symbols after scanning the @@ -2229,30 +2283,30 @@ finition. The library object modules are rescanned until no more symbols can be resolved. The scanning algorithm allows resolution of back references. No errors are reported for non - existant library files or object modules. + existant library files or object modules. The library file specification may be formed in one of two - ways: + ways: 1. If the library file contained an absolute path/file specification then this is the object module's - path/file. - (i.e. C:\...) + path/file. + (i.e. C:\...) 2. If the library file contains a relative path/file specification then the concatenation of the path and this file specification becomes the object module's - path/file. - (i.e. \...) + path/file. + (i.e. \...) As an example, assume there exists a library file termio.lib - in the syslib directory specifying the following object modules: + in the syslib directory specifying the following object modules: - \6809\io_disk first object module - d:\special\io_comm second object module + \6809\io_disk first object module + d:\special\io_comm second object module - and the following parameters were specified to the linker: + and the following parameters were specified to the linker: @@ -2260,23 +2314,23 @@ LIBRARY PATH(S) AND FILE(S) - -k c:\iosystem\ the first path - -k c:\syslib\ the second path + -k c:\iosystem\ the first path + -k c:\syslib\ the second path - -l termio the first library file - -l io the second library file (no such file) + -l termio the first library file + -l io the second library file (no such file) The linker will attempt to use the following object modules to - resolve any undefined symbols: + resolve any undefined symbols: - c:\syslib\6809\io_disk.rel (concatenated path/file) - d:\special\io_comm.rel (absolute path/file) + c:\syslib\6809\io_disk.rel (concatenated path/file) + d:\special\io_comm.rel (absolute path/file) all other path(s)/file(s) don't exist. (No errors are reported - for non existant path(s)/file(s).) + for non existant path(s)/file(s).) - 2.4 ASLINK PROCESSING + 2.4 ASLINK PROCESSING The linker processes the files in the order they are @@ -2286,7 +2340,7 @@ of any specified library file(s) and the importing of the module containing the symbol definition. After the first pass the -b (area base address) definitions, if any, are processed and the - areas linked. + areas linked. The area linking proceeds by first examining the area types ABS, CON, REL, OVR and PAG. Absolute areas (ABS) from separate @@ -2302,12 +2356,12 @@ completion of the area linking all area addresses and lengths have been determined. The areas of type PAG are verified to be on a 256 byte boundary and that the length does not exceed 256 - bytes. Any errors are noted on stderr and in the map file. + bytes. Any errors are noted on stderr and in the map file. Next the global symbol definitions (-g option), if any, are processed. The symbol definitions have been delayed until this point because the absolute addresses of all internal symbols are - known and can be used in the expression calculations. + known and can be used in the expression calculations. Before continuing with the linking process the symbol table is scanned to determine if any symbols have been referenced but @@ -2320,27 +2374,27 @@ if a .module directive was included in the assembled file the module making the reference to this undefined variable will be - printed. + printed. Constants defined as global in more than one module will be flagged as multiple definitions if their values are not identi- - cal. + cal. After the preceeding processes are complete the linker may output a map file (-m option). This file provides the following - information: + information: - 1. Global symbol values and label absolute addresses + 1. Global symbol values and label absolute addresses - 2. Defined areas and there lengths + 2. Defined areas and there lengths - 3. Remaining undefined symbols + 3. Remaining undefined symbols - 4. List of modules linked + 4. List of modules linked - 5. List of library modules linked + 5. List of library modules linked - 6. List of -b and -g definitions + 6. List of -b and -g definitions @@ -2355,17 +2409,17 @@ the listing files (file.lst) associated with the relocation files (file.rel) are scanned and used to create a new file (file.rst) which has all addresses and data relocated to their - final values. + final values. - 2.5 LINKER INPUT FORMAT + 2.5 LINKER INPUT FORMAT The linkers' input object file is an ascii file containing the information needed by the linker to bind multiple object - modules into a complete loadable memory image. + modules into a complete loadable memory image. - The object module contains the following designators: + The object module contains the following designators: [XDQ][HL] X Hexidecimal radix @@ -2377,11 +2431,11 @@ Q Octal radix - + H Most significant byte first L Least significant byte first - - H Header + + H Header M Module A Area S Symbol @@ -2390,39 +2444,39 @@ P Paging information - 2.5.1 Object Module Format + 2.5.1 Object Module Format The first line of an object module contains the [XDQ][HL] format specifier (i.e. XH indicates a hexidecimal file with - most significant byte first) for the following designators. + most significant byte first) for the following designators. - 2.5.2 Header Line + 2.5.2 Header Line - H aa areas gg global symbols + H aa areas gg global symbols The header line specifies the number of areas(aa) and the number of global symbols(gg) defined or referenced in this ob- - ject module segment. + ject module segment. - 2.5.3 Module Line + 2.5.3 Module Line - M name + M name The module line specifies the module name from which this header segment was assembled. The module line will not appear - if the .module directive was not used in the source program. + if the .module directive was not used in the source program. - 2.5.4 Symbol Line + 2.5.4 Symbol Line - S string Defnnnn + S string Defnnnn - or + or - S string Refnnnn + S string Refnnnn The symbol line defines (Def) or references (Ref) the symbol 'string' with the value nnnn. The defined value is relative to @@ -2435,54 +2489,54 @@ definition. References to external symbols will have a value of - zero. + zero. - 2.5.5 Area Line + 2.5.5 Area Line - A label size ss flags ff + A label size ss flags ff The area line defines the area label, the size (ss) of the area in bytes, and the area flags (ff). The area flags specify - the ABS, REL, CON, OVR, and PAG parameters: + the ABS, REL, CON, OVR, and PAG parameters: - OVR/CON (0x04/0x00 i.e. bit position 2) + OVR/CON (0x04/0x00 i.e. bit position 2) - ABS/REL (0x08/0x00 i.e. bit position 3) + ABS/REL (0x08/0x00 i.e. bit position 3) - PAG (0x10 i.e. bit position 4) + PAG (0x10 i.e. bit position 4) - 2.5.6 T Line + 2.5.6 T Line - T xx xx nn nn nn nn nn ... + T xx xx nn nn nn nn nn ... 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. + byte format. - 2.5.7 R Line + 2.5.7 R Line - R 0 0 nn nn n1 n2 xx xx ... + 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: + 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 + 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 + 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 8. bit 7 LSB byte(0x00)/MSB byte(0x80) with 2-byte - mode + mode 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 @@ -2494,54 +2548,54 @@ updated by the relocation). The T line data may be 1-byte or 2-byte byte data format or 2-byte word - format. + 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. + in the header area/symbol lists. The groups of 4 bytes are repeated for each item requiring relo- - cation in the preceeding T line. + cation in the preceeding T line. - 2.5.8 P Line + 2.5.8 P Line - P 0 0 nn nn n1 n2 xx xx + 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 + 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. + area defined with the PAG type is not larger than 256 bytes. The linker defaults any direct page references to the first area defined in the input REL file. All ASxxxx assemblers will - specify the _CODE area first, making this the default page area. + specify the _CODE area first, making this the default page area. - 2.6 LINKER ERROR MESSAGES + 2.6 LINKER ERROR MESSAGES The linker provides detailed error messages allowing the pro- grammer to quickly find the errant code. As the linker com- pletes pass 1 over the input file(s) it reports any page - boundary or page length errors as follows: + boundary or page length errors as follows: ?ASlink-Warning-Paged Area PAGE0 Boundary Error - + and/or - + ?ASlink-Warning-Paged Area PAGE0 Length Error - where PAGE0 is the paged area. + where PAGE0 is the paged area. @@ -2551,8 +2605,8 @@ During Pass two the linker reads the T, R, and P lines per- forming the necessary relocations and outputting the absolute - code. Various errors may be reported during this process - The P line processing can produce only one possible error: + code. Various errors may be reported during this process + The P line processing can produce only one possible error: ?ASlink-Warning-Page Definition Boundary Error file module pgarea pgoffset @@ -2560,10 +2614,10 @@ The error message specifies the file and module where the .setdp direct was issued and indicates the page area and the page - offset value determined after relocation. + offset value determined after relocation. - The R line processing produces various errors: + The R line processing produces various errors: ?ASlink-Warning-Byte PCR relocation error for symbol bra2 file module area offset @@ -2595,12 +2649,12 @@ (Defin) the symbol. If the symbol is defined in the same module as the reference the linker is unable to report the symbol name. The assembler listing file(s) should be examined at the offset - from the specified area to located the offending code. + from the specified area to located the offending code. - The errors are: + The errors are: 1. The byte PCR error is caused by exceeding the pc rela- - tive byte branch range. + tive byte branch range. THE LINKER PAGE 2-10 @@ -2608,13 +2662,13 @@ 2. The Unsigned byte error indicates an indexing value was - negative or larger than 255. + negative or larger than 255. 3. The Page0 error is generated if the direct page vari- - able is not in the page0 range of 0 to 255. + able is not in the page0 range of 0 to 255. 4. The page mode error is generated if the direct variable - is not within the current direct page (6809). + is not within the current direct page (6809). @@ -2622,11 +2676,11 @@ INTEL HEX OUTPUT FORMAT - 2.7 INTEL HEX OUTPUT FORMAT + 2.7 INTEL HEX OUTPUT 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 @@ -2635,35 +2689,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 @@ -2671,55 +2725,55 @@ and the data field. This sum is then negated (2's complement) and converted to two ascii characters, high digit - first. + first. THE LINKER Page 2-12 MOTOROLA S1-S9 OUTPUT FORMAT - 2.8 MOTORLA S1-S9 OUTPUT FORMAT + 2.8 MOTORLA S1-S9 OUTPUT 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. @@ -2744,38 +2798,38 @@ The assemblers and linker have been successfully compiled us- ing the DECUS C (PDP-11) compiler (patch level 9) with RT-11/TSX+, Eyring Research Institute, Inc. PDOS (680x0) C - V5.4b compiler, and Symantec C/C++ V6.1/V7.0. + V5.4b compiler, and Symantec C/C++ V6.1/V7.0. The device specific header file (i.e. m6800.h, m6801.h, etc.) contains the DECUS C 'BUILD' directives for generating a command file to compile, assemble, and link the necessary files - to prepare an executable image for a particular assembler. + to prepare an executable image for a particular assembler. - 3.1 BUILDING AN ASSEMBLER + 3.1 BUILDING AN ASSEMBLER The building of a typical assembler (6809 for example) re- - quires the following files: - - 1. M6809.H - 2. M09EXT.C - 3. M09MCH.C - 4. M09ADR.C - 5. M09PST.C - 6. ASM.H - 7. ASMAIN.C - 8. ASLEX.C - 9. ASSYM.C - 10. ASSUBR.C - 11. ASEXPR.C - 12. ASDATA.C - 13. ASLIST.C - 14. ASOUT.C + quires the following files: + + 1. M6809.H + 2. M09EXT.C + 3. M09MCH.C + 4. M09ADR.C + 5. M09PST.C + 6. ASM.H + 7. ASMAIN.C + 8. ASLEX.C + 9. ASSYM.C + 10. ASSUBR.C + 11. ASEXPR.C + 12. ASDATA.C + 13. ASLIST.C + 14. ASOUT.C The first five files are the 6809 processor dependent sec- - tions which contain the following: + tions which contain the following: @@ -2786,27 +2840,27 @@ 1. m6809.h - header file containing the machine specific definitions of constants, variables, structures, and - types + types 2. m09ext - device description, byte order, and file ex- - tension information + tension information 3. m09pst - a table of the assembler general directives, special device directives, and assembler mnemonics with - associated operation codes + associated operation codes 4. m09mch / m09adr - machine specific code for processing the device mnemonics, addressing modes, and special - directives + directives The remaining nine files provide the device independent sec- tions which handle the details of file input/output, symbol table generation, program/data areas, expression analysis, and - assembler directive processing. + assembler directive processing. The assembler defaults to the not case sensitive mode. This - may be altered by changing the case sensitivity flag in asm.h to + may be altered by changing the case sensitivity flag in asm.h to /* * Case Sensitivity Flag @@ -2814,27 +2868,27 @@ #define CASE_SENSITIVE 1 The assemblers and linker should be compiled with the same - case sensitivity option. + case sensitivity option. - 3.2 BUILDING ASLINK + 3.2 BUILDING ASLINK - The building of the linker requires the following files: + The building of the linker requires the following files: - 1. ASLINK.H - 2. LKMAIN.C - 3. LKLEX.C - 4. LKAREA.C - 5. LKHEAD.C - 6. LKSYM.C - 7. LKEVAL.C - 8. LKDATA.C - 9. LKLIST.C - 10. LKRLOC.C - 11. LKLIBR.C - 12. LKS19.C - 13. LKIHX.C + 1. ASLINK.H + 2. LKMAIN.C + 3. LKLEX.C + 4. LKAREA.C + 5. LKHEAD.C + 6. LKSYM.C + 7. LKEVAL.C + 8. LKDATA.C + 9. LKLIST.C + 10. LKRLOC.C + 11. LKLIBR.C + 12. LKS19.C + 13. LKIHX.C @@ -2843,7 +2897,7 @@ The linker defaults to the not case sensitive mode. This may - be altered by changing the case sensitivity flag in aslink.h to + be altered by changing the case sensitivity flag in aslink.h to /* * Case Sensitivity Flag @@ -2851,7 +2905,7 @@ #define CASE_SENSITIVE 1 The linker and assemblers should be compiled with the same - case sensitivity option. + case sensitivity option. @@ -2874,41 +2928,41 @@ - A.1 6800 REGISTER SET + A.1 6800 REGISTER SET - The following is a list of the 6800 registers used by AS6800: + The following is a list of the 6800 registers used by AS6800: a,b - 8-bit accumulators x - index register - A.2 6800 INSTRUCTION SET + A.2 6800 INSTRUCTION SET The following tables list all 6800/6802/6808 mnemonics recog- nized by the AS6800 assembler. The designation [] refers to a required addressing mode argument. The following list specifies - the format for each addressing mode supported by AS6800: + the format for each addressing mode supported by AS6800: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + ,x register indirect addressing zero offset - + offset,x register indirect addressing 0 <= offset <= 255 - + ext extended addressing - + label branch label The terms data, dir, offset, ext, and label may all be expres- - sions. + sions. @@ -2917,10 +2971,10 @@ Note that not all addressing modes are valid with every in- - struction, refer to the 6800 technical data for valid modes. + struction, refer to the 6800 technical data for valid modes. - A.2.1 Inherent Instructions + A.2.1 Inherent Instructions aba cba clc cli @@ -2935,14 +2989,14 @@ tba tpa tsx txs wai - + psha pshb psh a psh b pula pulb pul a pul b - A.2.2 Branch Instructions + A.2.2 Branch Instructions bra label bhi label bls label bcc label @@ -2959,52 +3013,52 @@ 6800 INSTRUCTION SET - A.2.3 Single Operand Instructions + A.2.3 Single Operand Instructions asla aslb asl a asl b asl [] - + asra asrb asr a asr b asr [] - + clra clrb clr a clr b clr [] - + coma comb com a com b com [] - + deca decb dec a dec b dec [] - + inca incb inc a inc b inc [] - + lsla lslb lsl a lsl b lsl [] - + lsra lsrb lsr a lsr b lsr [] - + nega negb neg a neg b neg [] - + rola rolb rol a rol b rol [] - + rora rorb ror a ror b ror [] - + tsta tstb tst a tst b tst [] @@ -3014,43 +3068,43 @@ 6800 INSTRUCTION SET - A.2.4 Double Operand Instructions + A.2.4 Double Operand Instructions adca [] adcb [] adc a [] adc b [] - + adda [] addb [] add a [] add b [] - + anda [] andb [] and a [] and b [] - + bita [] bitb [] bit a [] bit b [] - + cmpa [] cmpb [] cmp a [] cmp b [] - + eora [] eorb [] eor a [] eor b [] - + ldaa [] ldab [] lda a [] lda b [] - + oraa [] orab [] ora a [] ora b [] - + sbca [] sbcb [] sbc a [] sbc b [] - + staa [] stab [] sta a [] sta b [] - + suba [] subb [] sub a [] sub b [] - A.2.5 Jump and Jump to Subroutine Instructions + A.2.5 Jump and Jump to Subroutine Instructions jmp [] jsr [] @@ -3061,7 +3115,7 @@ 6800 INSTRUCTION SET - A.2.6 Long Register Instructions + A.2.6 Long Register Instructions cpx [] lds [] sts [] @@ -3088,42 +3142,42 @@ - B.1 .hd6303 DIRECTIVE + B.1 .hd6303 DIRECTIVE - Format: + Format: - .hd6303 + .hd6303 The .hd6303 directive enables processing of the HD6303 specific mnemonics not included in the 6801 instruction set. HD6303 mnemonics encountered without the .hd6303 directive will be - flagged with an 'o' error. + flagged with an 'o' error. - B.2 6801 REGISTER SET + B.2 6801 REGISTER SET - The following is a list of the 6801 registers used by AS6801: + The following is a list of the 6801 registers used by AS6801: a,b - 8-bit accumulators d - 16-bit accumulator x - index register - B.3 6801 INSTRUCTION SET + B.3 6801 INSTRUCTION SET The following tables list all 6801/6303 mnemonics recognized by the AS6801 assembler. The designation [] refers to a re- quired addressing mode argument. The following list specifies - the format for each addressing mode supported by AS6801: + the format for each addressing mode supported by AS6801: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + AS6801 ASSEMBLER PAGE B-2 @@ -3132,23 +3186,23 @@ ,x register indirect addressing zero offset - + offset,x register indirect addressing 0 <= offset <= 255 - + ext extended addressing - + label branch label The terms data, dir, offset, ext, and label may all be expres- - sions. + sions. Note that not all addressing modes are valid with every in- struction, refer to the 6801/6303 technical data for valid - modes. + modes. - B.3.1 Inherent Instructions + B.3.1 Inherent Instructions aba abx cba clc @@ -3166,7 +3220,7 @@ wai - B.3.2 Branch Instructions + B.3.2 Branch Instructions bra label brn label bhi label bls label @@ -3184,58 +3238,58 @@ 6801 INSTRUCTION SET - B.3.3 Single Operand Instructions + B.3.3 Single Operand Instructions asla aslb asld asl a asl b asl d asl [] - + asra asrb asr a asr b asr [] - + clra clrb clr a clr b clr [] - + coma comb com a com b com [] - + deca decb dec a dec b dec [] - + eora eorb eor a eor b eor [] - + inca incb inc a inc b inc [] - + lsla lslb lsld lsl a lsl b lsl d lsl [] - + lsra lsrb lsrd lsr a lsr b lsr d lsr [] - + nega negb neg a neg b neg [] - + psha pshb pshx psh a psh b psh x - + pula pulb pulx pul a pul b pul x - + rola rolb rol a rol b rol [] - + AS6801 ASSEMBLER PAGE B-4 @@ -3245,41 +3299,41 @@ rora rorb ror a ror b ror [] - + tsta tstb tst a tst b tst [] - B.3.4 Double Operand Instructions + B.3.4 Double Operand Instructions adca [] adcb [] adc a [] adc b [] - + adda [] addb [] addd [] add a [] add b [] add d [] - + anda [] andb [] and a [] and b [] - + bita [] bitb [] bit a [] bit b [] - + cmpa [] cmpb [] cmp a [] cmp b [] - + ldaa [] ldab [] lda a [] lda b [] - + oraa [] orab [] ora a [] ora b [] - + sbca [] sbcb [] sbc a [] sbc b [] - + staa [] stab [] sta a [] sta b [] - + suba [] subb [] subd [] sub a [] sub b [] sub d [] @@ -3290,12 +3344,12 @@ 6801 INSTRUCTION SET - B.3.5 Jump and Jump to Subroutine Instructions + B.3.5 Jump and Jump to Subroutine Instructions jmp [] jsr [] - B.3.6 Long Register Instructions + B.3.6 Long Register Instructions cpx [] ldd [] lds [] ldx [] @@ -3303,11 +3357,11 @@ stx [] - B.3.7 6303 Specific Instructions + B.3.7 6303 Specific Instructions aim #data, [] eim #data, [] oim #data, [] tim #data, [] - + xgdx slp @@ -3330,49 +3384,49 @@ - Requires the .setdp directive to specify the ram area. + Requires the .setdp directive to specify the ram area. - C.1 6804 REGISTER SET + C.1 6804 REGISTER SET - The following is a list of the 6804 registers used by AS6804: + The following is a list of the 6804 registers used by AS6804: x,y - index registers - C.2 6804 INSTRUCTION SET + C.2 6804 INSTRUCTION SET The following tables list all 6804 mnemonics recognized by the AS6804 assembler. The designation [] refers to a required addressing mode argument. The following list specifies the - format for each addressing mode supported by AS6804: + format for each addressing mode supported by AS6804: #data immediate data byte or word data - + ,x register indirect addressing - + dir direct addressing (see .setdp directive) 0 <= dir <= 255 - + ext extended addressing - + label branch label The terms data, dir, and ext may be expressions. The label for - the short branchs beq, bne, bcc, and bcs must not be external. + the short branchs beq, bne, bcc, and bcs must not be external. Note that not all addressing modes are valid with every in- - struction, refer to the 6804 technical data for valid modes. + struction, refer to the 6804 technical data for valid modes. AS6804 ASSEMBLER PAGE C-2 6804 INSTRUCTION SET - C.2.1 Inherent Instructions + C.2.1 Inherent Instructions coma decx decy incx @@ -3383,13 +3437,13 @@ tya wait - C.2.2 Branch Instructions + C.2.2 Branch Instructions bne label beq label bcc label bcs label - C.2.3 Single Operand Instructions + C.2.3 Single Operand Instructions add [] and [] @@ -3401,17 +3455,17 @@ sub [] - C.2.4 Jump and Jump to Subroutine Instructions + C.2.4 Jump and Jump to Subroutine Instructions jsr [] jmp [] - C.2.5 Bit Test Instructions + C.2.5 Bit Test Instructions brclr #data,[],label brset #data,[],label - + bclr #label,[] bset #label,[] @@ -3422,12 +3476,12 @@ 6804 INSTRUCTION SET - C.2.6 Load Immediate data Instruction + C.2.6 Load Immediate data Instruction mvi [],#data - C.2.7 6804 Derived Instructions + C.2.7 6804 Derived Instructions asla bam label @@ -3474,40 +3528,40 @@ - D.1 6805 REGISTER SET + D.1 6805 REGISTER SET - The following is a list of the 6805 registers used by AS6805: + The following is a list of the 6805 registers used by AS6805: a - 8-bit accumulator x - index register - D.2 6805 INSTRUCTION SET + D.2 6805 INSTRUCTION SET The following tables list all 6805 mnemonics recognized by the AS6805 assembler. The designation [] refers to a required addressing mode argument. The following list specifies the - format for each addressing mode supported by AS6805: + format for each addressing mode supported by AS6805: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + ,x register indirect addressing zero offset - + offset,x register indirect addressing 0 <= offset <= 255 --- byte mode 256 <= offset <= 65535 --- word mode (an externally defined offset uses the word mode) - + ext extended addressing - + label branch label @@ -3516,13 +3570,13 @@ 6805 INSTRUCTION SET - The terms data, dir, offset, and ext may all be expressions. + The terms data, dir, offset, and ext may all be expressions. Note that not all addressing modes are valid with every in- - struction, refer to the 6805 technical data for valid modes. + struction, refer to the 6805 technical data for valid modes. - D.2.1 Control Instructions + D.2.1 Control Instructions clc cli nop rsp @@ -3533,16 +3587,16 @@ wait - D.2.2 Bit Manipulation Instructions + D.2.2 Bit Manipulation Instructions brset #data,*dir,label brclr #data,*dir,label - + bset #data,*dir bclr #data,*dir - D.2.3 Branch Instructions + D.2.3 Branch Instructions bra label brn label bhi label bls label @@ -3559,43 +3613,43 @@ 6805 INSTRUCTION SET - D.2.4 Read-Modify-Write Instructions + D.2.4 Read-Modify-Write Instructions nega negx neg [] - + coma comx com [] - + lsra lsrx lsr [] - + rora rorx ror [] - + asra asrx asr [] - + lsla lslx lsl [] - + rola rolx rol [] - + deca decx dec [] - + inca incx inc [] - + tsta tstx tst [] - + clra clrx clr [] - D.2.5 Register\Memory Instructions + D.2.5 Register\Memory Instructions sub [] cmp [] sbc [] cpx [] @@ -3610,7 +3664,7 @@ 6805 INSTRUCTION SET - D.2.6 Jump and Jump to Subroutine Instructions + D.2.6 Jump and Jump to Subroutine Instructions jmp [] jsr [] @@ -3635,40 +3689,40 @@ - E.1 68HC08 REGISTER SET + E.1 68HC08 REGISTER SET The following is a list of the 68HC08 registers used by - AS68HC08: + AS68HC08: a - 8-bit accumulator x - index register s - stack pointer - E.2 68HC08 INSTRUCTION SET + E.2 68HC08 INSTRUCTION SET The following tables list all 68HC08 mnemonics recognized by the AS68HC08 assembler. The designation [] refers to a required addressing mode argument. The following list specifies the - format for each addressing mode supported by AS68HC08: + format for each addressing mode supported by AS68HC08: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + ,x register indexed addressing zero offset - + offset,x register indexed addressing 0 <= offset <= 255 --- byte mode 256 <= offset <= 65535 --- word mode (an externally defined offset uses the word mode) - + ,x+ register indexed addressing zero offset with post increment @@ -3677,27 +3731,27 @@ 68HC08 INSTRUCTION SET - + offset,x+ register indexed addressing unsigned byte offset with post increment - + offset,s stack pointer indexed addressing 0 <= offset <= 255 --- byte mode 256 <= offset <= 65535 --- word mode (an externally defined offset uses the word mode) - + ext extended addressing - + label branch label - The terms data, dir, offset, and ext may all be expressions. + The terms data, dir, offset, and ext may all be expressions. Note that not all addressing modes are valid with every in- - struction, refer to the 68HC08 technical data for valid modes. + struction, refer to the 68HC08 technical data for valid modes. - E.2.1 Control Instructions + E.2.1 Control Instructions clc cli daa div mul nop nsa psha @@ -3708,11 +3762,11 @@ txa txs wait - E.2.2 Bit Manipulation Instructions + E.2.2 Bit Manipulation Instructions brset #data,*dir,label brclr #data,*dir,label - + bset #data,*dir bclr #data,*dir @@ -3721,7 +3775,7 @@ 68HC08 INSTRUCTION SET - E.2.3 Branch Instructions + E.2.3 Branch Instructions bra label brn label bhi label bls label @@ -3736,7 +3790,7 @@ ble label - E.2.4 Complex Branch Instructions + E.2.4 Complex Branch Instructions cbeqa [],label cbeqx [],label @@ -3750,46 +3804,46 @@ 68HC08 INSTRUCTION SET - E.2.5 Read-Modify-Write Instructions + E.2.5 Read-Modify-Write Instructions nega negx neg [] - + coma comx com [] - + lsra lsrx lsr [] - + rora rorx ror [] - + asra asrx asr [] - + asla aslx asl [] - + lsla lslx lsl [] - + rola rolx rol [] - + deca decx dec [] - + inca incx inc [] - + tsta tstx tst [] - + clra clrx clr [] clrh - + aix #data - + ais #data @@ -3797,7 +3851,7 @@ 68HC08 INSTRUCTION SET - E.2.6 Register\Memory Instructions + E.2.6 Register\Memory Instructions sub [] cmp [] sbc [] cpx [] @@ -3808,19 +3862,19 @@ ldx [] stx [] - E.2.7 Double Operand Move Instruction + E.2.7 Double Operand Move Instruction mov [],[] - E.2.8 16-Bit Index Register Instructions + E.2.8 16-Bit Index Register Instructions cphx [] ldhx [] sthx [] - E.2.9 Jump and Jump to Subroutine Instructions + E.2.9 Jump and Jump to Subroutine Instructions jmp [] jsr [] @@ -3845,9 +3899,9 @@ - F.1 6809 REGISTER SET + F.1 6809 REGISTER SET - The following is a list of the 6809 registers used by AS6809: + The following is a list of the 6809 registers used by AS6809: a,b - 8-bit accumulators d - 16-bit accumulator @@ -3858,29 +3912,29 @@ dp - direct page - F.2 6809 INSTRUCTION SET + F.2 6809 INSTRUCTION SET The following tables list all 6809 mnemonics recognized by the AS6809 assembler. The designation [] refers to a required addressing mode argument. The following list specifies the - format for each addressing mode supported by AS6809: + format for each addressing mode supported by AS6809: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + label branch label - + r,r1,r2 registers cc,a,b,d,dp,x,y,s,u,pc - + ,-x ,--x register indexed autodecrement - + AS6809 ASSEMBLER PAGE F-2 @@ -3889,10 +3943,10 @@ ,x+ ,x++ register indexed autoincrement - + ,x register indexed addressing zero offset - + offset,x register indexed addressing -16 <= offset <= 15 --- 5-bit -128 <= offset <= -17 --- 8-bit @@ -3901,43 +3955,43 @@ 128 <= offset <= 32767 --- 16-bit (external definition of offset uses 16-bit mode) - + a,x accumulator offset indexed addressing - + ext extended addressing - + ext,pc pc addressing ( pc <- pc + ext ) - + ext,pcr pc relative addressing - + [,--x] register indexed indirect autodecrement - + [,x++] register indexed indirect autoincrement - + [,x] register indexed indirect addressing zero offset - + [offset,x] register indexed indirect addressing -128 <= offset <= 127 --- 8-bit -32768 <= offset <= -129 --- 16-bit 128 <= offset <= 32767 --- 16-bit (external definition of offset uses 16-bit mode) - + [a,x] accumulator offset indexed indirect addressing - + [ext] extended indirect addressing - + [ext,pc] pc indirect addressing ( [pc <- pc + ext] ) - + [ext,pcr] pc relative indirect addressing The terms data, dir, label, offset, and ext may all be expres- - sions. + sions. @@ -3946,10 +4000,10 @@ Note that not all addressing modes are valid with every in- - struction, refer to the 6809 technical data for valid modes. + struction, refer to the 6809 technical data for valid modes. - F.2.1 Inherent Instructions + F.2.1 Inherent Instructions abx daa mul nop @@ -3959,7 +4013,7 @@ swi3 sync - F.2.2 Short Branch Instructions + F.2.2 Short Branch Instructions bcc label bcs label beq label bge label @@ -3974,7 +4028,7 @@ bsr label - F.2.3 Long Branch Instructions + F.2.3 Long Branch Instructions lbcc label lbcs label lbeq label lbge label @@ -3993,41 +4047,41 @@ 6809 INSTRUCTION SET - F.2.4 Single Operand Instructions + F.2.4 Single Operand Instructions asla aslb asl [] - + asra asrb asr [] - + clra clrb clr [] - + coma comb com [] - + deca decb dec [] - + inca incb inc [] - + lsla lslb lsl [] - + lsra lsrb lsr [] - + nega negb neg [] - + rola rolb rol [] - + rora rorb ror [] - + tsta tstb tst [] @@ -4036,52 +4090,52 @@ 6809 INSTRUCTION SET - F.2.5 Double Operand Instructions + F.2.5 Double Operand Instructions adca [] adcb [] - + adda [] addb [] - + anda [] andb [] - + bita [] bitb [] - + cmpa [] cmpb [] - + eora [] eorb [] - + lda [] ldb [] - + ora [] orb [] - + sbca [] sbcb [] - + sta [] stb [] - + suba [] subb [] - F.2.6 D-register Instructions + F.2.6 D-register Instructions addd [] subd [] cmpd [] ldd [] std [] - F.2.7 Index/Stack Register Instructions + F.2.7 Index/Stack Register Instructions cmps [] cmpu [] cmpx [] cmpy [] - + lds [] ldu [] ldx [] ldy [] - + leas [] leau [] leax [] leay [] - + sts [] stu [] stx [] sty [] - + pshs r pshu r puls r pulu r @@ -4090,23 +4144,23 @@ 6809 INSTRUCTION SET - F.2.8 Jump and Jump to Subroutine Instructions + F.2.8 Jump and Jump to Subroutine Instructions jmp [] jsr [] - F.2.9 Register - Register Instructions + F.2.9 Register - Register Instructions exg r1,r2 tfr r1,r2 - F.2.10 Condition Code Register Instructions + F.2.10 Condition Code Register Instructions andcc #data orcc #data cwai #data - F.2.11 6800 Compatibility Instructions + F.2.11 6800 Compatibility Instructions aba cba clc cli @@ -4146,41 +4200,41 @@ - G.1 6811 REGISTER SET + G.1 6811 REGISTER SET - The following is a list of the 6811 registers used by AS6811: + The following is a list of the 6811 registers used by AS6811: a,b - 8-bit accumulators d - 16-bit accumulator x,y - index registers - G.2 6811 INSTRUCTION SET + G.2 6811 INSTRUCTION SET The following tables list all 6811 mnemonics recognized by the AS6811 assembler. The designation [] refers to a required addressing mode argument. The following list specifies the - format for each addressing mode supported by AS6811: + format for each addressing mode supported by AS6811: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + ,x register indirect addressing zero offset - + offset,x register indirect addressing 0 <= offset <= 255 - + ext extended addressing - + label branch label - The terms data, dir, offset, and ext may all be expressions. + The terms data, dir, offset, and ext may all be expressions. @@ -4189,10 +4243,10 @@ Note that not all addressing modes are valid with every in- - struction, refer to the 6811 technical data for valid modes. + struction, refer to the 6811 technical data for valid modes. - G.2.1 Inherent Instructions + G.2.1 Inherent Instructions aba abx aby cba @@ -4212,19 +4266,19 @@ tsx txs wai xgdx xgdy - + psha pshb psh a psh b pshx pshy psh x psh y - + pula pulb pul a pul b pulx puly pul x pul y - G.2.2 Branch Instructions + G.2.2 Branch Instructions bra label brn label bhi label bls label @@ -4242,52 +4296,52 @@ 6811 INSTRUCTION SET - G.2.3 Single Operand Instructions + G.2.3 Single Operand Instructions asla aslb asld asl a asl b asl d asl [] - + asra asrb asr a asr b asr [] - + clra clrb clr a clr b clr label - + coma comb com a com b com [] - + deca decb dec a dec b dec [] - + inca incb inc a inc b inc [] - + lsla lslb lsld lsl a lsl b lsl d lsl [] - + lsra lsrb lsrd lsr a lsr b lsr d lsr [] - + nega negb neg a neg b neg [] - + rola rolb rol a rol b rol [] - + rora rorb ror a ror b ror [] - + tsta tstb tst a tst b tst [] @@ -4297,47 +4351,47 @@ 6811 INSTRUCTION SET - G.2.4 Double Operand Instructions + G.2.4 Double Operand Instructions adca [] adcb [] adc a [] adc b [] - + adda [] addb [] addd [] add a [] add b [] add d [] - + anda [] andb [] and a [] and b [] - + bita [] bitb [] bit a [] bit b [] - + cmpa [] cmpb [] cmp a [] cmp b [] - + eora [] eorb [] eor a [] eor b [] - + ldaa [] ldab [] lda a [] lda b [] - + oraa [] orab [] ora a [] ora b [] - + sbca [] sbcb [] sbc a [] sbc b [] - + staa [] stab [] sta a [] sta b [] - + suba [] subb [] subd [] sub a [] sub b [] sub d [] - G.2.5 Bit Manupulation Instructions + G.2.5 Bit Manupulation Instructions bclr [],#data bset [],#data - + brclr [],#data,label brset [],#data,label @@ -4348,18 +4402,18 @@ 6811 INSTRUCTION SET - G.2.6 Jump and Jump to Subroutine Instructions + G.2.6 Jump and Jump to Subroutine Instructions jmp [] jsr [] - G.2.7 Long Register Instructions + G.2.7 Long Register Instructions cpx [] cpy [] - + ldd [] lds [] ldx [] ldy [] - + std [] sts [] stx [] sty [] @@ -4384,9 +4438,9 @@ - H.1 6816 REGISTER SET + H.1 6816 REGISTER SET - The following is a list of the 6816 registers used by AS6816: + The following is a list of the 6816 registers used by AS6816: a,b - 8-bit accumulators d - 16-bit accumulator @@ -4397,28 +4451,28 @@ ccr - condition code - H.2 6816 INSTRUCTION SET + H.2 6816 INSTRUCTION SET The following tables list all 6816 mnemonics recognized by the AS6816 assembler. The designation [] refers to a required addressing mode argument. The following list specifies the - format for each addressing mode supported by AS6816: + format for each addressing mode supported by AS6816: #data immediate data byte or word data - + #xo,#yo local immediate data (mac / rmac) - + label branch label - + r register ccr,a,b,d,e,x,y,z,s - + ,x zero offset register indexed addressing ,x8 ,x16 - + offset,x register indexed addressing @@ -4431,24 +4485,24 @@ 256 <= offset <= 32767 --- 16-bit (external definition of offset uses 16-bit mode) - + offset,x8 unsigned 8-bit offset indexed addressing offset,x16 signed 16-bit offset indexed addressing - + e,x accumulator offset indexed addressing - + ext extended addressing - + bank 64K bank number (jmp / jsr) The terms data, label, offset, bank, and ext may all be expres- - sions. + sions. Note that not all addressing modes are valid with every in- - struction, refer to the 6816 technical data for valid modes. + struction, refer to the 6816 technical data for valid modes. - H.2.1 Inherent Instructions + H.2.1 Inherent Instructions aba abx aby abz ace aced ade adx @@ -4478,12 +4532,12 @@ 6816 INSTRUCTION SET - H.2.2 Push/Pull Multiple Register Instructions + H.2.2 Push/Pull Multiple Register Instructions pshm r,... pulm r,... - H.2.3 Short Branch Instructions + H.2.3 Short Branch Instructions bcc label bcs label beq label bge label @@ -4498,7 +4552,7 @@ bsr label - H.2.4 Long Branch Instructions + H.2.4 Long Branch Instructions lbcc label lbcs label lbeq label lbge label @@ -4513,11 +4567,11 @@ lbsr label - H.2.5 Bit Manipulation Instructions + H.2.5 Bit Manipulation Instructions bclr [],#data bset [],#data - + brclr [],#data,label brset [],#data,label @@ -4526,54 +4580,54 @@ 6816 INSTRUCTION SET - H.2.6 Single Operand Instructions + H.2.6 Single Operand Instructions asla aslb asld asle aslm asl [] aslw [] - + asra asrb asrd asre asrm asr [] asrw [] - + clra clrb clrd clre clrm clr [] clrw [] - + coma comb comd come com [] comw [] - + deca decb dec [] decw [] - + inca incb inc [] incw [] - + lsla lslb lsld lsle lslm lsl [] lslw [] - + lsra lsrb lsrd lsre lsr [] lsrw [] - + nega negb negd nege neg [] negw [] - + rola rolb rold role rol [] rolw [] - + rora rorb rord rore ror [] rorw [] - + tsta tstb tsta tste tst [] tstw [] @@ -4583,49 +4637,49 @@ 6816 INSTRUCTION SET - H.2.7 Double Operand Instructions + H.2.7 Double Operand Instructions adca [] adcb [] adcd [] adce [] - + adda [] addb [] addd [] adde [] - + anda [] andb [] andd [] ande [] - + bita [] bitb [] - + cmpa [] cmpb [] cpd [] cpe [] - + eora [] eorb [] eord [] eore [] - + ldaa [] ldab [] ldd [] lde [] - + oraa [] orab [] ord [] ore [] - + sbca [] sbcb [] sbcd [] sbce [] - + staa [] stab [] std [] ste [] - + suba [] subb [] subd [] sube [] - H.2.8 Index/Stack Register Instructions + H.2.8 Index/Stack Register Instructions cps [] cpx [] cpy [] cpz [] - + lds [] ldx [] ldy [] ldz [] - + sts [] stx [] sty [] stz [] @@ -4634,17 +4688,17 @@ 6816 INSTRUCTION SET - H.2.9 Jump and Jump to Subroutine Instructions + H.2.9 Jump and Jump to Subroutine Instructions jmp bank,[] jsr bank,[] - H.2.10 Condition Code Register Instructions + H.2.10 Condition Code Register Instructions andp #data orp #data - H.2.11 Multiply and Accumulate Instructions + H.2.11 Multiply and Accumulate Instructions mac #data rmac #data mac #xo,#yo rmac #xo,#yo @@ -4670,9 +4724,9 @@ - I.1 H8/3XX REGISTER SET + I.1 H8/3XX REGISTER SET - The following is a list of the H8 registers used by ASH8: + The following is a list of the H8 registers used by ASH8: r0 - r7,sp 16-bit accumulators r0L - r7L,spL 8-bit accumulators @@ -4681,31 +4735,31 @@ ccr condition code - I.2 H8/3XX INSTRUCTION SET + I.2 H8/3XX INSTRUCTION SET The following tables list all H8/3xx mnemonics recognized by the ASH8 assembler. The designation [] refers to a required ad- dressing mode argument. The following list specifies the format - for each addressing mode supported by ASH8: + for each addressing mode supported by ASH8: #xx:3 immediate data (3 bit) #xx:8 immediate data (8 bit) #xx:16 immediate data (16 bit) - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + label branch label - - + + rn registers (16 bit) r0-r7,sp - + rnB registers (8 bit) r0H-r7H,r0L-r7L,spH,spL - + ASH8 ASSEMBLER PAGE I-2 @@ -4713,27 +4767,27 @@ ccr condition code register - + @rn register indirect - + @-rn register indirect (auto pre-decrement) - + @rn+ register indirect (auto post-increment) - + @[offset,rn] register indirect, 16-bit displacement - + @@offset memory indirect, (8-bit address) - + ext extended addressing (16-bit) The terms data, dir, label, offset, and ext may all be expres- - sions. + sions. Note that not all addressing modes are valid with every in- - struction, refer to the H8/3xx technical data for valid modes. + struction, refer to the H8/3xx technical data for valid modes. - I.2.1 Inherent Instructions + I.2.1 Inherent Instructions eepmov nop @@ -4742,7 +4796,7 @@ rts - I.2.2 Branch Instructions + I.2.2 Branch Instructions bcc label bcs label beq label bf label @@ -4762,43 +4816,43 @@ H8/3XX INSTRUCTION SET - I.2.3 Single Operand Instructions + I.2.3 Single Operand Instructions Free Form - + daa rnB das rnB - + dec rnB inc rnB - + neg rnB not rnB - + rotxl rnB rotxr rnB - + rotl rnB rotr rnB - + shal rnB shar rnB - + shll rnB shlr rnB - + push rn pop rn - - + + Byte / Word Form - + daa.b rnB das.b rnB - + dec.b rnB inc.b rnB - + neg.b rnB not.b rnB - + rotxl.b rnB rotxr.b rnB - + rotl.b rnB rotr.b rnB - + shal.b rnB shar.b rnB - + shll.b rnB shlr.b rnB - + push.w rn pop.w rn @@ -4806,54 +4860,54 @@ H8/3XX INSTRUCTION SET - I.2.4 Double Operand Instructions + I.2.4 Double Operand Instructions Free Form - + add rnB,rnB add #xx:8,rnB add rn,rn - + cmp rnB,rnB cmp #xx:8,rnB cmp rn,rn - + sub rnB,rnB sub rn,rn - + addx rnB,rnB addx #xx:8,rnB - + and rnB,rnB and #xx:8,rnB and #xx:8,ccr - + or rnB,rnB or #xx:8,rnB or #xx:8,ccr - + subx rnB,rnB subx #xx:8,rnB - + xor rnB,rnB xor #xx:8,rnB xor #xx:8,ccr - - + + Byte / Word Form - + add.b rnB,rnB add.b #xx:8,rnB add.w rn,rn - + cmp.b rnB,rnB cmp.b #xx:8,rnB cmp.w rn,rn - + sub.b rnB,rnB sub.w rn,rn - + addx.b rnB,rnB addx.b #xx:8,rnB - + and.b rnB,rnB and.b #xx:8,rnB and.b #xx:8,ccr - + or.b rnB,rnB or.b #xx:8,rnB or.b #xx:8,ccr - + subx.b rnB,rnB subx.b #xx:8,rnB - + xor.b rnB,rnB xor.b #xx:8,rnB xor.b #xx:8,ccr @@ -4862,10 +4916,10 @@ H8/3XX INSTRUCTION SET - I.2.5 Mov Instructions + I.2.5 Mov Instructions Free Form - + mov rnB,rnB mov rn,rn mov #xx:8,rnB mov #xx:16,rn mov @rn,rnB mov @rn,rn @@ -4886,10 +4940,10 @@ mov rnB,*dir mov rnB,@label mov rn,@label mov rnB,label mov rn,label - - + + Byte / Word Form - + mov.b rnB,rnB mov.w rn,rn mov.b #xx:8,rnB mov.w #xx:16,rn mov.b @rn,rnB mov.w @rn,rn @@ -4916,44 +4970,44 @@ H8/3XX INSTRUCTION SET - I.2.6 Bit Manipulation Instructions + I.2.6 Bit Manipulation Instructions bld #xx:3,rnB bld #xx:3,@rn bld #xx:3,@dir bld #xx:3,dir bld #xx:3,*@dir bld #xx:3,*dir - + bild #xx:3,rnB bild #xx:3,@rn bild #xx:3,@dir bild #xx:3,dir bild #xx:3,*@dir bild #xx:3,*dir - + bst #xx:3,rnB bst #xx:3,@rn bst #xx:3,@dir bst #xx:3,dir bst #xx:3,*@dir bst #xx:3,*dir - + bist #xx:3,rnB bist #xx:3,@rn bist #xx:3,@dir bist #xx:3,dir bist #xx:3,*@dir bist #xx:3,*dir - + band #xx:3,rnB band #xx:3,@rn band #xx:3,@dir band #xx:3,dir band #xx:3,*@dir band #xx:3,*dir - + biand #xx:3,rnB biand #xx:3,@rn biand #xx:3,@dir biand #xx:3,dir biand #xx:3,*@dir biand #xx:3,*dir - + bor #xx:3,rnB bor #xx:3,@rn bor #xx:3,@dir bor #xx:3,dir bor #xx:3,*@dir bor #xx:3,*dir - + bior #xx:3,rnB bior #xx:3,@rn bior #xx:3,@dir bior #xx:3,dir bior #xx:3,*@dir bior #xx:3,*dir - + bxor #xx:3,rnB bxor #xx:3,@rn bxor #xx:3,@dir bxor #xx:3,dir bxor #xx:3,*@dir bxor #xx:3,*dir - + bixor #xx:3,rnB bixor #xx:3,@rn bixor #xx:3,@dir bixor #xx:3,dir bixor #xx:3,*@dir bixor #xx:3,*dir @@ -4963,7 +5017,7 @@ H8/3XX INSTRUCTION SET - I.2.7 Extended Bit Manipulation Instructions + I.2.7 Extended Bit Manipulation Instructions bset #xx:3,rnB bset #xx:3,@rn bset #xx:3,@dir bset #xx:3,dir @@ -4971,21 +5025,21 @@ bset rnB,rnB bset rnB,@rn bset rnB,@dir bset rnB,dir bset rnB,*@dir bset rnB,*dir - + bclr #xx:3,rnB bclr #xx:3,@rn bclr #xx:3,@dir bclr #xx:3,dir bclr #xx:3,*@dir bclr #xx:3,*dir bclr rnB,rnB bclr rnB,@rn bclr rnB,@dir bclr rnB,dir bclr rnB,*@dir bclr rnB,*dir - + bnot #xx:3,rnB bnot #xx:3,@rn bnot #xx:3,@dir bnot #xx:3,dir bnot #xx:3,*@dir bnot #xx:3,*dir bnot rnB,rnB bnot rnB,@rn bnot rnB,@dir bnot rnB,dir bnot rnB,*@dir bnot rnB,*dir - + btst #xx:3,rnB btst #xx:3,@rn btst #xx:3,@dir btst #xx:3,dir btst #xx:3,*@dir btst #xx:3,*dir @@ -4994,20 +5048,20 @@ btst rnB,*@dir btst rnB,*dir - I.2.8 Condition Code Instructions + I.2.8 Condition Code Instructions andc #xx:8,ccr andc #xx:8 and #xx:8,ccr and.b #xx:8,ccr - + ldc #xx:8,ccr ldc #xx:8 ldc rnB,ccr ldc rnB - + orc #xx:8,ccr orc #xx:8 or #xx:8,ccr or.b #xx:8,ccr - + xorc #xx:8,ccr xorc #xx:8 xor #xx:8,ccr xor.b #xx:8,ccr - + stc ccr,rnB stc rnB @@ -5015,24 +5069,24 @@ H8/3XX INSTRUCTION SET - I.2.9 Other Instructions + I.2.9 Other Instructions divxu rnB,rn divxu.b rnB,rn - + mulxu rnB,rn mulxu.b rnB,rn - + movfpe @label,rnB movfpe label,rnB movfpe.b @label,rnB movfpe.b label,rnB - + movtpe @label,rnB movtpe label,rnB movtpe.b @label,rnB movtpe.b label,rnB - I.2.10 Jump and Jump to Subroutine Instructions + I.2.10 Jump and Jump to Subroutine Instructions jmp @rn jmp @@dir jmp @label jmp label - + jsr @rn jsr @@dir jsr @label jsr label @@ -5057,10 +5111,10 @@ - J.1 8085 REGISTER SET + J.1 8085 REGISTER SET The following is a list of the 8080/8085 registers used by - AS8085: + AS8085: a,b,c,d,e,h,l - 8-bit accumulators m - memory through (hl) @@ -5068,38 +5122,38 @@ psw - status word - J.2 8085 INSTRUCTION SET + J.2 8085 INSTRUCTION SET The following tables list all 8080/8085 mnemonics recognized by the AS8085 assembler. The following list specifies the - format for each addressing mode supported by AS8085: + format for each addressing mode supported by AS8085: #data immediate data byte or word data - + r,r1,r2 register or register pair psw,a,b,c,d,e,h,l bc,de,hl,sp,pc - + m memory address using (hl) - + addr direct memory addressing - + label call or jump label - The terms data, m, addr, and label may be expressions. + The terms data, m, addr, and label may be expressions. Note that not all addressing modes are valid with every in- struction, refer to the 8080/8085 technical data for valid - modes. + modes. AS8085 ASSEMBLER PAGE J-2 8085 INSTRUCTION SET - J.2.1 Inherent Instructions + J.2.1 Inherent Instructions cma cmc daa di @@ -5113,7 +5167,7 @@ xthl - J.2.2 Register/Memory/Immediate Instructions + J.2.2 Register/Memory/Immediate Instructions adc r adc m aci #data add r add m adi #data @@ -5125,7 +5179,7 @@ xra r xra m xri #data - J.2.3 Call and Return Instructions + J.2.3 Call and Return Instructions cc label rc cm label rm @@ -5138,7 +5192,7 @@ call label - J.2.4 Jump Instructions + J.2.4 Jump Instructions jc label jm label @@ -5155,36 +5209,36 @@ 8085 INSTRUCTION SET - J.2.5 Input/Output/Reset Instructions + J.2.5 Input/Output/Reset Instructions in data out data rst data - J.2.6 Move Instructions + J.2.6 Move Instructions mov r1,r2 mov r,m mov m,r - + mvi r,#data mvi m,#data - J.2.7 Other Instructions + J.2.7 Other Instructions dcr r dcr m inr r inr m - + dad r dcx r inx r ldax r pop r push r stax r - + lda addr lhld addr shld addr sta addr - + lxi r,#data @@ -5208,28 +5262,28 @@ - K.1 .hd64 DIRECTIVE + K.1 .hd64 DIRECTIVE - Format: + Format: - .hd64 + .hd64 The .hd64 directive enables processing of the HD64180 specific mnemonics not included in the Z80 instruction set. HD64180 mnemonics encountered without the .hd64 directive will be - flagged with an 'o' error. + flagged with an 'o' error. - K.2 Z80 REGISTER SET AND CONDITIONS + K.2 Z80 REGISTER SET AND CONDITIONS The following is a complete list of register designations and - condition mnemonics: + condition mnemonics: byte registers - a,b,c,d,e,h,l,i,r register pairs - af,af',bc,de,hl word registers - pc,sp,ix,iy - + C - carry bit set M - sign bit set NC - carry bit clear @@ -5246,49 +5300,49 @@ Z80 INSTRUCTION SET - K.3 Z80 INSTRUCTION SET + K.3 Z80 INSTRUCTION SET The following tables list all Z80/HD64180 mnemonics recog- nized by the ASZ80 assembler. The designation [] refers to a required addressing mode argument. The following list specifies - the format for each addressing mode supported by ASZ80: + the format for each addressing mode supported by ASZ80: #data immediate data byte or word data - + n byte value - + rg a byte register a,b,c,d,e,h,l - + rp a register pair bc,de,hl - + (hl) implied addressing or register indirect addressing - + (label) direct addressing - + offset(ix) indexed addressing with an offset - + label call/jmp/jr label The terms data, dir, offset, and ext may all be expressions. The terms dir and offset are not allowed to be external refer- - ences. + ences. Note that not all addressing modes are valid with every in- struction, refer to the Z80/HD64180 technical data for valid - modes. + modes. ASZ80 ASSEMBLER PAGE K-3 Z80 INSTRUCTION SET - K.3.1 Inherent Instructions + K.3.1 Inherent Instructions ccf cpd cpdr cpi @@ -5303,7 +5357,7 @@ rrd scf - K.3.2 Implicit Operand Instructions + K.3.2 Implicit Operand Instructions adc a,[] adc [] add a,[] add [] @@ -5328,7 +5382,7 @@ Z80 INSTRUCTION SET - K.3.3 Load Instruction + K.3.3 Load Instruction ld rg,[] ld [],rg ld (bc),a ld a,(bc) @@ -5339,12 +5393,12 @@ ld a,i ld a,r ld sp,hl ld sp,ix ld sp,iy ld rp,#data - + ldd lddr ldi ldir - K.3.4 Call/Return Instructions + K.3.4 Call/Return Instructions call C,label ret C call M,label ret M @@ -5357,18 +5411,18 @@ call label ret - K.3.5 Jump and Jump to Subroutine Instructions + K.3.5 Jump and Jump to Subroutine Instructions jp C,label jp M,label jp NC,label jp NZ,label jp P,label jp PE,label jp PO,label jp Z,label - + jp (hl) jp (ix) jp (iy) jp label - + djnz label - + jr C,label jr NC,label jr NZ,label jr Z,label jr label @@ -5378,14 +5432,14 @@ Z80 INSTRUCTION SET - K.3.6 Bit Manipulation Instructions + K.3.6 Bit Manipulation Instructions bit n,[] res n,[] set n,[] - K.3.7 Interrupt Mode and Reset Instructions + K.3.7 Interrupt Mode and Reset Instructions im n im n @@ -5393,29 +5447,29 @@ rst n - K.3.8 Input and Output Instructions + K.3.8 Input and Output Instructions in a,(n) in rg,(c) ind indr ini inir - + out (n),a out (c),rg outd otdr outi otir - K.3.9 Register Pair Instructions + K.3.9 Register Pair Instructions add hl,rp add ix,rp add iy,rp - + adc hl,rp sbc hl,rp - + ex (sp),hl ex (sp),ix ex (sp),iy ex de,hl ex af,af' - + push rp pop rp @@ -5423,19 +5477,19 @@ Z80 INSTRUCTION SET - K.3.10 HD64180 Specific Instructions + K.3.10 HD64180 Specific Instructions in0 rg,(n) out0 (n),rg - + otdm otdmr otim otimr - + mlt bc mlt de mlt hl mlt sp - + slp - + tst a tstio #data @@ -5460,11 +5514,11 @@ - L.1 ACKNOWLEDGMENT + L.1 ACKNOWLEDGMENT Thanks to Marko Makela for his contribution of the AS6500 - cross assembler. + cross assembler. Marko Makela Sillitie 10 A @@ -5474,7 +5528,7 @@ EARN/BitNet: msmakela@finuh Several additions and modifications were made to his code to - support the following families of 6500 processors: + support the following families of 6500 processors: (1) 650X and 651X processor family (2) 65F11 and 65F12 processor family @@ -5484,7 +5538,7 @@ The instruction syntax of this cross assembler contains two peculiarities: (1) the addressing indirection is denoted by the square brackets [] and (2) the `bbrx' and `bbsx' instructions - are written `bbr0 memory,label'. + are written `bbr0 memory,label'. @@ -5493,69 +5547,69 @@ 6500 REGISTER SET - L.2 6500 REGISTER SET + L.2 6500 REGISTER SET - The following is a list of the 6500 registers used by AS6500: + The following is a list of the 6500 registers used by AS6500: a - 8-bit accumulator x,y - index registers - L.3 6500 INSTRUCTION SET + L.3 6500 INSTRUCTION SET The following tables list all 6500 family mnemonics recog- nized by the AS6500 assembler. The designation [] refers to a required addressing mode argument. The following list specifies - the format for each addressing mode supported by AS6500: + the format for each addressing mode supported by AS6500: #data immediate data byte or word data - + *dir direct page addressing (see .setdp directive) - 0 <= dir <= 255 - + 0 <= dir <= 255 + offset,x indexed addressing offset,y indexed addressing address = (offset + (x or y)) - + [offset,x] pre-indexed indirect addressing 0 <= offset <= 255 address = contents of location (offset + (x or y)) mod 256 - + [offset],y post-indexed indirect addressing address = contents of location at offset plus the value of the y register - + [address] indirect addressing - + ext extended addressing - + label branch label - + address,label direct page memory location branch label bbrx and bbsx instruction addressing The terms data, dir, offset, address, ext, and label may all be - expressions. + expressions. Note that not all addressing modes are valid with every in- - struction, refer to the 65xx technical data for valid modes. + struction, refer to the 65xx technical data for valid modes. AS6500 ASSEMBLER PAGE L-3 6500 INSTRUCTION SET - L.3.1 Processor Specific Directives + L.3.1 Processor Specific Directives The AS6500 cross assembler has four (4) processor specific assembler directives which define the target 65xx processor - family: + family: .r6500 Core 650X and 651X family (default) .r65f11 Core plus 65F11 and 65F12 @@ -5563,7 +5617,7 @@ .r65c02 Core plus 65C02, 65C102, and 65C112 - L.3.2 65xx Core Inherent Instructions + L.3.2 65xx Core Inherent Instructions brk clc cld cli @@ -5580,7 +5634,7 @@ tya - L.3.3 65xx Core Branch Instructions + L.3.3 65xx Core Branch Instructions bcc label bhs label bcs label blo label @@ -5589,7 +5643,7 @@ bvc label bvs label - L.3.4 65xx Core Single Operand Instructions + L.3.4 65xx Core Single Operand Instructions asl [] dec [] @@ -5603,7 +5657,7 @@ 6500 INSTRUCTION SET - L.3.5 65xx Core Double Operand Instructions + L.3.5 65xx Core Double Operand Instructions adc [] and [] @@ -5616,12 +5670,12 @@ sta [] - L.3.6 65xx Core Jump and Jump to Subroutine Instructions + L.3.6 65xx Core Jump and Jump to Subroutine Instructions jmp [] jsr [] - L.3.7 65xx Core Miscellaneous X and Y Register Instructions + L.3.7 65xx Core Miscellaneous X and Y Register Instructions cpx [] cpy [] @@ -5635,51 +5689,51 @@ 6500 INSTRUCTION SET - L.3.8 65F11 and 65F12 Specific Instructions + L.3.8 65F11 and 65F12 Specific Instructions bbr0 [],label bbr1 [],label bbr2 [],label bbr3 [],label bbr4 [],label bbr5 [],label bbr6 [],label bbr7 [],label - + bbs0 [],label bbs1 [],label bbs2 [],label bbs3 [],label bbs4 [],label bbs5 [],label bbs6 [],label bbs7 [],label - + rmb0 [] rmb1 [] rmb2 [] rmb3 [] rmb4 [] rmb5 [] rmb6 [] rmb7 [] - + smb0 [] smb1 [] smb2 [] smb3 [] smb4 [] smb5 [] smb6 [] smb7 [] - L.3.9 65C00/21 and 65C29 Specific Instructions + L.3.9 65C00/21 and 65C29 Specific Instructions bbr0 [],label bbr1 [],label bbr2 [],label bbr3 [],label bbr4 [],label bbr5 [],label bbr6 [],label bbr7 [],label - + bbs0 [],label bbs1 [],label bbs2 [],label bbs3 [],label bbs4 [],label bbs5 [],label bbs6 [],label bbs7 [],label - + bra label - + phx phy plx ply - + rmb0 [] rmb1 [] rmb2 [] rmb3 [] rmb4 [] rmb5 [] rmb6 [] rmb7 [] - + smb0 [] smb1 [] smb2 [] smb3 [] smb4 [] smb5 [] @@ -5690,47 +5744,47 @@ 6500 INSTRUCTION SET - L.3.10 65C02, 65C102, and 65C112 Specific Instructions + L.3.10 65C02, 65C102, and 65C112 Specific Instructions bbr0 [],label bbr1 [],label bbr2 [],label bbr3 [],label bbr4 [],label bbr5 [],label bbr6 [],label bbr7 [],label - + bbs0 [],label bbs1 [],label bbs2 [],label bbs3 [],label bbs4 [],label bbs5 [],label bbs6 [],label bbs7 [],label - + bra label - + phx phy plx ply - + rmb0 [] rmb1 [] rmb2 [] rmb3 [] rmb4 [] rmb5 [] rmb6 [] rmb7 [] - + smb0 [] smb1 [] smb2 [] smb3 [] smb4 [] smb5 [] smb6 [] smb7 [] - + stz [] trb [] tsb [] Additional addressing modes for the following core instruc- tions are also available with the 65C02, 65C102, and 65C112 pro- - cessors. + cessors. adc [] and [] cmp [] eor [] lda [] ora [] sbc [] sta [] - + bit [] jmp [] - + dec inc \ No newline at end of file diff --git a/as/doc/asxhtm.html b/as/doc/asxhtm.html index 784d57b7..5c919d95 100644 --- a/as/doc/asxhtm.html +++ b/as/doc/asxhtm.html @@ -2290,54 +2290,103 @@ 1. -i/-s Intel Hex (file.ihx) or Motorola S19 (file.s19) image output file. - 2. -z Specifies that symbol names are case sensitive. - - 3. -m Generate a map file (file.map). This file con- + 2. -m Generate a map file (file.map). This file con- tains a list of the symbols (by area) with absolute ad- dresses, sizes of linked areas, and other linking information. - 4. -w Specifies that a wide listing format be used - for the map file. - - 5. -xdq Specifies the number radix for the map file + 3. -xdq Specifies the number radix for the map file (Hexidecimal, Decimal, or Octal). - 6. -u Generate an updated listing file (file.rst) + 4. -u Generate an updated listing file (file.rst) derived from the relocated addresses and data from the linker - 7. fileN Files to be linked. Files may be on the same + 5. fileN Files to be linked. Files may be on the same line as the above options or on a separate line(s) one file per line or multiple files separated by spaces or tabs. - - - THE LINKER PAGE 2-3 - INVOKING ASLINK - - - 8. -b area = expression (one definition per line) + 6. -b area = expression (one definition per line) This specifies an area base address where the expres- sion may contain constants and/or defined symbols from the linked files. - 9. -g symbol = expression (one definition per line) + 7. -g symbol = expression (one definition per line) This specifies the value for the symbol where the ex- pression may contain constants and/or defined symbols from the linked files. - 10. -k library directory path + 8. -k library directory path (one definition per line) This specifies one possible + + + + THE LINKER PAGE 2-3 + INVOKING ASLINK + + path to an object library. More than one path is al- lowed. - 11. -l library file specification + 9. -l library file specification (one definition per line) This specifies a possible library file. More than one file is allowed. - 12. -e or null line, terminates input to the linker. + 10. -e or null line, terminates input to the linker. + + aslink (msc51) specific options: + + Output: + -j Produce NoICE debug as file[NOI] + -z Produce SDCdb debug as file[cdb] + -u Update listing file(s) with link data as file(s)[.RST] + Miscellaneous: + -a [iram-size] Check for internal RAM overflow + -v [xram-size] Check for external RAM overflow + -w [code-size] Check for code overflow + -y Generate memory usage summary file[mem] + -Y Pack internal ram + -A [stack-size] Allocate space for stack + + + link-z80 (Z80) specific options: + + Map format: + -j no$gmb symbol file generated as file[SYM] + Output: + -z Produce SDCdb debug as file[cdb] + -Z Gameboy image as file[GB] + List: + -u Update listing file(s) with link data as file(s)[.RST] + + + link-gbz80 (GBZ80) specific options: + + Relocation: + -yo Number of rom banks (default: 2) + -ya Number of ram banks (default: 0) + -yt MBC type (default: no MBC) + -yn Name of program (default: name of output file) + -yp# Patch one byte in the output GB file (# is: addr=byte) + Map format: + -j no$gmb symbol file generated as file[SYM] + Output: + -Z Gameboy image as file[GB] + List: + -u Update listing file(s) with link data as file(s)[.RST] + + + link-hc08 (HC08) specific options: + Output: + -t ELF executable as file[elf] + -j Produce NoICE debug as file[NOI] + -z Produce SDCdb debug as file[cdb] + -u Update listing file(s) with link data as file(s)[.RST] + Miscellaneous: + -a [iram-size] Check for internal RAM overflow + -v [xram-size] Check for external RAM overflow + -w [code-size] Check for code overflow diff --git a/as/link/hc08/lkmain.c b/as/link/hc08/lkmain.c index e2aa0d63..88c46c7a 100644 --- a/as/link/hc08/lkmain.c +++ b/as/link/hc08/lkmain.c @@ -24,445 +24,445 @@ void Timer(int action, char * message) { - static double start, end, total=0.0; + static double start, end, total=0.0; static const double secs_per_tick = 1.0 / CLOCKS_PER_SEC; if(action==0) start=clock()*secs_per_tick; else if(action==1) { - end=clock() * secs_per_tick; - printf("%s \t%f seconds.\n", message, (end-start)); - total+=end-start; + end=clock() * secs_per_tick; + printf("%s \t%f seconds.\n", message, (end-start)); + total+=end-start; } else { - printf("Total time: \t%f seconds.\n", total); - total=0.0; + printf("Total time: \t%f seconds.\n", total); + total=0.0; } } #endif -/*)Module lkmain.c - * - * The module lkmain.c contains the functions which - * (1) input the linker options, parameters, and specifications - * (2) perform a two pass link - * (3) produce the appropriate linked data output and/or - * link map file and/or relocated listing files. - * - * lkmain.c contains the following functions: - * FILE * afile(fn,ft,wf) - * VOID bassav() - * VOID gblsav() - * VOID link_main() - * VOID lkexit() - * VOID main(argc,argv) - * VOID map() - * int parse() - * VOID setbas() - * VOID setgbl() - * VOID usage() - * - * lkmain.c contains the following local variables: - * char * usetext[] array of pointers to the - * command option tect lines +/*)Module lkmain.c + * + * The module lkmain.c contains the functions which + * (1) input the linker options, parameters, and specifications + * (2) perform a two pass link + * (3) produce the appropriate linked data output and/or + * link map file and/or relocated listing files. + * + * lkmain.c contains the following functions: + * FILE * afile(fn,ft,wf) + * VOID bassav() + * VOID gblsav() + * VOID link_main() + * VOID lkexit() + * VOID main(argc,argv) + * VOID map() + * int parse() + * VOID setbas() + * VOID setgbl() + * VOID usage() + * + * lkmain.c contains the following local variables: + * char * usetext[] array of pointers to the + * command option tect lines * */ -/*JCF: Creates some of the default areas so they are allocated in the right order.*/ +/*JCF: Creates some of the default areas so they are allocated in the right order.*/ void Areas51 (void) { - char * rel[]={ - "XH", - "H 7 areas 0 global symbols", - "A _CODE size 0 flags 0", /*Each .rel has one, so...*/ - "A REG_BANK_0 size 0 flags 4", /*Register banks are overlayable*/ - "A REG_BANK_1 size 0 flags 4", - "A REG_BANK_2 size 0 flags 4", - "A REG_BANK_3 size 0 flags 4", - "A BSEG size 0 flags 80", /*BSEG must be just before BITS*/ - "A BSEG_BYTES size 0 flags 0", /*Size will be obtained from BSEG in lnkarea()*/ - "" - }; - int j; - - for (j=0; rel[j][0]!=0; j++) - { - ip=rel[j]; - link_main(); - } - - /*Set the start address of the default areas:*/ - for(ap=areap; ap; ap=ap->a_ap) - { - /**/ if (!strcmp(ap->a_id, "REG_BANK_0")) { ap->a_addr=0x00; ap->a_type=1; } - else if (!strcmp(ap->a_id, "REG_BANK_1")) { ap->a_addr=0x08; ap->a_type=1; } - else if (!strcmp(ap->a_id, "REG_BANK_2")) { ap->a_addr=0x10; ap->a_type=1; } - else if (!strcmp(ap->a_id, "REG_BANK_3")) { ap->a_addr=0x18; ap->a_type=1; } - else if (!strcmp(ap->a_id, "BSEG_BYTES")) { ap->a_addr=0x20; ap->a_type=1; } - } + char * rel[]={ + "XH", + "H 7 areas 0 global symbols", + "A _CODE size 0 flags 0", /*Each .rel has one, so...*/ + "A REG_BANK_0 size 0 flags 4", /*Register banks are overlayable*/ + "A REG_BANK_1 size 0 flags 4", + "A REG_BANK_2 size 0 flags 4", + "A REG_BANK_3 size 0 flags 4", + "A BSEG size 0 flags 80", /*BSEG must be just before BITS*/ + "A BSEG_BYTES size 0 flags 0", /*Size will be obtained from BSEG in lnkarea()*/ + "" + }; + int j; + + for (j=0; rel[j][0]!=0; j++) + { + ip=rel[j]; + link_main(); + } + + /*Set the start address of the default areas:*/ + for(ap=areap; ap; ap=ap->a_ap) + { + /**/ if (!strcmp(ap->a_id, "REG_BANK_0")) { ap->a_addr=0x00; ap->a_type=1; } + else if (!strcmp(ap->a_id, "REG_BANK_1")) { ap->a_addr=0x08; ap->a_type=1; } + else if (!strcmp(ap->a_id, "REG_BANK_2")) { ap->a_addr=0x10; ap->a_type=1; } + else if (!strcmp(ap->a_id, "REG_BANK_3")) { ap->a_addr=0x18; ap->a_type=1; } + else if (!strcmp(ap->a_id, "BSEG_BYTES")) { ap->a_addr=0x20; ap->a_type=1; } + } } -/*)Function VOID main(argc,argv) - * - * int argc number of command line arguments + 1 - * char * argv[] array of pointers to the command line - * arguments - * - * The function main() evaluates the command line arguments to - * determine if the linker parameters are to input through 'stdin' - * or read from a command file. The functions lk_getline() and parse() - * are to input and evaluate the linker parameters. The linking process - * proceeds by making the first pass through each .rel file in the order - * presented to the linker. At the end of the first pass the setbase(), - * lnkarea(), setgbl(), and symdef() functions are called to evaluate - * the base address terms, link all areas, define global variables, - * and look for undefined symbols. Following these routines a linker - * map file may be produced and the linker output files may be opened. - * The second pass through the .rel files will output the linked data - * in one of the four supported formats. - * - * local variables: - * char * p pointer to an argument string - * int c character from argument string - * int i loop counter - * - * global variables: - * text line in ib[] - * lfile *cfp The pointer *cfp points to the - * current lfile structure - * char ctype[] array of character types, one per - * ASCII character - * lfile *filep The pointer *filep points to the - * beginning of a linked list of - * lfile structures. - * head *hp Pointer to the current - * head structure - * char ib[NINPUT] .rel file text line - * char *ip pointer into the .rel file - * lfile *linkp pointer to first lfile structure - * containing an input .rel file - * specification - * int lkerr error flag - * int mflag Map output flag - * int oflag Output file type flag - * FILE *ofp Output file handle - * for word formats - * FILE *ofph Output file handle - * for high byte format - * FILE *ofpl Output file handle - * for low byte format - * int pass linker pass number - * int pflag print linker command file flag - * int radix current number conversion radix - * FILE *sfp The file handle sfp points to the - * currently open file - * lfile *startp asmlnk startup file structure - * FILE * stdin c_library - * FILE * stdout c_library - * - * functions called: - * FILE * afile() lkmain.c - * int fclose() c_library - * int fprintf() c_library - * int lk_getline() lklex.c - * VOID library() lklibr.c - * VOID link_main() lkmain.c - * VOID lkexit() lkmain.c - * VOID lnkarea() lkarea.c - * VOID map() lkmain.c - * VOID new() lksym.c - * int parse() lkmain.c - * VOID reloc() lkreloc.c - * VOID search() lklibr.c - * VOID setbas() lkmain.c - * VOID setgbl() lkmain.c - * VOID symdef() lksym.c - * VOID usage() lkmain.c - * - * side effects: - * Completion of main() completes the linking process - * and may produce a map file (.map) and/or a linked - * data files (.ihx or .s19) and/or one or more - * relocated listing files (.rst). +/*)Function VOID main(argc,argv) + * + * int argc number of command line arguments + 1 + * char * argv[] array of pointers to the command line + * arguments + * + * The function main() evaluates the command line arguments to + * determine if the linker parameters are to input through 'stdin' + * or read from a command file. The functions lk_getline() and parse() + * are to input and evaluate the linker parameters. The linking process + * proceeds by making the first pass through each .rel file in the order + * presented to the linker. At the end of the first pass the setbase(), + * lnkarea(), setgbl(), and symdef() functions are called to evaluate + * the base address terms, link all areas, define global variables, + * and look for undefined symbols. Following these routines a linker + * map file may be produced and the linker output files may be opened. + * The second pass through the .rel files will output the linked data + * in one of the four supported formats. + * + * local variables: + * char * p pointer to an argument string + * int c character from argument string + * int i loop counter + * + * global variables: + * text line in ib[] + * lfile *cfp The pointer *cfp points to the + * current lfile structure + * char ctype[] array of character types, one per + * ASCII character + * lfile *filep The pointer *filep points to the + * beginning of a linked list of + * lfile structures. + * head *hp Pointer to the current + * head structure + * char ib[NINPUT] .rel file text line + * char *ip pointer into the .rel file + * lfile *linkp pointer to first lfile structure + * containing an input .rel file + * specification + * int lkerr error flag + * int mflag Map output flag + * int oflag Output file type flag + * FILE *ofp Output file handle + * for word formats + * FILE *ofph Output file handle + * for high byte format + * FILE *ofpl Output file handle + * for low byte format + * int pass linker pass number + * int pflag print linker command file flag + * int radix current number conversion radix + * FILE *sfp The file handle sfp points to the + * currently open file + * lfile *startp asmlnk startup file structure + * FILE * stdin c_library + * FILE * stdout c_library + * + * functions called: + * FILE * afile() lkmain.c + * int fclose() c_library + * int fprintf() c_library + * int lk_getline() lklex.c + * VOID library() lklibr.c + * VOID link_main() lkmain.c + * VOID lkexit() lkmain.c + * VOID lnkarea() lkarea.c + * VOID map() lkmain.c + * VOID new() lksym.c + * int parse() lkmain.c + * VOID reloc() lkreloc.c + * VOID search() lklibr.c + * VOID setbas() lkmain.c + * VOID setgbl() lkmain.c + * VOID symdef() lksym.c + * VOID usage() lkmain.c + * + * side effects: + * Completion of main() completes the linking process + * and may produce a map file (.map) and/or a linked + * data files (.ihx or .s19) and/or one or more + * relocated listing files (.rst). */ int main(int argc, char *argv[]) { - register char *p; - register int c, i; + register char *p; + register int c, i; #ifdef WIN32T Timer(0, ""); #endif - startp = (struct lfile *) new (sizeof (struct lfile)); - - pflag = 1; - for (i=1; if_type = F_STD; - break; - - case 'f': - case 'F': - startp->f_type = F_LNK; - break; - - case 'n': - case 'N': - pflag = 0; - break; - - case 'p': - case 'P': - pflag = 1; - break; - - default: - usage(); - } - } - } else { - if (startp->f_type == F_LNK) { - startp->f_idp = p; - } - } - } + startp = (struct lfile *) new (sizeof (struct lfile)); + + pflag = 1; + for (i=1; if_type = F_STD; + break; + + case 'f': + case 'F': + startp->f_type = F_LNK; + break; + + case 'n': + case 'N': + pflag = 0; + break; + + case 'p': + case 'P': + pflag = 1; + break; + + default: + usage(); + } + } + } else { + if (startp->f_type == F_LNK) { + startp->f_idp = p; + } + } + } if (startp->f_type == 0) - usage(); - if (startp->f_type == F_LNK && startp->f_idp == NULL) - usage(); - - cfp = NULL; - sfp = NULL; - filep = startp; - while (1) { - ip = ib; - if (lk_getline() == 0) - break; - if (pflag && sfp != stdin) - fprintf(stdout, "%s\n", ip); + usage(); + if (startp->f_type == F_LNK && startp->f_idp == NULL) + usage(); + + cfp = NULL; + sfp = NULL; + filep = startp; + while (1) { + ip = ib; + if (lk_getline() == 0) + break; + if (pflag && sfp != stdin) + fprintf(stdout, "%s\n", ip); if (*ip == '\0' || parse()) - break; - } + break; + } - if (sfp) { - fclose(sfp); - sfp = NULL; - } + if (sfp) { + fclose(sfp); + sfp = NULL; + } - if (linkp == NULL) - usage(); + if (linkp == NULL) + usage(); - syminit(); + syminit(); - if (dflag){ - //dfp = afile("temp", "cdb", 1); - SaveLinkedFilePath(linkp->f_idp); //Must be the first one... - dfp = afile(linkp->f_idp,"cdb",1); //JCF: Nov 30, 2002 - if (dfp == NULL) - lkexit(1); - } + if (dflag){ + //dfp = afile("temp", "cdb", 1); + SaveLinkedFilePath(linkp->f_idp); //Must be the first one... + dfp = afile(linkp->f_idp,"cdb",1); //JCF: Nov 30, 2002 + if (dfp == NULL) + lkexit(1); + } - for (pass=0; pass<2; ++pass) { - cfp = NULL; - sfp = NULL; - filep = linkp; - hp = NULL; - radix = 10; + for (pass=0; pass<2; ++pass) { + cfp = NULL; + sfp = NULL; + filep = linkp; + hp = NULL; + radix = 10; - Areas51(); /*JCF: Create the default 8051 areas in the right order*/ + Areas51(); /*JCF: Create the default 8051 areas in the right order*/ - while (lk_getline()) { - ip = ib; + while (lk_getline()) { + ip = ib; /* pass any "magic comments" to NoICE output */ if ((ip[0] == ';') && (ip[1] == '!') && jfp) { - fprintf( jfp, "%s\n", &ip[2] ); + fprintf( jfp, "%s\n", &ip[2] ); } - link_main(); - } - if (pass == 0) { - /* - * Search libraries for global symbols - */ - search(); - /* - * Set area base addresses. - */ - setbas(); - /* - * Link all area addresses. - */ - lnkarea(); - /* - * Process global definitions. - */ - setgbl(); - /* - * Check for undefined globals. - */ - symdef(stderr); - - /* Open NoICE output file if requested */ - if (jflag) { - jfp = afile(linkp->f_idp, "NOI", 1); - if (jfp == NULL) { - lkexit(1); - } - } - - /* - * Output Link Map if requested, - * or if NoICE output requested (since NoICE + link_main(); + } + if (pass == 0) { + /* + * Search libraries for global symbols + */ + search(); + /* + * Set area base addresses. + */ + setbas(); + /* + * Link all area addresses. + */ + lnkarea(); + /* + * Process global definitions. + */ + setgbl(); + /* + * Check for undefined globals. + */ + symdef(stderr); + + /* Open NoICE output file if requested */ + if (jflag) { + jfp = afile(linkp->f_idp, "NOI", 1); + if (jfp == NULL) { + lkexit(1); + } + } + + /* + * Output Link Map if requested, + * or if NoICE output requested (since NoICE * file is generated in part by map() processing) - */ - if (mflag || jflag) - map(); - - if (sflag) /*JCF: memory usage summary output*/ - if(summary(areap))lkexit(1); - - if (iram_size) - iramcheck(); - - /* - * Open output file - */ - if (oflag == 1) { - ofp = afile(linkp->f_idp, "ihx", 1); - if (ofp == NULL) { - lkexit(1); - } - /* include NoICE command to load hex file */ - if (jfp) fprintf( jfp, "LOAD %s.IHX\n", linkp->f_idp ); - - } else - if (oflag == 2) { - ofp = afile(linkp->f_idp, "S19", 1); - if (ofp == NULL) { - lkexit(1); - } - /* include NoICE command to load hex file */ - if (jfp) fprintf( jfp, "LOAD %s.S19\n", linkp->f_idp ); - } else - if (oflag == 3) { - ofp = afile(linkp->f_idp, "elf", 4); - if (ofp == NULL) { - lkexit(1); - } - } - } else { - /* - * Link in library files - */ - library(); - reloc('E'); - } - } - //JCF: - //CreateAOMF51(); + */ + if (mflag || jflag) + map(); + + if (sflag) /*JCF: memory usage summary output*/ + if(summary(areap))lkexit(1); + + if (iram_size) + iramcheck(); + + /* + * Open output file + */ + if (oflag == 1) { + ofp = afile(linkp->f_idp, "ihx", 1); + if (ofp == NULL) { + lkexit(1); + } + /* include NoICE command to load hex file */ + if (jfp) fprintf( jfp, "LOAD %s.IHX\n", linkp->f_idp ); + + } else + if (oflag == 2) { + ofp = afile(linkp->f_idp, "S19", 1); + if (ofp == NULL) { + lkexit(1); + } + /* include NoICE command to load hex file */ + if (jfp) fprintf( jfp, "LOAD %s.S19\n", linkp->f_idp ); + } else + if (oflag == 3) { + ofp = afile(linkp->f_idp, "elf", 4); + if (ofp == NULL) { + lkexit(1); + } + } + } else { + /* + * Link in library files + */ + library(); + reloc('E'); + } + } + //JCF: + //CreateAOMF51(); #ifdef WIN32T Timer(1, "Linker execution time"); #endif - lkexit(lkerr); - return 0; + lkexit(lkerr); + return 0; } -/*)Function VOID lkexit(i) +/*)Function VOID lkexit(i) * - * int i exit code + * int i exit code * - * The function lkexit() explicitly closes all open - * files and then terminates the program. + * The function lkexit() explicitly closes all open + * files and then terminates the program. * - * local variables: - * none + * local variables: + * none * - * global variables: - * FILE * mfp file handle for .map - * FILE * ofp file handle for .ihx/.s19 - * FILE * rfp file hanlde for .rst - * FILE * sfp file handle for .rel - * FILE * tfp file handle for .lst + * global variables: + * FILE * mfp file handle for .map + * FILE * ofp file handle for .ihx/.s19 + * FILE * rfp file hanlde for .rst + * FILE * sfp file handle for .rel + * FILE * tfp file handle for .lst * - * functions called: - * int fclose() c_library - * VOID exit() c_library + * functions called: + * int fclose() c_library + * VOID exit() c_library * - * side effects: - * All files closed. Program terminates. + * side effects: + * All files closed. Program terminates. */ VOID lkexit(int i) { - if (mfp != NULL) fclose(mfp); - if (jfp != NULL) fclose(jfp); - if (ofp != NULL) fclose(ofp); - if (rfp != NULL) fclose(rfp); - if (sfp != NULL) fclose(sfp); - if (tfp != NULL) fclose(tfp); - if (dfp != NULL) fclose(dfp); - /*if (dfp != NULL) - FILE *xfp = afile(linkp->f_idp,"cdb",1); - dfp = freopen("temp.cdb","r",dfp); - copyfile(xfp,dfp); - fclose(xfp); - fclose(dfp); - remove("temp.cdb"); - }*/ - exit(i); + if (mfp != NULL) fclose(mfp); + if (jfp != NULL) fclose(jfp); + if (ofp != NULL) fclose(ofp); + if (rfp != NULL) fclose(rfp); + if (sfp != NULL) fclose(sfp); + if (tfp != NULL) fclose(tfp); + if (dfp != NULL) fclose(dfp); + /*if (dfp != NULL) + FILE *xfp = afile(linkp->f_idp,"cdb",1); + dfp = freopen("temp.cdb","r",dfp); + copyfile(xfp,dfp); + fclose(xfp); + fclose(dfp); + remove("temp.cdb"); + }*/ + exit(i); } -/*)Function link_main() - * - * The function link_main() evaluates the directives for each line of - * text read from the .rel file(s). The valid directives processed - * are: - * X, D, Q, H, M, A, S, T, R, and P. - * - * local variables: - * int c first non blank character of a line - * - * global variables: - * head *headp The pointer to the first - * head structure of a linked list - * head *hp Pointer to the current - * head structure - * int pass linker pass number - * int radix current number conversion radix - * - * functions called: - * char endline() lklex.c - * VOID module() lkhead.c - * VOID newarea() lkarea.c - * VOID newhead() lkhead.c - * sym * newsym() lksym.c - * VOID reloc() lkreloc.c - * - * side effects: - * Head, area, and symbol structures are created and - * the radix is set as the .rel file(s) are read. +/*)Function link_main() + * + * The function link_main() evaluates the directives for each line of + * text read from the .rel file(s). The valid directives processed + * are: + * X, D, Q, H, M, A, S, T, R, and P. + * + * local variables: + * int c first non blank character of a line + * + * global variables: + * head *headp The pointer to the first + * head structure of a linked list + * head *hp Pointer to the current + * head structure + * int pass linker pass number + * int radix current number conversion radix + * + * functions called: + * char endline() lklex.c + * VOID module() lkhead.c + * VOID newarea() lkarea.c + * VOID newhead() lkhead.c + * sym * newsym() lksym.c + * VOID reloc() lkreloc.c + * + * side effects: + * Head, area, and symbol structures are created and + * the radix is set as the .rel file(s) are read. */ VOID link_main() { - register char c; + register char c; - if ((c=endline()) == 0) { return; } - switch (c) { + if ((c=endline()) == 0) { return; } + switch (c) { case 'O': /*For some important sdcc options*/ if (pass == 0) @@ -476,758 +476,758 @@ link_main() { if(strcmp(sdccopt, &ip[1])!=0) { - fprintf(stderr, - "?ASlink-Warning-Conflicting sdcc options:\n" + fprintf(stderr, + "?ASlink-Warning-Conflicting sdcc options:\n" " \"%s\" in module \"%s\" and\n" " \"%s\" in module \"%s\".\n", sdccopt, sdccopt_module, &ip[1], curr_module); - lkerr++; + lkerr++; } } } - break; - - case 'X': - radix = 16; - break; - - case 'D': - radix = 10; - break; - - case 'Q': - radix = 8; - break; - - case 'H': - if (pass == 0) { - newhead(); - } else { - if (hp == 0) { - hp = headp; - } else { - hp = hp->h_hp; - } - } - sdp.s_area = NULL; - sdp.s_areax = NULL; - sdp.s_addr = 0; - break; - - case 'M': - if (pass == 0) + break; + + case 'X': + radix = 16; + break; + + case 'D': + radix = 10; + break; + + case 'Q': + radix = 8; + break; + + case 'H': + if (pass == 0) { + newhead(); + } else { + if (hp == 0) { + hp = headp; + } else { + hp = hp->h_hp; + } + } + sdp.s_area = NULL; + sdp.s_areax = NULL; + sdp.s_addr = 0; + break; + + case 'M': + if (pass == 0) { strcpy(curr_module, &ip[1]); - module(); + module(); + } + break; + + case 'A': + if (pass == 0) + newarea(); + if (sdp.s_area == NULL) { + sdp.s_area = areap; + sdp.s_areax = areap->a_axp; + sdp.s_addr = 0; + } + break; + + case 'S': + if (pass == 0) + newsym(); + break; + + case 'T': + case 'R': + case 'P': + if (pass == 0) + break; + reloc(c); + break; + + default: + break; + } + if (c == 'X' || c == 'D' || c == 'Q') { + if ((c = get()) == 'H') { + hilo = 1; + } else + if (c == 'L') { + hilo = 0; + } } - break; - - case 'A': - if (pass == 0) - newarea(); - if (sdp.s_area == NULL) { - sdp.s_area = areap; - sdp.s_areax = areap->a_axp; - sdp.s_addr = 0; - } - break; - - case 'S': - if (pass == 0) - newsym(); - break; - - case 'T': - case 'R': - case 'P': - if (pass == 0) - break; - reloc(c); - break; - - default: - break; - } - if (c == 'X' || c == 'D' || c == 'Q') { - if ((c = get()) == 'H') { - hilo = 1; - } else - if (c == 'L') { - hilo = 0; - } - } } -/*)Function VOID map() - * - * The function map() opens the output map file and calls the various - * routines to - * (1) output the variables in each area, - * (2) list the files processed with module names, - * (3) list the libraries file processed, - * (4) list base address definitions, - * (5) list global variable definitions, and - * (6) list any undefined variables. - * - * local variables: - * int i counter - * head * hdp pointer to head structure - * lbfile *lbfh pointer to library file structure - * - * global variables: - * area *ap Pointer to the current - * area structure - * area *areap The pointer to the first - * area structure of a linked list - * base *basep The pointer to the first - * base structure - * base *bsp Pointer to the current - * base structure - * lfile *filep The pointer *filep points to the - * beginning of a linked list of - * lfile structures. - * globl *globlp The pointer to the first - * globl structure - * globl *gsp Pointer to the current - * globl structure - * head *headp The pointer to the first - * head structure of a linked list - * lbfile *lbfhead The pointer to the first - * lbfile structure of a linked list - * lfile *linkp pointer to first lfile structure - * containing an input REL file - * specification - * int lop current line number on page - * FILE *mfp Map output file handle - * int page current page number - * - * functions called: - * FILE * afile() lkmain.c - * int fprintf() c_library - * VOID lkexit() lkmain.c - * VOID lstarea() lklist.c - * VOID newpag() lklist.c - * VOID symdef() lksym.c - * - * side effects: - * The map file is created. +/*)Function VOID map() + * + * The function map() opens the output map file and calls the various + * routines to + * (1) output the variables in each area, + * (2) list the files processed with module names, + * (3) list the libraries file processed, + * (4) list base address definitions, + * (5) list global variable definitions, and + * (6) list any undefined variables. + * + * local variables: + * int i counter + * head * hdp pointer to head structure + * lbfile *lbfh pointer to library file structure + * + * global variables: + * area *ap Pointer to the current + * area structure + * area *areap The pointer to the first + * area structure of a linked list + * base *basep The pointer to the first + * base structure + * base *bsp Pointer to the current + * base structure + * lfile *filep The pointer *filep points to the + * beginning of a linked list of + * lfile structures. + * globl *globlp The pointer to the first + * globl structure + * globl *gsp Pointer to the current + * globl structure + * head *headp The pointer to the first + * head structure of a linked list + * lbfile *lbfhead The pointer to the first + * lbfile structure of a linked list + * lfile *linkp pointer to first lfile structure + * containing an input REL file + * specification + * int lop current line number on page + * FILE *mfp Map output file handle + * int page current page number + * + * functions called: + * FILE * afile() lkmain.c + * int fprintf() c_library + * VOID lkexit() lkmain.c + * VOID lstarea() lklist.c + * VOID newpag() lklist.c + * VOID symdef() lksym.c + * + * side effects: + * The map file is created. */ VOID map() { - register int i; - register struct head *hdp; - register struct lbfile *lbfh; - - /* - * Open Map File - */ - mfp = afile(linkp->f_idp, "map", 1); - if (mfp == NULL) { - lkexit(1); - } - - /* - * Output Map Area Lists - */ - page = 0; - lop = NLPP; - ap = areap; - while (ap) { - lstarea(ap); - ap = ap->a_ap; - } - /* - * List Linked Files - */ - newpag(mfp); - fprintf(mfp, "\nFiles Linked [ module(s) ]\n\n"); - hdp = headp; - filep = linkp; - while (filep) { - fprintf(mfp, "%-16s", filep->f_idp); - i = 0; - while ((hdp != NULL) && (hdp->h_lfile == filep)) { - if (i % 5) { - fprintf(mfp, ", %8.8s", hdp->m_id); - } else { - if (i) { - fprintf(mfp, ",\n%20s%8.8s", "", hdp->m_id); - } else { - fprintf(mfp, " [ %8.8s", hdp->m_id); - } - } - hdp = hdp->h_hp; - i++; - } - if (i) - fprintf(mfp, " ]"); - fprintf(mfp, "\n"); - filep = filep->f_flp; - } - /* - * List Linked Libraries - */ - if (lbfhead != NULL) { - fprintf(mfp, - "\nLibraries Linked [ object file ]\n\n"); - for (lbfh=lbfhead; lbfh; lbfh=lbfh->next) { - fprintf(mfp, "%-32s [ %16.16s ]\n", - lbfh->libspc, lbfh->relfil); - } - fprintf(mfp, "\n"); - } - /* - * List Base Address Definitions - */ - if (basep) { - newpag(mfp); - fprintf(mfp, "\nUser Base Address Definitions\n\n"); - bsp = basep; - while (bsp) { - fprintf(mfp, "%s\n", bsp->b_strp); - bsp = bsp->b_base; - } - } - /* - * List Global Definitions - */ - if (globlp) { - newpag(mfp); - fprintf(mfp, "\nUser Global Definitions\n\n"); - gsp = globlp; - while (gsp) { - fprintf(mfp, "%s\n", gsp->g_strp); - gsp = gsp->g_globl; - } - } - fprintf(mfp, "\n\f"); - symdef(mfp); + register int i; + register struct head *hdp; + register struct lbfile *lbfh; + + /* + * Open Map File + */ + mfp = afile(linkp->f_idp, "map", 1); + if (mfp == NULL) { + lkexit(1); + } + + /* + * Output Map Area Lists + */ + page = 0; + lop = NLPP; + ap = areap; + while (ap) { + lstarea(ap); + ap = ap->a_ap; + } + /* + * List Linked Files + */ + newpag(mfp); + fprintf(mfp, "\nFiles Linked [ module(s) ]\n\n"); + hdp = headp; + filep = linkp; + while (filep) { + fprintf(mfp, "%-16s", filep->f_idp); + i = 0; + while ((hdp != NULL) && (hdp->h_lfile == filep)) { + if (i % 5) { + fprintf(mfp, ", %8.8s", hdp->m_id); + } else { + if (i) { + fprintf(mfp, ",\n%20s%8.8s", "", hdp->m_id); + } else { + fprintf(mfp, " [ %8.8s", hdp->m_id); + } + } + hdp = hdp->h_hp; + i++; + } + if (i) + fprintf(mfp, " ]"); + fprintf(mfp, "\n"); + filep = filep->f_flp; + } + /* + * List Linked Libraries + */ + if (lbfhead != NULL) { + fprintf(mfp, + "\nLibraries Linked [ object file ]\n\n"); + for (lbfh=lbfhead; lbfh; lbfh=lbfh->next) { + fprintf(mfp, "%-32s [ %16.16s ]\n", + lbfh->libspc, lbfh->relfil); + } + fprintf(mfp, "\n"); + } + /* + * List Base Address Definitions + */ + if (basep) { + newpag(mfp); + fprintf(mfp, "\nUser Base Address Definitions\n\n"); + bsp = basep; + while (bsp) { + fprintf(mfp, "%s\n", bsp->b_strp); + bsp = bsp->b_base; + } + } + /* + * List Global Definitions + */ + if (globlp) { + newpag(mfp); + fprintf(mfp, "\nUser Global Definitions\n\n"); + gsp = globlp; + while (gsp) { + fprintf(mfp, "%s\n", gsp->g_strp); + gsp = gsp->g_globl; + } + } + fprintf(mfp, "\n\f"); + symdef(mfp); } -/*)Function int parse() - * - * The function parse() evaluates all command line or file input - * linker directives and updates the appropriate variables. - * - * local variables: - * int c character value - * char fid[] file id string - * - * global variables: - * char ctype[] array of character types, one per - * ASCII character - * lfile *lfp pointer to current lfile structure - * being processed by parse() - * lfile *linkp pointer to first lfile structure - * containing an input REL file - * specification - * int mflag Map output flag - * int oflag Output file type flag - * int pflag print linker command file flag - * FILE * stderr c_library - * int uflag Relocated listing flag - * int xflag Map file radix type flag - * - * Functions called: - * VOID addlib() lklibr.c - * VOID addpath() lklibr.c - * VOID bassav() lkmain.c - * int fprintf() c_library - * VOID gblsav() lkmain.c - * VOID getfid() lklex.c - * char getnb() lklex.c - * VOID lkexit() lkmain.c - * char * strcpy() c_library - * int strlen() c_library - * - * side effects: - * Various linker flags are updated and the linked - * structure lfile is created. +/*)Function int parse() + * + * The function parse() evaluates all command line or file input + * linker directives and updates the appropriate variables. + * + * local variables: + * int c character value + * char fid[] file id string + * + * global variables: + * char ctype[] array of character types, one per + * ASCII character + * lfile *lfp pointer to current lfile structure + * being processed by parse() + * lfile *linkp pointer to first lfile structure + * containing an input REL file + * specification + * int mflag Map output flag + * int oflag Output file type flag + * int pflag print linker command file flag + * FILE * stderr c_library + * int uflag Relocated listing flag + * int xflag Map file radix type flag + * + * Functions called: + * VOID addlib() lklibr.c + * VOID addpath() lklibr.c + * VOID bassav() lkmain.c + * int fprintf() c_library + * VOID gblsav() lkmain.c + * VOID getfid() lklex.c + * char getnb() lklex.c + * VOID lkexit() lkmain.c + * char * strcpy() c_library + * int strlen() c_library + * + * side effects: + * Various linker flags are updated and the linked + * structure lfile is created. */ int parse() { - register int c; - char fid[NINPUT]; - - while ((c = getnb()) != 0) { - if ( c == ';') - return(0); - if ( c == '-') { - while (ctype[c=get()] & LETTER) { - switch(c) { - - case 'i': - case 'I': - oflag = 1; - break; - - case 's': - case 'S': - oflag = 2; - break; - - case 't': - case 'T': - oflag = 3; - break; - - case 'm': - case 'M': - ++mflag; - break; - - case 'y': /*JCF: memory usage summary output*/ - case 'Y': - ++sflag; - break; - - case 'j': - case 'J': - jflag = 1; - break; - - case 'u': - case 'U': - uflag = 1; - break; - case 'r': - case 'R': - rflag = 1; - break; - case 'x': - case 'X': - xflag = 0; - break; - - case 'q': - case 'Q': - xflag = 1; - break; - - case 'd': - case 'D': - xflag = 2; - break; - - case 'e': - case 'E': - return(1); - - case 'n': - case 'N': - pflag = 0; - break; - - case 'p': - case 'P': - pflag = 1; - break; - - case 'b': - case 'B': - bassav(); - return(0); - - case 'g': - case 'G': - gblsav(); - return(0); - - case 'k': - case 'K': - addpath(); - return(0); - - case 'l': - case 'L': - addlib(); - return(0); - - case 'a': - case 'A': - iramsav(); - return(0); - - case 'v': - case 'V': - xramsav(); - return(0); - - case 'w': - case 'W': - codesav(); - return(0); - - case 'z': + register int c; + char fid[NINPUT]; + + while ((c = getnb()) != 0) { + if ( c == ';') + return(0); + if ( c == '-') { + while (ctype[c=get()] & LETTER) { + switch(c) { + + case 'i': + case 'I': + oflag = 1; + break; + + case 's': + case 'S': + oflag = 2; + break; + + case 't': + case 'T': + oflag = 3; + break; + + case 'm': + case 'M': + ++mflag; + break; + + case 'y': /*JCF: memory usage summary output*/ + case 'Y': + ++sflag; + break; + + case 'j': + case 'J': + jflag = 1; + break; + + case 'u': + case 'U': + uflag = 1; + break; + case 'r': + case 'R': + rflag = 1; + break; + case 'x': + case 'X': + xflag = 0; + break; + + case 'q': + case 'Q': + xflag = 1; + break; + + case 'd': + case 'D': + xflag = 2; + break; + + case 'e': + case 'E': + return(1); + + case 'n': + case 'N': + pflag = 0; + break; + + case 'p': + case 'P': + pflag = 1; + break; + + case 'b': + case 'B': + bassav(); + return(0); + + case 'g': + case 'G': + gblsav(); + return(0); + + case 'k': + case 'K': + addpath(); + return(0); + + case 'l': + case 'L': + addlib(); + return(0); + + case 'a': + case 'A': + iramsav(); + return(0); + + case 'v': + case 'V': + xramsav(); + return(0); + + case 'w': + case 'W': + codesav(); + return(0); + + case 'z': case 'Z': - dflag = 1; - return(0); - default: - fprintf(stderr, "Invalid option\n"); - lkexit(1); - } - } - if ( c == ';') - return(0); - } else + dflag = 1; + return(0); + default: + fprintf(stderr, "Invalid option\n"); + lkexit(1); + } + } + if ( c == ';') + return(0); + } else if (ctype[c] & ILL) { fprintf(stderr, "Invalid input"); lkexit(1); } else { - if (linkp == NULL) { - linkp = (struct lfile *) - new (sizeof (struct lfile)); - lfp = linkp; - } else { - lfp->f_flp = (struct lfile *) - new (sizeof (struct lfile)); - lfp = lfp->f_flp; - } - getfid(fid, c); - lfp->f_idp = (char *) new (strlen(fid)+1); - strcpy(lfp->f_idp, fid); - lfp->f_type = F_REL; - } - } - return(0); + if (linkp == NULL) { + linkp = (struct lfile *) + new (sizeof (struct lfile)); + lfp = linkp; + } else { + lfp->f_flp = (struct lfile *) + new (sizeof (struct lfile)); + lfp = lfp->f_flp; + } + getfid(fid, c); + lfp->f_idp = (char *) new (strlen(fid)+1); + strcpy(lfp->f_idp, fid); + lfp->f_type = F_REL; + } + } + return(0); } -/*)Function VOID bassav() +/*)Function VOID bassav() * - * The function bassav() creates a linked structure containing - * the base address strings input to the linker. + * The function bassav() creates a linked structure containing + * the base address strings input to the linker. * - * local variables: - * none + * local variables: + * none * - * global variables: - * base *basep The pointer to the first - * base structure - * base *bsp Pointer to the current - * base structure - * char *ip pointer into the REL file - * text line in ib[] + * global variables: + * base *basep The pointer to the first + * base structure + * base *bsp Pointer to the current + * base structure + * char *ip pointer into the REL file + * text line in ib[] * - * functions called: - * char getnb() lklex.c - * VOID * new() lksym.c - * int strlen() c_library - * char * strcpy() c_library - * VOID unget() lklex.c + * functions called: + * char getnb() lklex.c + * VOID * new() lksym.c + * int strlen() c_library + * char * strcpy() c_library + * VOID unget() lklex.c * - * side effects: - * The basep structure is created. + * side effects: + * The basep structure is created. */ VOID bassav() { - if (basep == NULL) { - basep = (struct base *) - new (sizeof (struct base)); - bsp = basep; - } else { - bsp->b_base = (struct base *) - new (sizeof (struct base)); - bsp = bsp->b_base; - } - unget(getnb()); - bsp->b_strp = (char *) new (strlen(ip)+1); - strcpy(bsp->b_strp, ip); + if (basep == NULL) { + basep = (struct base *) + new (sizeof (struct base)); + bsp = basep; + } else { + bsp->b_base = (struct base *) + new (sizeof (struct base)); + bsp = bsp->b_base; + } + unget(getnb()); + bsp->b_strp = (char *) new (strlen(ip)+1); + strcpy(bsp->b_strp, ip); } -/*)Function VOID setbas() - * - * The function setbas() scans the base address lines in the - * basep structure, evaluates the arguments, and sets beginning - * address of the specified areas. - * - * local variables: - * int v expression value - * char id[] base id string - * - * global variables: - * area *ap Pointer to the current - * area structure - * area *areap The pointer to the first - * area structure of a linked list - * base *basep The pointer to the first - * base structure - * base *bsp Pointer to the current - * base structure - * char *ip pointer into the REL file - * text line in ib[] - * int lkerr error flag - * - * functions called: - * Addr_T expr() lkeval.c - * int fprintf() c_library - * VOID getid() lklex.c - * char getnb() lklex.c - * int symeq() lksym.c - * - * side effects: - * The base address of an area is set. +/*)Function VOID setbas() + * + * The function setbas() scans the base address lines in the + * basep structure, evaluates the arguments, and sets beginning + * address of the specified areas. + * + * local variables: + * int v expression value + * char id[] base id string + * + * global variables: + * area *ap Pointer to the current + * area structure + * area *areap The pointer to the first + * area structure of a linked list + * base *basep The pointer to the first + * base structure + * base *bsp Pointer to the current + * base structure + * char *ip pointer into the REL file + * text line in ib[] + * int lkerr error flag + * + * functions called: + * Addr_T expr() lkeval.c + * int fprintf() c_library + * VOID getid() lklex.c + * char getnb() lklex.c + * int symeq() lksym.c + * + * side effects: + * The base address of an area is set. */ VOID setbas() { - register int v; - char id[NCPS]; - - bsp = basep; - while (bsp) { - ip = bsp->b_strp; - getid(id, -1); - if (getnb() == '=') { - v = expr(0); - for (ap = areap; ap != NULL; ap = ap->a_ap) { - if (symeq(id, ap->a_id)) - break; - } - if (ap == NULL) { - fprintf(stderr, - "ASlink-Warning-No definition of area %s\n", id); - lkerr++; - } else { - ap->a_addr = v; - ap->a_type = 1; /* JLH: value set */ - } - } else { - fprintf(stderr, "ASlink-Warning-No '=' in base expression"); - lkerr++; - } - bsp = bsp->b_base; - } + register int v; + char id[NCPS]; + + bsp = basep; + while (bsp) { + ip = bsp->b_strp; + getid(id, -1); + if (getnb() == '=') { + v = expr(0); + for (ap = areap; ap != NULL; ap = ap->a_ap) { + if (symeq(id, ap->a_id)) + break; + } + if (ap == NULL) { + fprintf(stderr, + "ASlink-Warning-No definition of area %s\n", id); + lkerr++; + } else { + ap->a_addr = v; + ap->a_type = 1; /* JLH: value set */ + } + } else { + fprintf(stderr, "ASlink-Warning-No '=' in base expression"); + lkerr++; + } + bsp = bsp->b_base; + } } -/*)Function VOID gblsav() +/*)Function VOID gblsav() * - * The function gblsav() creates a linked structure containing - * the global variable strings input to the linker. + * The function gblsav() creates a linked structure containing + * the global variable strings input to the linker. * - * local variable: - * none + * local variable: + * none * - * global variables: - * globl *globlp The pointer to the first - * globl structure - * globl *gsp Pointer to the current - * globl structure - * char *ip pointer into the REL file - * text line in ib[] - * int lkerr error flag + * global variables: + * globl *globlp The pointer to the first + * globl structure + * globl *gsp Pointer to the current + * globl structure + * char *ip pointer into the REL file + * text line in ib[] + * int lkerr error flag * - * functions called: - * char getnb() lklex.c - * VOID * new() lksym.c - * int strlen() c_library - * char * strcpy() c_library - * VOID unget() lklex.c + * functions called: + * char getnb() lklex.c + * VOID * new() lksym.c + * int strlen() c_library + * char * strcpy() c_library + * VOID unget() lklex.c * - * side effects: - * The globlp structure is created. + * side effects: + * The globlp structure is created. */ VOID gblsav() { - if (globlp == NULL) { - globlp = (struct globl *) - new (sizeof (struct globl)); - gsp = globlp; - } else { - gsp->g_globl = (struct globl *) - new (sizeof (struct globl)); - gsp = gsp->g_globl; - } - unget(getnb()); - gsp->g_strp = (char *) new (strlen(ip)+1); - strcpy(gsp->g_strp, ip); + if (globlp == NULL) { + globlp = (struct globl *) + new (sizeof (struct globl)); + gsp = globlp; + } else { + gsp->g_globl = (struct globl *) + new (sizeof (struct globl)); + gsp = gsp->g_globl; + } + unget(getnb()); + gsp->g_strp = (char *) new (strlen(ip)+1); + strcpy(gsp->g_strp, ip); } -/*)Function VOID setgbl() - * - * The function setgbl() scans the global variable lines in the - * globlp structure, evaluates the arguments, and sets a variable - * to this value. - * - * local variables: - * int v expression value - * char id[] base id string - * sym * sp pointer to a symbol structure - * - * global variables: - * char *ip pointer into the REL file - * text line in ib[] - * globl *globlp The pointer to the first - * globl structure - * globl *gsp Pointer to the current - * globl structure - * FILE * stderr c_library - * int lkerr error flag - * - * functions called: - * Addr_T expr() lkeval.c - * int fprintf() c_library - * VOID getid() lklex.c - * char getnb() lklex.c - * sym * lkpsym() lksym.c - * - * side effects: - * The value of a variable is set. +/*)Function VOID setgbl() + * + * The function setgbl() scans the global variable lines in the + * globlp structure, evaluates the arguments, and sets a variable + * to this value. + * + * local variables: + * int v expression value + * char id[] base id string + * sym * sp pointer to a symbol structure + * + * global variables: + * char *ip pointer into the REL file + * text line in ib[] + * globl *globlp The pointer to the first + * globl structure + * globl *gsp Pointer to the current + * globl structure + * FILE * stderr c_library + * int lkerr error flag + * + * functions called: + * Addr_T expr() lkeval.c + * int fprintf() c_library + * VOID getid() lklex.c + * char getnb() lklex.c + * sym * lkpsym() lksym.c + * + * side effects: + * The value of a variable is set. */ VOID setgbl() { - register int v; - register struct sym *sp; - char id[NCPS]; - - gsp = globlp; - while (gsp) { - ip = gsp->g_strp; - getid(id, -1); - if (getnb() == '=') { - v = expr(0); - sp = lkpsym(id, 0); - if (sp == NULL) { - fprintf(stderr, - "No definition of symbol %s\n", id); - lkerr++; - } else { - if (sp->s_flag & S_DEF) { - fprintf(stderr, - "Redefinition of symbol %s\n", id); - lkerr++; - sp->s_axp = NULL; - } - sp->s_addr = v; - sp->s_type |= S_DEF; - } - } else { - fprintf(stderr, "No '=' in global expression"); - lkerr++; - } - gsp = gsp->g_globl; - } + register int v; + register struct sym *sp; + char id[NCPS]; + + gsp = globlp; + while (gsp) { + ip = gsp->g_strp; + getid(id, -1); + if (getnb() == '=') { + v = expr(0); + sp = lkpsym(id, 0); + if (sp == NULL) { + fprintf(stderr, + "No definition of symbol %s\n", id); + lkerr++; + } else { + if (sp->s_flag & S_DEF) { + fprintf(stderr, + "Redefinition of symbol %s\n", id); + lkerr++; + sp->s_axp = NULL; + } + sp->s_addr = v; + sp->s_type |= S_DEF; + } + } else { + fprintf(stderr, "No '=' in global expression"); + lkerr++; + } + gsp = gsp->g_globl; + } } -/*)Function FILE * afile(fn,, ft, wf) +/*)Function FILE * afile(fn,, ft, wf) * - * char * fn file specification string - * char * ft file type string - * int wf read(0)/write(1) flag + * char * fn file specification string + * char * ft file type string + * int wf read(0)/write(1) flag * - * The function afile() opens a file for reading or writing. - * (1) If the file type specification string ft - * is not NULL then a file specification is - * constructed with the file path\name in fn - * and the extension in ft. - * (2) If the file type specification string ft - * is NULL then the file specification is - * constructed from fn. If fn does not have - * a file type then the default .rel file - * type is appended to the file specification. + * The function afile() opens a file for reading or writing. + * (1) If the file type specification string ft + * is not NULL then a file specification is + * constructed with the file path\name in fn + * and the extension in ft. + * (2) If the file type specification string ft + * is NULL then the file specification is + * constructed from fn. If fn does not have + * a file type then the default .rel file + * type is appended to the file specification. * - * afile() returns a file handle for the opened file or aborts - * the assembler on an open error. + * afile() returns a file handle for the opened file or aborts + * the assembler on an open error. * - * local variables: - * char fb[] constructed file specification string - * FILE * fp filehandle for opened file + * local variables: + * char fb[] constructed file specification string + * FILE * fp filehandle for opened file * - * global variables: - * int lkerr error flag + * global variables: + * int lkerr error flag * - * functions called: - * FILE * fopen() c_library - * int fprintf() c_library + * functions called: + * FILE * fopen() c_library + * int fprintf() c_library * - * side effects: - * File is opened for read or write. + * side effects: + * File is opened for read or write. */ FILE * afile(char *fn, char *ft, int wf) { - FILE *fp; - char fb[PATH_MAX]; - char *omode; - int i; - - switch (wf) { - case 0: omode = "r"; break; - case 1: omode = "w"; break; - case 2: omode = "a"; break; - case 3: omode = "rb"; break; - case 4: omode = "wb"; break; - case 5: omode = "ab"; break; - default: omode = "r"; break; - } - - /*Look backward the name path and get rid of the extension, if any*/ - i=strlen(fn); - for(; (fn[i]!='.')&&(fn[i]!='\\')&&(fn[i]!='/')&&(i>0); i--); - if( (fn[i]=='.') && strcmp(ft, "lnk") ) - { - strncpy(fb, fn, i); - fb[i]=0; - } - else - { - strcpy(fb, fn); - } - - /*Add the extension*/ - if (fb[i] != '.') - { - strcat(fb, "."); - strcat(fb, strlen(ft)?ft:"rel"); - } - - fp = fopen(fb, omode); - if (fp==NULL) - { - if (strcmp(ft,"adb"))/*Do not complaint for optional adb files*/ - { - fprintf(stderr, "%s: cannot %s.\n", fb, wf?"create":"open"); - lkerr++; - } - } - return (fp); + FILE *fp; + char fb[PATH_MAX]; + char *omode; + int i; + + switch (wf) { + case 0: omode = "r"; break; + case 1: omode = "w"; break; + case 2: omode = "a"; break; + case 3: omode = "rb"; break; + case 4: omode = "wb"; break; + case 5: omode = "ab"; break; + default: omode = "r"; break; + } + + /*Look backward the name path and get rid of the extension, if any*/ + i=strlen(fn); + for(; (fn[i]!='.')&&(fn[i]!='\\')&&(fn[i]!='/')&&(i>0); i--); + if( (fn[i]=='.') && strcmp(ft, "lnk") ) + { + strncpy(fb, fn, i); + fb[i]=0; + } + else + { + strcpy(fb, fn); + } + + /*Add the extension*/ + if (fb[i] != '.') + { + strcat(fb, "."); + strcat(fb, strlen(ft)?ft:"rel"); + } + + fp = fopen(fb, omode); + if (fp==NULL) + { + if (strcmp(ft,"adb"))/*Do not complaint for optional adb files*/ + { + fprintf(stderr, "%s: cannot %s.\n", fb, wf?"create":"open"); + lkerr++; + } + } + return (fp); } -/*)Function VOID iramsav() +/*)Function VOID iramsav() * - * The function iramsav() stores the size of the chip's internal RAM. - * This is used after linking to check that variable assignment to this - * dataspace didn't overflow into adjoining segments. Variables in the - * DSEG, OSEG, and ISEG are assigned to this dataspace. + * The function iramsav() stores the size of the chip's internal RAM. + * This is used after linking to check that variable assignment to this + * dataspace didn't overflow into adjoining segments. Variables in the + * DSEG, OSEG, and ISEG are assigned to this dataspace. * - * local variables: - * none + * local variables: + * none * - * global variables: - * char *ip pointer into the REL file - * text line in ib[] - * unsigned int size of chip's internal - * iram_size RAM segment + * global variables: + * char *ip pointer into the REL file + * text line in ib[] + * unsigned int size of chip's internal + * iram_size RAM segment * - * functions called: - * char getnb() lklex.c - * VOID unget() lklex.c - * Addr_T expr() lkeval.c + * functions called: + * char getnb() lklex.c + * VOID unget() lklex.c + * Addr_T expr() lkeval.c * - * side effects: - * The iram_size may be modified. + * side effects: + * The iram_size may be modified. */ VOID @@ -1235,9 +1235,9 @@ iramsav() { unget(getnb()); if (ip && *ip) - iram_size = expr(0); /* evaluate size expression */ + iram_size = expr(0); /* evaluate size expression */ else - iram_size = 128; /* Default is 128 (0x80) bytes */ + iram_size = 128; /* Default is 128 (0x80) bytes */ } /*Similar to iramsav but for xram memory*/ @@ -1246,9 +1246,9 @@ xramsav() { unget(getnb()); if (ip && *ip) - xram_size = expr(0); /* evaluate size expression */ + xram_size = expr(0); /* evaluate size expression */ else - xram_size = rflag?0x1000000:0x10000; + xram_size = rflag?0x1000000:0x10000; } /*Similar to iramsav but for code memory*/ @@ -1257,31 +1257,31 @@ codesav() { unget(getnb()); if (ip && *ip) - code_size = expr(0); /* evaluate size expression */ + code_size = expr(0); /* evaluate size expression */ else - code_size = rflag?0x1000000:0x10000; + code_size = rflag?0x1000000:0x10000; } -/*)Function VOID iramcheck() +/*)Function VOID iramcheck() * - * The function iramcheck() is used at the end of linking to check that - * the internal RAM area wasn't overflowed by too many variable - * assignments. Variables in the DSEG, ISEG, and OSEG are assigned to - * the chip's internal RAM. + * The function iramcheck() is used at the end of linking to check that + * the internal RAM area wasn't overflowed by too many variable + * assignments. Variables in the DSEG, ISEG, and OSEG are assigned to + * the chip's internal RAM. * - * local variables: - * none + * local variables: + * none * - * global variables: - * unsigned int size of chip's internal - * iram_size RAM segment - * struct area linked list of memory - * *areap areas + * global variables: + * unsigned int size of chip's internal + * iram_size RAM segment + * struct area linked list of memory + * *areap areas * - * functions called: + * functions called: * - * side effects: + * side effects: */ VOID @@ -1300,75 +1300,75 @@ iramcheck() { last_addr = ap->a_addr + ap->a_size - 1; if (last_addr >= iram_size) - fprintf(stderr, - "\nWARNING! Segment %s extends past the end\n" - " of internal RAM. Check map file.\n", - ap->a_id); + fprintf(stderr, + "\nWARNING! Segment %s extends past the end\n" + " of internal RAM. Check map file.\n", + ap->a_id); } } } char *usetxt[] = { - "Startup:", - " -c Command line input", - " -f file[LNK] File input", - " -p Prompt and echo of file[LNK] to stdout (default)", - " -n No echo of file[LNK] to stdout", -/* "Usage: [-Options] file [file ...]", */ - "Libraries:", - " -k Library path specification, one per -k", - " -l Library file specification, one per -l", - "Relocation:", - " -b area base address = expression", - " -g global symbol = expression", - "Map format:", - " -m Map output generated as file[MAP]", - " -x Hexadecimal (default), -d Decimal, -q Octal", - "Output:", - " -i Intel Hex as file[IHX]", - " -s Motorola S19 as file[S19]", + "Startup:", + " -c Command line input", + " -f file[LNK] File input", + " -p Prompt and echo of file[LNK] to stdout (default)", + " -n No echo of file[LNK] to stdout", +/* "Usage: [-Options] file [file ...]", */ + "Libraries:", + " -k Library path specification, one per -k", + " -l Library file specification, one per -l", + "Relocation:", + " -b area base address = expression", + " -g global symbol = expression", + "Map format:", + " -m Map output generated as file[MAP]", + " -x Hexadecimal (default), -d Decimal, -q Octal", + "Output:", + " -i Intel Hex as file[IHX]", + " -s Motorola S19 as file[S19]", " -t ELF executable as file[elf]", - " -j Produce NoICE debug as file[NOI]", - " -z Produce SDCdb debug as file[cdb]", -/* "List:", */ - " -u Update listing file(s) with link data as file(s)[.RST]", - "Miscellaneous:\n" - " -a [iram-size] Check for internal RAM overflow", - " -v [xram-size] Check for external RAM overflow", - " -w [code-size] Check for code overflow", - "End:", - " -e or null line terminates input", - 0 + " -j Produce NoICE debug as file[NOI]", + " -z Produce SDCdb debug as file[cdb]", +/* "List:", */ + " -u Update listing file(s) with link data as file(s)[.RST]", + "Miscellaneous:\n" + " -a [iram-size] Check for internal RAM overflow", + " -v [xram-size] Check for external RAM overflow", + " -w [code-size] Check for code overflow", + "End:", + " -e or null line terminates input", + 0 }; -/*)Function VOID usage() +/*)Function VOID usage() * - * The function usage() outputs to the stderr device the - * assembler name and version and a list of valid assembler options. + * The function usage() outputs to the stderr device the + * assembler name and version and a list of valid assembler options. * - * local variables: - * char ** dp pointer to an array of - * text string pointers. + * local variables: + * char ** dp pointer to an array of + * text string pointers. * - * global variables: - * FILE * stderr c_library + * global variables: + * FILE * stderr c_library * - * functions called: - * int fprintf() c_library + * functions called: + * int fprintf() c_library * - * side effects: - * none + * side effects: + * none */ VOID usage() { - register char **dp; + register char **dp; - fprintf(stderr, "\nASxxxx Linker %s\n\n", VERSION); - for (dp = usetxt; *dp; dp++) - fprintf(stderr, "%s\n", *dp); - lkexit(1); + fprintf(stderr, "\nASxxxx Linker %s\n\n", VERSION); + for (dp = usetxt; *dp; dp++) + fprintf(stderr, "%s\n", *dp); + lkexit(1); } /*)Function VOID copyfile() diff --git a/as/link/z80/lkmain.c b/as/link/z80/lkmain.c index fe5c174d..da4719ae 100644 --- a/as/link/z80/lkmain.c +++ b/as/link/z80/lkmain.c @@ -1440,11 +1440,13 @@ char *usetxt[] = { " -f file[LNK] File input", " -p Prompt and echo of file[LNK] to stdout (default)", " -n No echo of file[LNK] to stdout", +/* #ifdef SDK "Usage: [-Options] outfile file [file ...]", #else /* SDK */ "Usage: [-Options] file [file ...]", #endif /* SDK */ +*/ "Libraries:", " -k Library path specification, one per -k", " -l Library file specification, one per -l", -- 2.30.2