Imported Upstream version 2.9.0
[debian/cc1111] / as / doc / asmlnk.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26                               SDCC ASxxxx Assemblers
27
28
29                                        and
30
31
32                           SDCC ASLINK Relocating Linker
33 \f
34
35         CHAPTER 1  THE ASSEMBLER                                     1-1
36           1.1     THE ASXXXX ASSEMBLERS                              1-1
37           1.1.1     Assembly Pass 1                                  1-2
38           1.1.2     Assembly Pass 2                                  1-2
39           1.1.3     Assembly Pass 3                                  1-2
40           1.2     SOURCE PROGRAM FORMAT                              1-3
41           1.2.1     Statement Format                                 1-3
42           1.2.1.1     Label Field                                    1-3
43           1.2.1.2     Operator Field                                 1-5
44           1.2.1.3     Operand Field                                  1-5
45           1.2.1.4     Comment Field                                  1-6
46           1.3     SYMBOLS AND EXPRESSIONS                            1-6
47           1.3.1     Character Set                                    1-6
48           1.3.2     User-Defined Symbols                            1-10
49           1.3.3     Local Symbols                                   1-11
50           1.3.4     Current Location Counter                        1-12
51           1.3.5     Numbers                                         1-14
52           1.3.6     Terms                                           1-14
53           1.3.7     Expressions                                     1-15
54           1.4     GENERAL ASSEMBLER DIRECTIVES                      1-16
55           1.4.1     .module Directive                               1-16
56           1.4.2     .title Directive                                1-17
57           1.4.3     .sbttl Directive                                1-17
58           1.4.4     .page Directive                                 1-17
59           1.4.5     .byte and .db Directives                        1-17
60           1.4.6     .word and .dw Directives                        1-18
61           1.4.7     .blkb, .blkw, and .ds Directives                1-18
62           1.4.8     .ascii Directive                                1-18
63           1.4.9     .ascis Directive                                1-19
64           1.4.10    .asciz Directive                                1-19
65           1.4.11    .radix Directive                                1-20
66           1.4.12    .even Directive                                 1-20
67           1.4.13    .odd Directive                                  1-20
68           1.4.14    .area Directive                                 1-21
69           1.4.15    .org Directive                                  1-22
70           1.4.16    .globl Directive                                1-23
71           1.4.17    .if, .else, and .endif Directives               1-23
72           1.4.18    .include Directive                              1-24
73           1.4.19    .setdp Directive                                1-25
74           1.5     INVOKING ASXXXX                                   1-27
75           1.6     ERRORS                                            1-28
76           1.7     LISTING FILE                                      1-29
77           1.8     SYMBOL TABLE FILE                                 1-30
78           1.9     OBJECT FILE                                       1-31
79
80         CHAPTER 2  THE LINKER                                        2-1
81           2.1     ASLINK RELOCATING LINKER                           2-1
82           2.2     INVOKING ASLINK                                    2-2
83           2.3     LIBRARY PATH(S) AND FILE(S)                        2-3
84           2.4     ASLINK PROCESSING                                  2-4
85           2.5     LINKER INPUT FORMAT                                2-5
86           2.5.1     Object Module Format                             2-6
87           2.5.2     Header Line                                      2-6
88           2.5.3     Module Line                                      2-6
89           2.5.4     Symbol Line                                      2-6
90           2.5.5     Area Line                                        2-7
91 \f
92
93                                                                  Page ii
94
95
96
97           2.5.6     T Line                                           2-7
98           2.5.7     R Line                                           2-7
99           2.5.8     P Line                                           2-8
100           2.6     LINKER ERROR MESSAGES                              2-8
101           2.7     INTEL HEX OUTPUT FORMAT                           2-11
102           2.8     MOTORLA S1-S9 OUTPUT FORMAT                       2-12
103
104         CHAPTER 3  BUILDING ASXXXX AND ASLINK                        3-1
105           3.1     BUILDING AN ASSEMBLER                              3-1
106           3.2     BUILDING ASLINK                                    3-2
107
108         APPENDIX A  AS6800 ASSEMBLER                                 A-1
109           A.1     6800 REGISTER SET                                  A-1
110           A.2     6800 INSTRUCTION SET                               A-1
111           A.2.1     Inherent Instructions                            A-2
112           A.2.2     Branch Instructions                              A-2
113           A.2.3     Single Operand Instructions                      A-3
114           A.2.4     Double Operand Instructions                      A-4
115           A.2.5     Jump and Jump to Subroutine Instructions         A-4
116           A.2.6     Long Register Instructions                       A-5
117
118         APPENDIX B  AS6801 ASSEMBLER                                 B-1
119           B.1     .hd6303 DIRECTIVE                                  B-1
120           B.2     6801 REGISTER SET                                  B-1
121           B.3     6801 INSTRUCTION SET                               B-1
122           B.3.1     Inherent Instructions                            B-2
123           B.3.2     Branch Instructions                              B-2
124           B.3.3     Single Operand Instructions                      B-3
125           B.3.4     Double Operand Instructions                      B-4
126           B.3.5     Jump and Jump to Subroutine Instructions         B-5
127           B.3.6     Long Register Instructions                       B-5
128           B.3.7     6303 Specific Instructions                       B-5
129
130         APPENDIX C  AS6804 ASSEMBLER                                 C-1
131           C.1     6804 REGISTER SET                                  C-1
132           C.2     6804 INSTRUCTION SET                               C-1
133           C.2.1     Inherent Instructions                            C-2
134           C.2.2     Branch Instructions                              C-2
135           C.2.3     Single Operand Instructions                      C-2
136           C.2.4     Jump and Jump to Subroutine Instructions         C-2
137           C.2.5     Bit Test Instructions                            C-2
138           C.2.6     Load Immediate data Instruction                  C-3
139           C.2.7     6804 Derived Instructions                        C-3
140
141         APPENDIX D  AS6805 ASSEMBLER                                 D-1
142           D.1     6805 REGISTER SET                                  D-1
143           D.2     6805 INSTRUCTION SET                               D-1
144           D.2.1     Control Instructions                             D-2
145           D.2.2     Bit Manipulation Instructions                    D-2
146           D.2.3     Branch Instructions                              D-2
147           D.2.4     Read-Modify-Write Instructions                   D-3
148           D.2.5     Register\Memory Instructions                     D-3
149 \f
150
151                                                                 Page iii
152
153
154
155           D.2.6     Jump and Jump to Subroutine Instructions         D-4
156
157         APPENDIX E  AS68HC08 ASSEMBLER                               E-1
158           E.1     68HC08 REGISTER SET                                E-1
159           E.2     68HC08 INSTRUCTION SET                             E-1
160           E.2.1     Control Instructions                             E-2
161           E.2.2     Bit Manipulation Instructions                    E-2
162           E.2.3     Branch Instructions                              E-3
163           E.2.4     Complex Branch Instructions                      E-3
164           E.2.5     Read-Modify-Write Instructions                   E-4
165           E.2.6     Register\Memory Instructions                     E-5
166           E.2.7     Double Operand Move Instruction                  E-5
167           E.2.8     16-Bit <H:X> Index Register Instructions         E-5
168           E.2.9     Jump and Jump to Subroutine Instructions         E-5
169
170         APPENDIX F  AS6809 ASSEMBLER                                 F-1
171           F.1     6809 REGISTER SET                                  F-1
172           F.2     6809 INSTRUCTION SET                               F-1
173           F.2.1     Inherent Instructions                            F-3
174           F.2.2     Short Branch Instructions                        F-3
175           F.2.3     Long Branch Instructions                         F-3
176           F.2.4     Single Operand Instructions                      F-4
177           F.2.5     Double Operand Instructions                      F-5
178           F.2.6     D-register Instructions                          F-5
179           F.2.7     Index/Stack Register Instructions                F-5
180           F.2.8     Jump and Jump to Subroutine Instructions         F-6
181           F.2.9     Register - Register Instructions                 F-6
182           F.2.10    Condition Code Register Instructions             F-6
183           F.2.11    6800 Compatibility Instructions                  F-6
184
185         APPENDIX G  AS6811 ASSEMBLER                                 G-1
186           G.1     6811 REGISTER SET                                  G-1
187           G.2     6811 INSTRUCTION SET                               G-1
188           G.2.1     Inherent Instructions                            G-2
189           G.2.2     Branch Instructions                              G-2
190           G.2.3     Single Operand Instructions                      G-3
191           G.2.4     Double Operand Instructions                      G-4
192           G.2.5     Bit Manupulation Instructions                    G-4
193           G.2.6     Jump and Jump to Subroutine Instructions         G-5
194           G.2.7     Long Register Instructions                       G-5
195
196         APPENDIX H  AS6816 ASSEMBLER                                 H-1
197           H.1     6816 REGISTER SET                                  H-1
198           H.2     6816 INSTRUCTION SET                               H-1
199           H.2.1     Inherent Instructions                            H-2
200           H.2.2     Push/Pull Multiple Register Instructions         H-3
201           H.2.3     Short Branch Instructions                        H-3
202           H.2.4     Long Branch Instructions                         H-3
203           H.2.5     Bit Manipulation Instructions                    H-3
204           H.2.6     Single Operand Instructions                      H-4
205           H.2.7     Double Operand Instructions                      H-5
206           H.2.8     Index/Stack Register Instructions                H-5
207 \f
208
209                                                                  Page iv
210
211
212
213           H.2.9     Jump and Jump to Subroutine Instructions         H-6
214           H.2.10    Condition Code Register Instructions             H-6
215           H.2.11    Multiply and Accumulate Instructions             H-6
216
217         APPENDIX I  ASH8 ASSEMBLER                                   I-1
218           I.1     H8/3XX REGISTER SET                                I-1
219           I.2     H8/3XX INSTRUCTION SET                             I-1
220           I.2.1     Inherent Instructions                            I-2
221           I.2.2     Branch Instructions                              I-2
222           I.2.3     Single Operand Instructions                      I-3
223           I.2.4     Double Operand Instructions                      I-4
224           I.2.5     Mov Instructions                                 I-5
225           I.2.6     Bit Manipulation Instructions                    I-6
226           I.2.7     Extended Bit Manipulation Instructions           I-7
227           I.2.8     Condition Code Instructions                      I-7
228           I.2.9     Other Instructions                               I-8
229           I.2.10    Jump and Jump to Subroutine Instructions         I-8
230
231         APPENDIX J  AS8085 ASSEMBLER                                 J-1
232           J.1     8085 REGISTER SET                                  J-1
233           J.2     8085 INSTRUCTION SET                               J-1
234           J.2.1     Inherent Instructions                            J-2
235           J.2.2     Register/Memory/Immediate Instructions           J-2
236           J.2.3     Call and Return Instructions                     J-2
237           J.2.4     Jump Instructions                                J-2
238           J.2.5     Input/Output/Reset Instructions                  J-3
239           J.2.6     Move Instructions                                J-3
240           J.2.7     Other Instructions                               J-3
241
242         APPENDIX K  ASZ80 ASSEMBLER                                  K-1
243           K.1     .hd64 DIRECTIVE                                    K-1
244           K.2     Z80 REGISTER SET AND CONDITIONS                    K-1
245           K.3     Z80 INSTRUCTION SET                                K-2
246           K.3.1     Inherent Instructions                            K-3
247           K.3.2     Implicit Operand Instructions                    K-3
248           K.3.3     Load Instruction                                 K-4
249           K.3.4     Call/Return Instructions                         K-4
250           K.3.5     Jump and Jump to Subroutine Instructions         K-4
251           K.3.6     Bit Manipulation Instructions                    K-5
252           K.3.7     Interrupt Mode and Reset Instructions            K-5
253           K.3.8     Input and Output Instructions                    K-5
254           K.3.9     Register Pair Instructions                       K-5
255           K.3.10    HD64180 Specific Instructions                    K-6
256
257         APPENDIX L  AS6500 ASSEMBLER                                 L-1
258           L.1     ACKNOWLEDGMENT                                     L-1
259           L.2     6500 REGISTER SET                                  L-2
260           L.3     6500 INSTRUCTION SET                               L-2
261           L.3.1     Processor Specific Directives                    L-3
262           L.3.2     65xx Core Inherent Instructions                  L-3
263           L.3.3     65xx Core Branch Instructions                    L-3
264           L.3.4     65xx Core Single Operand Instructions            L-3
265 \f
266
267                                                                   Page v
268
269
270
271           L.3.5     65xx Core Double Operand Instructions            L-4
272           L.3.6     65xx Core Jump and Jump to Subroutine
273                     Instructions                                     L-4
274           L.3.7     65xx Core Miscellaneous X and Y Register
275                     Instructions                                     L-4
276           L.3.8     65F11 and 65F12 Specific Instructions            L-5
277           L.3.9     65C00/21 and 65C29 Specific Instructions         L-5
278           L.3.10    65C02, 65C102, and 65C112 Specific
279                     Instructions                                     L-6
280 \f
281
282                                                                  Page vi
283
284
285
286         ASxxxx Cross Assemblers, Version 1.7
287
288         Submitted by:
289         Alan R.  Baldwin,
290         Physics Dept.
291         Kent State University
292         Kent, Ohio 44242
293
294         Operating System:  TSX+, RT-11, PDOS, MS/DOS, Windows 3.x
295         or other supporting K&R C.
296
297         Source Langauge:  C
298
299            The ASxxxx Cross Assembler and Linker package (V1.7 November
300         1995) contains cross assemblers for the 6800(6802/6808),
301         6801(hd6303), 6804, 6805, 68HC08, 6809, 6811, 68HC16,
302         8085(8080), z80(hd64180), H8/3xx, and 6500 series microproces-
303         sors.  Complete source code is provided with the assem-
304         bler/linker submission.
305
306
307
308
309
310            The ASxxxx Cross Assembler and Linker package is available
311         from Kent State University at shop-pdp.kent.edu by "anonymous"
312         FTP.
313 \f
314
315                                                                 Page vii
316
317
318
319
320
321
322
323
324                                   P R E F A C E
325
326
327
328
329
330            The  ASxxxx  assemblers  were  written following the style of
331         several cross assemblers found in the Digital Equipment Corpora-
332         tion  Users  Society  (DECUS)  distribution of the C programming
333         language.  The DECUS code was provided with no documentation  as
334         to  the  input  syntax  or the output format.  Study of the code
335         revealed that the unknown author of the code  had  attempted  to
336         formulate  an assembler with attributes similiar to those of the
337         PDP-11 MACRO assembler (without macro's).  The  incomplete  code
338         from  the  DECUS C distribution has been largely rewritten, only
339         the program structure, and C source  file  organization  remains
340         relatively  unchanged.   However, I wish to thank the author for
341         his contribution to this set of assemblers.
342
343            The  ASLINK  program was written as a companion to the ASxxxx
344         assemblers, its design and implementation was not  derived  from
345         any other work.
346
347            I  would  greatly  appreciate  receiving  the  details of any
348         changes, additions, or errors pertaining to these  programs  and
349         will  attempt  to  incorporate  any  fixes  or  generally useful
350         changes in a future update to these programs.
351
352
353
354                 Alan R.  Baldwin
355                 Kent State University
356                 Physics Department
357                 Kent, Ohio 44242
358
359
360                 baldwin@shop-pdp.kent.edu
361                 tel:  (216) 672 2531
362                 fax:  (216) 672 2959
363
364
365
366                E N D   U S E R   L I C E N S E   A G R E E M E N T
367
368
369
370
371
372           This  program is free software; you can redistribute it and/or
373         modify  it under the terms of the GNU General Public License  as
374         published  by the Free Software Foundation; either version 3, or
375         (at your option) any later version.
376
377           This  program  is  distributed  in the hope that  it  will  be
378         useful,  but  WITHOUT ANY WARRANTY;  without  even  the  implied
379         warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
380         See the GNU General Public License for more details.
381
382           You  should  have  received a copy of the GNU  General  Public
383         License     along     with    this program.      If not,     see
384         <http://www.gnu.org/licenses/>.
385 \f
386
387
388
389
390
391
392
393
394
395
396
397
398
399                                     CHAPTER 1
400
401                                   THE ASSEMBLER
402
403
404
405
406
407         1.1  THE ASXXXX ASSEMBLERS
408
409
410            The  ASxxxx  assemblers are a series of microprocessor assem-
411         blers written in the C programming language.  Each assembler has
412         a device specific section which includes:
413
414              1.  device  description, byte order, and file extension in-
415                  formation
416
417              2.  a  table  of  the assembler general directives, special
418                  device directives, assembler mnemonics  and  associated
419                  operation codes
420
421              3.  machine specific code for processing the device mnemon-
422                  ics, addressing modes, and special directives
423
424         The device specific information is detailed in the appendices.
425
426            The assemblers have a common device independent section which
427         handles the details of file input/output, symbol  table  genera-
428         tion,  program/data  areas,  expression  analysis, and assembler
429         directive processing.
430
431         The assemblers provide the following features:
432
433              1.  Command string control of assembly functions
434
435              2.  Alphabetized, formatted symbol table listing
436
437              3.  Relocatable object modules
438
439              4.  Global symbols for linking object modules
440
441              5.  Conditional assembly directives
442
443 \f
444
445         THE ASSEMBLER                                           PAGE 1-2
446         THE ASXXXX ASSEMBLERS
447
448
449              6.  Program sectioning directives
450
451
452            ASxxxx assembles one or more source files into a single relo-
453         catable ascii object file.  The output of the ASxxxx  assemblers
454         consists of an ascii relocatable object file(*.rel), an assembly
455         listing file(*.lst), and a symbol file(*.sym).
456
457
458         1.1.1  Assembly Pass 1
459
460
461            During  pass  1, ASxxxx opens all source files and performs a
462         rudimenatry assembly of each source statement.  During this pro-
463         cess  all symbol tables are built, program sections defined, and
464         number of bytes for each assembled source line is estimated.
465
466            At the end of pass 1 all undefined symbols may be made global
467         (external) using the ASxxxx switch -g, otherwise undefined  sym-
468         bols will be flagged as errors during succeeding passes.
469
470
471         1.1.2  Assembly Pass 2
472
473
474            During  pass  2  the ASxxxx assembler resolves forward refer-
475         ences and determines the number  of  bytes  for  each  assembled
476         line.   The  number  of bytes used by a particular assembler in-
477         struction may depend upon the addressing mode, whether  the  in-
478         struction allows multiple forms based upon the relative distance
479         to the addressed location, or other factors.   Pass  2  resolves
480         these cases and determines the address of all symbols.
481
482
483         1.1.3  Assembly Pass 3
484
485
486            Pass 3 by the assembler generates the listing file, the relo-
487         catable output file, and the symbol tables.  Also during pass  3
488         the errors will be reported.
489
490            The  relocatable object file is an ascii file containing sym-
491         bol references and definitions, program  area  definitions,  and
492         the  relocatable assembled code, the linker ASLINK will use this
493         information to generate an absolute load file (Motorola or Intel
494         formats).
495
496
497 \f
498
499         THE ASSEMBLER                                           PAGE 1-3
500         SOURCE PROGRAM FORMAT
501
502
503         1.2  SOURCE PROGRAM FORMAT
504
505
506
507         1.2.1  Statement Format
508
509
510            A source program is composed of assembly-language statements.
511         Each statement must be completed on one line.  A line  may  con-
512         tain a maximum of 128 characters, longer lines are truncated and
513         lost.
514
515            An  ASxxxx  assembler  statement  may  have  as  many as four
516         fields.  These fields are identified by their order  within  the
517         statement  and/or  by separating characters between fields.  The
518         general format of the ASxxxx statement is:
519
520               [label:]  Operator        Operand         [;Comment(s)]
521
522            The  label and comment fields are optional.  The operator and
523         operand fields are interdependent.  The operator field may be an
524         assembler  directive or an assembly mnemonic.  The operand field
525         may be optional or required as defined in  the  context  of  the
526         operator.
527
528            ASxxxx  interprets  and  processes source statements one at a
529         time.  Each statement causes a particular operation to  be  per-
530         formed.
531
532
533         1.2.1.1  Label Field  -
534
535            A  label is a user-defined symbol which is assigned the value
536         of the current location counter and entered into  the  user  de-
537         fined  symbol  table.   The  current location counter is used by
538         ASxxxx to assign memory addresses to the source  program  state-
539         ments as they are encountered during the assembly process.  Thus
540         a label is a means  of  symbolically  referring  to  a  specific
541         statement.
542
543            When  a program section is absolute, the value of the current
544         location counter is absolute;  its value references an  absolute
545         memory  address.   Similarly, when a program section is relocat-
546         able, the value of the current location counter is  relocatable.
547         A  relocation  bias  calculated at link time is added to the ap-
548         parent value of the current location counter  to  establish  its
549         effective  absolute  address  at  execution time.  (The user can
550         also force the linker to relocate sections defined as  absolute.
551         This may be required under special circumstances.)
552
553            If  present,  a  label  must  be  the first field in a source
554         statement and must be terminated by a colon (:).   For  example,
555 \f
556
557         THE ASSEMBLER                                           PAGE 1-4
558         SOURCE PROGRAM FORMAT
559
560
561         if  the  value  of  the  current  location  counter  is absolute
562         01F0(H), the statement:
563
564               abcd:     nop
565
566         assigns  the  value  01F0(H) to the label abcd.  If the location
567         counter value were relocatable, the final value of abcd would be
568         01F0(H)+K, where K represents the relocation bias of the program
569         section, as calculated by the linker at link time.
570
571            More  than  one label may appear within a single label field.
572         Each label so specified is assigned the same address value.  For
573         example,  if  the  value  of  the  current  location  counter is
574         1FF0(H), the multiple labels in the following statement are each
575         assigned the value 1FF0(H):
576
577               abcd:     aq:     $abc:   nop
578
579            Multiple labels may also appear on successive lines.  For ex-
580         ample, the statements
581
582               abcd:
583               aq:
584               $abc:     nop
585
586         likewise  cause  the  same value to be assigned to all three la-
587         bels.
588
589            A  double  colon  (::)  defines the label as a global symbol.
590         For example, the statement
591
592               abcd::    nop
593
594         establishes the label abcd as a global symbol.  The distinguish-
595         ing attribute of a global symbol is that it  can  be  referenced
596         from  within an object module other than the module in which the
597         symbol is defined.  References to this label  in  other  modules
598         are  resolved when the modules are linked as a composite execut-
599         able image.
600
601         The legal characters for defining labels are:
602
603                 A through Z
604                 a through z
605                 0 through 9
606                 . (Period)
607                 $ (Dollar sign)
608                 _ (underscore)
609
610            A  label may be any length, however, only the first eight (8)
611         characters are significant and, therefore must be  unique  among
612         all   labels  in  the  source  program  (not  necessarily  among
613 \f
614
615         THE ASSEMBLER                                           PAGE 1-5
616         SOURCE PROGRAM FORMAT
617
618
619         separately compiled modules).  An error code(s) (m or p) will be
620         generated  in the assembly listing if the first eight characters
621         in two or more labels are the same.  The m code is caused by the
622         redeclaration  of  the symbol or its reference by another state-
623         ment.  The p code is generated because the symbols  location  is
624         changing on each pass through the source file.
625
626            The  label  must  not  start with the characters 0-9, as this
627         designates a local symbol with special attributes described in a
628         later section.
629
630            The  label  must  not  start  with  the  sequence $$, as this
631         represents the temporary radix 16 for constants.
632
633
634         1.2.1.2  Operator Field  -
635
636            The  operator field specifies the action to be performed.  It
637         may consist of an instruction mnemonic (op code) or an assembler
638         directive.
639
640            When  the  operator is an instruction mnemonic, a machine in-
641         struction is generated and the assembler evaluates the addresses
642         of  the operands which follow.  When the operator is a directive
643         ASxxxx performs certain control actions or processing operations
644         during assembly of the source program.
645
646            Leading  and  trailing  spaces  or tabs in the operator field
647         have no significance;  such characters serve  only  to  separate
648         the operator field from the preceeding and following fields.
649
650            An operator is terminated by a space, tab or end of line.
651
652
653         1.2.1.3  Operand Field  -
654
655            When  the  operator is an instruction mnemonic (op code), the
656         operand  field  contains  program  variables  that  are  to   be
657         evaluated/manipulated by the operator.
658
659            Operands  may  be  expressions  or  symbols, depending on the
660         operator.  Multiple expressions used in the operand  fields  may
661         be  separated  by a comma.  An operand should be preceeded by an
662         operator field;  if it is not, the statement will give an  error
663         (q  or  o).   All  operands  following instruction mnemonics are
664         treated as expressions.
665
666            The operand field is terminated by a semicolon when the field
667         is followed  by  a  comment.   For  example,  in  the  following
668         statement:
669
670               label:    lda     abcd,x          ;Comment field
671 \f
672
673         THE ASSEMBLER                                           PAGE 1-6
674         SOURCE PROGRAM FORMAT
675
676
677
678         the  tab  between lda and abcd terminates the operator field and
679         defines the beginning of the operand field;  a  comma  separates
680         the operands abcd and x;  and a semicolon terminates the operand
681         field and defines the beginning of the comment field.   When  no
682         comment  field  follows,  the operand field is terminated by the
683         end of the source line.
684
685
686         1.2.1.4  Comment Field  -
687
688            The comment field begins with a semicolon and extends through
689         the end of the line.  This field is optional and may contain any
690         7-bit ascii character except null.
691
692            Comments  do not affect assembly processing or program execu-
693         tion.
694
695
696         1.3  SYMBOLS AND EXPRESSIONS
697
698
699            This  section  describes the generic components of the ASxxxx
700         assemblers:  the character set, the conventions observed in con-
701         structing  symbols,  and  the use of numbers, operators, and ex-
702         pressions.
703
704
705         1.3.1  Character Set
706
707
708            The following characters are legal in ASxxxx source programs:
709
710              1.  The  letters  A  through Z.  Both upper- and lower-case
711                  letters are acceptable.  The assemblers are case sensi-
712                  tive,  i.e.  ABCD and abcd are different symbols.  (The
713                  assemblers can be made case insensitive by  recompiling
714                  with the appropriate switches.)
715
716              2.  The digits 0 through 9
717
718              3.  The  characters . (period), $ (dollar sign), and _ (un-
719                  derscore).
720
721              4.  The special characters listed in Tables 1 through 6.
722
723
724            Tables  1  through  6  describe  the various ASxxxx label and
725         field terminators, assignment operators, operand separators, as-
726         sembly, unary, binary, and radix operators.
727 \f
728
729         THE ASSEMBLER                                           PAGE 1-7
730         SYMBOLS AND EXPRESSIONS
731
732
733         Table 1         Label Terminators and Assignment Operators
734         ----------------------------------------------------------------
735
736                 :   Colon               Label terminator.
737
738                 ::  Double colon        Label  Terminator;   defines the
739                                         label as a global label.
740
741                 =   Equal sign          Direct assignment operator.
742
743                 ==  Double equal        Direct assignment operator;
744                     sign                defines  the  symbol as a global
745                                         symbol.
746
747         ----------------------------------------------------------------
748
749
750
751
752
753         Table 2         Field Terminators and Operand Separators
754         ----------------------------------------------------------------
755
756                     Tab                 Item or field terminator.
757
758                     Space               Item or field terminator.
759
760                 ,   Comma               Operand field separator.
761
762                 ;   Semicolon           Comment field indicator.
763
764         ----------------------------------------------------------------
765
766
767
768
769
770         Table 3         Assembler Operators
771         ----------------------------------------------------------------
772
773                 #   Number sign         Immediate expression indicator.
774
775                 .   Period              Current location counter.
776
777                 (   Left parenthesis    Expression delimiter.
778
779                 )   Right parenthesis   Expression delimeter.
780
781         ----------------------------------------------------------------
782 \f
783
784         THE ASSEMBLER                                           PAGE 1-8
785         SYMBOLS AND EXPRESSIONS
786
787
788
789
790
791
792
793         Table 4         Unary Operators
794         ----------------------------------------------------------------
795
796                 <   Left bracket        <FEDC   Produces  the lower byte
797                                                 value of the expression.
798                                                 (DC)
799
800                 >   Right bracket       >FEDC   Produces  the upper byte
801                                                 value of the expression.
802                                                 (FE)
803
804                 +   Plus sign           +A      Positive value of A
805
806                 -   Minus sign          -A      Produces   the  negative
807                                                 (2's complement) of A.
808
809                 ~   Tilde               ~A      Produces the 1's comple-
810                                                 ment of A.
811
812                 '   Single quote        'D      Produces  the  value  of
813                                                 the character D.
814
815                 "   Double quote        "AB     Produces the double byte
816                                                 value for AB.
817
818                 \   Backslash           '\n     Unix style characters
819                                                 \b, \f, \n, \r, \t
820                                      or '\001   or octal byte values.
821
822         ----------------------------------------------------------------
823
824
825
826
827
828 \f
829
830         THE ASSEMBLER                                           PAGE 1-9
831         SYMBOLS AND EXPRESSIONS
832
833
834         Table 5         Binary Operators
835         ----------------------------------------------------------------
836
837                 <<  Double          0800 << 4   Produces the 4 bit
838                     Left bracket                left-shifted   value  of
839                                                 0800.  (8000)
840
841                 >>  Double          0800 >> 4   Produces the 4 bit
842                     Right bracket               right-shifted  value  of
843                                                 0800.  (0080)
844
845                 +   Plus sign       A + B       Arithmetic      Addition
846                                                 operator.
847
848                 -   Minus sign      A - B       Arithmetic   Subtraction
849                                                 operator.
850
851                 *   Asterisk        A * B       Arithmetic   Multiplica-
852                                                 tion operator.   (signed
853                                                 16-bit)
854
855                 /   Slash           A / B       Arithmetic      Division
856                                                 operator.        (signed
857                                                 16-bit quotient)
858
859                 &   Ampersand       A & B       Logical AND operator.
860
861                 |   Bar             A | B       Logical OR operator.
862
863                 %   Percent sign    A % B       Modulus operator.
864                                                 (16-bit value)
865
866                 ^   Up arrow or     A ^ B       EXCLUSIVE OR operator.
867                     circumflex
868
869         ----------------------------------------------------------------
870
871
872
873
874
875 \f
876
877         THE ASSEMBLER                                          PAGE 1-10
878         SYMBOLS AND EXPRESSIONS
879
880
881         Table 6         Temporary Radix Operators
882         ----------------------------------------------------------------
883
884                 $%,   0b, 0B            Binary radix operator.
885
886                 $&,   0o, 0O, 0q, 0Q    Octal radix operator.
887
888                 $#,   0d, 0D            Decimal radix operator.
889
890                 $$,   0h, 0H, 0x, 0X    Hexidecimal radix operator.
891
892
893                 Potential  ambiguities arising from the use of 0b and 0d
894                 as temporary radix operators may be circumvented by pre-
895                 ceding  all  non-prefixed  hexidecimal  numbers with 00.
896                 Leading 0's are required in any  case  where  the  first
897                 hexidecimal  digit is abcdef as the assembler will treat
898                 the letter sequence as a label.
899
900         ----------------------------------------------------------------
901
902
903
904
905
906
907
908         1.3.2  User-Defined Symbols
909
910
911            User-defined  symbols are those symbols that are equated to a
912         specific value through a direct assignment statement  or  appear
913         as  labels.  These symbols are added to the User Symbol Table as
914         they are encountered during assembly.
915
916         The following rules govern the creation of user-defined symbols:
917
918              1.  Symbols  can  be  composed  of alphanumeric characters,
919                  dollar signs ($),  periods  (.),  and  underscores  (_)
920                  only.
921
922              2.  The  first  character  of a symbol must not be a number
923                  (except in the case of local symbols).
924
925              3.  The  first eight characters of a symbol must be unique.
926                  A symbol can be written  with  more  than  eight  legal
927                  characters, but the ninth and subsequent characters are
928                  ignored.
929
930              4.  Spaces and Tabs must not be embedded within a symbol.
931
932
933 \f
934
935         THE ASSEMBLER                                          PAGE 1-11
936         SYMBOLS AND EXPRESSIONS
937
938
939         1.3.3  Local Symbols
940
941
942            Local  symbols are specially formatted symbols used as labels
943         within a block of coding that has been delimited as a local sym-
944         bol  block.   Local  symbols  are  of  the form n$, where n is a
945         decimal integer from 0 to 255,  inclusive.   Examples  of  local
946         symbols are:
947
948               1$
949               27$
950               138$
951               244$
952
953            The  range  of  a local symbol block consists of those state-
954         ments between two normally constructed  symbolic  labels.   Note
955         that a statement of the form:
956
957               ALPHA = EXPRESSION
958
959         is a direct assignment statement but does not create a label and
960         thus does not delimit the range of a local symbol block.
961
962            Note that the range of a local symbol block may extend across
963         program areas.
964
965            Local symbols provide a convenient means of generating labels
966         for branch instructions and other such references  within  local
967         symbol  blocks.   Using local symbols reduces the possibility of
968         symbols with multiple definitions appearing within a  user  pro-
969         gram.   In  addition,  the  use  of local symbols differentiates
970         entry-point labels from local labels, since local labels  cannot
971         be referenced from outside their respective local symbol blocks.
972         Thus, local symbols of the same name can appear in  other  local
973         symbol blocks without conflict.  Local symbols require less sym-
974         bol table space than normal symbols.  Their use is recommended.
975
976            The  use of the same local symbol within a local symbol block
977         will generate one or both of the m or p errors.
978 \f
979
980         THE ASSEMBLER                                          PAGE 1-12
981         SYMBOLS AND EXPRESSIONS
982
983
984         Example of local symbols:
985
986                 a:      ldx     #atable ;get table address
987                         lda     #0d48   ;table length
988                 1$:     clr     ,x+     ;clear
989                         deca
990                         bne     1$
991
992                 b:      ldx     #btable ;get table address
993                         lda     #0d48   ;table length
994                 1$:     clr     ,x+     ;clear
995                         deca
996                         bne     1$
997
998
999         1.3.4  Current Location Counter
1000
1001
1002            The  period  (.) is the symbol for the current location coun-
1003         ter.  When used in the operand  field  of  an  instruction,  the
1004         period   represents  the  address  of  the  first  byte  of  the
1005         instruction:
1006
1007                 AS:     ldx     #.      ;The period (.) refers to
1008                                         ;the address of the ldx
1009                                         ;instruction.
1010
1011            When  used  in  the  operand field of an ASxxxx directive, it
1012         represents the address of the current byte or word:
1013
1014                 QK = 0
1015
1016                 .word   0xFFFE,.+4,QK   ;The operand .+4 in the .word
1017                                         ;directive represents a value
1018                                         ;stored in the second of the
1019                                         ;three words during assembly.
1020
1021            If  we  assume  the  current  value of the program counter is
1022         0H0200, then during assembly, ASxxxx  reserves  three  words  of
1023         storage  starting  at  location 0H0200.  The first value, a hex-
1024         idecimal constant FFFE, will be stored at location 0H0200.   The
1025         second  value  represented  by  .+4  will  be stored at location
1026         0H0202, its value will be 0H0206 ( = 0H0202  +  4).   The  third
1027         value  defined  by  the  symbol  QK  will  be placed at location
1028         0H0204.
1029
1030            At the beginning of each assembly pass, ASxxxx resets the lo-
1031         cation counter.  Normally, consecutive memory locations are  as-
1032         signed  to  each  byte  of  object code generated.  However, the
1033         value of the location counter can be changed  through  a  direct
1034         assignment statement of the following form:
1035
1036 \f
1037
1038         THE ASSEMBLER                                          PAGE 1-13
1039         SYMBOLS AND EXPRESSIONS
1040
1041
1042               . = . + expression
1043
1044
1045            The  new  location  counter can only be specified relative to
1046         the current location counter.  Neglecting to specify the current
1047         program  counter  along with the expression on the right side of
1048         the assignment operator will generate the (.) error.   (Absolute
1049         program areas may use the .org directive to specify the absolute
1050         location of the current program counter.)
1051
1052         The following coding illustrates the use of the current location
1053         counter:
1054
1055                 .area   CODE1   (ABS)   ;program area CODE1
1056                                         ;is ABSOLUTE
1057
1058                 .org    0H100           ;set location to
1059                                         ;0H100 absolute
1060
1061         num1:   ldx     #.+0H10         ;The label num1 has
1062                                         ;the value 0H100.
1063                                         ;X is loaded with
1064                                         ;0H100 + 0H10
1065
1066                 .org    0H130           ;location counter
1067                                         ;set to 0H130
1068
1069         num2:   ldy     #.              ;The label num2 has
1070                                         ;the value 0H130.
1071                                         ;Y is loaded with
1072                                         ;value 0H130.
1073
1074
1075                 .area   CODE2   (REL)   ;program area CODE2
1076                                         ;is RELOCATABLE
1077
1078                 . = . + 0H20            ;Set location counter
1079                                         ;to relocatable 0H20 of
1080                                         ;the program section.
1081
1082         num3:   .word   0               ;The label num3 has
1083                                         ;the value
1084                                         ;of relocatable 0H20.
1085
1086                 . = . + 0H40            ;will reserve 0H40
1087                                         ;bytes of storage as will
1088                 .blkb   0H40            ;or
1089                 .blkw   0H20
1090
1091            The  .blkb  and .blkw directives are the preferred methods of
1092         allocating space.
1093
1094 \f
1095
1096         THE ASSEMBLER                                          PAGE 1-14
1097         SYMBOLS AND EXPRESSIONS
1098
1099
1100         1.3.5  Numbers
1101
1102
1103            ASxxxx  assumes that all numbers in the source program are to
1104         be interpreted in decimal radix unless otherwise specified.  The
1105         .radix  directive  may  be used to specify the default as octal,
1106         decimal, or hexidecimal.  Individual numbers can  be  designated
1107         as  binary, octal, decimal, or hexidecimal through the temporary
1108         radix prefixes shown in table 6.
1109
1110            Negative  numbers  must be preceeded by a minus sign;  ASxxxx
1111         translates such numbers into two's  complement  form.   Positive
1112         numbers may (but need not) be preceeded by a plus sign.
1113
1114            Numbers are always considered to be absolute values, therefor
1115         they are never relocatable.
1116
1117
1118         1.3.6  Terms
1119
1120
1121            A  term is a component of an expression and may be one of the
1122         following:
1123
1124
1125              1.  A number.
1126
1127              2.  A symbol:
1128                  1.  A  period (.) specified in an expression causes the
1129                      current location counter to be used.
1130                  2.  A User-defined symbol.
1131                  3.  An undefined symbol is assigned a value of zero and
1132                      inserted in the User-Defined symbol table as an un-
1133                      defined symbol.
1134
1135              3.  A single quote followed by a single ascii character, or
1136                  a double quote followed by two ascii characters.
1137
1138              4.  An  expression enclosed in parenthesis.  Any expression
1139                  so enclosed is evaluated and reduced to a  single  term
1140                  before  the remainder of the expression in which it ap-
1141                  pears is evaluated.  Parenthesis, for example,  may  be
1142                  used  to  alter the left-to-right evaluation of expres-
1143                  sions, (as in A*B+C versus A*(B+C)), or to apply a  un-
1144                  ary operator to an entire expression (as in -(A+B)).
1145
1146              5.  A unary operator followed by a symbol or number.
1147
1148
1149
1150 \f
1151
1152         THE ASSEMBLER                                          PAGE 1-15
1153         SYMBOLS AND EXPRESSIONS
1154
1155
1156         1.3.7  Expressions
1157
1158
1159            Expressions  are  combinations  of  terms  joined together by
1160         binary operators.  Expressions reduce to a  16-bit  value.   The
1161         evaluation  of  an  expression includes the determination of its
1162         attributes.  A resultant expression value may be  one  of  three
1163         types  (as  described  later in this section):  relocatable, ab-
1164         solute, and external.
1165
1166         Expressions are evaluate with an operand hierarchy as follows:
1167
1168                 *       /       %       multiplication,
1169                                         division, and
1170                                         modulus first.
1171
1172                 +       -               addition and
1173                                         subtraction second.
1174
1175                 <<      >>              left shift and
1176                                         right shift third.
1177
1178                 ^                       exclusive or fourth.
1179
1180                 &                       logical and fifth.
1181
1182                 |                       logical or last
1183
1184                 except that unary operators take precedence over binary
1185                 operators.
1186
1187
1188            A  missing  or  illegal  operator  terminates  the expression
1189         analysis, causing error codes (o) and/or  (q)  to  be  generated
1190         depending upon the context of the expression itself.
1191
1192            At assembly time the value of an external (global) expression
1193         is equal to the value of the absolute part of  that  expression.
1194         For  example,  the expression external+4, where 'external' is an
1195         external symbol, has the value of 4.  This expression,  however,
1196         when  evaluated  at link time takes on the resolved value of the
1197         symbol 'external', plus 4.
1198
1199            Expressions,  when  evaluated  by  ASxxxx,  are  one of three
1200         types:  relocatable, absolute, or external.  The following  dis-
1201         tinctions are important:
1202
1203              1.  An  expression is relocatable if its value is fixed re-
1204                  lative to the base address of the program area in which
1205                  it appears;  it will have an offset value added at link
1206                  time.  Terms that contain labels defined in relocatable
1207                  program   areas   will   have   a   relocatable  value;
1208 \f
1209
1210         THE ASSEMBLER                                          PAGE 1-16
1211         SYMBOLS AND EXPRESSIONS
1212
1213
1214                  similarly, a period (.) in a relocatable program  area,
1215                  representing  the value of the current program location
1216                  counter, will also have a relocatable value.
1217
1218              2.  An  expression  is  absolute if its value is fixed.  An
1219                  expression whose terms are numbers and ascii characters
1220                  will  reduce  to  an absolute value.  A relocatable ex-
1221                  pression or term minus a relocatable term,  where  both
1222                  elements  being  evaluated  belong  to the same program
1223                  area, is an absolute expression.  This is because every
1224                  term  in  a  program area has the same relocation bias.
1225                  When one term is subtracted from the other the  reloca-
1226                  tion bias is zero.
1227
1228              3.  An  expression is external (or global) if it contains a
1229                  single global reference (plus or minus an absolute  ex-
1230                  pression  value) that is not defined within the current
1231                  program.  Thus, an external  expression  is  only  par-
1232                  tially  defined following assembly and must be resolved
1233                  at link time.
1234
1235
1236
1237         1.4  GENERAL ASSEMBLER DIRECTIVES
1238
1239
1240            An  ASxxxx  directive  is placed in the operator field of the
1241         source line.  Only one directive is  allowed  per  source  line.
1242         Each  directive  may  have  a blank operand field or one or more
1243         operands.  Legal operands differ with each directive.
1244
1245
1246         1.4.1  .module Directive
1247
1248         Format:
1249
1250                 .module string
1251
1252            The .module directive causes the string to be included in the
1253         assemblers output file as an identifier for this particular  ob-
1254         ject  module.   The  string  may  be  from  1 to 8 characters in
1255         length.  Only one identifier is allowed  per  assembled  module.
1256         The  main use of this directive is to allow the linker to report
1257         a modules' use of undefined symbols.  At link time all undefined
1258         symbols  are  reported  and  the  modules  referencing  them are
1259         listed.
1260
1261
1262 \f
1263
1264         THE ASSEMBLER                                          PAGE 1-17
1265         GENERAL ASSEMBLER DIRECTIVES
1266
1267
1268         1.4.2  .title Directive
1269
1270         Format:
1271
1272                 .title  string
1273
1274            The .title directive provides a character string to be placed
1275         on the second line of each page during listing.
1276
1277
1278         1.4.3  .sbttl Directive
1279
1280         Format:
1281
1282                 .sbttl  string
1283
1284            The .sbttl directive provides a character string to be placed
1285         on the third line of each page during listing.
1286
1287
1288         1.4.4  .page Directive
1289
1290         Format:
1291
1292                 .page
1293
1294            The .page directive causes a page ejection with a new heading
1295         to be printed.  The new page occurs after the next line  of  the
1296         source  program is processed, this allows an immediately follow-
1297         ing .sbttl directive to appear  on  the  new  page.   The  .page
1298         source  line will not appear in the file listing.  Paging may be
1299         disabled by invoking the -p directive.
1300
1301
1302         1.4.5  .byte and .db Directives
1303
1304         Format:
1305
1306                 .byte   exp             ;Stores the binary value
1307                 .db     exp             ;of the expression in the
1308                                         ;next byte.
1309
1310                 .byte   exp1,exp2,expn  ;Stores the binary values
1311                 .db     exp1,exp2,expn  ;of the list of expressions
1312                                         ;in successive bytes.
1313
1314         where:  exp,    represent expressions that will be
1315                 exp1,   truncated to 8-bits of data.
1316                 .       Each expression will be calculated
1317                 .       as a 16-bit word expression,
1318                 .       the high-order byte will be truncated.
1319                 .       Multiple expressions must be
1320 \f
1321
1322         THE ASSEMBLER                                          PAGE 1-18
1323         GENERAL ASSEMBLER DIRECTIVES
1324
1325
1326                 expn    separated by commas.
1327
1328            The  .byte  or .db directives are used to generate successive
1329         bytes of binary data in the object module.
1330
1331
1332         1.4.6  .word and .dw Directives
1333
1334         Format:
1335
1336                 .word   exp             ;Stores the binary value
1337                 .dw     exp             ;of the expression in
1338                                         ;the next word.
1339
1340                 .word   exp1,exp2,expn  ;Stores the binary values
1341                 .dw     exp1,exp2,expn  ;of the list of expressions
1342                                         ;in successive words.
1343
1344         where:  exp,    represent expressions that will occupy two
1345                 exp1,   bytes of data. Each expression will be
1346                 .       calculated as a 16-bit word expression.
1347                 .       Multiple expressions must be
1348                 expn    separated by commas.
1349
1350            The  .word  or .dw directives are used to generate successive
1351         words of binary data in the object module.
1352
1353
1354         1.4.7  .blkb, .blkw, and .ds Directives
1355
1356         Format:
1357
1358                 .blkb   N       ;reserve N bytes of space
1359                 .blkw   N       ;reserve N words of space
1360                 .ds     N       ;reserve N bytes of space
1361
1362            The  .blkb  and .ds directives reserve byte blocks in the ob-
1363         ject module;  the .blkw directive reserves word blocks.
1364
1365
1366         1.4.8  .ascii Directive
1367
1368         Format:
1369
1370                 .ascii  /string/
1371
1372         where:  string  is a string of printable ascii characters.
1373
1374                 /  /    represent   the  delimiting  characters.   These
1375                         delimiters   may   be   any   paired    printing
1376                         characters,  as  long  as the characters are not
1377                         contained within  the  string  itself.   If  the
1378 \f
1379
1380         THE ASSEMBLER                                          PAGE 1-19
1381         GENERAL ASSEMBLER DIRECTIVES
1382
1383
1384                         delimiting  characters  do not match, the .ascii
1385                         directive will give the (q) error.
1386
1387         The  .ascii  directive  places  one binary byte of data for each
1388         character in the string into the object module.
1389
1390
1391         1.4.9  .ascis Directive
1392
1393         Format:
1394
1395                 .ascis  /string/
1396
1397         where:  string  is a string of printable ascii characters.
1398
1399                 /  /    represent   the  delimiting  characters.   These
1400                         delimiters   may   be   any   paired    printing
1401                         characters,  as  long  as the characters are not
1402                         contained within  the  string  itself.   If  the
1403                         delimiting  characters  do not match, the .ascis
1404                         directive will give the (q) error.
1405
1406         The  .ascis  directive  places  one binary byte of data for each
1407         character in the  string  into  the  object  module.   The  last
1408         character in the string will have the high order bit set.
1409
1410
1411         1.4.10  .asciz Directive
1412
1413         Format:
1414
1415                 .asciz  /string/
1416
1417         where:  string  is a string of printable ascii characters.
1418
1419                 /  /    represent   the  delimiting  characters.   These
1420                         delimiters   may   be   any   paired    printing
1421                         characters,  as  long  as the characters are not
1422                         contained within  the  string  itself.   If  the
1423                         delimiting  characters  do not match, the .asciz
1424                         directive will give the (q) error.
1425
1426         The  .asciz  directive  places  one binary byte of data for each
1427         character in the string into the object module.   Following  all
1428         the  character  data  a  zero  byte is inserted to terminate the
1429         character string.
1430
1431
1432 \f
1433
1434         THE ASSEMBLER                                          PAGE 1-20
1435         GENERAL ASSEMBLER DIRECTIVES
1436
1437
1438         1.4.11  .radix Directive
1439
1440         Format:
1441
1442                 .radix  character
1443
1444         where:  character  represents  a single character specifying the
1445                         default radix to be used for succeeding numbers.
1446                         The character may be any one of the following:
1447
1448                         B,b     Binary
1449
1450                         O,o     Octal
1451                         Q,q
1452
1453                         D,d     Decimal
1454                         'blank'
1455
1456                         H,h     Hexidecimal
1457                         X,x
1458
1459
1460         1.4.12  .even Directive
1461
1462         Format:
1463
1464                 .even
1465
1466            The .even directive ensures that the current location counter
1467         contains an even boundary value by adding 1 if the current loca-
1468         tion is odd.
1469
1470
1471         1.4.13  .odd Directive
1472
1473         Format:
1474
1475                 .odd
1476
1477            The  .odd directive ensures that the current location counter
1478         contains an odd boundary value by adding one if the current  lo-
1479         cation is even.
1480
1481
1482 \f
1483
1484         THE ASSEMBLER                                          PAGE 1-21
1485         GENERAL ASSEMBLER DIRECTIVES
1486
1487
1488         1.4.14  .area Directive
1489
1490         Format:
1491
1492                 .area   name    [(options)]
1493
1494         where:  name    represents the symbolic name of the program sec-
1495                         tion.   This  name  may  be  the  same  as   any
1496                         user-defined  symbol  as  the area names are in-
1497                         dependent of all symbols and labels.
1498
1499                 options specify the type of program or data area:
1500                         ABS     absolute (automatically invokes OVR)
1501                         REL     relocatable
1502                         OVR     overlay
1503                         CON     concatenate
1504                         PAG     paged area
1505
1506
1507            The .area directive provides a means of defining and separat-
1508         ing multiple programming and data sections.   The  name  is  the
1509         area  label used by the assembler and the linker to collect code
1510         from various separately assembled modules into one section.  The
1511         name may be from 1 to 8 characters in length.
1512
1513            The options are specified within parenthesis and separated by
1514         commas as shown in the following example:
1515
1516                 .area  TEST  (REL,CON)  ;This section is relocatable
1517                                         ;and concatenated with other
1518                                         ;sections of this program area.
1519
1520                 .area  DATA  (REL,OVR)  ;This section is relocatable
1521                                         ;and overlays other sections
1522                                         ;of this program area.
1523
1524                 .area  SYS   (ABS,OVR)  ;(CON not allowed with ABS)
1525                                         ;This section is defined as
1526                                         ;absolute. Absolute sections
1527                                         ;are always overlayed with
1528                                         ;other sections of this program
1529                                         ;area.
1530
1531                 .area  PAGE  (PAG)      ;This is a paged section. The
1532                                         ;section must be on a 256 byte
1533                                         ;boundary and its length is
1534                                         ;checked by the linker to be
1535                                         ;no larger than 256 bytes.
1536                                         ;This is useful for direct page
1537                                         ;areas.
1538
1539 \f
1540
1541         THE ASSEMBLER                                          PAGE 1-22
1542         GENERAL ASSEMBLER DIRECTIVES
1543
1544
1545            The  default  area type is REL|CON;  i.e.  a relocatable sec-
1546         tion which is concatenated with other sections of code with  the
1547         same area name.  The ABS option indicates an absolute area.  The
1548         OVR and CON options indicate if program  sections  of  the  same
1549         name  will overlay each other (start at the same location) or be
1550         concatenated with each other (appended to each other).
1551
1552            Multiple  invocations  of  the  .area directive with the same
1553         name must specify the same options or leave  the  options  field
1554         blank,  this  defaults  to  the previously specified options for
1555         this program area.
1556         The   ASxxxx   assemblers   automatically  provide  two  program
1557         sections:
1558
1559                 '.  .ABS.'      This dumby section contains all absolute
1560                                 symbols and their values.
1561
1562                 '_CODE'         This  is  the default program/data area.
1563                                 This program area is of type (REL,CON).
1564         The  ASxxxx  assemblers  also automatically generate two symbols
1565         for each program area:
1566
1567                 's_<area>'      This is the starting address of the pro-
1568                                 gram area.
1569
1570                                 indent  -16  'l_<area>'      This is the
1571                                 length of the program area.
1572
1573
1574         1.4.15  .org Directive
1575
1576         Format:
1577
1578                 .org    exp
1579
1580         where:  exp     is  an absolute expression that becomes the cur-
1581                         rent location counter.
1582
1583         The  .org directive is valid only in an absolute program section
1584         and will give a (q) error if used in a relocatable program area.
1585         The  .org  directive specifies that the current location counter
1586         is to become the specified absolute value.
1587
1588
1589 \f
1590
1591         THE ASSEMBLER                                          PAGE 1-23
1592         GENERAL ASSEMBLER DIRECTIVES
1593
1594
1595         1.4.16  .globl Directive
1596
1597         Format:
1598
1599                 .globl  sym1,sym2,...,symn
1600
1601         where:  sym1,           represent legal symbolic names. When
1602                 sym2,...        When multiple symbols are specified,
1603                 symn            they are separated by commas.
1604
1605            A  .globl directive may also have a label field and/or a com-
1606         ment field.
1607
1608            The  .globl directive is provided to define (and thus provide
1609         linkage to) symbols not  otherwise  defined  as  global  symbols
1610         within  a  module.   In  defining  global  symbols the directive
1611         .globl J is similar to:
1612
1613               J == expression or J::
1614
1615            Because  object  modules  are linked by global symbols, these
1616         symbols are vital to a program.  All internal symbols  appearing
1617         within  a  given program must be defined at the end of pass 1 or
1618         they will be considered undefined.  The assembly directive  (-g)
1619         can  be  be  invoked to make all undefined symbols global at the
1620         end of pass 1.
1621
1622
1623         1.4.17  .if, .else, and .endif Directives
1624
1625         Format:
1626
1627                 .if     expr
1628                 .                       ;}
1629                 .                       ;} range of true condition
1630                 .                       ;}
1631                 .else
1632                 .                       ;}
1633                 .                       ;} range of false condition
1634                 .                       ;}
1635                 .endif
1636
1637            The  conditional  assembly directives allow you to include or
1638         exclude blocks of source code during the assembly process, based
1639         on the evaluation of the condition test.
1640
1641            The  range of true condition will be processed if the expres-
1642         sion 'expr' is not zero (i.e.  true) and the range of false con-
1643         dition  will  be processed if the expression 'expr' is zero (i.e
1644         false).  The range of true condition is optional as is the .else
1645         directive  and  the range of false condition.  The following are
1646         all valid .if/.else/.endif constructions:
1647 \f
1648
1649         THE ASSEMBLER                                          PAGE 1-24
1650         GENERAL ASSEMBLER DIRECTIVES
1651
1652
1653
1654                 .if     A-4             ;evaluate A-4
1655                 .byte   1,2             ;insert bytes if A-4 is
1656                 .endif                  ;not zero
1657
1658                 .if     K+3             ;evaluate K+3
1659                 .else
1660                 .byte   3,4             ;insert bytes if K+3
1661                 .endif                  ;is zero
1662
1663                 .if     J&3             ;evaluate J masked by 3
1664                 .byte   12              ;insert this byte if J&3
1665                 .else                   ;is not zero
1666                 .byte   13              ;insert this byte if J&3
1667                 .endif                  ;is zero
1668
1669
1670         The .if/.else/.endif directives may be nested upto 10 levels.
1671
1672            The  .page  directive  is  processed within a false condition
1673         range to allow extended textual information to  be  incorporated
1674         in  the  source  program  with  out  the need to use the comment
1675         delimiter (;):
1676
1677                 .if     0
1678
1679                 .page
1680                 This text will be bypassed during assembly
1681                 but appear in the listing file.
1682                 .
1683                 .
1684                 .
1685
1686                 .endif
1687
1688
1689         1.4.18  .include Directive
1690
1691         Format:
1692
1693                 .include        string
1694
1695         where:  string  represents  a  delimited string that is the file
1696                         specification of an ASxxxx source file.
1697
1698            The .include directive is used to insert a source file within
1699         the source file currently being assembled.  When this  directive
1700         is encountered, an implicit .page directive is issued.  When the
1701         end of the specified source file is reached, an  implicit  .page
1702         directive is issued and input continues from the previous source
1703         file.  The maximum nesting level of source files specified by  a
1704         .include directive is five.
1705 \f
1706
1707         THE ASSEMBLER                                          PAGE 1-25
1708         GENERAL ASSEMBLER DIRECTIVES
1709
1710
1711            The  total  number  of separately specified .include files is
1712         unlimited as each .include file is opened and then closed during
1713         each pass made by the assembler.
1714
1715
1716         1.4.19  .setdp Directive
1717
1718         Format:
1719
1720                 .setdp [base [,area]]
1721
1722         The  set  direct  page  directive has a common format in all the
1723         AS68xx assemblers.  The .setdp directive is used to  inform  the
1724         assembler  of  the current direct page region and the offset ad-
1725         dress within the selected area.  The normal  invocation  methods
1726         are:
1727
1728                 .area   DIRECT  (PAG)
1729                 .setdp
1730
1731                 or
1732
1733                 .setdp  0,DIRECT
1734
1735         for  all  the  68xx microprocessors (the 6804 has only the paged
1736         ram area).  The commands specify that the direct page is in area
1737         DIRECT and its offset address is 0 (the only valid value for all
1738         but the 6809 microprocessor).  Be sure to place the DIRECT  area
1739         at address 0 during linking.  When the base address and area are
1740         not specified, then zero and the current area are the  defaults.
1741         If  a  .setdp directive is not issued the assembler defaults the
1742         direct page to the area "_CODE" at offset 0.
1743
1744            The  assembler  verifies  that  any  local variable used in a
1745         direct variable reference is located in this area.  Local  vari-
1746         able  and  constant value direct access addresses are checked to
1747         be within the address range from 0 to 255.
1748
1749            External direct references are assumed by the assembler to be
1750         in the correct area and have valid  offsets.   The  linker  will
1751         check all direct page relocations to verify that they are within
1752         the correct area.
1753
1754            The  6809  microprocessor  allows the selection of the direct
1755         page to be on any 256 byte boundary by loading  the  appropriate
1756         value  into the dp register.  Typically one would like to select
1757         the page boundary at link time, one method follows:
1758 \f
1759
1760         THE ASSEMBLER                                          PAGE 1-26
1761         GENERAL ASSEMBLER DIRECTIVES
1762
1763
1764                 .area   DIRECT  (PAG)   ; define the direct page
1765                 .setdp
1766                 .
1767                 .
1768                 .
1769                 .area   PROGRAM
1770                 .
1771                 ldd     #DIRECT         ; load the direct page register
1772                 tfr     a,dp            ; for access to the direct page
1773
1774         At  link  time specify the base and global equates to locate the
1775         direct page:
1776
1777                 -b DIRECT = 0x1000
1778                 -g DIRECT = 0x1000
1779
1780         Both  the  area address and offset value must be specified (area
1781         and variable names are independent).   The  linker  will  verify
1782         that  the  relocated  direct page accesses are within the direct
1783         page.
1784         The  preceeding  sequence  could  be repeated for multiple paged
1785         areas, however an alternate method is to define a non-paged area
1786         and use the .setdp directive to specify the offset value:
1787
1788                 .area   DIRECT          ; define non-paged area
1789                 .
1790                 .
1791                 .
1792                 .area   PROGRAM
1793                 .
1794                 .setdp  0,DIRECT        ; direct page area
1795                 ldd     #DIRECT         ; load the direct page register
1796                 tfr     a,dp            ; for access to the direct page
1797                 .
1798                 .
1799                 .setdp  0x100,DIRECT    ; direct page area
1800                 ldd     #DIRECT+0x100   ; load the direct page register
1801                 tfr     a,dp            ; for access to the direct page
1802
1803         The  linker  will  verify that subsequent direct page references
1804         are in the specified area and offset address range.  It  is  the
1805         programmers responsibility to load the dp register with the cor-
1806         rect page segment  corresponding  to  the  .setdp  base  address
1807         specified.
1808
1809            For  those  cases  where a single piece of code must access a
1810         defined data structure within a direct page and there  are  many
1811         pages,  define  a  dumby  direct page linked at address 0.  This
1812         dumby page is used only to define  the  variable  labels.   Then
1813         load  the dp register with the real base address but donot use a
1814         .setdp  directive.   This  method  is  equivalent   to   indexed
1815 \f
1816
1817         THE ASSEMBLER                                          PAGE 1-27
1818         GENERAL ASSEMBLER DIRECTIVES
1819
1820
1821         addressing,  where the dp register is the index register and the
1822         direct addressing is the offset.
1823
1824
1825         1.5  INVOKING ASXXXX
1826
1827
1828            The  ASxxxx  assemblers are command line oriented.  After the
1829         assembler is started, enter the option(s) and file(s) to  assem-
1830         ble following the 'argv:' prompt:
1831
1832         argv:  [-dqxjgalcposf] file1 [file2 file3 ...  file6]
1833
1834         The options are:
1835
1836                 d       decimal listing
1837                 q       octal   listing
1838                 x       hex     listing (default)
1839
1840                         The listing radix affects the
1841                         .lst, .rel, and .sym files.
1842
1843                 j       add line number and debug information to file
1844                 g       undefined symbols made global
1845                 a       all user symbols made global
1846
1847                 l       create list   output file1.lst
1848                 o       create object output file1.rel
1849                 s       create symbol output file1.sym
1850
1851                 c       generate sdcdb debug information
1852
1853                 p       disable listing pagination
1854
1855                         relocatable reference flagging:
1856
1857                 f       by  `   in the listing file
1858                 ff      by mode in the listing file
1859
1860         asx8051 specific command line option:
1861                 -I<dir>  Add the named directory to the include file
1862                         search path.  This option may be used more than once.
1863                         Directories are searched in the order given.
1864
1865            The file name for the .lst, .rel, and .sym files is the first
1866         file name specified in the command line.  All output  files  are
1867         ascii  text  files which may be edited, copied, etc.  The output
1868         files are the concatenation of all the input files, if files are
1869         to  be  assembled  independently  invoke  the assembler for each
1870         file.
1871
1872            The  .rel  file contains a radix directive so that the linker
1873         will use the proper conversion for this file.  Linked files  may
1874         have different radices.
1875
1876            If  the list (l) option is specified without the symbol table
1877         (s) option, the symbol table is placed at the end of the listing
1878         file.
1879
1880         ASXXXX assembles supported by and distributed with SDCC are:
1881                 asx8051         (Intel 8051)
1882                 as-z80          (Zilog Z80 / Hitachi HD64180)
1883                 as-gbz80        (GameBoy Z80-like CPU)
1884                 as-hc08         (Motorola 68HC08)
1885 \f
1886
1887         THE ASSEMBLER                                          PAGE 1-28
1888         ERRORS
1889
1890
1891         1.6  ERRORS
1892
1893
1894            The  ASxxxx assemblers provide limited diagnostic error codes
1895         during the assembly process, these errors will be noted  in  the
1896         listing file and printed on the stderr device.
1897
1898            The assembler reports the errors on the stderr device as
1899
1900                 ?ASxxxx-Error-<*> in line nnn of filename
1901
1902         where  * is the error code, nnn is the line number, and filename
1903         is the source/include file.
1904
1905            The errors are:
1906
1907               (.)   This  error  is caused by an absolute direct assign-
1908                     ment of the current location counter
1909                           . = expression (incorrect)
1910                     rather than the correct
1911                           . = . + expression
1912
1913               (a)   Indicates  a machine specific addressing or address-
1914                     ing mode error.
1915
1916               (b)   Indicates a direct page boundary error.
1917
1918               (d)   Indicates a direct page addressing error.
1919
1920               (i)   Caused  by  an  .include file error or an .if/.endif
1921                     mismatch.
1922
1923               (m)   Multiple  definitions  of  the  same label, multiple
1924                     .module directives, or multiple  conflicting  attri-
1925                     butes in an .area directive.
1926
1927               (o)   Directive  or  mnemonic error or the use of the .org
1928                     directive in a relocatable area.
1929
1930               (p)   Phase error:  label location changing between passes
1931                     2 and 3.  Normally caused by having  more  than  one
1932                     level of forward referencing.
1933
1934               (q)   Questionable syntax:  missing or improper operators,
1935                     terminators, or delimiters.
1936
1937               (r)   Relocation  error:   logic  operation attempted on a
1938                     relocatable term, addition of two relocatable terms,
1939                     subtraction  of two relocatable terms not within the
1940                     same programming area or external symbols.
1941
1942               (u)   Undefined symbol encountered during assembly.
1943 \f
1944
1945         THE ASSEMBLER                                          PAGE 1-29
1946         LISTING FILE
1947
1948
1949         1.7  LISTING FILE
1950
1951
1952            The  (-l) option produces an ascii output listing file.  Each
1953         page of output contains a four line header:
1954
1955
1956              1.  The ASxxxx program name and page number
1957
1958              2.  Title from a .title directive (if any)
1959
1960              3.  Subtitle from a .sbttl directive (if any)
1961
1962              4.  Blank line
1963
1964
1965
1966         Each succeeding line contains five fields:
1967
1968
1969              1.  Error field (first three characters of line)
1970
1971              2.  Current location counter
1972
1973              3.  Generated code in byte format
1974
1975              4.  Source text line number
1976
1977              5.  Source text
1978
1979
1980            The error field may contain upto 2 error flags indicating any
1981         errors encountered while assembling this line of source code.
1982
1983            The  current  location counter field displays the 16-bit pro-
1984         gram position.  This field will be in the selected radix.
1985
1986            The generated code follows the program location.  The listing
1987         radix determines the number of bytes that will be  displayed  in
1988         this field.  Hexidecimal listing allows six bytes of data within
1989         the field, decimal and octal allow four bytes within the  field.
1990         If more than one field of data is generated from the assembly of
1991         a single line of source code, then the data field is repeated on
1992         successive lines.
1993
1994            The source text line number is printed in decimal and is fol-
1995         lowed by the source text.
1996
1997            Two  special  cases  will  disable  the  listing of a line of
1998         source text:
1999
2000 \f
2001
2002         THE ASSEMBLER                                          PAGE 1-30
2003         LISTING FILE
2004
2005
2006              1.  Source line with a .page directive is never listed.
2007
2008              2.  Source  line  with  a  .include  file  directive is not
2009                  listed unless the .include file cannot be opened.
2010
2011
2012            Two  data  field  options  are  available to flag those bytes
2013         which will be relocated by the linker.   If  the  -f  option  is
2014         specified  then  each  byte to be relocated will be preceeded by
2015         the '`' character.  If the -ff option  is  specified  then  each
2016         byte  to  be relocated will be preceeded by one of the following
2017         characters:
2018
2019              1.  *   paged relocation
2020
2021              2.  u   low  byte of unsigned word or unsigned byte
2022
2023              3.  v   high byte of unsigned word
2024
2025              4.  p   PCR low  byte of word relocation or PCR byte
2026
2027              5.  q   PCR high byte of word relocation
2028
2029              6.  r   low  byte relocation or byte relocation
2030
2031              7.  s   high byte relocation
2032
2033
2034
2035         1.8  SYMBOL TABLE FILE
2036
2037
2038            The symbol table has two parts:
2039
2040              1.  The alphabetically sorted list of symbols and/or labels
2041                  defined or referenced in the source program.
2042
2043              2.  A  list of the program areas defined during assembly of
2044                  the source program.
2045
2046
2047            The sorted list of symbols and/or labels contains the follow-
2048         ing information:
2049
2050              1.  Program  area  number (none if absolute value or exter-
2051                  nal)
2052
2053              2.  The symbol or label
2054
2055              3.  Directly assigned symbol is denoted with an (=) sign
2056
2057 \f
2058
2059         THE ASSEMBLER                                          PAGE 1-31
2060         SYMBOL TABLE FILE
2061
2062
2063              4.  The  value of a symbol, location of a label relative to
2064                  the program area base address (=0), or a ****  indicat-
2065                  ing the symbol or label is undefined.
2066
2067              5.  The  characters:   G - global, R - relocatable, and X -
2068                  external.
2069
2070
2071            The list of program areas provides the correspondence between
2072         the program area numbers and the defined program areas, the size
2073         of the program areas, and the area flags (attributes).
2074
2075
2076         1.9  OBJECT FILE
2077
2078
2079            The  object  file is an ascii file containing the information
2080         needed by the linker to bind multiple object modules into a com-
2081         plete  loadable  memory  image.   The object module contains the
2082         following designators:
2083
2084                 [XDQ][HL]
2085                         X       Hexidecimal radix
2086                         D       Decimal radix
2087                         Q       Octal radix
2088
2089                         H       Most significant byte first
2090                         L       Least significant byte first
2091
2092                 H       Header
2093                 M       Module
2094                 A       Area
2095                 S       Symbol
2096                 T       Object code
2097                 R       Relocation information
2098                 P       Paging information
2099
2100            Refer to the linker for a detailed description of each of the
2101         designators and the format of the information contained  in  the
2102         object file.
2103 \f
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117                                     CHAPTER 2
2118
2119                                    THE LINKER
2120
2121
2122
2123
2124
2125         2.1  ASLINK RELOCATING LINKER
2126
2127
2128            ASLINK is the companion linker for the ASxxxx assemblers.
2129
2130            The  program ASLINK is a general relocating linker performing
2131         the following functions:
2132
2133              1.  Bind multiple object modules into a single memory image
2134
2135              2.  Resolve inter-module symbol references
2136
2137              3.  Combine  code  belonging to the same area from multiple
2138                  object files into a single contiguous memory region
2139
2140              4.  Search and import object module libraries for undefined
2141                  global variables
2142
2143              5.  Perform   byte   and   word  program  counter  relative
2144                  (pc or pcr) addressing calculations
2145
2146              6.  Define absolute symbol values at link time
2147
2148              7.  Define absolute area base address values at link time
2149
2150              8.  Produce Intel Hex or Motorola S19 output file
2151
2152              9.  Produce a map of the linked memory image
2153
2154             10.  Produce  an updated listing file with the relocated ad-
2155                  dresses and data
2156
2157
2158
2159 \f
2160
2161         THE LINKER                                              PAGE 2-2
2162         INVOKING ASLINK
2163
2164
2165         2.2  INVOKING ASLINK
2166
2167
2168            The  linker  may run in the command line mode or command file
2169         modes.  The allowed startup linker commands are:
2170
2171         -c/-f           command line / command file modes
2172
2173         -p/-n           enable/disable echo file.lnk input to stdout
2174
2175            If  command  line  mode is selected, all linker commands come
2176         from stdin, if the command file mode is  selected  the  commands
2177         are input from the specified file (extension must be .lnk).
2178
2179            The linker is started via
2180
2181                 ASLINK  -(cfpn)
2182
2183         After invoking the linker the valid options are:
2184
2185              1.  -i/-s   Intel Hex (file.ihx) or Motorola S19 (file.s19)
2186                  image output file.
2187
2188              2.  -m      Generate a map file (file.map).  This file con-
2189                  tains a list of the symbols (by area) with absolute ad-
2190                  dresses,  sizes  of  linked  areas,  and  other linking
2191                  information.
2192
2193              3.  -u      Generate  an  updated  listing  file (file.rst)
2194                  derived from the relocated addresses and data from  the
2195                  linker
2196
2197              4.  -xdq    Specifies  the  number  radix  for the map file
2198                  (Hexidecimal, Decimal, or Octal).
2199
2200              5.  fileN   Files  to  be linked.  Files may be on the same
2201                  line as the above options or on a separate line(s)  one
2202                  file  per line or multiple files separated by spaces or
2203                  tabs.
2204
2205              6.  -b  area = expression (one definition per line)
2206                  This  specifies  an area base address where the expres-
2207                  sion may contain constants and/or defined symbols  from
2208                  the linked files.
2209
2210              7.  -g  symbol = expression (one definition per line)
2211                  This  specifies  the value for the symbol where the ex-
2212                  pression may contain constants and/or  defined  symbols
2213                  from the linked files.
2214
2215              8.  -k  library directory path
2216                  (one  definition  per line) This specifies one possible
2217
2218 \f
2219
2220         THE LINKER                                              PAGE 2-3
2221         INVOKING ASLINK
2222
2223
2224                  path to an object library.  More than one path  is  al-
2225                  lowed.
2226
2227              9.  -l  library file specification
2228                  (one  definition  per  line)  This specifies a possible
2229                  library file.  More than one file is allowed.
2230
2231             10.  -e      or null line, terminates input to the linker.
2232
2233         ASLINK linkers supported by and distributed with SDCC are:
2234                 aslink          (Intel 8051)
2235                 link-z90        (Zilog Z80 / Hitachi HD64180)
2236                 link-gbz80      (GameBoy Z80-like CPU)
2237                 link-hc08       (Motorola 68HC08)
2238
2239         aslink (Intel 8051) specific options:
2240
2241         Output:
2242           -j   Produce NoICE debug as file[NOI]
2243           -z   Produce SDCdb debug as file[cdb]
2244           -u   Update listing file(s) with link data as file(s)[.RST]
2245         Miscellaneous:
2246           -a   [iram-size] Check for internal RAM overflow
2247           -v   [xram-size] Check for external RAM overflow
2248           -w   [code-size] Check for code overflow
2249           -y   Generate memory usage summary file[mem]
2250           -Y   Pack internal ram
2251           -A   [stack-size] Allocate space for stack
2252
2253
2254         link-z80 (Zilog Z80 / Hitachi HD64180) specific options:
2255
2256         Map format:
2257           -j   no$gmb symbol file generated as file[SYM]
2258         Output:
2259           -z   Produce SDCdb debug as file[cdb]
2260           -Z   Gameboy image as file[GB]
2261         List:
2262           -u   Update listing file(s) with link data as file(s)[.RST]
2263
2264
2265         link-gbz80 (GameBoy Z80-like CPU) specific options:
2266
2267         Relocation:
2268           -yo  Number of rom banks (default: 2)
2269           -ya  Number of ram banks (default: 0)
2270           -yt  MBC type (default: no MBC)
2271           -yn  Name of program (default: name of output file)
2272           -yp# Patch one byte in the output GB file (# is: addr=byte)
2273         Map format:
2274           -j   no$gmb symbol file generated as file[SYM]
2275         Output:
2276           -Z   Gameboy image as file[GB]
2277         List:
2278           -u   Update listing file(s) with link data as file(s)[.RST]
2279
2280
2281         link-hc08 (Motorola 68HC08) specific options:
2282         Output:
2283           -t   ELF executable as file[elf]
2284           -j    Produce NoICE debug as file[NOI]
2285           -z   Produce SDCdb debug as file[cdb]
2286           -u    Update listing file(s) with link data as file(s)[.RST]
2287         Miscellaneous:
2288           -a    [iram-size] Check for internal RAM overflow
2289           -v    [xram-size] Check for external RAM overflow
2290           -w    [code-size] Check for code overflow
2291
2292
2293
2294         2.3  LIBRARY PATH(S) AND FILE(S)
2295
2296
2297            The process of resolving undefined symbols after scanning the
2298         input object  files  includes  the  scanning  of  object  module
2299         libraries.   The  linker will search through all combinations of
2300         the library path specifications (input by the -k option) and the
2301         library  file  specifications (input by the -l option) that lead
2302         to an existing library file.  Each library file contains a  list
2303         (one  file  per  line)  of  modules  included in this particular
2304         library.  Each existing object module is scanned for a match  to
2305         the undefined symbol.  The first module containing the symbol is
2306         then linked with the previous modules to resolve the symbol  de-
2307         finition.   The  library  object  modules are rescanned until no
2308         more symbols can be resolved.   The  scanning  algorithm  allows
2309         resolution  of  back references.  No errors are reported for non
2310         existant library files or object modules.
2311
2312            The  library  file  specification may be formed in one of two
2313         ways:
2314
2315              1.  If  the  library  file  contained an absolute path/file
2316                  specification  then  this  is   the   object   module's
2317                  path/file.
2318                  (i.e.  C:\...)
2319
2320              2.  If  the  library  file  contains  a  relative path/file
2321                  specification then the concatenation of  the  path  and
2322                  this  file  specification  becomes  the object module's
2323                  path/file.
2324                  (i.e.  \...)
2325
2326
2327            As  an example, assume there exists a library file termio.lib
2328         in the syslib directory specifying the following object modules:
2329
2330         \6809\io_disk        first object module
2331         d:\special\io_comm   second object module
2332
2333         and the following parameters were specified to the linker:
2334
2335 \f
2336
2337         THE LINKER                                              PAGE 2-4
2338         LIBRARY PATH(S) AND FILE(S)
2339
2340
2341         -k c:\iosystem\    the first path
2342         -k c:\syslib\      the second path
2343
2344         -l termio          the first library file
2345         -l io              the second library file (no such file)
2346
2347         The  linker  will attempt to use the following object modules to
2348         resolve any undefined symbols:
2349
2350         c:\syslib\6809\io_disk.rel     (concatenated path/file)
2351         d:\special\io_comm.rel         (absolute path/file)
2352
2353         all  other path(s)/file(s) don't exist.  (No errors are reported
2354         for non existant path(s)/file(s).)
2355
2356
2357         2.4  ASLINK PROCESSING
2358
2359
2360            The  linker  processes  the  files  in  the  order  they  are
2361         presented.  The first pass through the input files  is  used  to
2362         define  all  program  areas, the section area sizes, and symbols
2363         defined or referenced.  Undefined symbols will initiate a search
2364         of any specified library file(s) and the importing of the module
2365         containing the symbol definition.  After the first pass  the  -b
2366         (area  base  address) definitions, if any, are processed and the
2367         areas linked.
2368
2369            The  area  linking proceeds by first examining the area types
2370         ABS, CON, REL, OVR and PAG.  Absolute areas (ABS) from  separate
2371         object modules are always overlayed and have been assembled at a
2372         specific address, these are not normally relocated (if a -b com-
2373         mand  is  used  on an absolute area the area will be relocated).
2374         Relative areas (normally defined as REL|CON) have a base address
2375         of  0x0000  as read from the object files, the -b command speci-
2376         fies the beginning address of the area.  All subsequent relative
2377         areas  will  be  concatenated  with  proceeding  relative areas.
2378         Where specific ordering is desired, the first linker input  file
2379         should  have  the area definitions in the desired order.  At the
2380         completion of the area linking all area  addresses  and  lengths
2381         have  been determined.  The areas of type PAG are verified to be
2382         on a 256 byte boundary and that the length does not  exceed  256
2383         bytes.  Any errors are noted on stderr and in the map file.
2384
2385            Next  the  global symbol definitions (-g option), if any, are
2386         processed.  The symbol definitions have been delayed until  this
2387         point because the absolute addresses of all internal symbols are
2388         known and can be used in the expression calculations.
2389
2390            Before  continuing  with the linking process the symbol table
2391         is scanned to determine if any symbols have been referenced  but
2392         not defined.  Undefined symbols are listed on the stderr device.
2393 \f
2394
2395         THE LINKER                                              PAGE 2-5
2396         ASLINK PROCESSING
2397
2398
2399         if a .module directive was included in the  assembled  file  the
2400         module  making  the reference to this undefined variable will be
2401         printed.
2402
2403            Constants  defined  as global in more than one module will be
2404         flagged as multiple definitions if their values are not  identi-
2405         cal.
2406
2407            After  the  preceeding  processes are complete the linker may
2408         output a map file (-m option).  This file provides the following
2409         information:
2410
2411              1.  Global symbol values and label absolute addresses
2412
2413              2.  Defined areas and there lengths
2414
2415              3.  Remaining undefined symbols
2416
2417              4.  List of modules linked
2418
2419              5.  List of library modules linked
2420
2421              6.  List of -b and -g definitions
2422
2423
2424
2425
2426            The final step of the linking process is performed during the
2427         second pass of the input files.  As the xxx.rel files  are  read
2428         the code is relocated by substituting the physical addresses for
2429         the referenced symbols and areas and may be output in  Intel  or
2430         Motorola  formats.   The  number of files linked and symbols de-
2431         fined/referenced is limited by the processor space available  to
2432         build the area/symbol lists.  If the -u option is specified then
2433         the listing files  (file.lst)  associated  with  the  relocation
2434         files  (file.rel)  are  scanned  and  used  to create a new file
2435         (file.rst) which has all addresses and data relocated  to  their
2436         final values.
2437
2438
2439         2.5  LINKER INPUT FORMAT
2440
2441
2442            The  linkers'  input  object file is an ascii file containing
2443         the information needed by the linker  to  bind  multiple  object
2444         modules into a complete loadable memory image.
2445
2446         The object module contains the following designators:
2447
2448                 [XDQ][HL]
2449                         X       Hexidecimal radix
2450                         D       Decimal radix
2451 \f
2452
2453         THE LINKER                                              PAGE 2-6
2454         LINKER INPUT FORMAT
2455
2456
2457                         Q       Octal radix
2458
2459                         H       Most significant byte first
2460                         L       Least significant byte first
2461
2462                 H       Header
2463                 M       Module
2464                 A       Area
2465                 S       Symbol
2466                 T       Object code
2467                 R       Relocation information
2468                 P       Paging information
2469
2470
2471         2.5.1  Object Module Format
2472
2473
2474            The  first  line  of  an object module contains the [XDQ][HL]
2475         format specifier (i.e.  XH indicates  a  hexidecimal  file  with
2476         most significant byte first) for the following designators.
2477
2478
2479         2.5.2  Header Line
2480
2481                 H aa areas gg global symbols
2482
2483            The  header  line  specifies  the number of areas(aa) and the
2484         number of global symbols(gg) defined or referenced in  this  ob-
2485         ject module segment.
2486
2487
2488         2.5.3  Module Line
2489
2490                 M name
2491
2492            The  module  line  specifies  the module name from which this
2493         header segment was assembled.  The module line will  not  appear
2494         if the .module directive was not used in the source program.
2495
2496
2497         2.5.4  Symbol Line
2498
2499                 S string Defnnnn
2500
2501                         or
2502
2503                 S string Refnnnn
2504
2505            The  symbol line defines (Def) or references (Ref) the symbol
2506         'string' with the value nnnn.  The defined value is relative  to
2507         the  current  area  base  address.   References to constants and
2508         external global symbols will always appear before the first area
2509 \f
2510
2511         THE LINKER                                              PAGE 2-7
2512         LINKER INPUT FORMAT
2513
2514
2515         definition.  References to external symbols will have a value of
2516         zero.
2517
2518
2519         2.5.5  Area Line
2520
2521                 A label size ss flags ff
2522
2523            The  area  line  defines the area label, the size (ss) of the
2524         area in bytes, and the area flags (ff).  The area flags  specify
2525         the ABS, REL, CON, OVR, and PAG parameters:
2526
2527                 OVR/CON  (0x04/0x00 i.e.  bit position 2)
2528
2529                 ABS/REL  (0x08/0x00 i.e.  bit position 3)
2530
2531                 PAG      (0x10 i.e.  bit position 4)
2532
2533
2534         2.5.6  T Line
2535
2536                 T xx xx nn nn nn nn nn ...
2537
2538            The  T  line contains the assembled code output by the assem-
2539         bler with xx xx being the offset address from the  current  area
2540         base address and nn being the assembled instructions and data in
2541         byte format.
2542
2543
2544         2.5.7  R Line
2545
2546                 R 0 0 nn nn n1 n2 xx xx ...
2547
2548            The R line provides the relocation information to the linker.
2549         The nn nn value is the current area index, i.e.  which area  the
2550         current  values  were  assembled.  Relocation information is en-
2551         coded in groups of 4 bytes:
2552
2553              1.  n1 is the relocation mode and object format
2554                  1.  bit 0 word(0x00)/byte(0x01)
2555                  2.  bit 1 relocatable area(0x00)/symbol(0x02)
2556                  3.  bit 2 normal(0x00)/PC relative(0x04) relocation
2557                  4.  bit  3  1-byte(0x00)/2-byte(0x08) object format for
2558                      byte data
2559                  5.  bit 4 signed(0x00)/unsigned(0x10) byte data
2560                  6.  bit 5 normal(0x00)/page '0'(0x20) reference
2561                  7.  bit 6 normal(0x00)/page 'nnn'(0x40) reference
2562                  8.  bit  7  LSB  byte(0x00)/MSB  byte(0x80) with 2-byte
2563                      mode
2564
2565              2.  n2  is  a byte index into the corresponding (i.e.  pre-
2566                  ceeding) T line data (i.e.  a pointer to the data to be
2567 \f
2568
2569         THE LINKER                                              PAGE 2-8
2570         LINKER INPUT FORMAT
2571
2572
2573                  updated  by  the  relocation).   The T line data may be
2574                  1-byte or  2-byte  byte  data  format  or  2-byte  word
2575                  format.
2576
2577              3.  xx xx  is the area/symbol index for the area/symbol be-
2578                  ing referenced.  the corresponding area/symbol is found
2579                  in the header area/symbol lists.
2580
2581
2582         The groups of 4 bytes are repeated for each item requiring relo-
2583         cation in the preceeding T line.
2584
2585
2586         2.5.8  P Line
2587
2588                 P 0 0 nn nn n1 n2 xx xx
2589
2590            The  P  line provides the paging information to the linker as
2591         specified by a .setdp directive.  The format of  the  relocation
2592         information is identical to that of the R line.  The correspond-
2593         ing T line has the following information:
2594                 T xx xx aa aa bb bb
2595
2596            Where  aa aa is the area reference number which specifies the
2597         selected page area and bb bb is the base address  of  the  page.
2598         bb bb will require relocation processing if the 'n1 n2 xx xx' is
2599         specified in the P line.  The linker will verify that  the  base
2600         address is on a 256 byte boundary and that the page length of an
2601         area defined with the PAG type is not larger than 256 bytes.
2602
2603            The  linker  defaults any direct page references to the first
2604         area defined in the input REL file.  All ASxxxx assemblers  will
2605         specify the _CODE area first, making this the default page area.
2606
2607
2608         2.6  LINKER ERROR MESSAGES
2609
2610
2611            The linker provides detailed error messages allowing the pro-
2612         grammer to quickly find the errant code.   As  the  linker  com-
2613         pletes  pass 1  over  the  input  file(s)  it  reports  any page
2614         boundary or page length errors as follows:
2615
2616         ?ASlink-Warning-Paged Area PAGE0 Boundary Error
2617
2618         and/or
2619
2620         ?ASlink-Warning-Paged Area PAGE0 Length Error
2621
2622         where PAGE0 is the paged area.
2623
2624 \f
2625
2626         THE LINKER                                              PAGE 2-9
2627         LINKER ERROR MESSAGES
2628
2629
2630            During  Pass  two the linker reads the T, R, and P lines per-
2631         forming the necessary relocations and  outputting  the  absolute
2632         code.  Various errors may be reported during this process
2633         The P line processing can produce only one possible error:
2634
2635         ?ASlink-Warning-Page Definition Boundary Error
2636                  file        module      pgarea      pgoffset
2637           PgDef  t6809l      t6809l      PAGE0       0001
2638
2639         The error message specifies the file and module where the .setdp
2640         direct was issued and indicates  the  page  area  and  the  page
2641         offset value determined after relocation.
2642
2643
2644         The R line processing produces various errors:
2645
2646         ?ASlink-Warning-Byte PCR relocation error for symbol  bra2
2647                  file        module      area        offset
2648           Refby  t6809l      t6809l      TEST        00FE
2649           Defin  tconst      tconst      .  .ABS.    0080
2650
2651         ?ASlink-Warning-Unsigned Byte error for symbol  two56
2652                  file        module      area        offset
2653           Refby  t6800l      t6800l      DIRECT      0015
2654           Defin  tconst      tconst      .  .ABS.    0100
2655
2656         ?ASlink-Warning-Page0 relocation error for symbol  ltwo56
2657                  file        module      area        offset
2658           Refby  t6800l      t6800l      DIRECT      000D
2659           Defin  tconst      tconst      DIRECT      0100
2660
2661         ?ASlink-Warning-Page Mode relocation error for symbol  two56
2662                  file        module      area        offset
2663           Refby  t6809l      t6809l      DIRECT      0005
2664           Defin  tconst      tconst      .  .ABS.    0100
2665
2666         ?ASlink-Warning-Page Mode relocation error
2667                  file        module      area        offset
2668           Refby  t           Pagetest    PROGRAM     0006
2669           Defin  t           Pagetest    DIRECT      0100
2670
2671         These  error messages specify the file, module, area, and offset
2672         within the area of the code  referencing  (Refby)  and  defining
2673         (Defin) the symbol.  If the symbol is defined in the same module
2674         as the reference the linker is unable to report the symbol name.
2675         The  assembler  listing file(s) should be examined at the offset
2676         from the specified area to located the offending code.
2677
2678            The errors are:
2679
2680              1.  The  byte PCR error is caused by exceeding the pc rela-
2681                  tive byte branch range.
2682 \f
2683
2684         THE LINKER                                             PAGE 2-10
2685         LINKER ERROR MESSAGES
2686
2687
2688              2.  The Unsigned byte error indicates an indexing value was
2689                  negative or larger than 255.
2690
2691              3.  The  Page0  error is generated if the direct page vari-
2692                  able is not in the page0 range of 0 to 255.
2693
2694              4.  The page mode error is generated if the direct variable
2695                  is not within the current direct page (6809).
2696
2697 \f
2698
2699         THE LINKER                                             Page 2-11
2700         INTEL HEX OUTPUT FORMAT
2701
2702
2703         2.7  INTEL HEX OUTPUT FORMAT
2704
2705         Record Mark Field    -  This  field  signifies  the  start  of a
2706                                 record, and consists of an  ascii  colon
2707                                 (:).
2708
2709         Record Length Field  -  This   field   consists   of  two  ascii
2710                                 characters which indicate the number  of
2711                                 data   bytes   in   this   record.   The
2712                                 characters are the result of  converting
2713                                 the  number  of  bytes  in binary to two
2714                                 ascii characters, high digit first.   An
2715                                 End  of  File  record contains two ascii
2716                                 zeros in this field.
2717
2718         Load Address Field   -  This  field  consists  of the four ascii
2719                                 characters which result from  converting
2720                                 the  the  binary value of the address in
2721                                 which to begin loading this record.  The
2722                                 order is as follows:
2723
2724                                     High digit of high byte of address.
2725                                     Low digit of high byte of address.
2726                                     High digit of low byte of address.
2727                                     Low digit of low byte of address.
2728
2729                                 In an End of File record this field con-
2730                                 sists of either four ascii zeros or  the
2731                                 program  entry  address.   Currently the
2732                                 entry address option is not supported.
2733
2734         Record Type Field    -  This  field  identifies the record type,
2735                                 which is either 0 for data records or  1
2736                                 for  an End of File record.  It consists
2737                                 of two ascii characters, with  the  high
2738                                 digit of the record type first, followed
2739                                 by the low digit of the record type.
2740
2741         Data Field           -  This  field consists of the actual data,
2742                                 converted to two ascii characters,  high
2743                                 digit first.  There are no data bytes in
2744                                 the End of File record.
2745
2746         Checksum Field       -  The  checksum  field is the 8 bit binary
2747                                 sum of the record length field, the load
2748                                 address  field,  the  record type field,
2749                                 and the data field.  This  sum  is  then
2750                                 negated  (2's  complement) and converted
2751                                 to  two  ascii  characters,  high  digit
2752                                 first.
2753 \f
2754
2755         THE LINKER                                             Page 2-12
2756         MOTOROLA S1-S9 OUTPUT FORMAT
2757
2758
2759         2.8  MOTORLA S1-S9 OUTPUT FORMAT
2760
2761         Record Type Field    -  This  field  signifies  the  start  of a
2762                                 record and  identifies  the  the  record
2763                                 type as follows:
2764
2765                                     Ascii S1 - Data Record
2766                                     Ascii S9 - End of File Record
2767
2768         Record Length Field  -  This  field  specifies the record length
2769                                 which includes the  address,  data,  and
2770                                 checksum   fields.   The  8  bit  record
2771                                 length value is converted to  two  ascii
2772                                 characters, high digit first.
2773
2774         Load Address Field   -  This  field  consists  of the four ascii
2775                                 characters which result from  converting
2776                                 the  the  binary value of the address in
2777                                 which to begin loading this record.  The
2778                                 order is as follows:
2779
2780                                     High digit of high byte of address.
2781                                     Low digit of high byte of address.
2782                                     High digit of low byte of address.
2783                                     Low digit of low byte of address.
2784
2785                                 In an End of File record this field con-
2786                                 sists of either four ascii zeros or  the
2787                                 program  entry  address.   Currently the
2788                                 entry address option is not supported.
2789
2790         Data Field           -  This  field consists of the actual data,
2791                                 converted to two ascii characters,  high
2792                                 digit first.  There are no data bytes in
2793                                 the End of File record.
2794
2795         Checksum Field       -  The  checksum  field is the 8 bit binary
2796                                 sum of the record length field, the load
2797                                 address field, and the data field.  This
2798                                 sum is then  complemented  (1's  comple-
2799                                 ment)   and   converted   to  two  ascii
2800                                 characters, high digit first.
2801 \f
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815                                     CHAPTER 3
2816
2817                            BUILDING ASXXXX AND ASLINK
2818
2819
2820
2821
2822            The assemblers and linker have been successfully compiled us-
2823         ing  the  DECUS C  (PDP-11)  compiler  (patch  level   9)   with
2824         RT-11/TSX+,  Eyring  Research  Institute,  Inc.   PDOS (680x0) C
2825         V5.4b compiler, and Symantec C/C++ V6.1/V7.0.
2826
2827            The  device  specific  header  file  (i.e.  m6800.h, m6801.h,
2828         etc.) contains the DECUS C 'BUILD' directives for  generating  a
2829         command  file to compile, assemble, and link the necessary files
2830         to prepare an executable image for a particular assembler.
2831
2832
2833         3.1  BUILDING AN ASSEMBLER
2834
2835
2836            The  building  of  a typical assembler (6809 for example) re-
2837         quires the following files:
2838
2839              1.  M6809.H
2840              2.  M09EXT.C
2841              3.  M09MCH.C
2842              4.  M09ADR.C
2843              5.  M09PST.C
2844              6.  ASM.H
2845              7.  ASMAIN.C
2846              8.  ASLEX.C
2847              9.  ASSYM.C
2848             10.  ASSUBR.C
2849             11.  ASEXPR.C
2850             12.  ASDATA.C
2851             13.  ASLIST.C
2852             14.  ASOUT.C
2853
2854
2855            The  first  five  files are the 6809 processor dependent sec-
2856         tions which contain the following:
2857
2858
2859 \f
2860
2861         BUILDING ASXXXX AND ASLINK                              PAGE 3-2
2862         BUILDING AN ASSEMBLER
2863
2864
2865              1.  m6809.h -  header  file containing the machine specific
2866                  definitions of constants,  variables,  structures,  and
2867                  types
2868
2869              2.  m09ext -  device  description, byte order, and file ex-
2870                  tension information
2871
2872              3.  m09pst -  a  table of the assembler general directives,
2873                  special device directives, and assembler mnemonics with
2874                  associated operation codes
2875
2876              4.  m09mch / m09adr -  machine specific code for processing
2877                  the device mnemonics,  addressing  modes,  and  special
2878                  directives
2879
2880
2881            The  remaining nine files provide the device independent sec-
2882         tions which handle the  details  of  file  input/output,  symbol
2883         table  generation,  program/data areas, expression analysis, and
2884         assembler directive processing.
2885
2886            The  assembler defaults to the not case sensitive mode.  This
2887         may be altered by changing the case sensitivity flag in asm.h to
2888
2889                 /*
2890                  * Case Sensitivity Flag
2891                  */
2892                 #define CASE_SENSITIVE  1
2893
2894            The  assemblers  and  linker should be compiled with the same
2895         case sensitivity option.
2896
2897
2898         3.2  BUILDING ASLINK
2899
2900
2901            The building of the linker requires the following files:
2902
2903              1.  ASLINK.H
2904              2.  LKMAIN.C
2905              3.  LKLEX.C
2906              4.  LKAREA.C
2907              5.  LKHEAD.C
2908              6.  LKSYM.C
2909              7.  LKEVAL.C
2910              8.  LKDATA.C
2911              9.  LKLIST.C
2912             10.  LKRLOC.C
2913             11.  LKLIBR.C
2914             12.  LKS19.C
2915             13.  LKIHX.C
2916
2917 \f
2918
2919         BUILDING ASXXXX AND ASLINK                              PAGE 3-3
2920         BUILDING ASLINK
2921
2922
2923            The linker defaults to the not case sensitive mode.  This may
2924         be altered by changing the case sensitivity flag in aslink.h to
2925
2926                 /*
2927                  * Case Sensitivity Flag
2928                  */
2929                 #define CASE_SENSITIVE  1
2930
2931            The  linker  and  assemblers should be compiled with the same
2932         case sensitivity option.
2933 \f
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947                                    APPENDIX A
2948
2949                                 AS6800 ASSEMBLER
2950
2951
2952
2953
2954
2955         A.1  6800 REGISTER SET
2956
2957         The following is a list of the 6800 registers used by AS6800:
2958
2959                 a,b     -       8-bit accumulators
2960                 x       -       index register
2961
2962
2963         A.2  6800 INSTRUCTION SET
2964
2965
2966            The following tables list all 6800/6802/6808 mnemonics recog-
2967         nized by the AS6800 assembler.  The designation [] refers  to  a
2968         required addressing mode argument.  The following list specifies
2969         the format for each addressing mode supported by AS6800:
2970
2971                 #data           immediate data
2972                                 byte or word data
2973
2974                 *dir            direct page addressing
2975                                 (see .setdp directive)
2976                                 0 <= dir <= 255
2977
2978                 ,x              register indirect addressing
2979                                 zero offset
2980
2981                 offset,x        register indirect addressing
2982                                 0 <= offset <= 255
2983
2984                 ext             extended addressing
2985
2986                 label           branch label
2987
2988         The  terms  data, dir, offset, ext, and label may all be expres-
2989         sions.
2990
2991 \f
2992
2993         AS6800 ASSEMBLER                                        PAGE A-2
2994         6800 INSTRUCTION SET
2995
2996
2997            Note  that  not all addressing modes are valid with every in-
2998         struction, refer to the 6800 technical data for valid modes.
2999
3000
3001         A.2.1  Inherent Instructions
3002
3003                 aba                     cba
3004                 clc                     cli
3005                 clv                     daa
3006                 des                     dex
3007                 ins                     inx
3008                 nop                     rti
3009                 rts                     sba
3010                 sec                     sei
3011                 sev                     swi
3012                 tab                     tap
3013                 tba                     tpa
3014                 tsx                     txs
3015                 wai
3016
3017                 psha                    pshb
3018                 psh a                   psh b
3019                 pula                    pulb
3020                 pul a                   pul b
3021
3022
3023         A.2.2  Branch Instructions
3024
3025                 bra     label           bhi     label
3026                 bls     label           bcc     label
3027                 bhs     label           bcs     label
3028                 blo     label           bne     label
3029                 beq     label           bvc     label
3030                 bvs     label           bpl     label
3031                 bmi     label           bge     label
3032                 blt     label           bgt     label
3033                 ble     label           bsr     label
3034 \f
3035
3036         AS6800 ASSEMBLER                                        PAGE A-3
3037         6800 INSTRUCTION SET
3038
3039
3040         A.2.3  Single Operand Instructions
3041
3042                 asla                    aslb
3043                 asl a                   asl b
3044                 asl     []
3045
3046                 asra                    asrb
3047                 asr a                   asr b
3048                 asr     []
3049
3050                 clra                    clrb
3051                 clr a                   clr b
3052                 clr     []
3053
3054                 coma                    comb
3055                 com a                   com b
3056                 com     []
3057
3058                 deca                    decb
3059                 dec a                   dec b
3060                 dec     []
3061
3062                 inca                    incb
3063                 inc a                   inc b
3064                 inc     []
3065
3066                 lsla                    lslb
3067                 lsl a                   lsl b
3068                 lsl     []
3069
3070                 lsra                    lsrb
3071                 lsr a                   lsr b
3072                 lsr     []
3073
3074                 nega                    negb
3075                 neg a                   neg b
3076                 neg     []
3077
3078                 rola                    rolb
3079                 rol a                   rol b
3080                 rol     []
3081
3082                 rora                    rorb
3083                 ror a                   ror b
3084                 ror     []
3085
3086                 tsta                    tstb
3087                 tst a                   tst b
3088                 tst     []
3089 \f
3090
3091         AS6800 ASSEMBLER                                        PAGE A-4
3092         6800 INSTRUCTION SET
3093
3094
3095         A.2.4  Double Operand Instructions
3096
3097                 adca    []              adcb    []
3098                 adc a   []              adc b   []
3099
3100                 adda    []              addb    []
3101                 add a   []              add b   []
3102
3103                 anda    []              andb    []
3104                 and a   []              and b   []
3105
3106                 bita    []              bitb    []
3107                 bit a   []              bit b   []
3108
3109                 cmpa    []              cmpb    []
3110                 cmp a   []              cmp b   []
3111
3112                 eora    []              eorb    []
3113                 eor a   []              eor b   []
3114
3115                 ldaa    []              ldab    []
3116                 lda a   []              lda b   []
3117
3118                 oraa    []              orab    []
3119                 ora a   []              ora b   []
3120
3121                 sbca    []              sbcb    []
3122                 sbc a   []              sbc b   []
3123
3124                 staa    []              stab    []
3125                 sta a   []              sta b   []
3126
3127                 suba    []              subb    []
3128                 sub a   []              sub b   []
3129
3130
3131         A.2.5  Jump and Jump to Subroutine Instructions
3132
3133                 jmp     []              jsr     []
3134
3135
3136 \f
3137
3138         AS6800 ASSEMBLER                                        PAGE A-5
3139         6800 INSTRUCTION SET
3140
3141
3142         A.2.6  Long Register Instructions
3143
3144                 cpx     []
3145                 lds     []              sts     []
3146                 ldx     []              stx     []
3147 \f
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161                                    APPENDIX B
3162
3163                                 AS6801 ASSEMBLER
3164
3165
3166
3167
3168
3169         B.1  .hd6303 DIRECTIVE
3170
3171         Format:
3172
3173                 .hd6303
3174
3175         The  .hd6303 directive enables processing of the HD6303 specific
3176         mnemonics not included in  the  6801  instruction  set.   HD6303
3177         mnemonics  encountered  without  the  .hd6303  directive will be
3178         flagged with an 'o' error.
3179
3180
3181         B.2  6801 REGISTER SET
3182
3183         The following is a list of the 6801 registers used by AS6801:
3184
3185                 a,b     -       8-bit accumulators
3186                 d       -       16-bit accumulator <a:b>
3187                 x       -       index register
3188
3189
3190         B.3  6801 INSTRUCTION SET
3191
3192
3193            The  following tables list all 6801/6303 mnemonics recognized
3194         by the AS6801 assembler.  The designation []  refers  to  a  re-
3195         quired  addressing  mode argument.  The following list specifies
3196         the format for each addressing mode supported by AS6801:
3197
3198                 #data           immediate data
3199                                 byte or word data
3200
3201                 *dir            direct page addressing
3202                                 (see .setdp directive)
3203                                 0 <= dir <= 255
3204
3205 \f
3206
3207         AS6801 ASSEMBLER                                        PAGE B-2
3208         6801 INSTRUCTION SET
3209
3210
3211                 ,x              register indirect addressing
3212                                 zero offset
3213
3214                 offset,x        register indirect addressing
3215                                 0 <= offset <= 255
3216
3217                 ext             extended addressing
3218
3219                 label           branch label
3220
3221         The  terms  data, dir, offset, ext, and label may all be expres-
3222         sions.
3223
3224            Note  that  not all addressing modes are valid with every in-
3225         struction, refer to  the  6801/6303  technical  data  for  valid
3226         modes.
3227
3228
3229         B.3.1  Inherent Instructions
3230
3231                 aba             abx
3232                 cba             clc
3233                 cli             clv
3234                 daa             des
3235                 dex             ins
3236                 inx             mul
3237                 nop             rti
3238                 rts             sba
3239                 sec             sei
3240                 sev             swi
3241                 tab             tap
3242                 tba             tpa
3243                 tsx             txs
3244                 wai
3245
3246
3247         B.3.2  Branch Instructions
3248
3249                 bra     label           brn     label
3250                 bhi     label           bls     label
3251                 bcc     label           bhs     label
3252                 bcs     label           blo     label
3253                 bne     label           beq     label
3254                 bvc     label           bvs     label
3255                 bpl     label           bmi     label
3256                 bge     label           blt     label
3257                 bgt     label           ble     label
3258                 bsr     label
3259 \f
3260
3261         AS6801 ASSEMBLER                                        PAGE B-3
3262         6801 INSTRUCTION SET
3263
3264
3265         B.3.3  Single Operand Instructions
3266
3267                 asla            aslb            asld
3268                 asl a           asl b           asl d
3269                 asl     []
3270
3271                 asra            asrb
3272                 asr a           asr b
3273                 asr     []
3274
3275                 clra            clrb
3276                 clr a           clr b
3277                 clr     []
3278
3279                 coma            comb
3280                 com a           com b
3281                 com     []
3282
3283                 deca            decb
3284                 dec a           dec b
3285                 dec     []
3286
3287                 eora            eorb
3288                 eor a           eor b
3289                 eor     []
3290
3291                 inca            incb
3292                 inc a           inc b
3293                 inc     []
3294
3295                 lsla            lslb            lsld
3296                 lsl a           lsl b           lsl d
3297                 lsl     []
3298
3299                 lsra            lsrb            lsrd
3300                 lsr a           lsr b           lsr d
3301                 lsr     []
3302
3303                 nega            negb
3304                 neg a           neg b
3305                 neg     []
3306
3307                 psha            pshb            pshx
3308                 psh a           psh b           psh x
3309
3310                 pula            pulb            pulx
3311                 pul a           pul b           pul x
3312
3313                 rola            rolb
3314                 rol a           rol b
3315                 rol     []
3316
3317 \f
3318
3319         AS6801 ASSEMBLER                                        PAGE B-4
3320         6801 INSTRUCTION SET
3321
3322
3323                 rora            rorb
3324                 ror a           ror b
3325                 ror     []
3326
3327                 tsta            tstb
3328                 tst a           tst b
3329                 tst     []
3330
3331
3332         B.3.4  Double Operand Instructions
3333
3334                 adca    []      adcb    []
3335                 adc a   []      adc b   []
3336
3337                 adda    []      addb    []      addd    []
3338                 add a   []      add b   []      add d   []
3339
3340                 anda    []      andb    []
3341                 and a   []      and b   []
3342
3343                 bita    []      bitb    []
3344                 bit a   []      bit b   []
3345
3346                 cmpa    []      cmpb    []
3347                 cmp a   []      cmp b   []
3348
3349                 ldaa    []      ldab    []
3350                 lda a   []      lda b   []
3351
3352                 oraa    []      orab    []
3353                 ora a   []      ora b   []
3354
3355                 sbca    []      sbcb    []
3356                 sbc a   []      sbc b   []
3357
3358                 staa    []      stab    []
3359                 sta a   []      sta b   []
3360
3361                 suba    []      subb    []      subd    []
3362                 sub a   []      sub b   []      sub d   []
3363
3364
3365 \f
3366
3367         AS6801 ASSEMBLER                                        PAGE B-5
3368         6801 INSTRUCTION SET
3369
3370
3371         B.3.5  Jump and Jump to Subroutine Instructions
3372
3373                 jmp     []      jsr     []
3374
3375
3376         B.3.6  Long Register Instructions
3377
3378                 cpx     []      ldd     []
3379                 lds     []      ldx     []
3380                 std     []      sts     []
3381                 stx     []
3382
3383
3384         B.3.7  6303 Specific Instructions
3385
3386                 aim     #data, []       eim     #data, []
3387                 oim     #data, []       tim     #data, []
3388
3389                 xgdx            slp
3390 \f
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404                                    APPENDIX C
3405
3406                                 AS6804 ASSEMBLER
3407
3408
3409
3410
3411            Requires the .setdp directive to specify the ram area.
3412
3413
3414         C.1  6804 REGISTER SET
3415
3416         The following is a list of the 6804 registers used by AS6804:
3417
3418                 x,y     -       index registers
3419
3420
3421         C.2  6804 INSTRUCTION SET
3422
3423
3424            The  following  tables  list all 6804 mnemonics recognized by
3425         the AS6804 assembler.  The designation [] refers to  a  required
3426         addressing  mode  argument.   The  following  list specifies the
3427         format for each addressing mode supported by AS6804:
3428
3429                 #data           immediate data
3430                                 byte or word data
3431
3432                 ,x              register indirect addressing
3433
3434                 dir             direct addressing
3435                                 (see .setdp directive)
3436                                 0 <= dir <= 255
3437
3438                 ext             extended addressing
3439
3440                 label           branch label
3441
3442         The  terms data, dir, and ext may be expressions.  The label for
3443         the short branchs beq, bne, bcc, and bcs must not be external.
3444
3445            Note  that  not all addressing modes are valid with every in-
3446         struction, refer to the 6804 technical data for valid modes.
3447 \f
3448
3449         AS6804 ASSEMBLER                                        PAGE C-2
3450         6804 INSTRUCTION SET
3451
3452
3453         C.2.1  Inherent Instructions
3454
3455                 coma            decx
3456                 decy            incx
3457                 incy            rola
3458                 rti             rts
3459                 stop            tax
3460                 tay             txa
3461                 tya             wait
3462
3463
3464         C.2.2  Branch Instructions
3465
3466                 bne     label           beq     label
3467                 bcc     label           bcs     label
3468
3469
3470         C.2.3  Single Operand Instructions
3471
3472                 add     []
3473                 and     []
3474                 cmp     []
3475                 dec     []
3476                 inc     []
3477                 lda     []
3478                 sta     []
3479                 sub     []
3480
3481
3482         C.2.4  Jump and Jump to Subroutine Instructions
3483
3484                 jsr     []
3485                 jmp     []
3486
3487
3488         C.2.5  Bit Test Instructions
3489
3490                 brclr   #data,[],label
3491                 brset   #data,[],label
3492
3493                 bclr    #label,[]
3494                 bset    #label,[]
3495
3496
3497 \f
3498
3499         AS6804 ASSEMBLER                                        PAGE C-3
3500         6804 INSTRUCTION SET
3501
3502
3503         C.2.6  Load Immediate data Instruction
3504
3505                 mvi     [],#data
3506
3507
3508         C.2.7  6804 Derived Instructions
3509
3510                 asla
3511                 bam     label
3512                 bap     label
3513                 bxmi    label
3514                 bxpl    label
3515                 bymi    label
3516                 bypl    label
3517                 clra
3518                 clrx
3519                 clry
3520                 deca
3521                 decx
3522                 decy
3523                 inca
3524                 incx
3525                 incy
3526                 ldxi    #data
3527                 ldyi    #data
3528                 nop
3529                 tax
3530                 tay
3531                 txa
3532                 tya
3533 \f
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547                                    APPENDIX D
3548
3549                                 AS6805 ASSEMBLER
3550
3551
3552
3553
3554
3555         D.1  6805 REGISTER SET
3556
3557         The following is a list of the 6805 registers used by AS6805:
3558
3559                 a       -       8-bit accumulator
3560                 x       -       index register
3561
3562
3563         D.2  6805 INSTRUCTION SET
3564
3565
3566            The  following  tables  list all 6805 mnemonics recognized by
3567         the AS6805 assembler.  The designation [] refers to  a  required
3568         addressing  mode  argument.   The  following  list specifies the
3569         format for each addressing mode supported by AS6805:
3570
3571                 #data           immediate data
3572                                 byte or word data
3573
3574                 *dir            direct page addressing
3575                                 (see .setdp directive)
3576                                 0 <= dir <= 255
3577
3578                 ,x              register indirect addressing
3579                                 zero offset
3580
3581                 offset,x        register indirect addressing
3582                                   0 <= offset <= 255   --- byte mode
3583                                 256 <= offset <= 65535 --- word mode
3584                                 (an externally defined offset uses the
3585                                  word mode)
3586
3587                 ext             extended addressing
3588
3589                 label           branch label
3590
3591 \f
3592
3593         AS6805 ASSEMBLER                                        PAGE D-2
3594         6805 INSTRUCTION SET
3595
3596
3597         The terms data, dir, offset, and ext may all be expressions.
3598
3599            Note  that  not all addressing modes are valid with every in-
3600         struction, refer to the 6805 technical data for valid modes.
3601
3602
3603         D.2.1  Control Instructions
3604
3605                 clc             cli
3606                 nop             rsp
3607                 rti             rts
3608                 sec             sei
3609                 stop            swi
3610                 tax             txa
3611                 wait
3612
3613
3614         D.2.2  Bit Manipulation Instructions
3615
3616                 brset   #data,*dir,label
3617                 brclr   #data,*dir,label
3618
3619                 bset    #data,*dir
3620                 bclr    #data,*dir
3621
3622
3623         D.2.3  Branch Instructions
3624
3625                 bra     label           brn     label
3626                 bhi     label           bls     label
3627                 bcc     label           bcs     label
3628                 bne     label           beq     label
3629                 bhcc    label           bhcs    label
3630                 bpl     label           bmi     label
3631                 bmc     label           bms     label
3632                 bil     label           bih     label
3633                 bsr     label
3634 \f
3635
3636         AS6805 ASSEMBLER                                        PAGE D-3
3637         6805 INSTRUCTION SET
3638
3639
3640         D.2.4  Read-Modify-Write Instructions
3641
3642                 nega            negx
3643                 neg     []
3644
3645                 coma            comx
3646                 com     []
3647
3648                 lsra            lsrx
3649                 lsr     []
3650
3651                 rora            rorx
3652                 ror     []
3653
3654                 asra            asrx
3655                 asr     []
3656
3657                 lsla            lslx
3658                 lsl     []
3659
3660                 rola            rolx
3661                 rol     []
3662
3663                 deca            decx
3664                 dec     []
3665
3666                 inca            incx
3667                 inc     []
3668
3669                 tsta            tstx
3670                 tst     []
3671
3672                 clra            clrx
3673                 clr     []
3674
3675
3676         D.2.5  Register\Memory Instructions
3677
3678                 sub     []              cmp     []
3679                 sbc     []              cpx     []
3680                 and     []              bit     []
3681                 lda     []              sta     []
3682                 eor     []              adc     []
3683                 ora     []              add     []
3684                 ldx     []              stx     []
3685 \f
3686
3687         AS6805 ASSEMBLER                                        PAGE D-4
3688         6805 INSTRUCTION SET
3689
3690
3691         D.2.6  Jump and Jump to Subroutine Instructions
3692
3693                 jmp     []              jsr     []
3694 \f
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708                                    APPENDIX E
3709
3710                                AS68HC08 ASSEMBLER
3711
3712
3713
3714
3715
3716         E.1  68HC08 REGISTER SET
3717
3718         The  following  is  a  list  of  the  68HC08  registers  used by
3719         AS68HC08:
3720
3721                 a       -       8-bit accumulator
3722                 x       -       index register  <H:X>
3723                 s       -       stack pointer
3724
3725
3726         E.2  68HC08 INSTRUCTION SET
3727
3728
3729            The  following tables list all 68HC08 mnemonics recognized by
3730         the AS68HC08 assembler.  The designation [] refers to a required
3731         addressing  mode  argument.   The  following  list specifies the
3732         format for each addressing mode supported by AS68HC08:
3733
3734                 #data           immediate data
3735                                 byte or word data
3736
3737                 *dir            direct page addressing
3738                                 (see .setdp directive)
3739                                 0 <= dir <= 255
3740
3741                 ,x              register indexed addressing
3742                                 zero offset
3743
3744                 offset,x        register indexed addressing
3745                                   0 <= offset <= 255   --- byte mode
3746                                 256 <= offset <= 65535 --- word mode
3747                                 (an externally defined offset uses the
3748                                  word mode)
3749
3750                 ,x+             register indexed addressing
3751                                 zero offset with post increment
3752 \f
3753
3754         AS68HC08 ASSEMBLER                                      PAGE E-2
3755         68HC08 INSTRUCTION SET
3756
3757
3758
3759                 offset,x+       register indexed addressing
3760                                 unsigned byte offset with post increment
3761
3762                 offset,s        stack pointer indexed addressing
3763                                   0 <= offset <= 255   --- byte mode
3764                                 256 <= offset <= 65535 --- word mode
3765                                 (an externally defined offset uses the
3766                                  word mode)
3767
3768                 ext             extended addressing
3769
3770                 label           branch label
3771
3772         The terms data, dir, offset, and ext may all be expressions.
3773
3774            Note  that  not all addressing modes are valid with every in-
3775         struction, refer to the 68HC08 technical data for valid modes.
3776
3777
3778         E.2.1  Control Instructions
3779
3780                 clc             cli             daa             div
3781                 mul             nop             nsa             psha
3782                 pshh            pshx            pula            pulh
3783                 pulx            rsp             rti             rts
3784                 sec             sei             stop            swi
3785                 tap             tax             tpa             tsx
3786                 txa             txs             wait
3787
3788
3789         E.2.2  Bit Manipulation Instructions
3790
3791                 brset   #data,*dir,label
3792                 brclr   #data,*dir,label
3793
3794                 bset    #data,*dir
3795                 bclr    #data,*dir
3796 \f
3797
3798         AS68HC08 ASSEMBLER                                      PAGE E-3
3799         68HC08 INSTRUCTION SET
3800
3801
3802         E.2.3  Branch Instructions
3803
3804                 bra     label           brn     label
3805                 bhi     label           bls     label
3806                 bcc     label           bcs     label
3807                 bne     label           beq     label
3808                 bhcc    label           bhcs    label
3809                 bpl     label           bmi     label
3810                 bmc     label           bms     label
3811                 bil     label           bih     label
3812                 bsr     label           bge     label
3813                 blt     label           bgt     label
3814                 ble     label
3815
3816
3817         E.2.4  Complex Branch Instructions
3818
3819                 cbeqa   [],label
3820                 cbeqx   [],label
3821                 cbeq    [],label
3822                 dbnza   label
3823                 dbnzx   label
3824                 dbnz    [],label
3825 \f
3826
3827         AS68HC08 ASSEMBLER                                      PAGE E-4
3828         68HC08 INSTRUCTION SET
3829
3830
3831         E.2.5  Read-Modify-Write Instructions
3832
3833                 nega                    negx
3834                 neg     []
3835
3836                 coma                    comx
3837                 com     []
3838
3839                 lsra                    lsrx
3840                 lsr     []
3841
3842                 rora                    rorx
3843                 ror     []
3844
3845                 asra                    asrx
3846                 asr     []
3847
3848                 asla                    aslx
3849                 asl     []
3850
3851                 lsla                    lslx
3852                 lsl     []
3853
3854                 rola                    rolx
3855                 rol     []
3856
3857                 deca                    decx
3858                 dec     []
3859
3860                 inca                    incx
3861                 inc     []
3862
3863                 tsta                    tstx
3864                 tst     []
3865
3866                 clra                    clrx
3867                 clr     []              clrh
3868
3869                 aix     #data
3870
3871                 ais     #data
3872 \f
3873
3874         AS68HC08 ASSEMBLER                                      PAGE E-5
3875         68HC08 INSTRUCTION SET
3876
3877
3878         E.2.6  Register\Memory Instructions
3879
3880                 sub     []              cmp     []
3881                 sbc     []              cpx     []
3882                 and     []              bit     []
3883                 lda     []              sta     []
3884                 eor     []              adc     []
3885                 ora     []              add     []
3886                 ldx     []              stx     []
3887
3888
3889         E.2.7  Double Operand Move Instruction
3890
3891                 mov     [],[]
3892
3893
3894         E.2.8  16-Bit <H:X> Index Register Instructions
3895
3896                 cphx    []
3897                 ldhx    []
3898                 sthx    []
3899
3900
3901         E.2.9  Jump and Jump to Subroutine Instructions
3902
3903                 jmp     []              jsr     []
3904 \f
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918                                    APPENDIX F
3919
3920                                 AS6809 ASSEMBLER
3921
3922
3923
3924
3925
3926         F.1  6809 REGISTER SET
3927
3928         The following is a list of the 6809 registers used by AS6809:
3929
3930                 a,b     -       8-bit accumulators
3931                 d       -       16-bit accumulator <a:b>
3932                 x,y     -       index registers
3933                 s,u     -       stack pointers
3934                 pc      -       program counter
3935                 cc      -       condition code
3936                 dp      -       direct page
3937
3938
3939         F.2  6809 INSTRUCTION SET
3940
3941
3942            The  following  tables  list all 6809 mnemonics recognized by
3943         the AS6809 assembler.  The designation [] refers to  a  required
3944         addressing  mode  argument.   The  following  list specifies the
3945         format for each addressing mode supported by AS6809:
3946
3947                 #data           immediate data
3948                                 byte or word data
3949
3950                 *dir            direct page addressing
3951                                 (see .setdp directive)
3952                                 0 <= dir <= 255
3953
3954                 label           branch label
3955
3956                 r,r1,r2         registers
3957                                 cc,a,b,d,dp,x,y,s,u,pc
3958
3959                 ,-x     ,--x    register indexed
3960                                 autodecrement
3961
3962 \f
3963
3964         AS6809 ASSEMBLER                                        PAGE F-2
3965         6809 INSTRUCTION SET
3966
3967
3968                 ,x+     ,x++    register indexed
3969                                 autoincrement
3970
3971                 ,x              register indexed addressing
3972                                 zero offset
3973
3974                 offset,x        register indexed addressing
3975                                    -16 <= offset <= 15    ---  5-bit
3976                                   -128 <= offset <= -17   ---  8-bit
3977                                     16 <= offset <= 127   ---  8-bit
3978                                 -32768 <= offset <= -129  --- 16-bit
3979                                    128 <= offset <= 32767 --- 16-bit
3980                                 (external definition of offset
3981                                  uses 16-bit mode)
3982
3983                 a,x             accumulator offset indexed addressing
3984
3985                 ext             extended addressing
3986
3987                 ext,pc          pc addressing ( pc <- pc + ext )
3988
3989                 ext,pcr         pc relative addressing
3990
3991                 [,--x]          register indexed indirect
3992                                 autodecrement
3993
3994                 [,x++]          register indexed indirect
3995                                 autoincrement
3996
3997                 [,x]            register indexed indirect addressing
3998                                 zero offset
3999
4000                 [offset,x]      register indexed indirect addressing
4001                                   -128 <= offset <= 127   ---  8-bit
4002                                 -32768 <= offset <= -129  --- 16-bit
4003                                    128 <= offset <= 32767 --- 16-bit
4004                                 (external definition of offset
4005                                  uses 16-bit mode)
4006
4007                 [a,x]           accumulator offset indexed
4008                                 indirect addressing
4009
4010                 [ext]           extended indirect addressing
4011
4012                 [ext,pc]        pc indirect addressing
4013                                 ( [pc <- pc + ext] )
4014
4015                 [ext,pcr]       pc relative indirect addressing
4016
4017         The  terms  data, dir, label, offset, and ext may all be expres-
4018         sions.
4019
4020 \f
4021
4022         AS6809 ASSEMBLER                                        PAGE F-3
4023         6809 INSTRUCTION SET
4024
4025
4026            Note  that  not all addressing modes are valid with every in-
4027         struction, refer to the 6809 technical data for valid modes.
4028
4029
4030         F.2.1  Inherent Instructions
4031
4032                 abx             daa
4033                 mul             nop
4034                 rti             rts
4035                 sex             swi
4036                 swi1            swi2
4037                 swi3            sync
4038
4039
4040         F.2.2  Short Branch Instructions
4041
4042                 bcc     label           bcs     label
4043                 beq     label           bge     label
4044                 bgt     label           bhi     label
4045                 bhis    label           bhs     label
4046                 ble     label           blo     label
4047                 blos    label           bls     label
4048                 blt     label           bmi     label
4049                 bne     label           bpl     label
4050                 bra     label           brn     label
4051                 bvc     label           bvs     label
4052                 bsr     label
4053
4054
4055         F.2.3  Long Branch Instructions
4056
4057                 lbcc    label           lbcs    label
4058                 lbeq    label           lbge    label
4059                 lbgt    label           lbhi    label
4060                 lbhis   label           lbhs    label
4061                 lble    label           lblo    label
4062                 lblos   label           lbls    label
4063                 lblt    label           lbmi    label
4064                 lbne    label           lbpl    label
4065                 lbra    label           lbrn    label
4066                 lbvc    label           lbvs    label
4067                 lbsr    label
4068 \f
4069
4070         AS6809 ASSEMBLER                                        PAGE F-4
4071         6809 INSTRUCTION SET
4072
4073
4074         F.2.4  Single Operand Instructions
4075
4076                 asla            aslb
4077                 asl     []
4078
4079                 asra            asrb
4080                 asr     []
4081
4082                 clra            clrb
4083                 clr     []
4084
4085                 coma            comb
4086                 com     []
4087
4088                 deca            decb
4089                 dec     []
4090
4091                 inca            incb
4092                 inc     []
4093
4094                 lsla            lslb
4095                 lsl     []
4096
4097                 lsra            lsrb
4098                 lsr     []
4099
4100                 nega            negb
4101                 neg     []
4102
4103                 rola            rolb
4104                 rol     []
4105
4106                 rora            rorb
4107                 ror     []
4108
4109                 tsta            tstb
4110                 tst     []
4111 \f
4112
4113         AS6809 ASSEMBLER                                        PAGE F-5
4114         6809 INSTRUCTION SET
4115
4116
4117         F.2.5  Double Operand Instructions
4118
4119                 adca    []              adcb    []
4120
4121                 adda    []              addb    []
4122
4123                 anda    []              andb    []
4124
4125                 bita    []              bitb    []
4126
4127                 cmpa    []              cmpb    []
4128
4129                 eora    []              eorb    []
4130
4131                 lda     []              ldb     []
4132
4133                 ora     []              orb     []
4134
4135                 sbca    []              sbcb    []
4136
4137                 sta     []              stb     []
4138
4139                 suba    []              subb    []
4140
4141
4142         F.2.6  D-register Instructions
4143
4144                 addd    []              subd    []
4145                 cmpd    []              ldd     []
4146                 std     []
4147
4148
4149         F.2.7  Index/Stack Register Instructions
4150
4151                 cmps    []              cmpu    []
4152                 cmpx    []              cmpy    []
4153
4154                 lds     []              ldu     []
4155                 ldx     []              ldy     []
4156
4157                 leas    []              leau    []
4158                 leax    []              leay    []
4159
4160                 sts     []              stu     []
4161                 stx     []              sty     []
4162
4163                 pshs    r               pshu    r
4164                 puls    r               pulu    r
4165 \f
4166
4167         AS6809 ASSEMBLER                                        PAGE F-6
4168         6809 INSTRUCTION SET
4169
4170
4171         F.2.8  Jump and Jump to Subroutine Instructions
4172
4173                 jmp     []              jsr     []
4174
4175
4176         F.2.9  Register - Register Instructions
4177
4178                 exg     r1,r2           tfr     r1,r2
4179
4180
4181         F.2.10  Condition Code Register Instructions
4182
4183                 andcc   #data           orcc    #data
4184                 cwai    #data
4185
4186
4187         F.2.11  6800 Compatibility Instructions
4188
4189                 aba             cba
4190                 clc             cli
4191                 clv             des
4192                 dex             ins
4193                 inx
4194                 ldaa    []      ldab    []
4195                 oraa    []      orab    []
4196                 psha            pshb
4197                 pula            pulb
4198                 sba             sec
4199                 sei             sev
4200                 staa    []      stab    []
4201                 tab             tap
4202                 tba             tpa
4203                 tsx             txs
4204                 wai
4205 \f
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219                                    APPENDIX G
4220
4221                                 AS6811 ASSEMBLER
4222
4223
4224
4225
4226
4227         G.1  6811 REGISTER SET
4228
4229         The following is a list of the 6811 registers used by AS6811:
4230
4231                 a,b     -       8-bit accumulators
4232                 d       -       16-bit accumulator <a:b>
4233                 x,y     -       index registers
4234
4235
4236         G.2  6811 INSTRUCTION SET
4237
4238
4239            The  following  tables  list all 6811 mnemonics recognized by
4240         the AS6811 assembler.  The designation [] refers to  a  required
4241         addressing  mode  argument.   The  following  list specifies the
4242         format for each addressing mode supported by AS6811:
4243
4244                 #data           immediate data
4245                                 byte or word data
4246
4247                 *dir            direct page addressing
4248                                 (see .setdp directive)
4249                                 0 <= dir <= 255
4250
4251                 ,x              register indirect addressing
4252                                 zero offset
4253
4254                 offset,x        register indirect addressing
4255                                 0 <= offset <= 255
4256
4257                 ext             extended addressing
4258
4259                 label           branch label
4260
4261         The terms data, dir, offset, and ext may all be expressions.
4262
4263 \f
4264
4265         AS6811 ASSEMBLER                                        PAGE G-2
4266         6811 INSTRUCTION SET
4267
4268
4269            Note  that  not all addressing modes are valid with every in-
4270         struction, refer to the 6811 technical data for valid modes.
4271
4272
4273         G.2.1  Inherent Instructions
4274
4275                 aba             abx
4276                 aby             cba
4277                 clc             cli
4278                 clv             daa
4279                 des             dex
4280                 dey             fdiv
4281                 idiv            ins
4282                 inx             iny
4283                 mul             nop
4284                 rti             rts
4285                 sba             sec
4286                 sei             sev
4287                 stop            swi
4288                 tab             tap
4289                 tba             tpa
4290                 tsx             txs
4291                 wai             xgdx
4292                 xgdy
4293
4294                 psha            pshb
4295                 psh a           psh b
4296                 pshx            pshy
4297                 psh x           psh y
4298
4299                 pula            pulb
4300                 pul a           pul b
4301                 pulx            puly
4302                 pul x           pul y
4303
4304
4305         G.2.2  Branch Instructions
4306
4307                 bra     label           brn     label
4308                 bhi     label           bls     label
4309                 bcc     label           bhs     label
4310                 bcs     label           blo     label
4311                 bne     label           beq     label
4312                 bvc     label           bvs     label
4313                 bpl     label           bmi     label
4314                 bge     label           blt     label
4315                 bgt     label           ble     label
4316                 bsr     label
4317 \f
4318
4319         AS6811 ASSEMBLER                                        PAGE G-3
4320         6811 INSTRUCTION SET
4321
4322
4323         G.2.3  Single Operand Instructions
4324
4325                 asla            aslb            asld
4326                 asl a           asl b           asl d
4327                 asl     []
4328
4329                 asra            asrb
4330                 asr a           asr b
4331                 asr     []
4332
4333                 clra            clrb
4334                 clr a           clr b
4335                 clr     label
4336
4337                 coma            comb
4338                 com a           com b
4339                 com     []
4340
4341                 deca            decb
4342                 dec a           dec b
4343                 dec     []
4344
4345                 inca            incb
4346                 inc a           inc b
4347                 inc     []
4348
4349                 lsla            lslb            lsld
4350                 lsl a           lsl b           lsl d
4351                 lsl     []
4352
4353                 lsra            lsrb            lsrd
4354                 lsr a           lsr b           lsr d
4355                 lsr     []
4356
4357                 nega            negb
4358                 neg a           neg b
4359                 neg     []
4360
4361                 rola            rolb
4362                 rol a           rol b
4363                 rol     []
4364
4365                 rora            rorb
4366                 ror a           ror b
4367                 ror     []
4368
4369                 tsta            tstb
4370                 tst a           tst b
4371                 tst     []
4372 \f
4373
4374         AS6811 ASSEMBLER                                        PAGE G-4
4375         6811 INSTRUCTION SET
4376
4377
4378         G.2.4  Double Operand Instructions
4379
4380                 adca    []              adcb    []
4381                 adc a   []              adc b   []
4382
4383                 adda    []      addb    []      addd    []
4384                 add a   []      add b   []      add d   []
4385
4386                 anda    []              andb    []
4387                 and a   []              and b   []
4388
4389                 bita    []              bitb    []
4390                 bit a   []              bit b   []
4391
4392                 cmpa    []              cmpb    []
4393                 cmp a   []              cmp b   []
4394
4395                 eora    []              eorb    []
4396                 eor a   []              eor b   []
4397
4398                 ldaa    []              ldab    []
4399                 lda a   []              lda b   []
4400
4401                 oraa    []              orab    []
4402                 ora a   []              ora b   []
4403
4404                 sbca    []              sbcb    []
4405                 sbc a   []              sbc b   []
4406
4407                 staa    []              stab    []
4408                 sta a   []              sta b   []
4409
4410                 suba    []      subb    []      subd    []
4411                 sub a   []      sub b   []      sub d   []
4412
4413
4414         G.2.5  Bit Manupulation Instructions
4415
4416                 bclr    [],#data
4417                 bset    [],#data
4418
4419                 brclr   [],#data,label
4420                 brset   [],#data,label
4421
4422
4423 \f
4424
4425         AS6811 ASSEMBLER                                        PAGE G-5
4426         6811 INSTRUCTION SET
4427
4428
4429         G.2.6  Jump and Jump to Subroutine Instructions
4430
4431                 jmp     []              jsr     []
4432
4433
4434         G.2.7  Long Register Instructions
4435
4436                 cpx     []              cpy     []
4437
4438                 ldd     []              lds     []
4439                 ldx     []              ldy     []
4440
4441                 std     []              sts     []
4442                 stx     []              sty     []
4443 \f
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457                                    APPENDIX H
4458
4459                                 AS6816 ASSEMBLER
4460
4461
4462
4463
4464
4465         H.1  6816 REGISTER SET
4466
4467         The following is a list of the 6816 registers used by AS6816:
4468
4469                 a,b     -       8-bit accumulators
4470                 d       -       16-bit accumulator <a:b>
4471                 e       -       16-bit accumulator
4472                 x,y,z   -       index registers
4473                 k       -       address extension register
4474                 s       -       stack pointer
4475                 ccr     -       condition code
4476
4477
4478         H.2  6816 INSTRUCTION SET
4479
4480
4481            The  following  tables  list all 6816 mnemonics recognized by
4482         the AS6816 assembler.  The designation [] refers to  a  required
4483         addressing  mode  argument.   The  following  list specifies the
4484         format for each addressing mode supported by AS6816:
4485
4486                 #data           immediate data
4487                                 byte or word data
4488
4489                 #xo,#yo         local immediate data (mac / rmac)
4490
4491                 label           branch label
4492
4493                 r               register
4494                                 ccr,a,b,d,e,x,y,z,s
4495
4496                 ,x              zero offset register indexed addressing
4497                 ,x8
4498                 ,x16
4499
4500                 offset,x        register indexed addressing
4501 \f
4502
4503         AS6816 ASSEMBLER                                        PAGE H-2
4504         6816 INSTRUCTION SET
4505
4506
4507                                      0 <= offset <= 255   ---  8-bit
4508                                 -32768 <= offset <= -1    --- 16-bit
4509                                    256 <= offset <= 32767 --- 16-bit
4510                                 (external definition of offset
4511                                  uses 16-bit mode)
4512
4513                 offset,x8       unsigned 8-bit offset indexed addressing
4514                 offset,x16      signed 16-bit offset indexed addressing
4515
4516                 e,x             accumulator offset indexed addressing
4517
4518                 ext             extended addressing
4519
4520                 bank            64K bank number (jmp / jsr)
4521
4522         The  terms data, label, offset, bank, and ext may all be expres-
4523         sions.
4524
4525            Note  that  not all addressing modes are valid with every in-
4526         struction, refer to the 6816 technical data for valid modes.
4527
4528
4529         H.2.1  Inherent Instructions
4530
4531                 aba             abx             aby             abz
4532                 ace             aced            ade             adx
4533                 ady             adz             aex             aey
4534                 aez             bgnd            cba             daa
4535                 ediv            edivs           emul            emuls
4536                 fdiv            fmuls           idiv            ldhi
4537                 lpstop          mul             nop             psha
4538                 pshb            pshmac          pula            pulb
4539                 pulmac          rtr             rts             sba
4540                 sde             sted            swi             sxt
4541                 tab             tap             tba             tbek
4542                 tbsk            tbxk            tbyk            tbzk
4543                 tde             tdmsk           tdp             ted
4544                 tedm            tekb            tem             tmer
4545                 tmet            tmxed           tpa             tpd
4546                 tskb            tsx             tsy             tsz
4547                 txkb            txs             txy             txz
4548                 tykb            tys             tyx             tyz
4549                 tzkb            tzs             tzx             tzy
4550                 wai             xgab            xgde            xgdx
4551                 xgdy            xgdz            xgex            xgey
4552                 xgez
4553 \f
4554
4555         AS6816 ASSEMBLER                                        PAGE H-3
4556         6816 INSTRUCTION SET
4557
4558
4559         H.2.2  Push/Pull Multiple Register Instructions
4560
4561                 pshm    r,...           pulm    r,...
4562
4563
4564         H.2.3  Short Branch Instructions
4565
4566                 bcc     label           bcs     label
4567                 beq     label           bge     label
4568                 bgt     label           bhi     label
4569                 bhis    label           bhs     label
4570                 ble     label           blo     label
4571                 blos    label           bls     label
4572                 blt     label           bmi     label
4573                 bne     label           bpl     label
4574                 bra     label           brn     label
4575                 bvc     label           bvs     label
4576                 bsr     label
4577
4578
4579         H.2.4  Long Branch Instructions
4580
4581                 lbcc    label           lbcs    label
4582                 lbeq    label           lbge    label
4583                 lbgt    label           lbhi    label
4584                 lbhis   label           lbhs    label
4585                 lble    label           lblo    label
4586                 lblos   label           lbls    label
4587                 lblt    label           lbmi    label
4588                 lbne    label           lbpl    label
4589                 lbra    label           lbrn    label
4590                 lbvc    label           lbvs    label
4591                 lbsr    label
4592
4593
4594         H.2.5  Bit Manipulation Instructions
4595
4596                 bclr    [],#data
4597                 bset    [],#data
4598
4599                 brclr   [],#data,label
4600                 brset   [],#data,label
4601 \f
4602
4603         AS6816 ASSEMBLER                                        PAGE H-4
4604         6816 INSTRUCTION SET
4605
4606
4607         H.2.6  Single Operand Instructions
4608
4609                 asla                    aslb
4610                 asld                    asle
4611                 aslm
4612                 asl     []              aslw    []
4613
4614                 asra                    asrb
4615                 asrd                    asre
4616                 asrm
4617                 asr     []              asrw    []
4618
4619                 clra                    clrb
4620                 clrd                    clre
4621                                         clrm
4622                 clr     []              clrw    []
4623
4624                 coma                    comb
4625                 comd                    come
4626                 com     []              comw    []
4627
4628                 deca                    decb
4629                 dec     []              decw    []
4630
4631                 inca                    incb
4632                 inc     []              incw    []
4633
4634                 lsla                    lslb
4635                 lsld                    lsle
4636                 lslm
4637                 lsl     []              lslw    []
4638
4639                 lsra                    lsrb
4640                 lsrd                    lsre
4641                 lsr     []              lsrw    []
4642
4643                 nega                    negb
4644                 negd                    nege
4645                 neg     []              negw    []
4646
4647                 rola                    rolb
4648                 rold                    role
4649                 rol     []              rolw    []
4650
4651                 rora                    rorb
4652                 rord                    rore
4653                 ror     []              rorw    []
4654
4655                 tsta                    tstb
4656                 tsta                    tste
4657                 tst     []              tstw    []
4658 \f
4659
4660         AS6816 ASSEMBLER                                        PAGE H-5
4661         6816 INSTRUCTION SET
4662
4663
4664         H.2.7  Double Operand Instructions
4665
4666                 adca    []              adcb    []
4667                 adcd    []              adce    []
4668
4669                 adda    []              addb    []
4670                 addd    []              adde    []
4671
4672                 anda    []              andb    []
4673                 andd    []              ande    []
4674
4675                 bita    []              bitb    []
4676
4677                 cmpa    []              cmpb    []
4678                 cpd     []              cpe     []
4679
4680                 eora    []              eorb    []
4681                 eord    []              eore    []
4682
4683                 ldaa    []              ldab    []
4684                 ldd     []              lde     []
4685
4686                 oraa    []              orab    []
4687                 ord     []              ore     []
4688
4689                 sbca    []              sbcb    []
4690                 sbcd    []              sbce    []
4691
4692                 staa    []              stab    []
4693                 std     []              ste     []
4694
4695                 suba    []              subb    []
4696                 subd    []              sube    []
4697
4698
4699         H.2.8  Index/Stack Register Instructions
4700
4701                 cps     []              cpx     []
4702                 cpy     []              cpz     []
4703
4704                 lds     []              ldx     []
4705                 ldy     []              ldz     []
4706
4707                 sts     []              stx     []
4708                 sty     []              stz     []
4709 \f
4710
4711         AS6816 ASSEMBLER                                        PAGE H-6
4712         6816 INSTRUCTION SET
4713
4714
4715         H.2.9  Jump and Jump to Subroutine Instructions
4716
4717                 jmp     bank,[]         jsr     bank,[]
4718
4719
4720         H.2.10  Condition Code Register Instructions
4721
4722                 andp    #data           orp     #data
4723
4724
4725         H.2.11  Multiply and Accumulate Instructions
4726
4727                 mac     #data           rmac    #data
4728                 mac     #xo,#yo         rmac    #xo,#yo
4729 \f
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743                                    APPENDIX I
4744
4745                                  ASH8 ASSEMBLER
4746
4747
4748
4749
4750
4751         I.1  H8/3XX REGISTER SET
4752
4753         The following is a list of the H8 registers used by ASH8:
4754
4755                 r0  -  r7,sp            16-bit accumulators
4756                 r0L -  r7L,spL          8-bit accumulators
4757                 r0H -  r7H,spH          8-bit accumulators
4758                 spL,spH,sp              stack pointers
4759                 ccr                     condition code
4760
4761
4762         I.2  H8/3XX INSTRUCTION SET
4763
4764
4765            The  following tables list all H8/3xx mnemonics recognized by
4766         the ASH8 assembler.  The designation [] refers to a required ad-
4767         dressing mode argument.  The following list specifies the format
4768         for each addressing mode supported by ASH8:
4769
4770                 #xx:3           immediate data (3  bit)
4771                 #xx:8           immediate data (8  bit)
4772                 #xx:16          immediate data (16 bit)
4773
4774                 *dir            direct page addressing
4775                                 (see .setdp directive)
4776                                 0 <= dir <= 255
4777
4778                 label           branch label
4779
4780
4781                 rn              registers (16 bit)
4782                                 r0-r7,sp
4783
4784                 rnB             registers (8 bit)
4785                                 r0H-r7H,r0L-r7L,spH,spL
4786
4787 \f
4788
4789         ASH8 ASSEMBLER                                          PAGE I-2
4790         H8/3XX INSTRUCTION SET
4791
4792
4793                 ccr             condition code register
4794
4795                 @rn             register indirect
4796
4797                 @-rn            register indirect (auto pre-decrement)
4798
4799                 @rn+            register indirect (auto post-increment)
4800
4801                 @[offset,rn]    register indirect, 16-bit displacement
4802
4803                 @@offset        memory indirect, (8-bit address)
4804
4805                 ext             extended addressing (16-bit)
4806
4807         The  terms  data, dir, label, offset, and ext may all be expres-
4808         sions.
4809
4810            Note  that  not all addressing modes are valid with every in-
4811         struction, refer to the H8/3xx technical data for valid modes.
4812
4813
4814         I.2.1  Inherent Instructions
4815
4816                 eepmov
4817                 nop
4818                 sleep
4819                 rte
4820                 rts
4821
4822
4823         I.2.2  Branch Instructions
4824
4825                 bcc     label                   bcs     label
4826                 beq     label                   bf      label
4827                 bge     label                   bgt     label
4828                 bhi     label                   bhis    label
4829                 bhs     label                   ble     label
4830                 blo     label                   blos    label
4831                 bls     label                   blt     label
4832                 bmi     label                   bne     label
4833                 bpl     label                   bra     label
4834                 brn     label                   bt      label
4835                 bvc     label                   bvs     label
4836                 bsr     label
4837 \f
4838
4839         ASH8 ASSEMBLER                                          PAGE I-3
4840         H8/3XX INSTRUCTION SET
4841
4842
4843         I.2.3  Single Operand Instructions
4844
4845                 Free Form
4846
4847                 daa     rnB                     das     rnB
4848
4849                 dec     rnB                     inc     rnB
4850
4851                 neg     rnB                     not     rnB
4852
4853                 rotxl   rnB                     rotxr   rnB
4854
4855                 rotl    rnB                     rotr    rnB
4856
4857                 shal    rnB                     shar    rnB
4858
4859                 shll    rnB                     shlr    rnB
4860
4861                 push    rn                      pop     rn
4862
4863
4864                 Byte / Word Form
4865
4866                 daa.b   rnB                     das.b   rnB
4867
4868                 dec.b   rnB                     inc.b   rnB
4869
4870                 neg.b   rnB                     not.b   rnB
4871
4872                 rotxl.b rnB                     rotxr.b rnB
4873
4874                 rotl.b  rnB                     rotr.b  rnB
4875
4876                 shal.b  rnB                     shar.b  rnB
4877
4878                 shll.b  rnB                     shlr.b  rnB
4879
4880                 push.w  rn                      pop.w   rn
4881 \f
4882
4883         ASH8 ASSEMBLER                                          PAGE I-4
4884         H8/3XX INSTRUCTION SET
4885
4886
4887         I.2.4  Double Operand Instructions
4888
4889                 Free Form
4890
4891                 add     rnB,rnB                 add     #xx:8,rnB
4892                 add     rn,rn
4893
4894                 cmp     rnB,rnB                 cmp     #xx:8,rnB
4895                 cmp     rn,rn
4896
4897                 sub     rnB,rnB
4898                 sub     rn,rn
4899
4900                 addx    rnB,rnB                 addx    #xx:8,rnB
4901
4902                 and     rnB,rnB                 and     #xx:8,rnB
4903                                                 and     #xx:8,ccr
4904
4905                 or      rnB,rnB                 or      #xx:8,rnB
4906                                                 or      #xx:8,ccr
4907
4908                 subx    rnB,rnB                 subx    #xx:8,rnB
4909
4910                 xor     rnB,rnB                 xor     #xx:8,rnB
4911                                                 xor     #xx:8,ccr
4912
4913
4914                 Byte / Word Form
4915
4916                 add.b   rnB,rnB                 add.b   #xx:8,rnB
4917                 add.w   rn,rn
4918
4919                 cmp.b   rnB,rnB                 cmp.b   #xx:8,rnB
4920                 cmp.w   rn,rn
4921
4922                 sub.b   rnB,rnB
4923                 sub.w   rn,rn
4924
4925                 addx.b  rnB,rnB                 addx.b  #xx:8,rnB
4926
4927                 and.b   rnB,rnB                 and.b   #xx:8,rnB
4928                                                 and.b   #xx:8,ccr
4929
4930                 or.b    rnB,rnB                 or.b    #xx:8,rnB
4931                                                 or.b    #xx:8,ccr
4932
4933                 subx.b  rnB,rnB                 subx.b  #xx:8,rnB
4934
4935                 xor.b   rnB,rnB                 xor.b   #xx:8,rnB
4936                                                 xor.b   #xx:8,ccr
4937 \f
4938
4939         ASH8 ASSEMBLER                                          PAGE I-5
4940         H8/3XX INSTRUCTION SET
4941
4942
4943         I.2.5  Mov Instructions
4944
4945                 Free Form
4946
4947                 mov     rnB,rnB                 mov     rn,rn
4948                 mov     #xx:8,rnB               mov     #xx:16,rn
4949                 mov     @rn,rnB                 mov     @rn,rn
4950                 mov     @[offset,rn],rnB        mov     @[offset,rn],rn
4951                 mov     @rn+,rnB                mov     @rn+,rn
4952                 mov     @dir,rnB
4953                 mov     dir,rnB
4954                 mov     *@dir,rnB
4955                 mov     *dir,rnB
4956                 mov     @label,rnB              mov     @label,rn
4957                 mov     label,rnB               mov     label,rn
4958                 mov     rnB,@rn                 mov     rn,@rn
4959                 mov     rnB,@[offset,rn]        mov     rn,@[offset,rn]
4960                 mov     rnB,@-rn                mov     rn,@-rn
4961                 mov     rnB,@dir
4962                 mov     rnB,dir
4963                 mov     rnB,*@dir
4964                 mov     rnB,*dir
4965                 mov     rnB,@label              mov     rn,@label
4966                 mov     rnB,label               mov     rn,label
4967
4968
4969                 Byte / Word Form
4970
4971                 mov.b   rnB,rnB                 mov.w   rn,rn
4972                 mov.b   #xx:8,rnB               mov.w   #xx:16,rn
4973                 mov.b   @rn,rnB                 mov.w   @rn,rn
4974                 mov.b   @[offset,rn],rnB        mov.w   @[offset,rn],rn
4975                 mov.b   @rn+,rnB                mov.w   @rn+,rn
4976                 mov.b   @dir,rnB
4977                 mov.b   dir,rnB
4978                 mov.b   *@dir,rnB
4979                 mov.b   *dir,rnB
4980                 mov.b   @label,rnB              mov.w   @label,rn
4981                 mov.b   label,rnB               mov.w   label,rn
4982                 mov.b   rnB,@rn                 mov.w   rn,@rn
4983                 mov.b   rnB,@[offset,rn]        mov.w   rn,@[offset,rn]
4984                 mov.b   rnB,@-rn                mov.w   rn,@-rn
4985                 mov.b   rnB,@dir
4986                 mov.b   rnB,dir
4987                 mov.b   rnB,*@dir
4988                 mov.b   rnB,*dir
4989                 mov.b   rnB,@label              mov.w   rn,@label
4990                 mov.b   rnB,label               mov.w   rn,label
4991 \f
4992
4993         ASH8 ASSEMBLER                                          PAGE I-6
4994         H8/3XX INSTRUCTION SET
4995
4996
4997         I.2.6  Bit Manipulation Instructions
4998
4999                 bld     #xx:3,rnB               bld     #xx:3,@rn
5000                 bld     #xx:3,@dir              bld     #xx:3,dir
5001                 bld     #xx:3,*@dir             bld     #xx:3,*dir
5002
5003                 bild    #xx:3,rnB               bild    #xx:3,@rn
5004                 bild    #xx:3,@dir              bild    #xx:3,dir
5005                 bild    #xx:3,*@dir             bild    #xx:3,*dir
5006
5007                 bst     #xx:3,rnB               bst     #xx:3,@rn
5008                 bst     #xx:3,@dir              bst     #xx:3,dir
5009                 bst     #xx:3,*@dir             bst     #xx:3,*dir
5010
5011                 bist    #xx:3,rnB               bist    #xx:3,@rn
5012                 bist    #xx:3,@dir              bist    #xx:3,dir
5013                 bist    #xx:3,*@dir             bist    #xx:3,*dir
5014
5015                 band    #xx:3,rnB               band    #xx:3,@rn
5016                 band    #xx:3,@dir              band    #xx:3,dir
5017                 band    #xx:3,*@dir             band    #xx:3,*dir
5018
5019                 biand   #xx:3,rnB               biand   #xx:3,@rn
5020                 biand   #xx:3,@dir              biand   #xx:3,dir
5021                 biand   #xx:3,*@dir             biand   #xx:3,*dir
5022
5023                 bor     #xx:3,rnB               bor     #xx:3,@rn
5024                 bor     #xx:3,@dir              bor     #xx:3,dir
5025                 bor     #xx:3,*@dir             bor     #xx:3,*dir
5026
5027                 bior    #xx:3,rnB               bior    #xx:3,@rn
5028                 bior    #xx:3,@dir              bior    #xx:3,dir
5029                 bior    #xx:3,*@dir             bior    #xx:3,*dir
5030
5031                 bxor    #xx:3,rnB               bxor    #xx:3,@rn
5032                 bxor    #xx:3,@dir              bxor    #xx:3,dir
5033                 bxor    #xx:3,*@dir             bxor    #xx:3,*dir
5034
5035                 bixor   #xx:3,rnB               bixor   #xx:3,@rn
5036                 bixor   #xx:3,@dir              bixor   #xx:3,dir
5037                 bixor   #xx:3,*@dir             bixor   #xx:3,*dir
5038 \f
5039
5040         ASH8 ASSEMBLER                                          PAGE I-7
5041         H8/3XX INSTRUCTION SET
5042
5043
5044         I.2.7  Extended Bit Manipulation Instructions
5045
5046                 bset    #xx:3,rnB               bset    #xx:3,@rn
5047                 bset    #xx:3,@dir              bset    #xx:3,dir
5048                 bset    #xx:3,*@dir             bset    #xx:3,*dir
5049                 bset    rnB,rnB                 bset    rnB,@rn
5050                 bset    rnB,@dir                bset    rnB,dir
5051                 bset    rnB,*@dir               bset    rnB,*dir
5052
5053                 bclr    #xx:3,rnB               bclr    #xx:3,@rn
5054                 bclr    #xx:3,@dir              bclr    #xx:3,dir
5055                 bclr    #xx:3,*@dir             bclr    #xx:3,*dir
5056                 bclr    rnB,rnB                 bclr    rnB,@rn
5057                 bclr    rnB,@dir                bclr    rnB,dir
5058                 bclr    rnB,*@dir               bclr    rnB,*dir
5059
5060                 bnot    #xx:3,rnB               bnot    #xx:3,@rn
5061                 bnot    #xx:3,@dir              bnot    #xx:3,dir
5062                 bnot    #xx:3,*@dir             bnot    #xx:3,*dir
5063                 bnot    rnB,rnB                 bnot    rnB,@rn
5064                 bnot    rnB,@dir                bnot    rnB,dir
5065                 bnot    rnB,*@dir               bnot    rnB,*dir
5066
5067                 btst    #xx:3,rnB               btst    #xx:3,@rn
5068                 btst    #xx:3,@dir              btst    #xx:3,dir
5069                 btst    #xx:3,*@dir             btst    #xx:3,*dir
5070                 btst    rnB,rnB                 btst    rnB,@rn
5071                 btst    rnB,@dir                btst    rnB,dir
5072                 btst    rnB,*@dir               btst    rnB,*dir
5073
5074
5075         I.2.8  Condition Code Instructions
5076
5077                 andc    #xx:8,ccr               andc    #xx:8
5078                 and     #xx:8,ccr               and.b   #xx:8,ccr
5079
5080                 ldc     #xx:8,ccr               ldc     #xx:8
5081                 ldc     rnB,ccr                 ldc     rnB
5082
5083                 orc     #xx:8,ccr               orc     #xx:8
5084                 or      #xx:8,ccr               or.b    #xx:8,ccr
5085
5086                 xorc    #xx:8,ccr               xorc    #xx:8
5087                 xor     #xx:8,ccr               xor.b   #xx:8,ccr
5088
5089                 stc     ccr,rnB                 stc     rnB
5090 \f
5091
5092         ASH8 ASSEMBLER                                          PAGE I-8
5093         H8/3XX INSTRUCTION SET
5094
5095
5096         I.2.9  Other Instructions
5097
5098                 divxu   rnB,rn                  divxu.b rnB,rn
5099
5100                 mulxu   rnB,rn                  mulxu.b rnB,rn
5101
5102                 movfpe  @label,rnB              movfpe  label,rnB
5103                 movfpe.b  @label,rnB            movfpe.b  label,rnB
5104
5105                 movtpe  @label,rnB              movtpe  label,rnB
5106                 movtpe.b  @label,rnB            movtpe.b  label,rnB
5107
5108
5109         I.2.10  Jump and Jump to Subroutine Instructions
5110
5111                 jmp     @rn                     jmp     @@dir
5112                 jmp     @label                  jmp     label
5113
5114                 jsr     @rn                     jsr     @@dir
5115                 jsr     @label                  jsr     label
5116 \f
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130                                    APPENDIX J
5131
5132                                 AS8085 ASSEMBLER
5133
5134
5135
5136
5137
5138         J.1  8085 REGISTER SET
5139
5140         The  following  is  a  list  of  the 8080/8085 registers used by
5141         AS8085:
5142
5143                 a,b,c,d,e,h,l   -       8-bit accumulators
5144                 m               -       memory through (hl)
5145                 sp              -       stack pointer
5146                 psw             -       status word
5147
5148
5149         J.2  8085 INSTRUCTION SET
5150
5151
5152            The  following tables list all 8080/8085 mnemonics recognized
5153         by the AS8085  assembler.   The  following  list  specifies  the
5154         format for each addressing mode supported by AS8085:
5155
5156                 #data           immediate data
5157                                 byte or word data
5158
5159                 r,r1,r2         register or register pair
5160                                 psw,a,b,c,d,e,h,l
5161                                 bc,de,hl,sp,pc
5162
5163                 m               memory address using (hl)
5164
5165                 addr            direct memory addressing
5166
5167                 label           call or jump label
5168
5169         The terms data, m, addr, and label may be expressions.
5170
5171            Note  that  not all addressing modes are valid with every in-
5172         struction, refer to  the  8080/8085  technical  data  for  valid
5173         modes.
5174 \f
5175
5176         AS8085 ASSEMBLER                                        PAGE J-2
5177         8085 INSTRUCTION SET
5178
5179
5180         J.2.1  Inherent Instructions
5181
5182                 cma             cmc
5183                 daa             di
5184                 ei              hlt
5185                 nop             pchl
5186                 ral             rar
5187                 ret             rim
5188                 rrc             rlc
5189                 sim             sphl
5190                 stc             xchg
5191                 xthl
5192
5193
5194         J.2.2  Register/Memory/Immediate Instructions
5195
5196                 adc     r       adc     m       aci     #data
5197                 add     r       add     m       adi     #data
5198                 ana     r       ana     m       ani     #data
5199                 cmp     r       cmp     m       cpi     #data
5200                 ora     r       ora     m       ori     #data
5201                 sbb     r       sbb     m       sbi     #data
5202                 sub     r       sub     m       sui     #data
5203                 xra     r       xra     m       xri     #data
5204
5205
5206         J.2.3  Call and Return Instructions
5207
5208                 cc      label           rc
5209                 cm      label           rm
5210                 cnc     label           rnc
5211                 cnz     label           rnz
5212                 cp      label           rp
5213                 cpe     label           rpe
5214                 cpo     label           rpo
5215                 cz      label           rz
5216                 call    label
5217
5218
5219         J.2.4  Jump Instructions
5220
5221                 jc      label
5222                 jm      label
5223                 jnc     label
5224                 jnz     label
5225                 jp      label
5226                 jpe     label
5227                 jpo     label
5228                 jz      label
5229                 jmp     label
5230 \f
5231
5232         AS8085 ASSEMBLER                                        PAGE J-3
5233         8085 INSTRUCTION SET
5234
5235
5236         J.2.5  Input/Output/Reset Instructions
5237
5238                 in      data
5239                 out     data
5240                 rst     data
5241
5242
5243         J.2.6  Move Instructions
5244
5245                 mov     r1,r2
5246                 mov     r,m
5247                 mov     m,r
5248
5249                 mvi     r,#data
5250                 mvi     m,#data
5251
5252
5253         J.2.7  Other Instructions
5254
5255                 dcr     r               dcr     m
5256                 inr     r               inr     m
5257
5258                 dad     r               dcx     r
5259                 inx     r               ldax    r
5260                 pop     r               push    r
5261                 stax    r
5262
5263                 lda     addr            lhld    addr
5264                 shld    addr            sta     addr
5265
5266                 lxi     r,#data
5267 \f
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281                                    APPENDIX K
5282
5283                                  ASZ80 ASSEMBLER
5284
5285
5286
5287
5288
5289         K.1  .hd64 DIRECTIVE
5290
5291         Format:
5292
5293                 .hd64
5294
5295         The  .hd64  directive enables processing of the HD64180 specific
5296         mnemonics not included in  the  Z80  instruction  set.   HD64180
5297         mnemonics  encountered  without  the  .hd64  directive  will  be
5298         flagged with an 'o' error.
5299
5300
5301         K.2  Z80 REGISTER SET AND CONDITIONS
5302
5303
5304            The following is a complete list of register designations and
5305         condition mnemonics:
5306
5307                 byte registers  -       a,b,c,d,e,h,l,i,r
5308                 register pairs  -       af,af',bc,de,hl
5309                 word registers  -       pc,sp,ix,iy
5310
5311                 C -     carry bit set
5312                 M -     sign bit set
5313                 NC -    carry bit clear
5314                 NZ -    zero bit clear
5315                 P -     sign bit clear
5316                 PE -    parity even
5317                 PO -    parity odd
5318                 Z -     zero bit set
5319
5320
5321 \f
5322
5323         ASZ80 ASSEMBLER                                         PAGE K-2
5324         Z80 INSTRUCTION SET
5325
5326
5327         K.3  Z80 INSTRUCTION SET
5328
5329
5330            The  following  tables  list all Z80/HD64180 mnemonics recog-
5331         nized by the ASZ80 assembler.  The designation []  refers  to  a
5332         required addressing mode argument.  The following list specifies
5333         the format for each addressing mode supported by ASZ80:
5334
5335                 #data           immediate data
5336                                 byte or word data
5337
5338                 n               byte value
5339
5340                 rg              a byte register
5341                                 a,b,c,d,e,h,l
5342
5343                 rp              a register pair
5344                                 bc,de,hl
5345
5346                 (hl)            implied addressing or
5347                                 register indirect addressing
5348
5349                 (label)         direct addressing
5350
5351                 offset(ix)      indexed addressing with
5352                                 an offset
5353
5354                 label           call/jmp/jr label
5355
5356         The  terms  data,  dir,  offset, and ext may all be expressions.
5357         The terms dir and offset are not allowed to be  external  refer-
5358         ences.
5359
5360            Note  that  not all addressing modes are valid with every in-
5361         struction, refer to the Z80/HD64180  technical  data  for  valid
5362         modes.
5363 \f
5364
5365         ASZ80 ASSEMBLER                                         PAGE K-3
5366         Z80 INSTRUCTION SET
5367
5368
5369         K.3.1  Inherent Instructions
5370
5371                 ccf             cpd
5372                 cpdr            cpi
5373                 cpir            cpl
5374                 daa             di
5375                 ei              exx
5376                 halt            neg
5377                 nop             reti
5378                 retn            rla
5379                 rlca            rld
5380                 rra             rrca
5381                 rrd             scf
5382
5383
5384         K.3.2  Implicit Operand Instructions
5385
5386                 adc     a,[]            adc     []
5387                 add     a,[]            add     []
5388                 and     a,[]            and     []
5389                 cp      a,[]            cp      []
5390                 dec     a,[]            dec     []
5391                 inc     a,[]            inc     []
5392                 or      a,[]            or      []
5393                 rl      a,[]            rl      []
5394                 rlc     a,[]            rlc     []
5395                 rr      a,[]            rr      []
5396                 rrc     a,[]            rrc     []
5397                 sbc     a,[]            sbc     []
5398                 sla     a,[]            sla     []
5399                 sra     a,[]            sra     []
5400                 srl     a,[]            srl     []
5401                 sub     a,[]            sub     []
5402                 xor     a,[]            xor     []
5403 \f
5404
5405         ASZ80 ASSEMBLER                                         PAGE K-4
5406         Z80 INSTRUCTION SET
5407
5408
5409         K.3.3  Load Instruction
5410
5411                 ld      rg,[]           ld      [],rg
5412                 ld      (bc),a          ld      a,(bc)
5413                 ld      (de),a          ld      a,(de)
5414                 ld      (label),a       ld      a,(label)
5415                 ld      (label),rp      ld      rp,(label)
5416                 ld      i,a             ld      r,a
5417                 ld      a,i             ld      a,r
5418                 ld      sp,hl           ld      sp,ix
5419                 ld      sp,iy           ld      rp,#data
5420
5421                 ldd                     lddr
5422                 ldi                     ldir
5423
5424
5425         K.3.4  Call/Return Instructions
5426
5427                 call    C,label         ret     C
5428                 call    M,label         ret     M
5429                 call    NC,label        ret     NC
5430                 call    NZ,label        ret     NZ
5431                 call    P,label         ret     P
5432                 call    PE,label        ret     PE
5433                 call    PO,label        ret     PO
5434                 call    Z,label         ret     Z
5435                 call    label           ret
5436
5437
5438         K.3.5  Jump and Jump to Subroutine Instructions
5439
5440                 jp      C,label         jp      M,label
5441                 jp      NC,label        jp      NZ,label
5442                 jp      P,label         jp      PE,label
5443                 jp      PO,label        jp      Z,label
5444
5445                 jp      (hl)            jp      (ix)
5446                 jp      (iy)            jp      label
5447
5448                 djnz    label
5449
5450                 jr      C,label         jr      NC,label
5451                 jr      NZ,label        jr      Z,label
5452                 jr      label
5453 \f
5454
5455         ASZ80 ASSEMBLER                                         PAGE K-5
5456         Z80 INSTRUCTION SET
5457
5458
5459         K.3.6  Bit Manipulation Instructions
5460
5461                 bit     n,[]
5462                 res     n,[]
5463                 set     n,[]
5464
5465
5466         K.3.7  Interrupt Mode and Reset Instructions
5467
5468                 im      n
5469                 im      n
5470                 im      n
5471                 rst     n
5472
5473
5474         K.3.8  Input and Output Instructions
5475
5476                 in      a,(n)           in      rg,(c)
5477                 ind                     indr
5478                 ini                     inir
5479
5480                 out     (n),a           out     (c),rg
5481                 outd                    otdr
5482                 outi                    otir
5483
5484
5485         K.3.9  Register Pair Instructions
5486
5487                 add     hl,rp           add     ix,rp
5488                 add     iy,rp
5489
5490                 adc     hl,rp           sbc     hl,rp
5491
5492                 ex      (sp),hl         ex      (sp),ix
5493                 ex      (sp),iy
5494                 ex      de,hl
5495                 ex      af,af'
5496
5497                 push    rp              pop     rp
5498 \f
5499
5500         ASZ80 ASSEMBLER                                         PAGE K-6
5501         Z80 INSTRUCTION SET
5502
5503
5504         K.3.10  HD64180 Specific Instructions
5505
5506                 in0     rg,(n)
5507                 out0    (n),rg
5508
5509                 otdm                    otdmr
5510                 otim                    otimr
5511
5512                 mlt     bc              mlt     de
5513                 mlt     hl              mlt     sp
5514
5515                 slp
5516
5517                 tst     a
5518                 tstio   #data
5519 \f
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533                                    APPENDIX L
5534
5535                                 AS6500 ASSEMBLER
5536
5537
5538
5539
5540
5541         L.1  ACKNOWLEDGMENT
5542
5543
5544            Thanks  to  Marko  Makela  for his contribution of the AS6500
5545         cross assembler.
5546
5547                 Marko Makela
5548                 Sillitie 10 A
5549                 01480 Vantaa
5550                 Finland
5551                 Internet: Marko.Makela@Helsinki.Fi
5552                 EARN/BitNet: msmakela@finuh
5553
5554            Several  additions and modifications were made to his code to
5555         support the following families of 6500 processors:
5556
5557                 (1)     650X and 651X processor family
5558                 (2)     65F11 and 65F12 processor family
5559                 (3)     65C00/21 and 65C29 processor family
5560                 (4)     65C02, 65C102, and 65C112 processor family
5561
5562            The  instruction  syntax of this cross assembler contains two
5563         peculiarities:  (1) the addressing indirection is denoted by the
5564         square  brackets  []  and (2) the `bbrx' and `bbsx' instructions
5565         are written `bbr0 memory,label'.
5566
5567
5568 \f
5569
5570         AS6500 ASSEMBLER                                        PAGE L-2
5571         6500 REGISTER SET
5572
5573
5574         L.2  6500 REGISTER SET
5575
5576         The following is a list of the 6500 registers used by AS6500:
5577
5578                 a       -       8-bit accumulator
5579                 x,y     -       index registers
5580
5581
5582         L.3  6500 INSTRUCTION SET
5583
5584
5585            The  following  tables  list all 6500 family mnemonics recog-
5586         nized by the AS6500 assembler.  The designation [] refers  to  a
5587         required addressing mode argument.  The following list specifies
5588         the format for each addressing mode supported by AS6500:
5589
5590                 #data           immediate data
5591                                 byte or word data
5592
5593                 *dir            direct page addressing
5594                                 (see .setdp directive)
5595                                 0 <= dir <= 255
5596
5597                 offset,x        indexed addressing
5598                 offset,y        indexed addressing
5599                                 address = (offset + (x or y))
5600
5601                 [offset,x]      pre-indexed indirect addressing
5602                                 0 <= offset <= 255
5603                                 address = contents of location
5604                                     (offset + (x or y)) mod 256
5605
5606                 [offset],y      post-indexed indirect addressing
5607                                 address = contents of location at offset
5608                                     plus the value of the y register
5609
5610                 [address]       indirect addressing
5611
5612                 ext             extended addressing
5613
5614                 label           branch label
5615
5616                 address,label   direct page memory location
5617                                 branch label
5618                                 bbrx and bbsx instruction addressing
5619
5620         The  terms data, dir, offset, address, ext, and label may all be
5621         expressions.
5622
5623            Note  that  not all addressing modes are valid with every in-
5624         struction, refer to the 65xx technical data for valid modes.
5625 \f
5626
5627         AS6500 ASSEMBLER                                        PAGE L-3
5628         6500 INSTRUCTION SET
5629
5630
5631         L.3.1  Processor Specific Directives
5632
5633
5634            The  AS6500  cross  assembler has four (4) processor specific
5635         assembler directives which  define  the  target  65xx  processor
5636         family:
5637
5638                 .r6500          Core 650X and 651X family (default)
5639                 .r65f11         Core plus 65F11 and 65F12
5640                 .r65c00         Core plus 65C00/21 and 65C29
5641                 .r65c02         Core plus 65C02, 65C102, and 65C112
5642
5643
5644         L.3.2  65xx Core Inherent Instructions
5645
5646                 brk                     clc
5647                 cld                     cli
5648                 clv                     dex
5649                 dey                     inx
5650                 iny                     nop
5651                 pha                     php
5652                 pla                     plp
5653                 rti                     rts
5654                 sec                     sed
5655                 sei                     tax
5656                 tay                     tsx
5657                 txa                     txs
5658                 tya
5659
5660
5661         L.3.3  65xx Core Branch Instructions
5662
5663                 bcc     label           bhs     label
5664                 bcs     label           blo     label
5665                 beq     label           bmi     label
5666                 bne     label           bpl     label
5667                 bvc     label           bvs     label
5668
5669
5670         L.3.4  65xx Core Single Operand Instructions
5671
5672                 asl     []
5673                 dec     []
5674                 inc     []
5675                 lsr     []
5676                 rol     []
5677                 ror     []
5678 \f
5679
5680         AS6500 ASSEMBLER                                        PAGE L-4
5681         6500 INSTRUCTION SET
5682
5683
5684         L.3.5  65xx Core Double Operand Instructions
5685
5686                 adc     []
5687                 and     []
5688                 bit     []
5689                 cmp     []
5690                 eor     []
5691                 lda     []
5692                 ora     []
5693                 sbc     []
5694                 sta     []
5695
5696
5697         L.3.6  65xx Core Jump and Jump to Subroutine Instructions
5698
5699                 jmp     []              jsr     []
5700
5701
5702         L.3.7  65xx Core Miscellaneous X and Y Register Instructions
5703
5704                 cpx     []
5705                 cpy     []
5706                 ldx     []
5707                 stx     []
5708                 ldy     []
5709                 sty     []
5710 \f
5711
5712         AS6500 ASSEMBLER                                        PAGE L-5
5713         6500 INSTRUCTION SET
5714
5715
5716         L.3.8  65F11 and 65F12 Specific Instructions
5717
5718                 bbr0    [],label                bbr1    [],label
5719                 bbr2    [],label                bbr3    [],label
5720                 bbr4    [],label                bbr5    [],label
5721                 bbr6    [],label                bbr7    [],label
5722
5723                 bbs0    [],label                bbs1    [],label
5724                 bbs2    [],label                bbs3    [],label
5725                 bbs4    [],label                bbs5    [],label
5726                 bbs6    [],label                bbs7    [],label
5727
5728                 rmb0    []                      rmb1    []
5729                 rmb2    []                      rmb3    []
5730                 rmb4    []                      rmb5    []
5731                 rmb6    []                      rmb7    []
5732
5733                 smb0    []                      smb1    []
5734                 smb2    []                      smb3    []
5735                 smb4    []                      smb5    []
5736                 smb6    []                      smb7    []
5737
5738
5739         L.3.9  65C00/21 and 65C29 Specific Instructions
5740
5741                 bbr0    [],label                bbr1    [],label
5742                 bbr2    [],label                bbr3    [],label
5743                 bbr4    [],label                bbr5    [],label
5744                 bbr6    [],label                bbr7    [],label
5745
5746                 bbs0    [],label                bbs1    [],label
5747                 bbs2    [],label                bbs3    [],label
5748                 bbs4    [],label                bbs5    [],label
5749                 bbs6    [],label                bbs7    [],label
5750
5751                 bra     label
5752
5753                 phx                             phy
5754                 plx                             ply
5755
5756                 rmb0    []                      rmb1    []
5757                 rmb2    []                      rmb3    []
5758                 rmb4    []                      rmb5    []
5759                 rmb6    []                      rmb7    []
5760
5761                 smb0    []                      smb1    []
5762                 smb2    []                      smb3    []
5763                 smb4    []                      smb5    []
5764                 smb6    []                      smb7    []
5765 \f
5766
5767         AS6500 ASSEMBLER                                        PAGE L-6
5768         6500 INSTRUCTION SET
5769
5770
5771         L.3.10  65C02, 65C102, and 65C112 Specific Instructions
5772
5773                 bbr0    [],label                bbr1    [],label
5774                 bbr2    [],label                bbr3    [],label
5775                 bbr4    [],label                bbr5    [],label
5776                 bbr6    [],label                bbr7    [],label
5777
5778                 bbs0    [],label                bbs1    [],label
5779                 bbs2    [],label                bbs3    [],label
5780                 bbs4    [],label                bbs5    [],label
5781                 bbs6    [],label                bbs7    [],label
5782
5783                 bra     label
5784
5785                 phx                             phy
5786                 plx                             ply
5787
5788                 rmb0    []                      rmb1    []
5789                 rmb2    []                      rmb3    []
5790                 rmb4    []                      rmb5    []
5791                 rmb6    []                      rmb7    []
5792
5793                 smb0    []                      smb1    []
5794                 smb2    []                      smb3    []
5795                 smb4    []                      smb5    []
5796                 smb6    []                      smb7    []
5797
5798                 stz     []
5799                 trb     []
5800                 tsb     []
5801
5802            Additional  addressing  modes for the following core instruc-
5803         tions are also available with the 65C02, 65C102, and 65C112 pro-
5804         cessors.
5805
5806                 adc     []                      and     []
5807                 cmp     []                      eor     []
5808                 lda     []                      ora     []
5809                 sbc     []                      sta     []
5810
5811                 bit     []                      jmp     []
5812
5813                 dec                             inc
5814 \f