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