* doc/sdccman.lyx: documented ar format libraries
[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 linkers supported by and distributed with SDCC are:
2216                 aslink          (Intel 8051)
2217                 link-z90        (Zilog Z80 / Hitachi HD64180)
2218                 link-gbz80      (GameBoy Z80-like CPU)
2219                 link-hc08       (Motorola 68HC08)
2220
2221         aslink (Intel 8051) specific options:
2222
2223         Output:
2224           -j   Produce NoICE debug as file[NOI]
2225           -z   Produce SDCdb debug as file[cdb]
2226           -u   Update listing file(s) with link data as file(s)[.RST]
2227         Miscellaneous:
2228           -a   [iram-size] Check for internal RAM overflow
2229           -v   [xram-size] Check for external RAM overflow
2230           -w   [code-size] Check for code overflow
2231           -y   Generate memory usage summary file[mem]
2232           -Y   Pack internal ram
2233           -A   [stack-size] Allocate space for stack
2234
2235
2236         link-z80 (Zilog Z80 / Hitachi HD64180) specific options:
2237
2238         Map format:
2239           -j   no$gmb symbol file generated as file[SYM]
2240         Output:
2241           -z   Produce SDCdb debug as file[cdb]
2242           -Z   Gameboy image as file[GB]
2243         List:
2244           -u   Update listing file(s) with link data as file(s)[.RST]
2245
2246
2247         link-gbz80 (GameBoy Z80-like CPU) specific options:
2248
2249         Relocation:
2250           -yo  Number of rom banks (default: 2)
2251           -ya  Number of ram banks (default: 0)
2252           -yt  MBC type (default: no MBC)
2253           -yn  Name of program (default: name of output file)
2254           -yp# Patch one byte in the output GB file (# is: addr=byte)
2255         Map format:
2256           -j   no$gmb symbol file generated as file[SYM]
2257         Output:
2258           -Z   Gameboy image as file[GB]
2259         List:
2260           -u   Update listing file(s) with link data as file(s)[.RST]
2261
2262
2263         link-hc08 (Motorola 68HC08) specific options:
2264         Output:
2265           -t   ELF executable as file[elf]
2266           -j    Produce NoICE debug as file[NOI]
2267           -z   Produce SDCdb debug as file[cdb]
2268           -u    Update listing file(s) with link data as file(s)[.RST]
2269         Miscellaneous:
2270           -a    [iram-size] Check for internal RAM overflow
2271           -v    [xram-size] Check for external RAM overflow
2272           -w    [code-size] Check for code overflow
2273
2274
2275
2276         2.3  LIBRARY PATH(S) AND FILE(S)
2277
2278
2279            The process of resolving undefined symbols after scanning the
2280         input object  files  includes  the  scanning  of  object  module
2281         libraries.   The  linker will search through all combinations of
2282         the library path specifications (input by the -k option) and the
2283         library  file  specifications (input by the -l option) that lead
2284         to an existing library file.  Each library file contains a  list
2285         (one  file  per  line)  of  modules  included in this particular
2286         library.  Each existing object module is scanned for a match  to
2287         the undefined symbol.  The first module containing the symbol is
2288         then linked with the previous modules to resolve the symbol  de-
2289         finition.   The  library  object  modules are rescanned until no
2290         more symbols can be resolved.   The  scanning  algorithm  allows
2291         resolution  of  back references.  No errors are reported for non
2292         existant library files or object modules.
2293
2294            The  library  file  specification may be formed in one of two
2295         ways:
2296
2297              1.  If  the  library  file  contained an absolute path/file
2298                  specification  then  this  is   the   object   module's
2299                  path/file.
2300                  (i.e.  C:\...)
2301
2302              2.  If  the  library  file  contains  a  relative path/file
2303                  specification then the concatenation of  the  path  and
2304                  this  file  specification  becomes  the object module's
2305                  path/file.
2306                  (i.e.  \...)
2307
2308
2309            As  an example, assume there exists a library file termio.lib
2310         in the syslib directory specifying the following object modules:
2311
2312         \6809\io_disk        first object module
2313         d:\special\io_comm   second object module
2314
2315         and the following parameters were specified to the linker:
2316
2317 \f
2318
2319         THE LINKER                                              PAGE 2-4
2320         LIBRARY PATH(S) AND FILE(S)
2321
2322
2323         -k c:\iosystem\    the first path
2324         -k c:\syslib\      the second path
2325
2326         -l termio          the first library file
2327         -l io              the second library file (no such file)
2328
2329         The  linker  will attempt to use the following object modules to
2330         resolve any undefined symbols:
2331
2332         c:\syslib\6809\io_disk.rel     (concatenated path/file)
2333         d:\special\io_comm.rel         (absolute path/file)
2334
2335         all  other path(s)/file(s) don't exist.  (No errors are reported
2336         for non existant path(s)/file(s).)
2337
2338
2339         2.4  ASLINK PROCESSING
2340
2341
2342            The  linker  processes  the  files  in  the  order  they  are
2343         presented.  The first pass through the input files  is  used  to
2344         define  all  program  areas, the section area sizes, and symbols
2345         defined or referenced.  Undefined symbols will initiate a search
2346         of any specified library file(s) and the importing of the module
2347         containing the symbol definition.  After the first pass  the  -b
2348         (area  base  address) definitions, if any, are processed and the
2349         areas linked.
2350
2351            The  area  linking proceeds by first examining the area types
2352         ABS, CON, REL, OVR and PAG.  Absolute areas (ABS) from  separate
2353         object modules are always overlayed and have been assembled at a
2354         specific address, these are not normally relocated (if a -b com-
2355         mand  is  used  on an absolute area the area will be relocated).
2356         Relative areas (normally defined as REL|CON) have a base address
2357         of  0x0000  as read from the object files, the -b command speci-
2358         fies the beginning address of the area.  All subsequent relative
2359         areas  will  be  concatenated  with  proceeding  relative areas.
2360         Where specific ordering is desired, the first linker input  file
2361         should  have  the area definitions in the desired order.  At the
2362         completion of the area linking all area  addresses  and  lengths
2363         have  been determined.  The areas of type PAG are verified to be
2364         on a 256 byte boundary and that the length does not  exceed  256
2365         bytes.  Any errors are noted on stderr and in the map file.
2366
2367            Next  the  global symbol definitions (-g option), if any, are
2368         processed.  The symbol definitions have been delayed until  this
2369         point because the absolute addresses of all internal symbols are
2370         known and can be used in the expression calculations.
2371
2372            Before  continuing  with the linking process the symbol table
2373         is scanned to determine if any symbols have been referenced  but
2374         not defined.  Undefined symbols are listed on the stderr device.
2375 \f
2376
2377         THE LINKER                                              PAGE 2-5
2378         ASLINK PROCESSING
2379
2380
2381         if a .module directive was included in the  assembled  file  the
2382         module  making  the reference to this undefined variable will be
2383         printed.
2384
2385            Constants  defined  as global in more than one module will be
2386         flagged as multiple definitions if their values are not  identi-
2387         cal.
2388
2389            After  the  preceeding  processes are complete the linker may
2390         output a map file (-m option).  This file provides the following
2391         information:
2392
2393              1.  Global symbol values and label absolute addresses
2394
2395              2.  Defined areas and there lengths
2396
2397              3.  Remaining undefined symbols
2398
2399              4.  List of modules linked
2400
2401              5.  List of library modules linked
2402
2403              6.  List of -b and -g definitions
2404
2405
2406
2407
2408            The final step of the linking process is performed during the
2409         second pass of the input files.  As the xxx.rel files  are  read
2410         the code is relocated by substituting the physical addresses for
2411         the referenced symbols and areas and may be output in  Intel  or
2412         Motorola  formats.   The  number of files linked and symbols de-
2413         fined/referenced is limited by the processor space available  to
2414         build the area/symbol lists.  If the -u option is specified then
2415         the listing files  (file.lst)  associated  with  the  relocation
2416         files  (file.rel)  are  scanned  and  used  to create a new file
2417         (file.rst) which has all addresses and data relocated  to  their
2418         final values.
2419
2420
2421         2.5  LINKER INPUT FORMAT
2422
2423
2424            The  linkers'  input  object file is an ascii file containing
2425         the information needed by the linker  to  bind  multiple  object
2426         modules into a complete loadable memory image.
2427
2428         The object module contains the following designators:
2429
2430                 [XDQ][HL]
2431                         X       Hexidecimal radix
2432                         D       Decimal radix
2433 \f
2434
2435         THE LINKER                                              PAGE 2-6
2436         LINKER INPUT FORMAT
2437
2438
2439                         Q       Octal radix
2440
2441                         H       Most significant byte first
2442                         L       Least significant byte first
2443
2444                 H       Header
2445                 M       Module
2446                 A       Area
2447                 S       Symbol
2448                 T       Object code
2449                 R       Relocation information
2450                 P       Paging information
2451
2452
2453         2.5.1  Object Module Format
2454
2455
2456            The  first  line  of  an object module contains the [XDQ][HL]
2457         format specifier (i.e.  XH indicates  a  hexidecimal  file  with
2458         most significant byte first) for the following designators.
2459
2460
2461         2.5.2  Header Line
2462
2463                 H aa areas gg global symbols
2464
2465            The  header  line  specifies  the number of areas(aa) and the
2466         number of global symbols(gg) defined or referenced in  this  ob-
2467         ject module segment.
2468
2469
2470         2.5.3  Module Line
2471
2472                 M name
2473
2474            The  module  line  specifies  the module name from which this
2475         header segment was assembled.  The module line will  not  appear
2476         if the .module directive was not used in the source program.
2477
2478
2479         2.5.4  Symbol Line
2480
2481                 S string Defnnnn
2482
2483                         or
2484
2485                 S string Refnnnn
2486
2487            The  symbol line defines (Def) or references (Ref) the symbol
2488         'string' with the value nnnn.  The defined value is relative  to
2489         the  current  area  base  address.   References to constants and
2490         external global symbols will always appear before the first area
2491 \f
2492
2493         THE LINKER                                              PAGE 2-7
2494         LINKER INPUT FORMAT
2495
2496
2497         definition.  References to external symbols will have a value of
2498         zero.
2499
2500
2501         2.5.5  Area Line
2502
2503                 A label size ss flags ff
2504
2505            The  area  line  defines the area label, the size (ss) of the
2506         area in bytes, and the area flags (ff).  The area flags  specify
2507         the ABS, REL, CON, OVR, and PAG parameters:
2508
2509                 OVR/CON  (0x04/0x00 i.e.  bit position 2)
2510
2511                 ABS/REL  (0x08/0x00 i.e.  bit position 3)
2512
2513                 PAG      (0x10 i.e.  bit position 4)
2514
2515
2516         2.5.6  T Line
2517
2518                 T xx xx nn nn nn nn nn ...
2519
2520            The  T  line contains the assembled code output by the assem-
2521         bler with xx xx being the offset address from the  current  area
2522         base address and nn being the assembled instructions and data in
2523         byte format.
2524
2525
2526         2.5.7  R Line
2527
2528                 R 0 0 nn nn n1 n2 xx xx ...
2529
2530            The R line provides the relocation information to the linker.
2531         The nn nn value is the current area index, i.e.  which area  the
2532         current  values  were  assembled.  Relocation information is en-
2533         coded in groups of 4 bytes:
2534
2535              1.  n1 is the relocation mode and object format
2536                  1.  bit 0 word(0x00)/byte(0x01)
2537                  2.  bit 1 relocatable area(0x00)/symbol(0x02)
2538                  3.  bit 2 normal(0x00)/PC relative(0x04) relocation
2539                  4.  bit  3  1-byte(0x00)/2-byte(0x08) object format for
2540                      byte data
2541                  5.  bit 4 signed(0x00)/unsigned(0x10) byte data
2542                  6.  bit 5 normal(0x00)/page '0'(0x20) reference
2543                  7.  bit 6 normal(0x00)/page 'nnn'(0x40) reference
2544                  8.  bit  7  LSB  byte(0x00)/MSB  byte(0x80) with 2-byte
2545                      mode
2546
2547              2.  n2  is  a byte index into the corresponding (i.e.  pre-
2548                  ceeding) T line data (i.e.  a pointer to the data to be
2549 \f
2550
2551         THE LINKER                                              PAGE 2-8
2552         LINKER INPUT FORMAT
2553
2554
2555                  updated  by  the  relocation).   The T line data may be
2556                  1-byte or  2-byte  byte  data  format  or  2-byte  word
2557                  format.
2558
2559              3.  xx xx  is the area/symbol index for the area/symbol be-
2560                  ing referenced.  the corresponding area/symbol is found
2561                  in the header area/symbol lists.
2562
2563
2564         The groups of 4 bytes are repeated for each item requiring relo-
2565         cation in the preceeding T line.
2566
2567
2568         2.5.8  P Line
2569
2570                 P 0 0 nn nn n1 n2 xx xx
2571
2572            The  P  line provides the paging information to the linker as
2573         specified by a .setdp directive.  The format of  the  relocation
2574         information is identical to that of the R line.  The correspond-
2575         ing T line has the following information:
2576                 T xx xx aa aa bb bb
2577
2578            Where  aa aa is the area reference number which specifies the
2579         selected page area and bb bb is the base address  of  the  page.
2580         bb bb will require relocation processing if the 'n1 n2 xx xx' is
2581         specified in the P line.  The linker will verify that  the  base
2582         address is on a 256 byte boundary and that the page length of an
2583         area defined with the PAG type is not larger than 256 bytes.
2584
2585            The  linker  defaults any direct page references to the first
2586         area defined in the input REL file.  All ASxxxx assemblers  will
2587         specify the _CODE area first, making this the default page area.
2588
2589
2590         2.6  LINKER ERROR MESSAGES
2591
2592
2593            The linker provides detailed error messages allowing the pro-
2594         grammer to quickly find the errant code.   As  the  linker  com-
2595         pletes  pass 1  over  the  input  file(s)  it  reports  any page
2596         boundary or page length errors as follows:
2597
2598         ?ASlink-Warning-Paged Area PAGE0 Boundary Error
2599
2600         and/or
2601
2602         ?ASlink-Warning-Paged Area PAGE0 Length Error
2603
2604         where PAGE0 is the paged area.
2605
2606 \f
2607
2608         THE LINKER                                              PAGE 2-9
2609         LINKER ERROR MESSAGES
2610
2611
2612            During  Pass  two the linker reads the T, R, and P lines per-
2613         forming the necessary relocations and  outputting  the  absolute
2614         code.  Various errors may be reported during this process
2615         The P line processing can produce only one possible error:
2616
2617         ?ASlink-Warning-Page Definition Boundary Error
2618                  file        module      pgarea      pgoffset
2619           PgDef  t6809l      t6809l      PAGE0       0001
2620
2621         The error message specifies the file and module where the .setdp
2622         direct was issued and indicates  the  page  area  and  the  page
2623         offset value determined after relocation.
2624
2625
2626         The R line processing produces various errors:
2627
2628         ?ASlink-Warning-Byte PCR relocation error for symbol  bra2
2629                  file        module      area        offset
2630           Refby  t6809l      t6809l      TEST        00FE
2631           Defin  tconst      tconst      .  .ABS.    0080
2632
2633         ?ASlink-Warning-Unsigned Byte error for symbol  two56
2634                  file        module      area        offset
2635           Refby  t6800l      t6800l      DIRECT      0015
2636           Defin  tconst      tconst      .  .ABS.    0100
2637
2638         ?ASlink-Warning-Page0 relocation error for symbol  ltwo56
2639                  file        module      area        offset
2640           Refby  t6800l      t6800l      DIRECT      000D
2641           Defin  tconst      tconst      DIRECT      0100
2642
2643         ?ASlink-Warning-Page Mode relocation error for symbol  two56
2644                  file        module      area        offset
2645           Refby  t6809l      t6809l      DIRECT      0005
2646           Defin  tconst      tconst      .  .ABS.    0100
2647
2648         ?ASlink-Warning-Page Mode relocation error
2649                  file        module      area        offset
2650           Refby  t           Pagetest    PROGRAM     0006
2651           Defin  t           Pagetest    DIRECT      0100
2652
2653         These  error messages specify the file, module, area, and offset
2654         within the area of the code  referencing  (Refby)  and  defining
2655         (Defin) the symbol.  If the symbol is defined in the same module
2656         as the reference the linker is unable to report the symbol name.
2657         The  assembler  listing file(s) should be examined at the offset
2658         from the specified area to located the offending code.
2659
2660            The errors are:
2661
2662              1.  The  byte PCR error is caused by exceeding the pc rela-
2663                  tive byte branch range.
2664 \f
2665
2666         THE LINKER                                             PAGE 2-10
2667         LINKER ERROR MESSAGES
2668
2669
2670              2.  The Unsigned byte error indicates an indexing value was
2671                  negative or larger than 255.
2672
2673              3.  The  Page0  error is generated if the direct page vari-
2674                  able is not in the page0 range of 0 to 255.
2675
2676              4.  The page mode error is generated if the direct variable
2677                  is not within the current direct page (6809).
2678
2679 \f
2680
2681         THE LINKER                                             Page 2-11
2682         INTEL HEX OUTPUT FORMAT
2683
2684
2685         2.7  INTEL HEX OUTPUT FORMAT
2686
2687         Record Mark Field    -  This  field  signifies  the  start  of a
2688                                 record, and consists of an  ascii  colon
2689                                 (:).
2690
2691         Record Length Field  -  This   field   consists   of  two  ascii
2692                                 characters which indicate the number  of
2693                                 data   bytes   in   this   record.   The
2694                                 characters are the result of  converting
2695                                 the  number  of  bytes  in binary to two
2696                                 ascii characters, high digit first.   An
2697                                 End  of  File  record contains two ascii
2698                                 zeros in this field.
2699
2700         Load Address Field   -  This  field  consists  of the four ascii
2701                                 characters which result from  converting
2702                                 the  the  binary value of the address in
2703                                 which to begin loading this record.  The
2704                                 order is as follows:
2705
2706                                     High digit of high byte of address.
2707                                     Low digit of high byte of address.
2708                                     High digit of low byte of address.
2709                                     Low digit of low byte of address.
2710
2711                                 In an End of File record this field con-
2712                                 sists of either four ascii zeros or  the
2713                                 program  entry  address.   Currently the
2714                                 entry address option is not supported.
2715
2716         Record Type Field    -  This  field  identifies the record type,
2717                                 which is either 0 for data records or  1
2718                                 for  an End of File record.  It consists
2719                                 of two ascii characters, with  the  high
2720                                 digit of the record type first, followed
2721                                 by the low digit of the record type.
2722
2723         Data Field           -  This  field consists of the actual data,
2724                                 converted to two ascii characters,  high
2725                                 digit first.  There are no data bytes in
2726                                 the End of File record.
2727
2728         Checksum Field       -  The  checksum  field is the 8 bit binary
2729                                 sum of the record length field, the load
2730                                 address  field,  the  record type field,
2731                                 and the data field.  This  sum  is  then
2732                                 negated  (2's  complement) and converted
2733                                 to  two  ascii  characters,  high  digit
2734                                 first.
2735 \f
2736
2737         THE LINKER                                             Page 2-12
2738         MOTOROLA S1-S9 OUTPUT FORMAT
2739
2740
2741         2.8  MOTORLA S1-S9 OUTPUT FORMAT
2742
2743         Record Type Field    -  This  field  signifies  the  start  of a
2744                                 record and  identifies  the  the  record
2745                                 type as follows:
2746
2747                                     Ascii S1 - Data Record
2748                                     Ascii S9 - End of File Record
2749
2750         Record Length Field  -  This  field  specifies the record length
2751                                 which includes the  address,  data,  and
2752                                 checksum   fields.   The  8  bit  record
2753                                 length value is converted to  two  ascii
2754                                 characters, high digit first.
2755
2756         Load Address Field   -  This  field  consists  of the four ascii
2757                                 characters which result from  converting
2758                                 the  the  binary value of the address in
2759                                 which to begin loading this record.  The
2760                                 order is as follows:
2761
2762                                     High digit of high byte of address.
2763                                     Low digit of high byte of address.
2764                                     High digit of low byte of address.
2765                                     Low digit of low byte of address.
2766
2767                                 In an End of File record this field con-
2768                                 sists of either four ascii zeros or  the
2769                                 program  entry  address.   Currently the
2770                                 entry address option is not supported.
2771
2772         Data Field           -  This  field consists of the actual data,
2773                                 converted to two ascii characters,  high
2774                                 digit first.  There are no data bytes in
2775                                 the End of File record.
2776
2777         Checksum Field       -  The  checksum  field is the 8 bit binary
2778                                 sum of the record length field, the load
2779                                 address field, and the data field.  This
2780                                 sum is then  complemented  (1's  comple-
2781                                 ment)   and   converted   to  two  ascii
2782                                 characters, high digit first.
2783 \f
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797                                     CHAPTER 3
2798
2799                            BUILDING ASXXXX AND ASLINK
2800
2801
2802
2803
2804            The assemblers and linker have been successfully compiled us-
2805         ing  the  DECUS C  (PDP-11)  compiler  (patch  level   9)   with
2806         RT-11/TSX+,  Eyring  Research  Institute,  Inc.   PDOS (680x0) C
2807         V5.4b compiler, and Symantec C/C++ V6.1/V7.0.
2808
2809            The  device  specific  header  file  (i.e.  m6800.h, m6801.h,
2810         etc.) contains the DECUS C 'BUILD' directives for  generating  a
2811         command  file to compile, assemble, and link the necessary files
2812         to prepare an executable image for a particular assembler.
2813
2814
2815         3.1  BUILDING AN ASSEMBLER
2816
2817
2818            The  building  of  a typical assembler (6809 for example) re-
2819         quires the following files:
2820
2821              1.  M6809.H
2822              2.  M09EXT.C
2823              3.  M09MCH.C
2824              4.  M09ADR.C
2825              5.  M09PST.C
2826              6.  ASM.H
2827              7.  ASMAIN.C
2828              8.  ASLEX.C
2829              9.  ASSYM.C
2830             10.  ASSUBR.C
2831             11.  ASEXPR.C
2832             12.  ASDATA.C
2833             13.  ASLIST.C
2834             14.  ASOUT.C
2835
2836
2837            The  first  five  files are the 6809 processor dependent sec-
2838         tions which contain the following:
2839
2840
2841 \f
2842
2843         BUILDING ASXXXX AND ASLINK                              PAGE 3-2
2844         BUILDING AN ASSEMBLER
2845
2846
2847              1.  m6809.h -  header  file containing the machine specific
2848                  definitions of constants,  variables,  structures,  and
2849                  types
2850
2851              2.  m09ext -  device  description, byte order, and file ex-
2852                  tension information
2853
2854              3.  m09pst -  a  table of the assembler general directives,
2855                  special device directives, and assembler mnemonics with
2856                  associated operation codes
2857
2858              4.  m09mch / m09adr -  machine specific code for processing
2859                  the device mnemonics,  addressing  modes,  and  special
2860                  directives
2861
2862
2863            The  remaining nine files provide the device independent sec-
2864         tions which handle the  details  of  file  input/output,  symbol
2865         table  generation,  program/data areas, expression analysis, and
2866         assembler directive processing.
2867
2868            The  assembler defaults to the not case sensitive mode.  This
2869         may be altered by changing the case sensitivity flag in asm.h to
2870
2871                 /*
2872                  * Case Sensitivity Flag
2873                  */
2874                 #define CASE_SENSITIVE  1
2875
2876            The  assemblers  and  linker should be compiled with the same
2877         case sensitivity option.
2878
2879
2880         3.2  BUILDING ASLINK
2881
2882
2883            The building of the linker requires the following files:
2884
2885              1.  ASLINK.H
2886              2.  LKMAIN.C
2887              3.  LKLEX.C
2888              4.  LKAREA.C
2889              5.  LKHEAD.C
2890              6.  LKSYM.C
2891              7.  LKEVAL.C
2892              8.  LKDATA.C
2893              9.  LKLIST.C
2894             10.  LKRLOC.C
2895             11.  LKLIBR.C
2896             12.  LKS19.C
2897             13.  LKIHX.C
2898
2899 \f
2900
2901         BUILDING ASXXXX AND ASLINK                              PAGE 3-3
2902         BUILDING ASLINK
2903
2904
2905            The linker defaults to the not case sensitive mode.  This may
2906         be altered by changing the case sensitivity flag in aslink.h to
2907
2908                 /*
2909                  * Case Sensitivity Flag
2910                  */
2911                 #define CASE_SENSITIVE  1
2912
2913            The  linker  and  assemblers should be compiled with the same
2914         case sensitivity option.
2915 \f
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929                                    APPENDIX A
2930
2931                                 AS6800 ASSEMBLER
2932
2933
2934
2935
2936
2937         A.1  6800 REGISTER SET
2938
2939         The following is a list of the 6800 registers used by AS6800:
2940
2941                 a,b     -       8-bit accumulators
2942                 x       -       index register
2943
2944
2945         A.2  6800 INSTRUCTION SET
2946
2947
2948            The following tables list all 6800/6802/6808 mnemonics recog-
2949         nized by the AS6800 assembler.  The designation [] refers  to  a
2950         required addressing mode argument.  The following list specifies
2951         the format for each addressing mode supported by AS6800:
2952
2953                 #data           immediate data
2954                                 byte or word data
2955
2956                 *dir            direct page addressing
2957                                 (see .setdp directive)
2958                                 0 <= dir <= 255
2959
2960                 ,x              register indirect addressing
2961                                 zero offset
2962
2963                 offset,x        register indirect addressing
2964                                 0 <= offset <= 255
2965
2966                 ext             extended addressing
2967
2968                 label           branch label
2969
2970         The  terms  data, dir, offset, ext, and label may all be expres-
2971         sions.
2972
2973 \f
2974
2975         AS6800 ASSEMBLER                                        PAGE A-2
2976         6800 INSTRUCTION SET
2977
2978
2979            Note  that  not all addressing modes are valid with every in-
2980         struction, refer to the 6800 technical data for valid modes.
2981
2982
2983         A.2.1  Inherent Instructions
2984
2985                 aba                     cba
2986                 clc                     cli
2987                 clv                     daa
2988                 des                     dex
2989                 ins                     inx
2990                 nop                     rti
2991                 rts                     sba
2992                 sec                     sei
2993                 sev                     swi
2994                 tab                     tap
2995                 tba                     tpa
2996                 tsx                     txs
2997                 wai
2998
2999                 psha                    pshb
3000                 psh a                   psh b
3001                 pula                    pulb
3002                 pul a                   pul b
3003
3004
3005         A.2.2  Branch Instructions
3006
3007                 bra     label           bhi     label
3008                 bls     label           bcc     label
3009                 bhs     label           bcs     label
3010                 blo     label           bne     label
3011                 beq     label           bvc     label
3012                 bvs     label           bpl     label
3013                 bmi     label           bge     label
3014                 blt     label           bgt     label
3015                 ble     label           bsr     label
3016 \f
3017
3018         AS6800 ASSEMBLER                                        PAGE A-3
3019         6800 INSTRUCTION SET
3020
3021
3022         A.2.3  Single Operand Instructions
3023
3024                 asla                    aslb
3025                 asl a                   asl b
3026                 asl     []
3027
3028                 asra                    asrb
3029                 asr a                   asr b
3030                 asr     []
3031
3032                 clra                    clrb
3033                 clr a                   clr b
3034                 clr     []
3035
3036                 coma                    comb
3037                 com a                   com b
3038                 com     []
3039
3040                 deca                    decb
3041                 dec a                   dec b
3042                 dec     []
3043
3044                 inca                    incb
3045                 inc a                   inc b
3046                 inc     []
3047
3048                 lsla                    lslb
3049                 lsl a                   lsl b
3050                 lsl     []
3051
3052                 lsra                    lsrb
3053                 lsr a                   lsr b
3054                 lsr     []
3055
3056                 nega                    negb
3057                 neg a                   neg b
3058                 neg     []
3059
3060                 rola                    rolb
3061                 rol a                   rol b
3062                 rol     []
3063
3064                 rora                    rorb
3065                 ror a                   ror b
3066                 ror     []
3067
3068                 tsta                    tstb
3069                 tst a                   tst b
3070                 tst     []
3071 \f
3072
3073         AS6800 ASSEMBLER                                        PAGE A-4
3074         6800 INSTRUCTION SET
3075
3076
3077         A.2.4  Double Operand Instructions
3078
3079                 adca    []              adcb    []
3080                 adc a   []              adc b   []
3081
3082                 adda    []              addb    []
3083                 add a   []              add b   []
3084
3085                 anda    []              andb    []
3086                 and a   []              and b   []
3087
3088                 bita    []              bitb    []
3089                 bit a   []              bit b   []
3090
3091                 cmpa    []              cmpb    []
3092                 cmp a   []              cmp b   []
3093
3094                 eora    []              eorb    []
3095                 eor a   []              eor b   []
3096
3097                 ldaa    []              ldab    []
3098                 lda a   []              lda b   []
3099
3100                 oraa    []              orab    []
3101                 ora a   []              ora b   []
3102
3103                 sbca    []              sbcb    []
3104                 sbc a   []              sbc b   []
3105
3106                 staa    []              stab    []
3107                 sta a   []              sta b   []
3108
3109                 suba    []              subb    []
3110                 sub a   []              sub b   []
3111
3112
3113         A.2.5  Jump and Jump to Subroutine Instructions
3114
3115                 jmp     []              jsr     []
3116
3117
3118 \f
3119
3120         AS6800 ASSEMBLER                                        PAGE A-5
3121         6800 INSTRUCTION SET
3122
3123
3124         A.2.6  Long Register Instructions
3125
3126                 cpx     []
3127                 lds     []              sts     []
3128                 ldx     []              stx     []
3129 \f
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143                                    APPENDIX B
3144
3145                                 AS6801 ASSEMBLER
3146
3147
3148
3149
3150
3151         B.1  .hd6303 DIRECTIVE
3152
3153         Format:
3154
3155                 .hd6303
3156
3157         The  .hd6303 directive enables processing of the HD6303 specific
3158         mnemonics not included in  the  6801  instruction  set.   HD6303
3159         mnemonics  encountered  without  the  .hd6303  directive will be
3160         flagged with an 'o' error.
3161
3162
3163         B.2  6801 REGISTER SET
3164
3165         The following is a list of the 6801 registers used by AS6801:
3166
3167                 a,b     -       8-bit accumulators
3168                 d       -       16-bit accumulator <a:b>
3169                 x       -       index register
3170
3171
3172         B.3  6801 INSTRUCTION SET
3173
3174
3175            The  following tables list all 6801/6303 mnemonics recognized
3176         by the AS6801 assembler.  The designation []  refers  to  a  re-
3177         quired  addressing  mode argument.  The following list specifies
3178         the format for each addressing mode supported by AS6801:
3179
3180                 #data           immediate data
3181                                 byte or word data
3182
3183                 *dir            direct page addressing
3184                                 (see .setdp directive)
3185                                 0 <= dir <= 255
3186
3187 \f
3188
3189         AS6801 ASSEMBLER                                        PAGE B-2
3190         6801 INSTRUCTION SET
3191
3192
3193                 ,x              register indirect addressing
3194                                 zero offset
3195
3196                 offset,x        register indirect addressing
3197                                 0 <= offset <= 255
3198
3199                 ext             extended addressing
3200
3201                 label           branch label
3202
3203         The  terms  data, dir, offset, ext, and label may all be expres-
3204         sions.
3205
3206            Note  that  not all addressing modes are valid with every in-
3207         struction, refer to  the  6801/6303  technical  data  for  valid
3208         modes.
3209
3210
3211         B.3.1  Inherent Instructions
3212
3213                 aba             abx
3214                 cba             clc
3215                 cli             clv
3216                 daa             des
3217                 dex             ins
3218                 inx             mul
3219                 nop             rti
3220                 rts             sba
3221                 sec             sei
3222                 sev             swi
3223                 tab             tap
3224                 tba             tpa
3225                 tsx             txs
3226                 wai
3227
3228
3229         B.3.2  Branch Instructions
3230
3231                 bra     label           brn     label
3232                 bhi     label           bls     label
3233                 bcc     label           bhs     label
3234                 bcs     label           blo     label
3235                 bne     label           beq     label
3236                 bvc     label           bvs     label
3237                 bpl     label           bmi     label
3238                 bge     label           blt     label
3239                 bgt     label           ble     label
3240                 bsr     label
3241 \f
3242
3243         AS6801 ASSEMBLER                                        PAGE B-3
3244         6801 INSTRUCTION SET
3245
3246
3247         B.3.3  Single Operand Instructions
3248
3249                 asla            aslb            asld
3250                 asl a           asl b           asl d
3251                 asl     []
3252
3253                 asra            asrb
3254                 asr a           asr b
3255                 asr     []
3256
3257                 clra            clrb
3258                 clr a           clr b
3259                 clr     []
3260
3261                 coma            comb
3262                 com a           com b
3263                 com     []
3264
3265                 deca            decb
3266                 dec a           dec b
3267                 dec     []
3268
3269                 eora            eorb
3270                 eor a           eor b
3271                 eor     []
3272
3273                 inca            incb
3274                 inc a           inc b
3275                 inc     []
3276
3277                 lsla            lslb            lsld
3278                 lsl a           lsl b           lsl d
3279                 lsl     []
3280
3281                 lsra            lsrb            lsrd
3282                 lsr a           lsr b           lsr d
3283                 lsr     []
3284
3285                 nega            negb
3286                 neg a           neg b
3287                 neg     []
3288
3289                 psha            pshb            pshx
3290                 psh a           psh b           psh x
3291
3292                 pula            pulb            pulx
3293                 pul a           pul b           pul x
3294
3295                 rola            rolb
3296                 rol a           rol b
3297                 rol     []
3298
3299 \f
3300
3301         AS6801 ASSEMBLER                                        PAGE B-4
3302         6801 INSTRUCTION SET
3303
3304
3305                 rora            rorb
3306                 ror a           ror b
3307                 ror     []
3308
3309                 tsta            tstb
3310                 tst a           tst b
3311                 tst     []
3312
3313
3314         B.3.4  Double Operand Instructions
3315
3316                 adca    []      adcb    []
3317                 adc a   []      adc b   []
3318
3319                 adda    []      addb    []      addd    []
3320                 add a   []      add b   []      add d   []
3321
3322                 anda    []      andb    []
3323                 and a   []      and b   []
3324
3325                 bita    []      bitb    []
3326                 bit a   []      bit b   []
3327
3328                 cmpa    []      cmpb    []
3329                 cmp a   []      cmp b   []
3330
3331                 ldaa    []      ldab    []
3332                 lda a   []      lda b   []
3333
3334                 oraa    []      orab    []
3335                 ora a   []      ora b   []
3336
3337                 sbca    []      sbcb    []
3338                 sbc a   []      sbc b   []
3339
3340                 staa    []      stab    []
3341                 sta a   []      sta b   []
3342
3343                 suba    []      subb    []      subd    []
3344                 sub a   []      sub b   []      sub d   []
3345
3346
3347 \f
3348
3349         AS6801 ASSEMBLER                                        PAGE B-5
3350         6801 INSTRUCTION SET
3351
3352
3353         B.3.5  Jump and Jump to Subroutine Instructions
3354
3355                 jmp     []      jsr     []
3356
3357
3358         B.3.6  Long Register Instructions
3359
3360                 cpx     []      ldd     []
3361                 lds     []      ldx     []
3362                 std     []      sts     []
3363                 stx     []
3364
3365
3366         B.3.7  6303 Specific Instructions
3367
3368                 aim     #data, []       eim     #data, []
3369                 oim     #data, []       tim     #data, []
3370
3371                 xgdx            slp
3372 \f
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386                                    APPENDIX C
3387
3388                                 AS6804 ASSEMBLER
3389
3390
3391
3392
3393            Requires the .setdp directive to specify the ram area.
3394
3395
3396         C.1  6804 REGISTER SET
3397
3398         The following is a list of the 6804 registers used by AS6804:
3399
3400                 x,y     -       index registers
3401
3402
3403         C.2  6804 INSTRUCTION SET
3404
3405
3406            The  following  tables  list all 6804 mnemonics recognized by
3407         the AS6804 assembler.  The designation [] refers to  a  required
3408         addressing  mode  argument.   The  following  list specifies the
3409         format for each addressing mode supported by AS6804:
3410
3411                 #data           immediate data
3412                                 byte or word data
3413
3414                 ,x              register indirect addressing
3415
3416                 dir             direct addressing
3417                                 (see .setdp directive)
3418                                 0 <= dir <= 255
3419
3420                 ext             extended addressing
3421
3422                 label           branch label
3423
3424         The  terms data, dir, and ext may be expressions.  The label for
3425         the short branchs beq, bne, bcc, and bcs must not be external.
3426
3427            Note  that  not all addressing modes are valid with every in-
3428         struction, refer to the 6804 technical data for valid modes.
3429 \f
3430
3431         AS6804 ASSEMBLER                                        PAGE C-2
3432         6804 INSTRUCTION SET
3433
3434
3435         C.2.1  Inherent Instructions
3436
3437                 coma            decx
3438                 decy            incx
3439                 incy            rola
3440                 rti             rts
3441                 stop            tax
3442                 tay             txa
3443                 tya             wait
3444
3445
3446         C.2.2  Branch Instructions
3447
3448                 bne     label           beq     label
3449                 bcc     label           bcs     label
3450
3451
3452         C.2.3  Single Operand Instructions
3453
3454                 add     []
3455                 and     []
3456                 cmp     []
3457                 dec     []
3458                 inc     []
3459                 lda     []
3460                 sta     []
3461                 sub     []
3462
3463
3464         C.2.4  Jump and Jump to Subroutine Instructions
3465
3466                 jsr     []
3467                 jmp     []
3468
3469
3470         C.2.5  Bit Test Instructions
3471
3472                 brclr   #data,[],label
3473                 brset   #data,[],label
3474
3475                 bclr    #label,[]
3476                 bset    #label,[]
3477
3478
3479 \f
3480
3481         AS6804 ASSEMBLER                                        PAGE C-3
3482         6804 INSTRUCTION SET
3483
3484
3485         C.2.6  Load Immediate data Instruction
3486
3487                 mvi     [],#data
3488
3489
3490         C.2.7  6804 Derived Instructions
3491
3492                 asla
3493                 bam     label
3494                 bap     label
3495                 bxmi    label
3496                 bxpl    label
3497                 bymi    label
3498                 bypl    label
3499                 clra
3500                 clrx
3501                 clry
3502                 deca
3503                 decx
3504                 decy
3505                 inca
3506                 incx
3507                 incy
3508                 ldxi    #data
3509                 ldyi    #data
3510                 nop
3511                 tax
3512                 tay
3513                 txa
3514                 tya
3515 \f
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529                                    APPENDIX D
3530
3531                                 AS6805 ASSEMBLER
3532
3533
3534
3535
3536
3537         D.1  6805 REGISTER SET
3538
3539         The following is a list of the 6805 registers used by AS6805:
3540
3541                 a       -       8-bit accumulator
3542                 x       -       index register
3543
3544
3545         D.2  6805 INSTRUCTION SET
3546
3547
3548            The  following  tables  list all 6805 mnemonics recognized by
3549         the AS6805 assembler.  The designation [] refers to  a  required
3550         addressing  mode  argument.   The  following  list specifies the
3551         format for each addressing mode supported by AS6805:
3552
3553                 #data           immediate data
3554                                 byte or word data
3555
3556                 *dir            direct page addressing
3557                                 (see .setdp directive)
3558                                 0 <= dir <= 255
3559
3560                 ,x              register indirect addressing
3561                                 zero offset
3562
3563                 offset,x        register indirect addressing
3564                                   0 <= offset <= 255   --- byte mode
3565                                 256 <= offset <= 65535 --- word mode
3566                                 (an externally defined offset uses the
3567                                  word mode)
3568
3569                 ext             extended addressing
3570
3571                 label           branch label
3572
3573 \f
3574
3575         AS6805 ASSEMBLER                                        PAGE D-2
3576         6805 INSTRUCTION SET
3577
3578
3579         The terms data, dir, offset, and ext may all be expressions.
3580
3581            Note  that  not all addressing modes are valid with every in-
3582         struction, refer to the 6805 technical data for valid modes.
3583
3584
3585         D.2.1  Control Instructions
3586
3587                 clc             cli
3588                 nop             rsp
3589                 rti             rts
3590                 sec             sei
3591                 stop            swi
3592                 tax             txa
3593                 wait
3594
3595
3596         D.2.2  Bit Manipulation Instructions
3597
3598                 brset   #data,*dir,label
3599                 brclr   #data,*dir,label
3600
3601                 bset    #data,*dir
3602                 bclr    #data,*dir
3603
3604
3605         D.2.3  Branch Instructions
3606
3607                 bra     label           brn     label
3608                 bhi     label           bls     label
3609                 bcc     label           bcs     label
3610                 bne     label           beq     label
3611                 bhcc    label           bhcs    label
3612                 bpl     label           bmi     label
3613                 bmc     label           bms     label
3614                 bil     label           bih     label
3615                 bsr     label
3616 \f
3617
3618         AS6805 ASSEMBLER                                        PAGE D-3
3619         6805 INSTRUCTION SET
3620
3621
3622         D.2.4  Read-Modify-Write Instructions
3623
3624                 nega            negx
3625                 neg     []
3626
3627                 coma            comx
3628                 com     []
3629
3630                 lsra            lsrx
3631                 lsr     []
3632
3633                 rora            rorx
3634                 ror     []
3635
3636                 asra            asrx
3637                 asr     []
3638
3639                 lsla            lslx
3640                 lsl     []
3641
3642                 rola            rolx
3643                 rol     []
3644
3645                 deca            decx
3646                 dec     []
3647
3648                 inca            incx
3649                 inc     []
3650
3651                 tsta            tstx
3652                 tst     []
3653
3654                 clra            clrx
3655                 clr     []
3656
3657
3658         D.2.5  Register\Memory Instructions
3659
3660                 sub     []              cmp     []
3661                 sbc     []              cpx     []
3662                 and     []              bit     []
3663                 lda     []              sta     []
3664                 eor     []              adc     []
3665                 ora     []              add     []
3666                 ldx     []              stx     []
3667 \f
3668
3669         AS6805 ASSEMBLER                                        PAGE D-4
3670         6805 INSTRUCTION SET
3671
3672
3673         D.2.6  Jump and Jump to Subroutine Instructions
3674
3675                 jmp     []              jsr     []
3676 \f
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690                                    APPENDIX E
3691
3692                                AS68HC08 ASSEMBLER
3693
3694
3695
3696
3697
3698         E.1  68HC08 REGISTER SET
3699
3700         The  following  is  a  list  of  the  68HC08  registers  used by
3701         AS68HC08:
3702
3703                 a       -       8-bit accumulator
3704                 x       -       index register  <H:X>
3705                 s       -       stack pointer
3706
3707
3708         E.2  68HC08 INSTRUCTION SET
3709
3710
3711            The  following tables list all 68HC08 mnemonics recognized by
3712         the AS68HC08 assembler.  The designation [] refers to a required
3713         addressing  mode  argument.   The  following  list specifies the
3714         format for each addressing mode supported by AS68HC08:
3715
3716                 #data           immediate data
3717                                 byte or word data
3718
3719                 *dir            direct page addressing
3720                                 (see .setdp directive)
3721                                 0 <= dir <= 255
3722
3723                 ,x              register indexed addressing
3724                                 zero offset
3725
3726                 offset,x        register indexed addressing
3727                                   0 <= offset <= 255   --- byte mode
3728                                 256 <= offset <= 65535 --- word mode
3729                                 (an externally defined offset uses the
3730                                  word mode)
3731
3732                 ,x+             register indexed addressing
3733                                 zero offset with post increment
3734 \f
3735
3736         AS68HC08 ASSEMBLER                                      PAGE E-2
3737         68HC08 INSTRUCTION SET
3738
3739
3740
3741                 offset,x+       register indexed addressing
3742                                 unsigned byte offset with post increment
3743
3744                 offset,s        stack pointer indexed addressing
3745                                   0 <= offset <= 255   --- byte mode
3746                                 256 <= offset <= 65535 --- word mode
3747                                 (an externally defined offset uses the
3748                                  word mode)
3749
3750                 ext             extended addressing
3751
3752                 label           branch label
3753
3754         The terms data, dir, offset, and ext may all be expressions.
3755
3756            Note  that  not all addressing modes are valid with every in-
3757         struction, refer to the 68HC08 technical data for valid modes.
3758
3759
3760         E.2.1  Control Instructions
3761
3762                 clc             cli             daa             div
3763                 mul             nop             nsa             psha
3764                 pshh            pshx            pula            pulh
3765                 pulx            rsp             rti             rts
3766                 sec             sei             stop            swi
3767                 tap             tax             tpa             tsx
3768                 txa             txs             wait
3769
3770
3771         E.2.2  Bit Manipulation Instructions
3772
3773                 brset   #data,*dir,label
3774                 brclr   #data,*dir,label
3775
3776                 bset    #data,*dir
3777                 bclr    #data,*dir
3778 \f
3779
3780         AS68HC08 ASSEMBLER                                      PAGE E-3
3781         68HC08 INSTRUCTION SET
3782
3783
3784         E.2.3  Branch Instructions
3785
3786                 bra     label           brn     label
3787                 bhi     label           bls     label
3788                 bcc     label           bcs     label
3789                 bne     label           beq     label
3790                 bhcc    label           bhcs    label
3791                 bpl     label           bmi     label
3792                 bmc     label           bms     label
3793                 bil     label           bih     label
3794                 bsr     label           bge     label
3795                 blt     label           bgt     label
3796                 ble     label
3797
3798
3799         E.2.4  Complex Branch Instructions
3800
3801                 cbeqa   [],label
3802                 cbeqx   [],label
3803                 cbeq    [],label
3804                 dbnza   label
3805                 dbnzx   label
3806                 dbnz    [],label
3807 \f
3808
3809         AS68HC08 ASSEMBLER                                      PAGE E-4
3810         68HC08 INSTRUCTION SET
3811
3812
3813         E.2.5  Read-Modify-Write Instructions
3814
3815                 nega                    negx
3816                 neg     []
3817
3818                 coma                    comx
3819                 com     []
3820
3821                 lsra                    lsrx
3822                 lsr     []
3823
3824                 rora                    rorx
3825                 ror     []
3826
3827                 asra                    asrx
3828                 asr     []
3829
3830                 asla                    aslx
3831                 asl     []
3832
3833                 lsla                    lslx
3834                 lsl     []
3835
3836                 rola                    rolx
3837                 rol     []
3838
3839                 deca                    decx
3840                 dec     []
3841
3842                 inca                    incx
3843                 inc     []
3844
3845                 tsta                    tstx
3846                 tst     []
3847
3848                 clra                    clrx
3849                 clr     []              clrh
3850
3851                 aix     #data
3852
3853                 ais     #data
3854 \f
3855
3856         AS68HC08 ASSEMBLER                                      PAGE E-5
3857         68HC08 INSTRUCTION SET
3858
3859
3860         E.2.6  Register\Memory Instructions
3861
3862                 sub     []              cmp     []
3863                 sbc     []              cpx     []
3864                 and     []              bit     []
3865                 lda     []              sta     []
3866                 eor     []              adc     []
3867                 ora     []              add     []
3868                 ldx     []              stx     []
3869
3870
3871         E.2.7  Double Operand Move Instruction
3872
3873                 mov     [],[]
3874
3875
3876         E.2.8  16-Bit <H:X> Index Register Instructions
3877
3878                 cphx    []
3879                 ldhx    []
3880                 sthx    []
3881
3882
3883         E.2.9  Jump and Jump to Subroutine Instructions
3884
3885                 jmp     []              jsr     []
3886 \f
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900                                    APPENDIX F
3901
3902                                 AS6809 ASSEMBLER
3903
3904
3905
3906
3907
3908         F.1  6809 REGISTER SET
3909
3910         The following is a list of the 6809 registers used by AS6809:
3911
3912                 a,b     -       8-bit accumulators
3913                 d       -       16-bit accumulator <a:b>
3914                 x,y     -       index registers
3915                 s,u     -       stack pointers
3916                 pc      -       program counter
3917                 cc      -       condition code
3918                 dp      -       direct page
3919
3920
3921         F.2  6809 INSTRUCTION SET
3922
3923
3924            The  following  tables  list all 6809 mnemonics recognized by
3925         the AS6809 assembler.  The designation [] refers to  a  required
3926         addressing  mode  argument.   The  following  list specifies the
3927         format for each addressing mode supported by AS6809:
3928
3929                 #data           immediate data
3930                                 byte or word data
3931
3932                 *dir            direct page addressing
3933                                 (see .setdp directive)
3934                                 0 <= dir <= 255
3935
3936                 label           branch label
3937
3938                 r,r1,r2         registers
3939                                 cc,a,b,d,dp,x,y,s,u,pc
3940
3941                 ,-x     ,--x    register indexed
3942                                 autodecrement
3943
3944 \f
3945
3946         AS6809 ASSEMBLER                                        PAGE F-2
3947         6809 INSTRUCTION SET
3948
3949
3950                 ,x+     ,x++    register indexed
3951                                 autoincrement
3952
3953                 ,x              register indexed addressing
3954                                 zero offset
3955
3956                 offset,x        register indexed addressing
3957                                    -16 <= offset <= 15    ---  5-bit
3958                                   -128 <= offset <= -17   ---  8-bit
3959                                     16 <= offset <= 127   ---  8-bit
3960                                 -32768 <= offset <= -129  --- 16-bit
3961                                    128 <= offset <= 32767 --- 16-bit
3962                                 (external definition of offset
3963                                  uses 16-bit mode)
3964
3965                 a,x             accumulator offset indexed addressing
3966
3967                 ext             extended addressing
3968
3969                 ext,pc          pc addressing ( pc <- pc + ext )
3970
3971                 ext,pcr         pc relative addressing
3972
3973                 [,--x]          register indexed indirect
3974                                 autodecrement
3975
3976                 [,x++]          register indexed indirect
3977                                 autoincrement
3978
3979                 [,x]            register indexed indirect addressing
3980                                 zero offset
3981
3982                 [offset,x]      register indexed indirect addressing
3983                                   -128 <= offset <= 127   ---  8-bit
3984                                 -32768 <= offset <= -129  --- 16-bit
3985                                    128 <= offset <= 32767 --- 16-bit
3986                                 (external definition of offset
3987                                  uses 16-bit mode)
3988
3989                 [a,x]           accumulator offset indexed
3990                                 indirect addressing
3991
3992                 [ext]           extended indirect addressing
3993
3994                 [ext,pc]        pc indirect addressing
3995                                 ( [pc <- pc + ext] )
3996
3997                 [ext,pcr]       pc relative indirect addressing
3998
3999         The  terms  data, dir, label, offset, and ext may all be expres-
4000         sions.
4001
4002 \f
4003
4004         AS6809 ASSEMBLER                                        PAGE F-3
4005         6809 INSTRUCTION SET
4006
4007
4008            Note  that  not all addressing modes are valid with every in-
4009         struction, refer to the 6809 technical data for valid modes.
4010
4011
4012         F.2.1  Inherent Instructions
4013
4014                 abx             daa
4015                 mul             nop
4016                 rti             rts
4017                 sex             swi
4018                 swi1            swi2
4019                 swi3            sync
4020
4021
4022         F.2.2  Short Branch Instructions
4023
4024                 bcc     label           bcs     label
4025                 beq     label           bge     label
4026                 bgt     label           bhi     label
4027                 bhis    label           bhs     label
4028                 ble     label           blo     label
4029                 blos    label           bls     label
4030                 blt     label           bmi     label
4031                 bne     label           bpl     label
4032                 bra     label           brn     label
4033                 bvc     label           bvs     label
4034                 bsr     label
4035
4036
4037         F.2.3  Long Branch Instructions
4038
4039                 lbcc    label           lbcs    label
4040                 lbeq    label           lbge    label
4041                 lbgt    label           lbhi    label
4042                 lbhis   label           lbhs    label
4043                 lble    label           lblo    label
4044                 lblos   label           lbls    label
4045                 lblt    label           lbmi    label
4046                 lbne    label           lbpl    label
4047                 lbra    label           lbrn    label
4048                 lbvc    label           lbvs    label
4049                 lbsr    label
4050 \f
4051
4052         AS6809 ASSEMBLER                                        PAGE F-4
4053         6809 INSTRUCTION SET
4054
4055
4056         F.2.4  Single Operand Instructions
4057
4058                 asla            aslb
4059                 asl     []
4060
4061                 asra            asrb
4062                 asr     []
4063
4064                 clra            clrb
4065                 clr     []
4066
4067                 coma            comb
4068                 com     []
4069
4070                 deca            decb
4071                 dec     []
4072
4073                 inca            incb
4074                 inc     []
4075
4076                 lsla            lslb
4077                 lsl     []
4078
4079                 lsra            lsrb
4080                 lsr     []
4081
4082                 nega            negb
4083                 neg     []
4084
4085                 rola            rolb
4086                 rol     []
4087
4088                 rora            rorb
4089                 ror     []
4090
4091                 tsta            tstb
4092                 tst     []
4093 \f
4094
4095         AS6809 ASSEMBLER                                        PAGE F-5
4096         6809 INSTRUCTION SET
4097
4098
4099         F.2.5  Double Operand Instructions
4100
4101                 adca    []              adcb    []
4102
4103                 adda    []              addb    []
4104
4105                 anda    []              andb    []
4106
4107                 bita    []              bitb    []
4108
4109                 cmpa    []              cmpb    []
4110
4111                 eora    []              eorb    []
4112
4113                 lda     []              ldb     []
4114
4115                 ora     []              orb     []
4116
4117                 sbca    []              sbcb    []
4118
4119                 sta     []              stb     []
4120
4121                 suba    []              subb    []
4122
4123
4124         F.2.6  D-register Instructions
4125
4126                 addd    []              subd    []
4127                 cmpd    []              ldd     []
4128                 std     []
4129
4130
4131         F.2.7  Index/Stack Register Instructions
4132
4133                 cmps    []              cmpu    []
4134                 cmpx    []              cmpy    []
4135
4136                 lds     []              ldu     []
4137                 ldx     []              ldy     []
4138
4139                 leas    []              leau    []
4140                 leax    []              leay    []
4141
4142                 sts     []              stu     []
4143                 stx     []              sty     []
4144
4145                 pshs    r               pshu    r
4146                 puls    r               pulu    r
4147 \f
4148
4149         AS6809 ASSEMBLER                                        PAGE F-6
4150         6809 INSTRUCTION SET
4151
4152
4153         F.2.8  Jump and Jump to Subroutine Instructions
4154
4155                 jmp     []              jsr     []
4156
4157
4158         F.2.9  Register - Register Instructions
4159
4160                 exg     r1,r2           tfr     r1,r2
4161
4162
4163         F.2.10  Condition Code Register Instructions
4164
4165                 andcc   #data           orcc    #data
4166                 cwai    #data
4167
4168
4169         F.2.11  6800 Compatibility Instructions
4170
4171                 aba             cba
4172                 clc             cli
4173                 clv             des
4174                 dex             ins
4175                 inx
4176                 ldaa    []      ldab    []
4177                 oraa    []      orab    []
4178                 psha            pshb
4179                 pula            pulb
4180                 sba             sec
4181                 sei             sev
4182                 staa    []      stab    []
4183                 tab             tap
4184                 tba             tpa
4185                 tsx             txs
4186                 wai
4187 \f
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201                                    APPENDIX G
4202
4203                                 AS6811 ASSEMBLER
4204
4205
4206
4207
4208
4209         G.1  6811 REGISTER SET
4210
4211         The following is a list of the 6811 registers used by AS6811:
4212
4213                 a,b     -       8-bit accumulators
4214                 d       -       16-bit accumulator <a:b>
4215                 x,y     -       index registers
4216
4217
4218         G.2  6811 INSTRUCTION SET
4219
4220
4221            The  following  tables  list all 6811 mnemonics recognized by
4222         the AS6811 assembler.  The designation [] refers to  a  required
4223         addressing  mode  argument.   The  following  list specifies the
4224         format for each addressing mode supported by AS6811:
4225
4226                 #data           immediate data
4227                                 byte or word data
4228
4229                 *dir            direct page addressing
4230                                 (see .setdp directive)
4231                                 0 <= dir <= 255
4232
4233                 ,x              register indirect addressing
4234                                 zero offset
4235
4236                 offset,x        register indirect addressing
4237                                 0 <= offset <= 255
4238
4239                 ext             extended addressing
4240
4241                 label           branch label
4242
4243         The terms data, dir, offset, and ext may all be expressions.
4244
4245 \f
4246
4247         AS6811 ASSEMBLER                                        PAGE G-2
4248         6811 INSTRUCTION SET
4249
4250
4251            Note  that  not all addressing modes are valid with every in-
4252         struction, refer to the 6811 technical data for valid modes.
4253
4254
4255         G.2.1  Inherent Instructions
4256
4257                 aba             abx
4258                 aby             cba
4259                 clc             cli
4260                 clv             daa
4261                 des             dex
4262                 dey             fdiv
4263                 idiv            ins
4264                 inx             iny
4265                 mul             nop
4266                 rti             rts
4267                 sba             sec
4268                 sei             sev
4269                 stop            swi
4270                 tab             tap
4271                 tba             tpa
4272                 tsx             txs
4273                 wai             xgdx
4274                 xgdy
4275
4276                 psha            pshb
4277                 psh a           psh b
4278                 pshx            pshy
4279                 psh x           psh y
4280
4281                 pula            pulb
4282                 pul a           pul b
4283                 pulx            puly
4284                 pul x           pul y
4285
4286
4287         G.2.2  Branch Instructions
4288
4289                 bra     label           brn     label
4290                 bhi     label           bls     label
4291                 bcc     label           bhs     label
4292                 bcs     label           blo     label
4293                 bne     label           beq     label
4294                 bvc     label           bvs     label
4295                 bpl     label           bmi     label
4296                 bge     label           blt     label
4297                 bgt     label           ble     label
4298                 bsr     label
4299 \f
4300
4301         AS6811 ASSEMBLER                                        PAGE G-3
4302         6811 INSTRUCTION SET
4303
4304
4305         G.2.3  Single Operand Instructions
4306
4307                 asla            aslb            asld
4308                 asl a           asl b           asl d
4309                 asl     []
4310
4311                 asra            asrb
4312                 asr a           asr b
4313                 asr     []
4314
4315                 clra            clrb
4316                 clr a           clr b
4317                 clr     label
4318
4319                 coma            comb
4320                 com a           com b
4321                 com     []
4322
4323                 deca            decb
4324                 dec a           dec b
4325                 dec     []
4326
4327                 inca            incb
4328                 inc a           inc b
4329                 inc     []
4330
4331                 lsla            lslb            lsld
4332                 lsl a           lsl b           lsl d
4333                 lsl     []
4334
4335                 lsra            lsrb            lsrd
4336                 lsr a           lsr b           lsr d
4337                 lsr     []
4338
4339                 nega            negb
4340                 neg a           neg b
4341                 neg     []
4342
4343                 rola            rolb
4344                 rol a           rol b
4345                 rol     []
4346
4347                 rora            rorb
4348                 ror a           ror b
4349                 ror     []
4350
4351                 tsta            tstb
4352                 tst a           tst b
4353                 tst     []
4354 \f
4355
4356         AS6811 ASSEMBLER                                        PAGE G-4
4357         6811 INSTRUCTION SET
4358
4359
4360         G.2.4  Double Operand Instructions
4361
4362                 adca    []              adcb    []
4363                 adc a   []              adc b   []
4364
4365                 adda    []      addb    []      addd    []
4366                 add a   []      add b   []      add d   []
4367
4368                 anda    []              andb    []
4369                 and a   []              and b   []
4370
4371                 bita    []              bitb    []
4372                 bit a   []              bit b   []
4373
4374                 cmpa    []              cmpb    []
4375                 cmp a   []              cmp b   []
4376
4377                 eora    []              eorb    []
4378                 eor a   []              eor b   []
4379
4380                 ldaa    []              ldab    []
4381                 lda a   []              lda b   []
4382
4383                 oraa    []              orab    []
4384                 ora a   []              ora b   []
4385
4386                 sbca    []              sbcb    []
4387                 sbc a   []              sbc b   []
4388
4389                 staa    []              stab    []
4390                 sta a   []              sta b   []
4391
4392                 suba    []      subb    []      subd    []
4393                 sub a   []      sub b   []      sub d   []
4394
4395
4396         G.2.5  Bit Manupulation Instructions
4397
4398                 bclr    [],#data
4399                 bset    [],#data
4400
4401                 brclr   [],#data,label
4402                 brset   [],#data,label
4403
4404
4405 \f
4406
4407         AS6811 ASSEMBLER                                        PAGE G-5
4408         6811 INSTRUCTION SET
4409
4410
4411         G.2.6  Jump and Jump to Subroutine Instructions
4412
4413                 jmp     []              jsr     []
4414
4415
4416         G.2.7  Long Register Instructions
4417
4418                 cpx     []              cpy     []
4419
4420                 ldd     []              lds     []
4421                 ldx     []              ldy     []
4422
4423                 std     []              sts     []
4424                 stx     []              sty     []
4425 \f
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439                                    APPENDIX H
4440
4441                                 AS6816 ASSEMBLER
4442
4443
4444
4445
4446
4447         H.1  6816 REGISTER SET
4448
4449         The following is a list of the 6816 registers used by AS6816:
4450
4451                 a,b     -       8-bit accumulators
4452                 d       -       16-bit accumulator <a:b>
4453                 e       -       16-bit accumulator
4454                 x,y,z   -       index registers
4455                 k       -       address extension register
4456                 s       -       stack pointer
4457                 ccr     -       condition code
4458
4459
4460         H.2  6816 INSTRUCTION SET
4461
4462
4463            The  following  tables  list all 6816 mnemonics recognized by
4464         the AS6816 assembler.  The designation [] refers to  a  required
4465         addressing  mode  argument.   The  following  list specifies the
4466         format for each addressing mode supported by AS6816:
4467
4468                 #data           immediate data
4469                                 byte or word data
4470
4471                 #xo,#yo         local immediate data (mac / rmac)
4472
4473                 label           branch label
4474
4475                 r               register
4476                                 ccr,a,b,d,e,x,y,z,s
4477
4478                 ,x              zero offset register indexed addressing
4479                 ,x8
4480                 ,x16
4481
4482                 offset,x        register indexed addressing
4483 \f
4484
4485         AS6816 ASSEMBLER                                        PAGE H-2
4486         6816 INSTRUCTION SET
4487
4488
4489                                      0 <= offset <= 255   ---  8-bit
4490                                 -32768 <= offset <= -1    --- 16-bit
4491                                    256 <= offset <= 32767 --- 16-bit
4492                                 (external definition of offset
4493                                  uses 16-bit mode)
4494
4495                 offset,x8       unsigned 8-bit offset indexed addressing
4496                 offset,x16      signed 16-bit offset indexed addressing
4497
4498                 e,x             accumulator offset indexed addressing
4499
4500                 ext             extended addressing
4501
4502                 bank            64K bank number (jmp / jsr)
4503
4504         The  terms data, label, offset, bank, and ext may all be expres-
4505         sions.
4506
4507            Note  that  not all addressing modes are valid with every in-
4508         struction, refer to the 6816 technical data for valid modes.
4509
4510
4511         H.2.1  Inherent Instructions
4512
4513                 aba             abx             aby             abz
4514                 ace             aced            ade             adx
4515                 ady             adz             aex             aey
4516                 aez             bgnd            cba             daa
4517                 ediv            edivs           emul            emuls
4518                 fdiv            fmuls           idiv            ldhi
4519                 lpstop          mul             nop             psha
4520                 pshb            pshmac          pula            pulb
4521                 pulmac          rtr             rts             sba
4522                 sde             sted            swi             sxt
4523                 tab             tap             tba             tbek
4524                 tbsk            tbxk            tbyk            tbzk
4525                 tde             tdmsk           tdp             ted
4526                 tedm            tekb            tem             tmer
4527                 tmet            tmxed           tpa             tpd
4528                 tskb            tsx             tsy             tsz
4529                 txkb            txs             txy             txz
4530                 tykb            tys             tyx             tyz
4531                 tzkb            tzs             tzx             tzy
4532                 wai             xgab            xgde            xgdx
4533                 xgdy            xgdz            xgex            xgey
4534                 xgez
4535 \f
4536
4537         AS6816 ASSEMBLER                                        PAGE H-3
4538         6816 INSTRUCTION SET
4539
4540
4541         H.2.2  Push/Pull Multiple Register Instructions
4542
4543                 pshm    r,...           pulm    r,...
4544
4545
4546         H.2.3  Short Branch Instructions
4547
4548                 bcc     label           bcs     label
4549                 beq     label           bge     label
4550                 bgt     label           bhi     label
4551                 bhis    label           bhs     label
4552                 ble     label           blo     label
4553                 blos    label           bls     label
4554                 blt     label           bmi     label
4555                 bne     label           bpl     label
4556                 bra     label           brn     label
4557                 bvc     label           bvs     label
4558                 bsr     label
4559
4560
4561         H.2.4  Long Branch Instructions
4562
4563                 lbcc    label           lbcs    label
4564                 lbeq    label           lbge    label
4565                 lbgt    label           lbhi    label
4566                 lbhis   label           lbhs    label
4567                 lble    label           lblo    label
4568                 lblos   label           lbls    label
4569                 lblt    label           lbmi    label
4570                 lbne    label           lbpl    label
4571                 lbra    label           lbrn    label
4572                 lbvc    label           lbvs    label
4573                 lbsr    label
4574
4575
4576         H.2.5  Bit Manipulation Instructions
4577
4578                 bclr    [],#data
4579                 bset    [],#data
4580
4581                 brclr   [],#data,label
4582                 brset   [],#data,label
4583 \f
4584
4585         AS6816 ASSEMBLER                                        PAGE H-4
4586         6816 INSTRUCTION SET
4587
4588
4589         H.2.6  Single Operand Instructions
4590
4591                 asla                    aslb
4592                 asld                    asle
4593                 aslm
4594                 asl     []              aslw    []
4595
4596                 asra                    asrb
4597                 asrd                    asre
4598                 asrm
4599                 asr     []              asrw    []
4600
4601                 clra                    clrb
4602                 clrd                    clre
4603                                         clrm
4604                 clr     []              clrw    []
4605
4606                 coma                    comb
4607                 comd                    come
4608                 com     []              comw    []
4609
4610                 deca                    decb
4611                 dec     []              decw    []
4612
4613                 inca                    incb
4614                 inc     []              incw    []
4615
4616                 lsla                    lslb
4617                 lsld                    lsle
4618                 lslm
4619                 lsl     []              lslw    []
4620
4621                 lsra                    lsrb
4622                 lsrd                    lsre
4623                 lsr     []              lsrw    []
4624
4625                 nega                    negb
4626                 negd                    nege
4627                 neg     []              negw    []
4628
4629                 rola                    rolb
4630                 rold                    role
4631                 rol     []              rolw    []
4632
4633                 rora                    rorb
4634                 rord                    rore
4635                 ror     []              rorw    []
4636
4637                 tsta                    tstb
4638                 tsta                    tste
4639                 tst     []              tstw    []
4640 \f
4641
4642         AS6816 ASSEMBLER                                        PAGE H-5
4643         6816 INSTRUCTION SET
4644
4645
4646         H.2.7  Double Operand Instructions
4647
4648                 adca    []              adcb    []
4649                 adcd    []              adce    []
4650
4651                 adda    []              addb    []
4652                 addd    []              adde    []
4653
4654                 anda    []              andb    []
4655                 andd    []              ande    []
4656
4657                 bita    []              bitb    []
4658
4659                 cmpa    []              cmpb    []
4660                 cpd     []              cpe     []
4661
4662                 eora    []              eorb    []
4663                 eord    []              eore    []
4664
4665                 ldaa    []              ldab    []
4666                 ldd     []              lde     []
4667
4668                 oraa    []              orab    []
4669                 ord     []              ore     []
4670
4671                 sbca    []              sbcb    []
4672                 sbcd    []              sbce    []
4673
4674                 staa    []              stab    []
4675                 std     []              ste     []
4676
4677                 suba    []              subb    []
4678                 subd    []              sube    []
4679
4680
4681         H.2.8  Index/Stack Register Instructions
4682
4683                 cps     []              cpx     []
4684                 cpy     []              cpz     []
4685
4686                 lds     []              ldx     []
4687                 ldy     []              ldz     []
4688
4689                 sts     []              stx     []
4690                 sty     []              stz     []
4691 \f
4692
4693         AS6816 ASSEMBLER                                        PAGE H-6
4694         6816 INSTRUCTION SET
4695
4696
4697         H.2.9  Jump and Jump to Subroutine Instructions
4698
4699                 jmp     bank,[]         jsr     bank,[]
4700
4701
4702         H.2.10  Condition Code Register Instructions
4703
4704                 andp    #data           orp     #data
4705
4706
4707         H.2.11  Multiply and Accumulate Instructions
4708
4709                 mac     #data           rmac    #data
4710                 mac     #xo,#yo         rmac    #xo,#yo
4711 \f
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725                                    APPENDIX I
4726
4727                                  ASH8 ASSEMBLER
4728
4729
4730
4731
4732
4733         I.1  H8/3XX REGISTER SET
4734
4735         The following is a list of the H8 registers used by ASH8:
4736
4737                 r0  -  r7,sp            16-bit accumulators
4738                 r0L -  r7L,spL          8-bit accumulators
4739                 r0H -  r7H,spH          8-bit accumulators
4740                 spL,spH,sp              stack pointers
4741                 ccr                     condition code
4742
4743
4744         I.2  H8/3XX INSTRUCTION SET
4745
4746
4747            The  following tables list all H8/3xx mnemonics recognized by
4748         the ASH8 assembler.  The designation [] refers to a required ad-
4749         dressing mode argument.  The following list specifies the format
4750         for each addressing mode supported by ASH8:
4751
4752                 #xx:3           immediate data (3  bit)
4753                 #xx:8           immediate data (8  bit)
4754                 #xx:16          immediate data (16 bit)
4755
4756                 *dir            direct page addressing
4757                                 (see .setdp directive)
4758                                 0 <= dir <= 255
4759
4760                 label           branch label
4761
4762
4763                 rn              registers (16 bit)
4764                                 r0-r7,sp
4765
4766                 rnB             registers (8 bit)
4767                                 r0H-r7H,r0L-r7L,spH,spL
4768
4769 \f
4770
4771         ASH8 ASSEMBLER                                          PAGE I-2
4772         H8/3XX INSTRUCTION SET
4773
4774
4775                 ccr             condition code register
4776
4777                 @rn             register indirect
4778
4779                 @-rn            register indirect (auto pre-decrement)
4780
4781                 @rn+            register indirect (auto post-increment)
4782
4783                 @[offset,rn]    register indirect, 16-bit displacement
4784
4785                 @@offset        memory indirect, (8-bit address)
4786
4787                 ext             extended addressing (16-bit)
4788
4789         The  terms  data, dir, label, offset, and ext may all be expres-
4790         sions.
4791
4792            Note  that  not all addressing modes are valid with every in-
4793         struction, refer to the H8/3xx technical data for valid modes.
4794
4795
4796         I.2.1  Inherent Instructions
4797
4798                 eepmov
4799                 nop
4800                 sleep
4801                 rte
4802                 rts
4803
4804
4805         I.2.2  Branch Instructions
4806
4807                 bcc     label                   bcs     label
4808                 beq     label                   bf      label
4809                 bge     label                   bgt     label
4810                 bhi     label                   bhis    label
4811                 bhs     label                   ble     label
4812                 blo     label                   blos    label
4813                 bls     label                   blt     label
4814                 bmi     label                   bne     label
4815                 bpl     label                   bra     label
4816                 brn     label                   bt      label
4817                 bvc     label                   bvs     label
4818                 bsr     label
4819 \f
4820
4821         ASH8 ASSEMBLER                                          PAGE I-3
4822         H8/3XX INSTRUCTION SET
4823
4824
4825         I.2.3  Single Operand Instructions
4826
4827                 Free Form
4828
4829                 daa     rnB                     das     rnB
4830
4831                 dec     rnB                     inc     rnB
4832
4833                 neg     rnB                     not     rnB
4834
4835                 rotxl   rnB                     rotxr   rnB
4836
4837                 rotl    rnB                     rotr    rnB
4838
4839                 shal    rnB                     shar    rnB
4840
4841                 shll    rnB                     shlr    rnB
4842
4843                 push    rn                      pop     rn
4844
4845
4846                 Byte / Word Form
4847
4848                 daa.b   rnB                     das.b   rnB
4849
4850                 dec.b   rnB                     inc.b   rnB
4851
4852                 neg.b   rnB                     not.b   rnB
4853
4854                 rotxl.b rnB                     rotxr.b rnB
4855
4856                 rotl.b  rnB                     rotr.b  rnB
4857
4858                 shal.b  rnB                     shar.b  rnB
4859
4860                 shll.b  rnB                     shlr.b  rnB
4861
4862                 push.w  rn                      pop.w   rn
4863 \f
4864
4865         ASH8 ASSEMBLER                                          PAGE I-4
4866         H8/3XX INSTRUCTION SET
4867
4868
4869         I.2.4  Double Operand Instructions
4870
4871                 Free Form
4872
4873                 add     rnB,rnB                 add     #xx:8,rnB
4874                 add     rn,rn
4875
4876                 cmp     rnB,rnB                 cmp     #xx:8,rnB
4877                 cmp     rn,rn
4878
4879                 sub     rnB,rnB
4880                 sub     rn,rn
4881
4882                 addx    rnB,rnB                 addx    #xx:8,rnB
4883
4884                 and     rnB,rnB                 and     #xx:8,rnB
4885                                                 and     #xx:8,ccr
4886
4887                 or      rnB,rnB                 or      #xx:8,rnB
4888                                                 or      #xx:8,ccr
4889
4890                 subx    rnB,rnB                 subx    #xx:8,rnB
4891
4892                 xor     rnB,rnB                 xor     #xx:8,rnB
4893                                                 xor     #xx:8,ccr
4894
4895
4896                 Byte / Word Form
4897
4898                 add.b   rnB,rnB                 add.b   #xx:8,rnB
4899                 add.w   rn,rn
4900
4901                 cmp.b   rnB,rnB                 cmp.b   #xx:8,rnB
4902                 cmp.w   rn,rn
4903
4904                 sub.b   rnB,rnB
4905                 sub.w   rn,rn
4906
4907                 addx.b  rnB,rnB                 addx.b  #xx:8,rnB
4908
4909                 and.b   rnB,rnB                 and.b   #xx:8,rnB
4910                                                 and.b   #xx:8,ccr
4911
4912                 or.b    rnB,rnB                 or.b    #xx:8,rnB
4913                                                 or.b    #xx:8,ccr
4914
4915                 subx.b  rnB,rnB                 subx.b  #xx:8,rnB
4916
4917                 xor.b   rnB,rnB                 xor.b   #xx:8,rnB
4918                                                 xor.b   #xx:8,ccr
4919 \f
4920
4921         ASH8 ASSEMBLER                                          PAGE I-5
4922         H8/3XX INSTRUCTION SET
4923
4924
4925         I.2.5  Mov Instructions
4926
4927                 Free Form
4928
4929                 mov     rnB,rnB                 mov     rn,rn
4930                 mov     #xx:8,rnB               mov     #xx:16,rn
4931                 mov     @rn,rnB                 mov     @rn,rn
4932                 mov     @[offset,rn],rnB        mov     @[offset,rn],rn
4933                 mov     @rn+,rnB                mov     @rn+,rn
4934                 mov     @dir,rnB
4935                 mov     dir,rnB
4936                 mov     *@dir,rnB
4937                 mov     *dir,rnB
4938                 mov     @label,rnB              mov     @label,rn
4939                 mov     label,rnB               mov     label,rn
4940                 mov     rnB,@rn                 mov     rn,@rn
4941                 mov     rnB,@[offset,rn]        mov     rn,@[offset,rn]
4942                 mov     rnB,@-rn                mov     rn,@-rn
4943                 mov     rnB,@dir
4944                 mov     rnB,dir
4945                 mov     rnB,*@dir
4946                 mov     rnB,*dir
4947                 mov     rnB,@label              mov     rn,@label
4948                 mov     rnB,label               mov     rn,label
4949
4950
4951                 Byte / Word Form
4952
4953                 mov.b   rnB,rnB                 mov.w   rn,rn
4954                 mov.b   #xx:8,rnB               mov.w   #xx:16,rn
4955                 mov.b   @rn,rnB                 mov.w   @rn,rn
4956                 mov.b   @[offset,rn],rnB        mov.w   @[offset,rn],rn
4957                 mov.b   @rn+,rnB                mov.w   @rn+,rn
4958                 mov.b   @dir,rnB
4959                 mov.b   dir,rnB
4960                 mov.b   *@dir,rnB
4961                 mov.b   *dir,rnB
4962                 mov.b   @label,rnB              mov.w   @label,rn
4963                 mov.b   label,rnB               mov.w   label,rn
4964                 mov.b   rnB,@rn                 mov.w   rn,@rn
4965                 mov.b   rnB,@[offset,rn]        mov.w   rn,@[offset,rn]
4966                 mov.b   rnB,@-rn                mov.w   rn,@-rn
4967                 mov.b   rnB,@dir
4968                 mov.b   rnB,dir
4969                 mov.b   rnB,*@dir
4970                 mov.b   rnB,*dir
4971                 mov.b   rnB,@label              mov.w   rn,@label
4972                 mov.b   rnB,label               mov.w   rn,label
4973 \f
4974
4975         ASH8 ASSEMBLER                                          PAGE I-6
4976         H8/3XX INSTRUCTION SET
4977
4978
4979         I.2.6  Bit Manipulation Instructions
4980
4981                 bld     #xx:3,rnB               bld     #xx:3,@rn
4982                 bld     #xx:3,@dir              bld     #xx:3,dir
4983                 bld     #xx:3,*@dir             bld     #xx:3,*dir
4984
4985                 bild    #xx:3,rnB               bild    #xx:3,@rn
4986                 bild    #xx:3,@dir              bild    #xx:3,dir
4987                 bild    #xx:3,*@dir             bild    #xx:3,*dir
4988
4989                 bst     #xx:3,rnB               bst     #xx:3,@rn
4990                 bst     #xx:3,@dir              bst     #xx:3,dir
4991                 bst     #xx:3,*@dir             bst     #xx:3,*dir
4992
4993                 bist    #xx:3,rnB               bist    #xx:3,@rn
4994                 bist    #xx:3,@dir              bist    #xx:3,dir
4995                 bist    #xx:3,*@dir             bist    #xx:3,*dir
4996
4997                 band    #xx:3,rnB               band    #xx:3,@rn
4998                 band    #xx:3,@dir              band    #xx:3,dir
4999                 band    #xx:3,*@dir             band    #xx:3,*dir
5000
5001                 biand   #xx:3,rnB               biand   #xx:3,@rn
5002                 biand   #xx:3,@dir              biand   #xx:3,dir
5003                 biand   #xx:3,*@dir             biand   #xx:3,*dir
5004
5005                 bor     #xx:3,rnB               bor     #xx:3,@rn
5006                 bor     #xx:3,@dir              bor     #xx:3,dir
5007                 bor     #xx:3,*@dir             bor     #xx:3,*dir
5008
5009                 bior    #xx:3,rnB               bior    #xx:3,@rn
5010                 bior    #xx:3,@dir              bior    #xx:3,dir
5011                 bior    #xx:3,*@dir             bior    #xx:3,*dir
5012
5013                 bxor    #xx:3,rnB               bxor    #xx:3,@rn
5014                 bxor    #xx:3,@dir              bxor    #xx:3,dir
5015                 bxor    #xx:3,*@dir             bxor    #xx:3,*dir
5016
5017                 bixor   #xx:3,rnB               bixor   #xx:3,@rn
5018                 bixor   #xx:3,@dir              bixor   #xx:3,dir
5019                 bixor   #xx:3,*@dir             bixor   #xx:3,*dir
5020 \f
5021
5022         ASH8 ASSEMBLER                                          PAGE I-7
5023         H8/3XX INSTRUCTION SET
5024
5025
5026         I.2.7  Extended Bit Manipulation Instructions
5027
5028                 bset    #xx:3,rnB               bset    #xx:3,@rn
5029                 bset    #xx:3,@dir              bset    #xx:3,dir
5030                 bset    #xx:3,*@dir             bset    #xx:3,*dir
5031                 bset    rnB,rnB                 bset    rnB,@rn
5032                 bset    rnB,@dir                bset    rnB,dir
5033                 bset    rnB,*@dir               bset    rnB,*dir
5034
5035                 bclr    #xx:3,rnB               bclr    #xx:3,@rn
5036                 bclr    #xx:3,@dir              bclr    #xx:3,dir
5037                 bclr    #xx:3,*@dir             bclr    #xx:3,*dir
5038                 bclr    rnB,rnB                 bclr    rnB,@rn
5039                 bclr    rnB,@dir                bclr    rnB,dir
5040                 bclr    rnB,*@dir               bclr    rnB,*dir
5041
5042                 bnot    #xx:3,rnB               bnot    #xx:3,@rn
5043                 bnot    #xx:3,@dir              bnot    #xx:3,dir
5044                 bnot    #xx:3,*@dir             bnot    #xx:3,*dir
5045                 bnot    rnB,rnB                 bnot    rnB,@rn
5046                 bnot    rnB,@dir                bnot    rnB,dir
5047                 bnot    rnB,*@dir               bnot    rnB,*dir
5048
5049                 btst    #xx:3,rnB               btst    #xx:3,@rn
5050                 btst    #xx:3,@dir              btst    #xx:3,dir
5051                 btst    #xx:3,*@dir             btst    #xx:3,*dir
5052                 btst    rnB,rnB                 btst    rnB,@rn
5053                 btst    rnB,@dir                btst    rnB,dir
5054                 btst    rnB,*@dir               btst    rnB,*dir
5055
5056
5057         I.2.8  Condition Code Instructions
5058
5059                 andc    #xx:8,ccr               andc    #xx:8
5060                 and     #xx:8,ccr               and.b   #xx:8,ccr
5061
5062                 ldc     #xx:8,ccr               ldc     #xx:8
5063                 ldc     rnB,ccr                 ldc     rnB
5064
5065                 orc     #xx:8,ccr               orc     #xx:8
5066                 or      #xx:8,ccr               or.b    #xx:8,ccr
5067
5068                 xorc    #xx:8,ccr               xorc    #xx:8
5069                 xor     #xx:8,ccr               xor.b   #xx:8,ccr
5070
5071                 stc     ccr,rnB                 stc     rnB
5072 \f
5073
5074         ASH8 ASSEMBLER                                          PAGE I-8
5075         H8/3XX INSTRUCTION SET
5076
5077
5078         I.2.9  Other Instructions
5079
5080                 divxu   rnB,rn                  divxu.b rnB,rn
5081
5082                 mulxu   rnB,rn                  mulxu.b rnB,rn
5083
5084                 movfpe  @label,rnB              movfpe  label,rnB
5085                 movfpe.b  @label,rnB            movfpe.b  label,rnB
5086
5087                 movtpe  @label,rnB              movtpe  label,rnB
5088                 movtpe.b  @label,rnB            movtpe.b  label,rnB
5089
5090
5091         I.2.10  Jump and Jump to Subroutine Instructions
5092
5093                 jmp     @rn                     jmp     @@dir
5094                 jmp     @label                  jmp     label
5095
5096                 jsr     @rn                     jsr     @@dir
5097                 jsr     @label                  jsr     label
5098 \f
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112                                    APPENDIX J
5113
5114                                 AS8085 ASSEMBLER
5115
5116
5117
5118
5119
5120         J.1  8085 REGISTER SET
5121
5122         The  following  is  a  list  of  the 8080/8085 registers used by
5123         AS8085:
5124
5125                 a,b,c,d,e,h,l   -       8-bit accumulators
5126                 m               -       memory through (hl)
5127                 sp              -       stack pointer
5128                 psw             -       status word
5129
5130
5131         J.2  8085 INSTRUCTION SET
5132
5133
5134            The  following tables list all 8080/8085 mnemonics recognized
5135         by the AS8085  assembler.   The  following  list  specifies  the
5136         format for each addressing mode supported by AS8085:
5137
5138                 #data           immediate data
5139                                 byte or word data
5140
5141                 r,r1,r2         register or register pair
5142                                 psw,a,b,c,d,e,h,l
5143                                 bc,de,hl,sp,pc
5144
5145                 m               memory address using (hl)
5146
5147                 addr            direct memory addressing
5148
5149                 label           call or jump label
5150
5151         The terms data, m, addr, and label may be expressions.
5152
5153            Note  that  not all addressing modes are valid with every in-
5154         struction, refer to  the  8080/8085  technical  data  for  valid
5155         modes.
5156 \f
5157
5158         AS8085 ASSEMBLER                                        PAGE J-2
5159         8085 INSTRUCTION SET
5160
5161
5162         J.2.1  Inherent Instructions
5163
5164                 cma             cmc
5165                 daa             di
5166                 ei              hlt
5167                 nop             pchl
5168                 ral             rar
5169                 ret             rim
5170                 rrc             rlc
5171                 sim             sphl
5172                 stc             xchg
5173                 xthl
5174
5175
5176         J.2.2  Register/Memory/Immediate Instructions
5177
5178                 adc     r       adc     m       aci     #data
5179                 add     r       add     m       adi     #data
5180                 ana     r       ana     m       ani     #data
5181                 cmp     r       cmp     m       cpi     #data
5182                 ora     r       ora     m       ori     #data
5183                 sbb     r       sbb     m       sbi     #data
5184                 sub     r       sub     m       sui     #data
5185                 xra     r       xra     m       xri     #data
5186
5187
5188         J.2.3  Call and Return Instructions
5189
5190                 cc      label           rc
5191                 cm      label           rm
5192                 cnc     label           rnc
5193                 cnz     label           rnz
5194                 cp      label           rp
5195                 cpe     label           rpe
5196                 cpo     label           rpo
5197                 cz      label           rz
5198                 call    label
5199
5200
5201         J.2.4  Jump Instructions
5202
5203                 jc      label
5204                 jm      label
5205                 jnc     label
5206                 jnz     label
5207                 jp      label
5208                 jpe     label
5209                 jpo     label
5210                 jz      label
5211                 jmp     label
5212 \f
5213
5214         AS8085 ASSEMBLER                                        PAGE J-3
5215         8085 INSTRUCTION SET
5216
5217
5218         J.2.5  Input/Output/Reset Instructions
5219
5220                 in      data
5221                 out     data
5222                 rst     data
5223
5224
5225         J.2.6  Move Instructions
5226
5227                 mov     r1,r2
5228                 mov     r,m
5229                 mov     m,r
5230
5231                 mvi     r,#data
5232                 mvi     m,#data
5233
5234
5235         J.2.7  Other Instructions
5236
5237                 dcr     r               dcr     m
5238                 inr     r               inr     m
5239
5240                 dad     r               dcx     r
5241                 inx     r               ldax    r
5242                 pop     r               push    r
5243                 stax    r
5244
5245                 lda     addr            lhld    addr
5246                 shld    addr            sta     addr
5247
5248                 lxi     r,#data
5249 \f
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263                                    APPENDIX K
5264
5265                                  ASZ80 ASSEMBLER
5266
5267
5268
5269
5270
5271         K.1  .hd64 DIRECTIVE
5272
5273         Format:
5274
5275                 .hd64
5276
5277         The  .hd64  directive enables processing of the HD64180 specific
5278         mnemonics not included in  the  Z80  instruction  set.   HD64180
5279         mnemonics  encountered  without  the  .hd64  directive  will  be
5280         flagged with an 'o' error.
5281
5282
5283         K.2  Z80 REGISTER SET AND CONDITIONS
5284
5285
5286            The following is a complete list of register designations and
5287         condition mnemonics:
5288
5289                 byte registers  -       a,b,c,d,e,h,l,i,r
5290                 register pairs  -       af,af',bc,de,hl
5291                 word registers  -       pc,sp,ix,iy
5292
5293                 C -     carry bit set
5294                 M -     sign bit set
5295                 NC -    carry bit clear
5296                 NZ -    zero bit clear
5297                 P -     sign bit clear
5298                 PE -    parity even
5299                 PO -    parity odd
5300                 Z -     zero bit set
5301
5302
5303 \f
5304
5305         ASZ80 ASSEMBLER                                         PAGE K-2
5306         Z80 INSTRUCTION SET
5307
5308
5309         K.3  Z80 INSTRUCTION SET
5310
5311
5312            The  following  tables  list all Z80/HD64180 mnemonics recog-
5313         nized by the ASZ80 assembler.  The designation []  refers  to  a
5314         required addressing mode argument.  The following list specifies
5315         the format for each addressing mode supported by ASZ80:
5316
5317                 #data           immediate data
5318                                 byte or word data
5319
5320                 n               byte value
5321
5322                 rg              a byte register
5323                                 a,b,c,d,e,h,l
5324
5325                 rp              a register pair
5326                                 bc,de,hl
5327
5328                 (hl)            implied addressing or
5329                                 register indirect addressing
5330
5331                 (label)         direct addressing
5332
5333                 offset(ix)      indexed addressing with
5334                                 an offset
5335
5336                 label           call/jmp/jr label
5337
5338         The  terms  data,  dir,  offset, and ext may all be expressions.
5339         The terms dir and offset are not allowed to be  external  refer-
5340         ences.
5341
5342            Note  that  not all addressing modes are valid with every in-
5343         struction, refer to the Z80/HD64180  technical  data  for  valid
5344         modes.
5345 \f
5346
5347         ASZ80 ASSEMBLER                                         PAGE K-3
5348         Z80 INSTRUCTION SET
5349
5350
5351         K.3.1  Inherent Instructions
5352
5353                 ccf             cpd
5354                 cpdr            cpi
5355                 cpir            cpl
5356                 daa             di
5357                 ei              exx
5358                 halt            neg
5359                 nop             reti
5360                 retn            rla
5361                 rlca            rld
5362                 rra             rrca
5363                 rrd             scf
5364
5365
5366         K.3.2  Implicit Operand Instructions
5367
5368                 adc     a,[]            adc     []
5369                 add     a,[]            add     []
5370                 and     a,[]            and     []
5371                 cp      a,[]            cp      []
5372                 dec     a,[]            dec     []
5373                 inc     a,[]            inc     []
5374                 or      a,[]            or      []
5375                 rl      a,[]            rl      []
5376                 rlc     a,[]            rlc     []
5377                 rr      a,[]            rr      []
5378                 rrc     a,[]            rrc     []
5379                 sbc     a,[]            sbc     []
5380                 sla     a,[]            sla     []
5381                 sra     a,[]            sra     []
5382                 srl     a,[]            srl     []
5383                 sub     a,[]            sub     []
5384                 xor     a,[]            xor     []
5385 \f
5386
5387         ASZ80 ASSEMBLER                                         PAGE K-4
5388         Z80 INSTRUCTION SET
5389
5390
5391         K.3.3  Load Instruction
5392
5393                 ld      rg,[]           ld      [],rg
5394                 ld      (bc),a          ld      a,(bc)
5395                 ld      (de),a          ld      a,(de)
5396                 ld      (label),a       ld      a,(label)
5397                 ld      (label),rp      ld      rp,(label)
5398                 ld      i,a             ld      r,a
5399                 ld      a,i             ld      a,r
5400                 ld      sp,hl           ld      sp,ix
5401                 ld      sp,iy           ld      rp,#data
5402
5403                 ldd                     lddr
5404                 ldi                     ldir
5405
5406
5407         K.3.4  Call/Return Instructions
5408
5409                 call    C,label         ret     C
5410                 call    M,label         ret     M
5411                 call    NC,label        ret     NC
5412                 call    NZ,label        ret     NZ
5413                 call    P,label         ret     P
5414                 call    PE,label        ret     PE
5415                 call    PO,label        ret     PO
5416                 call    Z,label         ret     Z
5417                 call    label           ret
5418
5419
5420         K.3.5  Jump and Jump to Subroutine Instructions
5421
5422                 jp      C,label         jp      M,label
5423                 jp      NC,label        jp      NZ,label
5424                 jp      P,label         jp      PE,label
5425                 jp      PO,label        jp      Z,label
5426
5427                 jp      (hl)            jp      (ix)
5428                 jp      (iy)            jp      label
5429
5430                 djnz    label
5431
5432                 jr      C,label         jr      NC,label
5433                 jr      NZ,label        jr      Z,label
5434                 jr      label
5435 \f
5436
5437         ASZ80 ASSEMBLER                                         PAGE K-5
5438         Z80 INSTRUCTION SET
5439
5440
5441         K.3.6  Bit Manipulation Instructions
5442
5443                 bit     n,[]
5444                 res     n,[]
5445                 set     n,[]
5446
5447
5448         K.3.7  Interrupt Mode and Reset Instructions
5449
5450                 im      n
5451                 im      n
5452                 im      n
5453                 rst     n
5454
5455
5456         K.3.8  Input and Output Instructions
5457
5458                 in      a,(n)           in      rg,(c)
5459                 ind                     indr
5460                 ini                     inir
5461
5462                 out     (n),a           out     (c),rg
5463                 outd                    otdr
5464                 outi                    otir
5465
5466
5467         K.3.9  Register Pair Instructions
5468
5469                 add     hl,rp           add     ix,rp
5470                 add     iy,rp
5471
5472                 adc     hl,rp           sbc     hl,rp
5473
5474                 ex      (sp),hl         ex      (sp),ix
5475                 ex      (sp),iy
5476                 ex      de,hl
5477                 ex      af,af'
5478
5479                 push    rp              pop     rp
5480 \f
5481
5482         ASZ80 ASSEMBLER                                         PAGE K-6
5483         Z80 INSTRUCTION SET
5484
5485
5486         K.3.10  HD64180 Specific Instructions
5487
5488                 in0     rg,(n)
5489                 out0    (n),rg
5490
5491                 otdm                    otdmr
5492                 otim                    otimr
5493
5494                 mlt     bc              mlt     de
5495                 mlt     hl              mlt     sp
5496
5497                 slp
5498
5499                 tst     a
5500                 tstio   #data
5501 \f
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515                                    APPENDIX L
5516
5517                                 AS6500 ASSEMBLER
5518
5519
5520
5521
5522
5523         L.1  ACKNOWLEDGMENT
5524
5525
5526            Thanks  to  Marko  Makela  for his contribution of the AS6500
5527         cross assembler.
5528
5529                 Marko Makela
5530                 Sillitie 10 A
5531                 01480 Vantaa
5532                 Finland
5533                 Internet: Marko.Makela@Helsinki.Fi
5534                 EARN/BitNet: msmakela@finuh
5535
5536            Several  additions and modifications were made to his code to
5537         support the following families of 6500 processors:
5538
5539                 (1)     650X and 651X processor family
5540                 (2)     65F11 and 65F12 processor family
5541                 (3)     65C00/21 and 65C29 processor family
5542                 (4)     65C02, 65C102, and 65C112 processor family
5543
5544            The  instruction  syntax of this cross assembler contains two
5545         peculiarities:  (1) the addressing indirection is denoted by the
5546         square  brackets  []  and (2) the `bbrx' and `bbsx' instructions
5547         are written `bbr0 memory,label'.
5548
5549
5550 \f
5551
5552         AS6500 ASSEMBLER                                        PAGE L-2
5553         6500 REGISTER SET
5554
5555
5556         L.2  6500 REGISTER SET
5557
5558         The following is a list of the 6500 registers used by AS6500:
5559
5560                 a       -       8-bit accumulator
5561                 x,y     -       index registers
5562
5563
5564         L.3  6500 INSTRUCTION SET
5565
5566
5567            The  following  tables  list all 6500 family mnemonics recog-
5568         nized by the AS6500 assembler.  The designation [] refers  to  a
5569         required addressing mode argument.  The following list specifies
5570         the format for each addressing mode supported by AS6500:
5571
5572                 #data           immediate data
5573                                 byte or word data
5574
5575                 *dir            direct page addressing
5576                                 (see .setdp directive)
5577                                 0 <= dir <= 255
5578
5579                 offset,x        indexed addressing
5580                 offset,y        indexed addressing
5581                                 address = (offset + (x or y))
5582
5583                 [offset,x]      pre-indexed indirect addressing
5584                                 0 <= offset <= 255
5585                                 address = contents of location
5586                                     (offset + (x or y)) mod 256
5587
5588                 [offset],y      post-indexed indirect addressing
5589                                 address = contents of location at offset
5590                                     plus the value of the y register
5591
5592                 [address]       indirect addressing
5593
5594                 ext             extended addressing
5595
5596                 label           branch label
5597
5598                 address,label   direct page memory location
5599                                 branch label
5600                                 bbrx and bbsx instruction addressing
5601
5602         The  terms data, dir, offset, address, ext, and label may all be
5603         expressions.
5604
5605            Note  that  not all addressing modes are valid with every in-
5606         struction, refer to the 65xx technical data for valid modes.
5607 \f
5608
5609         AS6500 ASSEMBLER                                        PAGE L-3
5610         6500 INSTRUCTION SET
5611
5612
5613         L.3.1  Processor Specific Directives
5614
5615
5616            The  AS6500  cross  assembler has four (4) processor specific
5617         assembler directives which  define  the  target  65xx  processor
5618         family:
5619
5620                 .r6500          Core 650X and 651X family (default)
5621                 .r65f11         Core plus 65F11 and 65F12
5622                 .r65c00         Core plus 65C00/21 and 65C29
5623                 .r65c02         Core plus 65C02, 65C102, and 65C112
5624
5625
5626         L.3.2  65xx Core Inherent Instructions
5627
5628                 brk                     clc
5629                 cld                     cli
5630                 clv                     dex
5631                 dey                     inx
5632                 iny                     nop
5633                 pha                     php
5634                 pla                     plp
5635                 rti                     rts
5636                 sec                     sed
5637                 sei                     tax
5638                 tay                     tsx
5639                 txa                     txs
5640                 tya
5641
5642
5643         L.3.3  65xx Core Branch Instructions
5644
5645                 bcc     label           bhs     label
5646                 bcs     label           blo     label
5647                 beq     label           bmi     label
5648                 bne     label           bpl     label
5649                 bvc     label           bvs     label
5650
5651
5652         L.3.4  65xx Core Single Operand Instructions
5653
5654                 asl     []
5655                 dec     []
5656                 inc     []
5657                 lsr     []
5658                 rol     []
5659                 ror     []
5660 \f
5661
5662         AS6500 ASSEMBLER                                        PAGE L-4
5663         6500 INSTRUCTION SET
5664
5665
5666         L.3.5  65xx Core Double Operand Instructions
5667
5668                 adc     []
5669                 and     []
5670                 bit     []
5671                 cmp     []
5672                 eor     []
5673                 lda     []
5674                 ora     []
5675                 sbc     []
5676                 sta     []
5677
5678
5679         L.3.6  65xx Core Jump and Jump to Subroutine Instructions
5680
5681                 jmp     []              jsr     []
5682
5683
5684         L.3.7  65xx Core Miscellaneous X and Y Register Instructions
5685
5686                 cpx     []
5687                 cpy     []
5688                 ldx     []
5689                 stx     []
5690                 ldy     []
5691                 sty     []
5692 \f
5693
5694         AS6500 ASSEMBLER                                        PAGE L-5
5695         6500 INSTRUCTION SET
5696
5697
5698         L.3.8  65F11 and 65F12 Specific Instructions
5699
5700                 bbr0    [],label                bbr1    [],label
5701                 bbr2    [],label                bbr3    [],label
5702                 bbr4    [],label                bbr5    [],label
5703                 bbr6    [],label                bbr7    [],label
5704
5705                 bbs0    [],label                bbs1    [],label
5706                 bbs2    [],label                bbs3    [],label
5707                 bbs4    [],label                bbs5    [],label
5708                 bbs6    [],label                bbs7    [],label
5709
5710                 rmb0    []                      rmb1    []
5711                 rmb2    []                      rmb3    []
5712                 rmb4    []                      rmb5    []
5713                 rmb6    []                      rmb7    []
5714
5715                 smb0    []                      smb1    []
5716                 smb2    []                      smb3    []
5717                 smb4    []                      smb5    []
5718                 smb6    []                      smb7    []
5719
5720
5721         L.3.9  65C00/21 and 65C29 Specific Instructions
5722
5723                 bbr0    [],label                bbr1    [],label
5724                 bbr2    [],label                bbr3    [],label
5725                 bbr4    [],label                bbr5    [],label
5726                 bbr6    [],label                bbr7    [],label
5727
5728                 bbs0    [],label                bbs1    [],label
5729                 bbs2    [],label                bbs3    [],label
5730                 bbs4    [],label                bbs5    [],label
5731                 bbs6    [],label                bbs7    [],label
5732
5733                 bra     label
5734
5735                 phx                             phy
5736                 plx                             ply
5737
5738                 rmb0    []                      rmb1    []
5739                 rmb2    []                      rmb3    []
5740                 rmb4    []                      rmb5    []
5741                 rmb6    []                      rmb7    []
5742
5743                 smb0    []                      smb1    []
5744                 smb2    []                      smb3    []
5745                 smb4    []                      smb5    []
5746                 smb6    []                      smb7    []
5747 \f
5748
5749         AS6500 ASSEMBLER                                        PAGE L-6
5750         6500 INSTRUCTION SET
5751
5752
5753         L.3.10  65C02, 65C102, and 65C112 Specific Instructions
5754
5755                 bbr0    [],label                bbr1    [],label
5756                 bbr2    [],label                bbr3    [],label
5757                 bbr4    [],label                bbr5    [],label
5758                 bbr6    [],label                bbr7    [],label
5759
5760                 bbs0    [],label                bbs1    [],label
5761                 bbs2    [],label                bbs3    [],label
5762                 bbs4    [],label                bbs5    [],label
5763                 bbs6    [],label                bbs7    [],label
5764
5765                 bra     label
5766
5767                 phx                             phy
5768                 plx                             ply
5769
5770                 rmb0    []                      rmb1    []
5771                 rmb2    []                      rmb3    []
5772                 rmb4    []                      rmb5    []
5773                 rmb6    []                      rmb7    []
5774
5775                 smb0    []                      smb1    []
5776                 smb2    []                      smb3    []
5777                 smb4    []                      smb5    []
5778                 smb6    []                      smb7    []
5779
5780                 stz     []
5781                 trb     []
5782                 tsb     []
5783
5784            Additional  addressing  modes for the following core instruc-
5785         tions are also available with the 65C02, 65C102, and 65C112 pro-
5786         cessors.
5787
5788                 adc     []                      and     []
5789                 cmp     []                      eor     []
5790                 lda     []                      ora     []
5791                 sbc     []                      sta     []
5792
5793                 bit     []                      jmp     []
5794
5795                 dec                             inc
5796 \f