]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/library/freescale/opcode.ma
Bertrand's conjecture (weak), some work in progress
[helm.git] / helm / software / matita / library / freescale / opcode.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                           Progetto FreeScale                           *)
17 (*                                                                        *)
18 (* Sviluppato da:                                                         *)
19 (*   Cosimo Oliboni, oliboni@cs.unibo.it                                  *)
20 (*                                                                        *)
21 (* Questo materiale fa parte della tesi:                                  *)
22 (*   "Formalizzazione Interattiva dei Microcontroller a 8bit FreeScale"   *)
23 (*                                                                        *)
24 (*                    data ultima modifica 15/11/2007                     *)
25 (* ********************************************************************** *)
26
27 set "baseuri" "cic:/matita/freescale/opcode/".
28
29 (*include "/media/VIRTUOSO/freescale/aux_bases.ma".*)
30 include "freescale/aux_bases.ma".
31
32 (* ********************************************** *)
33 (* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *)
34 (* ********************************************** *)
35
36 (* enumerazione delle ALU *)
37 inductive mcu_type: Type ≝
38   HC05  : mcu_type
39 | HC08  : mcu_type
40 | HCS08 : mcu_type
41 | RS08  : mcu_type.
42
43 (* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *)
44 inductive instr_mode: Type ≝
45   (* INHERENT = nessun operando *)
46   MODE_INH  : instr_mode
47   (* INHERENT = nessun operando (A implicito) *)
48 | MODE_INHA : instr_mode
49   (* INHERENT = nessun operando (X implicito) *)
50 | MODE_INHX : instr_mode
51   (* INHERENT = nessun operando (H implicito) *)
52 | MODE_INHH : instr_mode
53
54   (* IMMEDIATE = operando valore immediato byte = 0xbb *)
55 | MODE_IMM1 : instr_mode
56   (* IMMEDIATE = operando valore immediato word = 0xwwww *)
57 | MODE_IMM2 : instr_mode
58   (* DIRECT = operando offset byte = [0x00bb] *)
59 | MODE_DIR1 : instr_mode
60   (* DIRECT = operando offset word = [0xwwww] *)
61 | MODE_DIR2 : instr_mode
62   (* INDEXED = nessun operando (implicito [X] *)
63 | MODE_IX0  : instr_mode
64   (* INDEXED = operando offset relativo byte = [X+0x00bb] *)
65 | MODE_IX1  : instr_mode
66   (* INDEXED = operando offset relativo word = [X+0xwwww] *)
67 | MODE_IX2  : instr_mode
68   (* INDEXED = operando offset relativo byte = [SP+0x00bb] *)
69 | MODE_SP1  : instr_mode
70   (* INDEXED = operando offset relativo word = [SP+0xwwww] *)
71 | MODE_SP2  : instr_mode
72
73   (* DIRECT → DIRECT = carica da diretto/scrive su diretto *)
74 | MODE_DIR1_to_DIR1 : instr_mode
75   (* IMMEDIATE → DIRECT = carica da immediato/scrive su diretto *)
76 | MODE_IMM1_to_DIR1 : instr_mode
77   (* INDEXED++ → DIRECT = carica da [X]/scrive su diretto/H:X++ *)
78 | MODE_IX0p_to_DIR1 : instr_mode
79   (* DIRECT → INDEXED++ = carica da diretto/scrive su [X]/H:X++ *)
80 | MODE_DIR1_to_IX0p : instr_mode
81
82   (* INHERENT(A) + IMMEDIATE *)
83 | MODE_INHA_and_IMM1 : instr_mode
84   (* INHERENT(X) + IMMEDIATE *)
85 | MODE_INHX_and_IMM1 : instr_mode
86   (* IMMEDIATE + IMMEDIATE *)
87 | MODE_IMM1_and_IMM1 : instr_mode
88   (* DIRECT + IMMEDIATE *)
89 | MODE_DIR1_and_IMM1 : instr_mode
90   (* INDEXED + IMMEDIATE *)
91 | MODE_IX0_and_IMM1  : instr_mode
92   (* INDEXED++ + IMMEDIATE *)
93 | MODE_IX0p_and_IMM1 : instr_mode
94   (* INDEXED + IMMEDIATE *)
95 | MODE_IX1_and_IMM1  : instr_mode
96   (* INDEXED++ + IMMEDIATE *)
97 | MODE_IX1p_and_IMM1 : instr_mode
98   (* INDEXED + IMMEDIATE *)
99 | MODE_SP1_and_IMM1  : instr_mode
100
101   (* DIRECT(mTNY) = operando offset byte(maschera scrittura implicita 3 bit) *)
102   (* ex: DIR3 e' carica b, scrivi b con n-simo bit modificato *)
103 | MODE_DIRn          : oct → instr_mode
104   (* DIRECT(mTNY) + IMMEDIATE = operando offset byte(maschera lettura implicita 3 bit) *)
105   (*                            + operando valore immediato byte  *)
106   (* ex: DIR2_and_IMM1 e' carica b, carica imm, restituisci n-simo bit di b + imm *)
107 | MODE_DIRn_and_IMM1 : oct → instr_mode
108   (* TINY = nessun operando (diretto implicito 4bit = [0x00000000:0000iiii]) *)
109 | MODE_TNY           : exadecim → instr_mode
110   (* SHORT = nessun operando (diretto implicito 5bit = [0x00000000:000iiiii]) *)
111 | MODE_SRT           : bitrigesim → instr_mode
112 .
113
114 (* enumerazione delle istruzioni di tutte le ALU *)
115 inductive opcode: Type ≝
116   ADC    : opcode (* add with carry *)
117 | ADD    : opcode (* add *)
118 | AIS    : opcode (* add immediate to SP *)
119 | AIX    : opcode (* add immediate to X *)
120 | AND    : opcode (* and *)
121 | ASL    : opcode (* aritmetic shift left *)
122 | ASR    : opcode (* aritmetic shift right *)
123 | BCC    : opcode (* branch if C=0 *)
124 | BCLRn  : opcode (* clear bit n *)
125 | BCS    : opcode (* branch if C=1 *)
126 | BEQ    : opcode (* branch if Z=1 *)
127 | BGE    : opcode (* branch if N⊙V=0 (great or equal) *)
128 | BGND   : opcode (* !!background mode!! *)
129 | BGT    : opcode (* branch if Z|N⊙V=0 clear (great) *)
130 | BHCC   : opcode (* branch if H=0 *)
131 | BHCS   : opcode (* branch if H=1 *)
132 | BHI    : opcode (* branch if C|Z=0, (higher) *)
133 | BIH    : opcode (* branch if nIRQ=1 *)
134 | BIL    : opcode (* branch if nIRQ=0 *)
135 | BIT    : opcode (* flag = and (bit test) *)
136 | BLE    : opcode (* branch if Z|N⊙V=1 (less or equal) *)
137 | BLS    : opcode (* branch if C|Z=1 (lower or same) *)
138 | BLT    : opcode (* branch if N⊙1=1 (less) *)
139 | BMC    : opcode (* branch if I=0 (interrupt mask clear) *)
140 | BMI    : opcode (* branch if N=1 (minus) *)
141 | BMS    : opcode (* branch if I=1 (interrupt mask set) *)
142 | BNE    : opcode (* branch if Z=0 *)
143 | BPL    : opcode (* branch if N=0 (plus) *)
144 | BRA    : opcode (* branch always *)
145 | BRCLRn : opcode (* branch if bit n clear *)
146 | BRN    : opcode (* branch never (nop) *)
147 | BRSETn : opcode (* branch if bit n set *)
148 | BSETn  : opcode (* set bit n *)
149 | BSR    : opcode (* branch to subroutine *)
150 | CBEQA  : opcode (* compare (A) and BEQ *)
151 | CBEQX  : opcode (* compare (X) and BEQ *)
152 | CLC    : opcode (* C=0 *)
153 | CLI    : opcode (* I=0 *)
154 | CLR    : opcode (* operand=0 *)
155 | CMP    : opcode (* flag = sub (compare A) *)
156 | COM    : opcode (* not (1 complement) *)
157 | CPHX   : opcode (* flag = sub (compare H:X) *)
158 | CPX    : opcode (* flag = sub (compare X) *)
159 | DAA    : opcode (* decimal adjust A *)
160 | DBNZ   : opcode (* dec and BNE *)
161 | DEC    : opcode (* operand=operand-1 (decrement) *)
162 | DIV    : opcode (* div *)
163 | EOR    : opcode (* xor *)
164 | INC    : opcode (* operand=operand+1 (increment) *)
165 | JMP    : opcode (* jmp word [operand] *)
166 | JSR    : opcode (* jmp to subroutine *)
167 | LDA    : opcode (* load in A *)
168 | LDHX   : opcode (* load in H:X *)
169 | LDX    : opcode (* load in X *)
170 | LSR    : opcode (* logical shift right *)
171 | MOV    : opcode (* move *)
172 | MUL    : opcode (* mul *)
173 | NEG    : opcode (* neg (2 complement) *)
174 | NOP    : opcode (* nop *)
175 | NSA    : opcode (* nibble swap A (al:ah <- ah:al) *)
176 | ORA    : opcode (* or *)
177 | PSHA   : opcode (* push A *)
178 | PSHH   : opcode (* push H *)
179 | PSHX   : opcode (* push X *)
180 | PULA   : opcode (* pop A *)
181 | PULH   : opcode (* pop H *)
182 | PULX   : opcode (* pop X *)
183 | ROL    : opcode (* rotate left *)
184 | ROR    : opcode (* rotate right *)
185 | RSP    : opcode (* reset SP (0x00FF) *)
186 | RTI    : opcode (* return from interrupt *)
187 | RTS    : opcode (* return from subroutine *)
188 | SBC    : opcode (* sub with carry*)
189 | SEC    : opcode (* C=1 *)
190 | SEI    : opcode (* I=1 *)
191 | SHA    : opcode (* swap spc_high,A *)
192 | SLA    : opcode (* swap spc_low,A *)
193 | STA    : opcode (* store from A *)
194 | STHX   : opcode (* store from H:X *)
195 | STOP   : opcode (* !!stop mode!! *)
196 | STX    : opcode (* store from X *)
197 | SUB    : opcode (* sub *)
198 | SWI    : opcode (* software interrupt *)
199 | TAP    : opcode (* flag=A (transfer A to process status byte *)
200 | TAX    : opcode (* X=A (transfer A to X) *)
201 | TPA    : opcode (* A=flag (transfer process status byte to A) *)
202 | TST    : opcode (* flag = sub (test) *)
203 | TSX    : opcode (* X:H=SP (transfer SP to H:X) *)
204 | TXA    : opcode (* A=X (transfer X to A) *)
205 | TXS    : opcode (* SP=X:H (transfer H:X to SP) *)
206 | WAIT   : opcode (* !!wait mode!! *)
207 .
208
209 (* introduzione di un tipo opcode dipendente dall'mcu_type (phantom type) *)
210 inductive any_opcode (m:mcu_type) : Type ≝
211  anyOP : opcode → any_opcode m.
212
213 coercion cic:/matita/freescale/opcode/any_opcode.ind#xpointer(1/1/1).
214
215 (* raggruppamento di byte e word in un tipo unico *)
216 inductive byte8_or_word16 : Type ≝
217   Byte: byte8  → byte8_or_word16
218 | Word: word16 → byte8_or_word16.
219
220 coercion cic:/matita/freescale/opcode/byte8_or_word16.ind#xpointer(1/1/1).
221 coercion cic:/matita/freescale/opcode/byte8_or_word16.ind#xpointer(1/1/2).
222
223 (* opcode → naturali, per usare eqb *)
224 definition magic_of_opcode ≝
225 λo:opcode.match o with
226 [ ADC    ⇒ 〈x0,x0〉
227 | ADD    ⇒ 〈x0,x1〉
228 | AIS    ⇒ 〈x0,x2〉
229 | AIX    ⇒ 〈x0,x3〉
230 | AND    ⇒ 〈x0,x4〉
231 | ASL    ⇒ 〈x0,x5〉
232 | ASR    ⇒ 〈x0,x6〉
233 | BCC    ⇒ 〈x0,x7〉
234 | BCLRn  ⇒ 〈x0,x8〉
235 | BCS    ⇒ 〈x0,x9〉
236 | BEQ    ⇒ 〈x0,xA〉
237 | BGE    ⇒ 〈x0,xB〉
238 | BGND   ⇒ 〈x0,xC〉
239 | BGT    ⇒ 〈x0,xD〉
240 | BHCC   ⇒ 〈x0,xE〉
241 | BHCS   ⇒ 〈x0,xF〉
242 | BHI    ⇒ 〈x1,x0〉
243 | BIH    ⇒ 〈x1,x1〉
244 | BIL    ⇒ 〈x1,x2〉
245 | BIT    ⇒ 〈x1,x3〉
246 | BLE    ⇒ 〈x1,x4〉
247 | BLS    ⇒ 〈x1,x5〉
248 | BLT    ⇒ 〈x1,x6〉
249 | BMC    ⇒ 〈x1,x7〉
250 | BMI    ⇒ 〈x1,x8〉
251 | BMS    ⇒ 〈x1,x9〉
252 | BNE    ⇒ 〈x1,xA〉
253 | BPL    ⇒ 〈x1,xB〉
254 | BRA    ⇒ 〈x1,xC〉
255 | BRCLRn ⇒ 〈x1,xD〉
256 | BRN    ⇒ 〈x1,xE〉
257 | BRSETn ⇒ 〈x1,xF〉
258 | BSETn  ⇒ 〈x2,x0〉
259 | BSR    ⇒ 〈x2,x1〉
260 | CBEQA  ⇒ 〈x2,x2〉
261 | CBEQX  ⇒ 〈x2,x3〉
262 | CLC    ⇒ 〈x2,x4〉
263 | CLI    ⇒ 〈x2,x5〉
264 | CLR    ⇒ 〈x2,x6〉
265 | CMP    ⇒ 〈x2,x7〉
266 | COM    ⇒ 〈x2,x8〉
267 | CPHX   ⇒ 〈x2,x9〉
268 | CPX    ⇒ 〈x2,xA〉
269 | DAA    ⇒ 〈x2,xB〉
270 | DBNZ   ⇒ 〈x2,xC〉
271 | DEC    ⇒ 〈x2,xD〉
272 | DIV    ⇒ 〈x2,xE〉
273 | EOR    ⇒ 〈x2,xF〉
274 | INC    ⇒ 〈x3,x0〉
275 | JMP    ⇒ 〈x3,x1〉
276 | JSR    ⇒ 〈x3,x2〉
277 | LDA    ⇒ 〈x3,x3〉
278 | LDHX   ⇒ 〈x3,x4〉
279 | LDX    ⇒ 〈x3,x5〉
280 | LSR    ⇒ 〈x3,x6〉
281 | MOV    ⇒ 〈x3,x7〉
282 | MUL    ⇒ 〈x3,x8〉
283 | NEG    ⇒ 〈x3,x9〉
284 | NOP    ⇒ 〈x3,xA〉
285 | NSA    ⇒ 〈x3,xB〉
286 | ORA    ⇒ 〈x3,xC〉
287 | PSHA   ⇒ 〈x3,xD〉
288 | PSHH   ⇒ 〈x3,xE〉
289 | PSHX   ⇒ 〈x3,xF〉
290 | PULA   ⇒ 〈x4,x0〉
291 | PULH   ⇒ 〈x4,x1〉
292 | PULX   ⇒ 〈x4,x2〉
293 | ROL    ⇒ 〈x4,x3〉
294 | ROR    ⇒ 〈x4,x4〉
295 | RSP    ⇒ 〈x4,x5〉
296 | RTI    ⇒ 〈x4,x6〉
297 | RTS    ⇒ 〈x4,x7〉
298 | SBC    ⇒ 〈x4,x8〉
299 | SEC    ⇒ 〈x4,x9〉
300 | SEI    ⇒ 〈x4,xA〉
301 | SHA    ⇒ 〈x4,xB〉
302 | SLA    ⇒ 〈x4,xC〉
303 | STA    ⇒ 〈x4,xD〉
304 | STHX   ⇒ 〈x4,xE〉
305 | STOP   ⇒ 〈x4,xF〉
306 | STX    ⇒ 〈x5,x0〉
307 | SUB    ⇒ 〈x5,x1〉
308 | SWI    ⇒ 〈x5,x2〉
309 | TAP    ⇒ 〈x5,x3〉
310 | TAX    ⇒ 〈x5,x4〉
311 | TPA    ⇒ 〈x5,x5〉
312 | TST    ⇒ 〈x5,x6〉
313 | TSX    ⇒ 〈x5,x7〉
314 | TXA    ⇒ 〈x5,x8〉
315 | TXS    ⇒ 〈x5,x9〉
316 | WAIT   ⇒ 〈x5,xA〉
317 ].
318
319 (* confronto fra opcode, legale solo se tipati sulla stessa mcu *)
320 definition eqop ≝
321 λm:mcu_type.λo:any_opcode m.λo':any_opcode m.match o with
322  [ anyOP p ⇒ match o' with
323   [ anyOP p' ⇒ (eq_b8 (magic_of_opcode p) (magic_of_opcode p')) ] ].
324
325 (* instr_mode → naturali, per usare eqb *)
326 definition magic_of_instr_mode ≝
327 λi:instr_mode.match i with
328 [ MODE_INH  ⇒ 〈x0,x0〉
329 | MODE_INHA ⇒ 〈x0,x1〉
330 | MODE_INHX ⇒ 〈x0,x2〉
331 | MODE_INHH ⇒ 〈x0,x3〉
332  
333 | MODE_IMM1 ⇒ 〈x0,x4〉
334 | MODE_IMM2 ⇒ 〈x0,x5〉
335 | MODE_DIR1 ⇒ 〈x0,x6〉
336 | MODE_DIR2 ⇒ 〈x0,x7〉
337 | MODE_IX0  ⇒ 〈x0,x8〉
338 | MODE_IX1  ⇒ 〈x0,x9〉
339 | MODE_IX2  ⇒ 〈x0,xA〉
340 | MODE_SP1  ⇒ 〈x0,xB〉
341 | MODE_SP2  ⇒ 〈x0,xC〉
342
343 | MODE_DIR1_to_DIR1 ⇒ 〈x0,xD〉
344 | MODE_IMM1_to_DIR1 ⇒ 〈x0,xE〉
345 | MODE_IX0p_to_DIR1 ⇒ 〈x0,xF〉
346 | MODE_DIR1_to_IX0p ⇒ 〈x1,x0〉
347
348 | MODE_INHA_and_IMM1 ⇒ 〈x1,x1〉
349 | MODE_INHX_and_IMM1 ⇒ 〈x1,x2〉
350 | MODE_IMM1_and_IMM1 ⇒ 〈x1,x3〉
351 | MODE_DIR1_and_IMM1 ⇒ 〈x1,x4〉
352 | MODE_IX0_and_IMM1  ⇒ 〈x1,x5〉
353 | MODE_IX0p_and_IMM1 ⇒ 〈x1,x6〉
354 | MODE_IX1_and_IMM1  ⇒ 〈x1,x7〉
355 | MODE_IX1p_and_IMM1 ⇒ 〈x1,x8〉
356 | MODE_SP1_and_IMM1  ⇒ 〈x1,x9〉
357
358   (* 26-33: bisogna considerare l'operando implicito *)
359 | MODE_DIRn o          ⇒ plus_b8nc 〈x1,xA〉 〈x0,(exadecim_of_oct o)〉
360   (* 34-41: bisogna considerare l'operando implicito *)
361 | MODE_DIRn_and_IMM1 o ⇒ plus_b8nc 〈x2,x2〉 〈x0,(exadecim_of_oct o)〉
362   (* 42-57: bisogna considerare l'operando implicito *)
363 | MODE_TNY e           ⇒ plus_b8nc 〈x2,xA〉 〈x0,e〉
364   (* 58-99: bisogna considerare gli operandi impliciti *)
365 | MODE_SRT t           ⇒ plus_b8nc 〈x3,xA〉 (byte8_of_bitrigesim t)
366 ].
367
368 (* confronto fra instr_mode *)
369 definition eqim ≝
370 λi:instr_mode.λi':instr_mode.(eq_b8 (magic_of_instr_mode i) (magic_of_instr_mode i')).
371
372 (* ********************************************* *)
373 (* STRUMENTI PER LE DIMOSTRAZIONI DI CORRETTEZZA *)
374 (* ********************************************* *)
375
376 (* su tutta la lista quante volte compare il byte *)
377 let rec get_byte_count (m:mcu_type) (b:byte8) (c:nat)
378  (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝
379  match l with
380   [ nil ⇒ c
381   | cons hd tl ⇒ match thd4T ???? hd with
382    [ Byte b' ⇒ match eq_b8 b b' with
383     [ true ⇒ get_byte_count m b (S c) tl
384     | false ⇒ get_byte_count m b c tl
385     ]
386    | Word _ ⇒ get_byte_count m b c tl
387    ]
388   ].
389
390 (* su tutta la lista quante volte compare la word (0x9E+byte) *)
391 let rec get_word_count (m:mcu_type) (b:byte8) (c:nat)
392  (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝
393  match l with
394   [ nil ⇒ c
395   | cons hd tl ⇒ match thd4T ???? hd with
396    [ Byte _ ⇒ get_word_count m b c tl
397    | Word w ⇒ match eq_w16 〈〈x9,xE〉:b〉 w with
398     [ true ⇒ get_word_count m b (S c) tl
399     | false ⇒ get_word_count m b c tl
400     ]
401    ]
402   ].
403
404 (* b e' non implementato? *)
405 let rec test_not_impl (b:byte8) (l:list byte8) on l ≝
406  match l with
407   [ nil ⇒ false
408   | cons hd tl ⇒ match eq_b8 b hd with
409    [ true ⇒ true
410    | false ⇒ test_not_impl b tl
411    ]
412   ].
413
414 (* su tutta la lista quante volte compare la coppia opcode,instr_mode *)
415 let rec get_OpIm_count (m:mcu_type) (o:any_opcode m) (i:instr_mode) (c:nat)
416  (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝
417  match l with
418   [ nil ⇒ c
419   | cons hd tl ⇒
420    match (eqop m o (fst4T ???? hd)) ⊗
421          (eqim i (snd4T ???? hd)) with
422     [ true ⇒ get_OpIm_count m o i (S c) tl
423     | false ⇒ get_OpIm_count m o i c tl
424     ] 
425   ].
426
427 (* iteratore sugli opcode *)
428 definition forall_opcode ≝ λP.
429  P ADC    ⊗ P ADD    ⊗ P AIS    ⊗ P AIX    ⊗ P AND    ⊗ P ASL    ⊗ P ASR    ⊗ P BCC    ⊗
430  P BCLRn  ⊗ P BCS    ⊗ P BEQ    ⊗ P BGE    ⊗ P BGND   ⊗ P BGT    ⊗ P BHCC   ⊗ P BHCS   ⊗
431  P BHI    ⊗ P BIH    ⊗ P BIL    ⊗ P BIT    ⊗ P BLE    ⊗ P BLS    ⊗ P BLT    ⊗ P BMC    ⊗
432  P BMI    ⊗ P BMS    ⊗ P BNE    ⊗ P BPL    ⊗ P BRA    ⊗ P BRCLRn ⊗ P BRN    ⊗ P BRSETn ⊗
433  P BSETn  ⊗ P BSR    ⊗ P CBEQA  ⊗ P CBEQX  ⊗ P CLC    ⊗ P CLI    ⊗ P CLR    ⊗ P CMP    ⊗
434  P COM    ⊗ P CPHX   ⊗ P CPX    ⊗ P DAA    ⊗ P DBNZ   ⊗ P DEC    ⊗ P DIV    ⊗ P EOR    ⊗
435  P INC    ⊗ P JMP    ⊗ P JSR    ⊗ P LDA    ⊗ P LDHX   ⊗ P LDX    ⊗ P LSR    ⊗ P MOV    ⊗
436  P MUL    ⊗ P NEG    ⊗ P NOP    ⊗ P NSA    ⊗ P ORA    ⊗ P PSHA   ⊗ P PSHH   ⊗ P PSHX   ⊗
437  P PULA   ⊗ P PULH   ⊗ P PULX   ⊗ P ROL    ⊗ P ROR    ⊗ P RSP    ⊗ P RTI    ⊗ P RTS    ⊗
438  P SBC    ⊗ P SEC    ⊗ P SEI    ⊗ P SHA    ⊗ P SLA    ⊗ P STA    ⊗ P STHX   ⊗ P STOP   ⊗
439  P STX    ⊗ P SUB    ⊗ P SWI    ⊗ P TAP    ⊗ P TAX    ⊗ P TPA    ⊗ P TST    ⊗ P TSX    ⊗
440  P TXA    ⊗ P TXS    ⊗ P WAIT.
441
442 (* iteratore sulle modalita' *)
443 definition forall_instr_mode ≝ λP.
444   P MODE_INH
445 ⊗ P MODE_INHA 
446 ⊗ P MODE_INHX 
447 ⊗ P MODE_INHH
448
449 ⊗ P MODE_IMM1 
450 ⊗ P MODE_IMM2 
451 ⊗ P MODE_DIR1 
452 ⊗ P MODE_DIR2
453 ⊗ P MODE_IX0  
454 ⊗ P MODE_IX1  
455 ⊗ P MODE_IX2  
456 ⊗ P MODE_SP1  
457 ⊗ P MODE_SP2
458
459 ⊗ P MODE_DIR1_to_DIR1 
460 ⊗ P MODE_IMM1_to_DIR1
461 ⊗ P MODE_IX0p_to_DIR1 
462 ⊗ P MODE_DIR1_to_IX0p
463
464 ⊗ P MODE_INHA_and_IMM1 
465 ⊗ P MODE_INHX_and_IMM1 
466 ⊗ P MODE_IMM1_and_IMM1
467 ⊗ P MODE_DIR1_and_IMM1 
468 ⊗ P MODE_IX0_and_IMM1  
469 ⊗ P MODE_IX0p_and_IMM1
470 ⊗ P MODE_IX1_and_IMM1  
471 ⊗ P MODE_IX1p_and_IMM1 
472 ⊗ P MODE_SP1_and_IMM1
473
474 ⊗ forall_oct (λo. P (MODE_DIRn o))
475 ⊗ forall_oct (λo. P (MODE_DIRn_and_IMM1 o))
476 ⊗ forall_exadecim (λe. P (MODE_TNY e))
477 ⊗ forall_bitrigesim (λt. P (MODE_SRT t)).