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