2 ;; This file verifies the compliance with the Motorola specification:
5 ;; Document #1001, Version 1.0
6 ;; SPECIFICATION FOR Motorola 8- and 16-Bit ASSEMBLY LANGUAGE INPUT STANDARD
11 ;; http://www.mcu.motsps.com/dev_tools/hc12/eabi/m8-16alis.pdf
13 ;; Lines starting with '#' represent instructions that fail in GAS.
17 ;; Validated within the whole file
19 ;; Section 8.2.1 Character Set
22 ;; Section 8.2.2 Assembly Language Statement
23 ;; Validated within the whole file
25 ;; Section 8.2.3 Comments
27 ;; This file is full of comments
29 ;; Section 8.2.5 Location Counter
33 L0: * ; L0 set to 0 (relative to text)
35 L1: equ * ; L1 set to 2 (relative to text)
37 ;; Section 8.2.6 Sections
43 ;; Section 8.2.7 Expressions
44 L2: equ 23 ; Absolute = 0x17
45 L3: equ L0-23 ; Simple relocatable
47 ;; Section 8.2.7.1 Primary Expression
48 L4: equ 45 ; Numeric = 0x2d
51 ;; Section 8.2.7.2 Absolute Expression
54 L6: equ -L4 ; unary expr 0xffffffd3
55 L7: equ L6+1000 ; binary expr 0x03bb
56 L8: equ L6-12 ; 0xffffffc7
57 L9: equ L_txt2-L_txt ; reloc - reloc 2 = sizeof(ldaa #44)
59 ;; Section 8.2.7.3 Simple Relocatable Expressions
60 L10: equ _start ; symbol 0 + text
61 L11: equ L10+23 ; reloc+abs 0x17 + text
62 L12: equ L11-4 ; reloc-abs 0x13 + text
63 L13: equ L12+L9 ; reloc+abs 0x15 + text
65 ;; Section 8.2.8 Symbols
73 ;; Section 8.2.8.1 Labels
74 L_label_shall_be_significant_to_at_least_32_chars:
76 L_label_lower: ; Labels are case sensitive
81 ;; Section 8.2.9 Constants
83 ; Section 8.2.9.1 Decimal Constants
86 ldaa #123 ; -> ldaa #0x7b
87 ldaa #-23 ; -> ldaa #0xe9
89 ;; Section 8.2.9.2 Binary Constants
90 ldab #%10001010 ; -> ldab #0x8A
91 ldab #%0111 ; -> ldab #0x07
93 ;; Section 8.2.9.3 Octal Constants
94 ldaa #@74 ; -> ldaa 0x3c
95 ldaa #@377 ; -> ldaa 0xff
97 ;; Section 8.2.9.4 Hexadecimal Constants
98 ldaa #$ae ; -> ldaa 0xae
99 ldaa #$B2 ; -> ldaa 0xb2
101 ;; Section 8.2.9.5 String Constants
103 # ascii '"Single quote string"'
104 ascii "'Double quote string'"
106 ;; Section 8.2.9.6 Floating Point Constants
108 L_float: float 3.241592e-2
110 ;; Section 8.2.10 Operators
113 ldx #(((1<<3)&(1<<3)|2)<<4)+(4*4-1)
114 ldx #(L2>=23)&1-(L2<=23)&1+(L2==23)&1 ; -> ldx #1
115 ldx #(L2>23)&1-(L2<23)&1+(L2==23)&1 ; -> ldx #0
117 ldab #~L4 ; -> ldab #0xd2
118 # ldab #<_start ; force to 8-bit
119 # ldx #>_start ; force to 16-bit
120 # ldab #page(_start) ; 68HC12 page number of symbol
122 ;; Section 8.2.11 Instructions
123 ;; Defined by other tests
125 ;; Section 8.2.12 Assembler Directives
127 ;; Section 8.2.12.1 Conditional Directives
129 # The specification says we are allowed to have spaces in expressions.
130 # This does not work with GAS in mri mode, the instruction 'if L2 < 24'
131 # is in fact treated as 'if L2'.
138 if L2<23||L2>23||L2==22+1 ; true
146 ldaa #L2+8 ; -> ldaa #31
163 ldx #23 ; -> ldx #0x17
165 ifndef L_undef ; true
169 ;; Section 8.2.12.2 Define Constant -dc
173 dc.w (1<<9)+2 ; 0x02 0x02
181 ;; Section 8.2.12.3 Define Constant Block -dcb
188 # dcb.b 4, 12 ; Fails in GAS due to space
190 ;; Section 8.2.12.4 Define Storage - ds
196 ;; Section 8.2.12.5 Equate Symbol Value - equ
199 L_equ3: equ L_equ2-L_equ1
201 ;; Section 8.2.12.6 Include File - include
202 # include 'malis-include.s'
203 # include "malis-include.s"
204 include malis-include.s
205 include malis-include.s
207 ;; Section 8.2.12.7 Origin - org
216 ;; Section 8.2.12.8 Define Section - section
223 ;; Section 8.2.12.9 Set Value of Symbol - set
229 ;; Section 8.2.12.10 External Symbol Definition - xdef
234 ;; Section 8.2.12.11 External Symbol Reference - xref