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