OSDN Git Service

- ora zp,x/abs/abs,xy/indir,y supported.
[motonesfpga/motonesfpga.git] / tools / test-image / sample1.asm
1 .setcpu         "6502"\r
2 .autoimport     on\r
3 \r
4 ; iNES header\r
5 .segment "HEADER"\r
6         .byte   $4E, $45, $53, $1A      ; "NES" Header\r
7         .byte   $02                     ; PRG-BANKS\r
8         .byte   $01                     ; CHR-BANKS\r
9         .byte   $01                     ; Vetrical Mirror\r
10         .byte   $00                     ; \r
11         .byte   $00, $00, $00, $00      ; \r
12         .byte   $00, $00, $00, $00      ; \r
13 \r
14 .segment "STARTUP"\r
15 .proc   Reset\r
16 ; interrupt off, initialize sp.\r
17         sei\r
18         ldx     #$ff\r
19         txs\r
20 \r
21     ;ppu register initialize.\r
22         lda     #$00\r
23         sta     $2000\r
24         sta     $2001\r
25 \r
26         lda     #$3f\r
27         sta     $2006\r
28         lda     #$00\r
29         sta     $2006\r
30         ldx     #$00\r
31         ldy     #$10\r
32 \r
33     ;;load palette.\r
34 copypal:\r
35         lda     palettes, x\r
36         sta     $2007\r
37         inx\r
38         dey\r
39         bne     copypal\r
40 \r
41         lda     #$21\r
42         sta     $2006\r
43         lda     #$c9\r
44         sta     $2006\r
45         ldx     #$00\r
46         ldy     #$0d\r
47 \r
48     ;;load name table.\r
49 copymap:\r
50         lda     string, x\r
51         sta     $2007\r
52         inx\r
53         dey\r
54         bne     copymap\r
55 \r
56         lda     #$00\r
57         sta     $2005\r
58         sta     $2005\r
59 \r
60     ;;show test msg.\r
61         lda     #$08\r
62         sta     $2000\r
63         lda     #$1e\r
64         sta     $2001\r
65 \r
66     jmp boundary_1\r
67     ;;fill dummy data to test page boundary instruction.\r
68     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
69     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
70     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
71     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
72     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
73     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
74     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
75     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
76     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
77     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
78 \r
79     ;;;single byte instruction page boundary test.\r
80 boundary_1:\r
81     lda #$01\r
82     ror\r
83     ror\r
84     ror\r
85     ror\r
86     ror\r
87     ror\r
88     ror\r
89     ror\r
90     ror\r
91     ror\r
92     ror\r
93     ror\r
94     ror\r
95 ;;this is pch increment at T1 cycle. \r
96 ;;;@80ff\r
97     rol\r
98     lsr\r
99 \r
100     jmp boundary_2_1\r
101 \r
102     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
103     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
104     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
105     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
106     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
107     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
108     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
109     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
110     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
111     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
112     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
113     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
114     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
115     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
116     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
117 \r
118 boundary_2_1:\r
119     ;;;two byte instruction page boundary test.\r
120         lda     #$01\r
121         lda     #$01\r
122         lda     #$01\r
123         lda     #$01\r
124         lda     #$01\r
125         lda     #$01\r
126 ;;this is pch increment at T1 cycle. \r
127     ;;;@81ff\r
128         ldx     #$08\r
129 \r
130 \r
131     jmp boundary_2_2\r
132 \r
133     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
134     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
135     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
136     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
137     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
138     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
139     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
140     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
141     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
142     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
143     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
144     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
145     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
146     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
147     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
148 \r
149 boundary_2_2:\r
150     ;;;two byte instruction page boundary test.\r
151         lda     #$01\r
152         lda     #$01\r
153         lda     #$01\r
154         lda     #$01\r
155         lda     #$01\r
156     ror\r
157 ;;this is pch increment at next T0 cycle. \r
158     ;;;@82fe\r
159         ldx     #$0a\r
160 \r
161     jmp boundary_2_3\r
162 \r
163     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
164     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
165     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
166     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
167     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
168     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
169     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
170     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
171     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
172     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
173     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
174     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
175     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
176     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
177     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
178 \r
179 boundary_2_3:\r
180     ;;;two byte instruction w/ 3 exec cycle page boundary test.\r
181         lda     #$01\r
182         lda     #$01\r
183         lda     #$01\r
184 \r
185         ror\r
186         lda     #$01\r
187         lda     #$de\r
188         sta     $13\r
189 \r
190 \r
191 ;;this is pch increment at T1 cycle. \r
192     ;;;@83ff\r
193         ldy $09, x\r
194 \r
195 \r
196     jmp boundary_2_4\r
197 \r
198     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
199     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
200     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
201     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
202     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
203     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
204     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
205     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
206     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
207     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
208     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
209     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
210     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
211     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
212     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
213 \r
214 boundary_2_4:\r
215     ;;;two byte instruction w/ 3 exec cycle page boundary test.\r
216         lda     #$01\r
217         lda     #$01\r
218         ldy     #$05\r
219 \r
220         ror\r
221         lda     #$01\r
222         lda     #$de\r
223 ;;this is pch increment at T2 cycle. \r
224     ;;;@84fe\r
225         sta     $13\r
226 \r
227 \r
228     jmp boundary_3_1\r
229 \r
230     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
231     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
232     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
233     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
234     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
235     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
236     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
237     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
238     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
239     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
240     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
241     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
242     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
243     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
244     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
245 \r
246 boundary_3_1:\r
247     ;;;three byte instruction w/ page boundary test.\r
248         lda     #$01\r
249         lda     #$01\r
250         ldy     #$05\r
251 \r
252         ror\r
253         lda     #$01\r
254         lda     #$dd\r
255 ;;this is pch increment at T3 cycle. \r
256     ;;;@85fd\r
257         sta     $06fc, x\r
258 \r
259     jmp boundary_3_2\r
260 \r
261     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
262     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
263     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
264     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
265     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
266     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
267     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
268     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
269     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
270     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
271     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
272     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
273     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
274     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
275     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
276 \r
277 boundary_3_2:\r
278     ;;;three byte instruction w/ page boundary test.\r
279         lda     #$01\r
280         lda     #$01\r
281         lda     #$01\r
282         ldy     #$05\r
283 \r
284         lda     #$01\r
285         lda     #$dd\r
286 ;;this is pch increment at T2 cycle. \r
287     ;;;@86fe\r
288         sta     $06fc, x\r
289 \r
290     jmp boundary_3_3\r
291 \r
292     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
293     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
294     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
295     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
296     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
297     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
298     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
299     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
300     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
301     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
302     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
303     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
304     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
305     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
306     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
307 \r
308 boundary_3_3:\r
309     ;;;three byte instruction w/ page boundary test.\r
310         lda     #$01\r
311         lda     #$01\r
312         lda     #$01\r
313         ldy     #$05\r
314 \r
315         ldy     #$08\r
316         lda     #$dd\r
317 ;;this is pch increment at T1 cycle. \r
318     ;;;@87ff\r
319         sta     $06fc, x\r
320 \r
321     jmp boundary_3_4\r
322 \r
323     .byte      $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
324     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
325     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
326     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
327     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
328     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
329     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
330     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
331     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
332     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
333     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
334     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
335     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
336     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
337     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
338 \r
339 boundary_3_4:\r
340     ;;;three byte instruction w/ page boundary test.\r
341         lda     #$01\r
342         lda     #$01\r
343     ror\r
344 \r
345         ldy     #$08\r
346         lda     #$dd\r
347 ;;this is pch increment at T0 cycle. \r
348     ;;;@88fd\r
349         sta     $06fc, x\r
350 \r
351     nop\r
352     nop\r
353     nop\r
354 \r
355     ;;;instruction coverage test....\r
356     ;;adc abs, y\r
357     ldy #$10\r
358     ldx #$fa\r
359     stx $0790\r
360     lda #$b0\r
361     ;;fa+b0=aa\r
362     adc $0780, y\r
363 \r
364     clc\r
365     ldy #$ab\r
366     ldx #$fa\r
367     stx $082b\r
368     lda #$dd\r
369     ;;fa+dd=d7\r
370     adc $0780, y\r
371 \r
372     ;;bit zp\r
373     ldx #$15\r
374     stx $2b\r
375     bit $2b\r
376     lda #$8a\r
377     bit $2b\r
378 \r
379     ;;sbc imm\r
380     ;;8a-5c=2e\r
381     sbc #$5c\r
382     ;;2e-3d=f1\r
383     sbc #$3d\r
384     ;;f1-e5=0c\r
385     sbc #$e5\r
386 \r
387     ;;cli/clv\r
388     cli\r
389     ldx #$c0\r
390     stx $2b\r
391     bit $2b\r
392     clv\r
393 \r
394     ;;adc zp, x/abs, x/indir, y\r
395     lda #$11\r
396     ldx #$e4\r
397     sta $a4\r
398     ;11+81=92\r
399     lda #$81\r
400     adc $c0, x\r
401 \r
402     stx $0734\r
403     ;93+e4=177\r
404     adc $0650, x\r
405 \r
406     ldx #$c9\r
407     stx $07e8\r
408     lda #$34\r
409     sta $07\r
410     lda #$07\r
411     sta $08\r
412     ldy #$b4\r
413     ;c9+07=d0\r
414     adc ($07), y\r
415 \r
416     ;;and zp, x/abs/abs, x/indir, y\r
417     lda #$f5\r
418     ldx #$e4\r
419     sta $a4\r
420     ;f5&5e=54\r
421     lda #$5e\r
422     and $c0, x\r
423 \r
424     stx $0734\r
425     ;e4&54=44\r
426     and $0650, x\r
427 \r
428     ldx #$c9\r
429     stx $07e8\r
430     lda #$34\r
431     sta $07\r
432     lda #$07\r
433     sta $08\r
434     ldy #$b4\r
435     ;no page crossing\r
436     ;c9&07=01\r
437     and ($07), y\r
438 \r
439     ldx #$c9\r
440     stx $0825\r
441     lda #$34\r
442     sta $07\r
443     lda #$07\r
444     sta $08\r
445     ldy #$f1\r
446     ;page crossing\r
447     ;c9&07=01\r
448     and ($07), y\r
449 \r
450     ;;cmp zp, x/abs/abs, x/indir, y\r
451     lda #$de\r
452     ldx #$e4\r
453     sta $a4\r
454     ;c5-de=-19 > (e7)\r
455     lda #$c5\r
456     cmp $c0, x\r
457 \r
458     sec\r
459     lda #$75\r
460     stx $0734\r
461     ;75-e4=-6f > 91\r
462     cmp $0650, x\r
463 \r
464     ldx #$c9\r
465     stx $0825\r
466     lda #$34\r
467     sta $07\r
468     lda #$07\r
469     sta $08\r
470     ldy #$f1\r
471     lda #$c9\r
472     ;page crossing\r
473     ;c9-c9=0\r
474     cmp ($07), y\r
475 \r
476     ;;rol zp/zp, x/abs/abs, x\r
477     lda #$de\r
478     ldx #$e4\r
479     sta $a4\r
480     ;de<1 =bc w/ carry\r
481     clc\r
482     rol $c0, x\r
483     ;bc<1 =78  w/ carry\r
484     rol $a4\r
485 \r
486     ldx #$64\r
487     stx $0722\r
488     ;64<1 = c8 w/o carry\r
489     rol $06be, x\r
490 \r
491     ldx #$80\r
492     stx $0734\r
493     ;80<1 = 00 w/ carry.\r
494     rol $0734\r
495 \r
496     ;;cpx abs\r
497     ;;cpy zp/abs\r
498     lda #$de\r
499     sta $03a4\r
500     ;c5-de=-19 > (e7)\r
501     ldx #$c5\r
502     cpx $03a4\r
503 \r
504     sec\r
505     ldy #$75\r
506     ldx #$e4\r
507     stx $34\r
508     ;75-e4=-6f > 91\r
509     cpy $34\r
510 \r
511     ldx #$c9\r
512     stx $0825\r
513     ldy #$c9\r
514     ;c9-c9=0\r
515     cpy $0825\r
516 \r
517     ;;lsr zp/zp, x/abs/abs, x\r
518     lda #$de\r
519     ldx #$e4\r
520     sta $a4\r
521     ;de>1 =6f w/o carry\r
522     clc\r
523     lsr $c0, x\r
524     ;6f>1 =37  w/ carry\r
525     lsr $a4\r
526 \r
527     ldx #$64\r
528     stx $0722\r
529     ;64>1 = 32 w/o carry\r
530     lsr $06be, x\r
531 \r
532     ldx #$01\r
533     stx $0734\r
534     ;01>1 = 00 w/ carry.\r
535     lsr $0734\r
536 \r
537     ;;ldy abs, x\r
538     ;;ldx zp, y\r
539     ldx #$fa\r
540     stx $0820\r
541     ;;page cross\r
542     ldy $0726, x\r
543 \r
544     ldx #$10\r
545     stx $0820\r
546     ;no page cross\r
547     ldy $0810, x\r
548 \r
549     ldy #$10\r
550     sty $e0\r
551     ldx #$55\r
552     ldx $d0, y\r
553 \r
554     ;;dec zp, x/abs, x\r
555     ;;inc zp, x/abs, x\r
556     lda #$00\r
557     ldx #$e4\r
558     sta $88\r
559     ldy #$00\r
560     dec $a4, x\r
561 \r
562     ldx #$64\r
563     stx $0722\r
564     dec $06be, x\r
565 \r
566     lda #$fe\r
567     ldx #$e4\r
568     sta $88\r
569     inc $a4, x\r
570     inc $a4, x\r
571     inc $a4, x\r
572 \r
573     ldx #$64\r
574     stx $0722\r
575     inc $06be, x\r
576 \r
577     ;;ror zp/zp,x/abs\r
578     lda #$02\r
579     ldx #$e4\r
580     sta $88\r
581     ror $a4, x\r
582     ror $a4, x\r
583     ror $a4, x\r
584 \r
585     ldx #$64\r
586     stx $0722\r
587     ror $0722\r
588 \r
589     ;;asl zp/zp,x/abs/abs,x\r
590     lda #$40\r
591     ldx #$e4\r
592     sta $88\r
593     asl $88\r
594     asl $a4, x\r
595     asl $a4, x\r
596 \r
597     ldx #$64\r
598     stx $0722\r
599     asl $06be,x\r
600 \r
601     ;;sta zp,x\r
602     ;;stx zp,y\r
603     ;;sty zp,x\r
604     lda #$40\r
605     ldx #$e4\r
606     ldy #$c5\r
607     sta $a4, x\r
608     stx $a4, y\r
609     sty $a4, x\r
610 \r
611     ;;branch page cross test.\r
612     jmp bl_test0\r
613 \r
614 \r
615 \r
616 \r
617 \r
618 \r
619 \r
620 \r
621 bl_test0:\r
622     ldx #5\r
623 bl_test1:\r
624     dex\r
625     ;;forward branch\r
626     bpl bl_test2\r
627 \r
628     jmp bl_test2\r
629     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
630     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
631     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
632     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
633     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
634     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
635     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
636 \r
637 bl_test2:\r
638     dex\r
639     ;;backward branch\r
640     bpl bl_test1\r
641 \r
642     ;;test2\r
643     ldx #5\r
644 bl_test3:\r
645     dex\r
646     bpl bl_test4\r
647 \r
648     jmp bl_test4\r
649 \r
650     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
651     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
652     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
653     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
654     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
655     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
656     .byte $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f\r
657 \r
658 bl_test4:\r
659     dex\r
660     bpl bl_test3\r
661 \r
662     ;;ora zp, x/abs, x/indir, y\r
663     lda #$de\r
664     ldx #$e4\r
665     sta $a4\r
666     ;c5|de=df\r
667     lda #$c5\r
668     ora $c0, x\r
669 \r
670     lda #$75\r
671     stx $0734\r
672     ;75|e4=f5\r
673     ora $0650, x\r
674 \r
675     ldx #$c9\r
676     stx $0825\r
677     lda #$34\r
678     sta $07\r
679     lda #$07\r
680     sta $08\r
681     ldy #$f1\r
682     ;page crossing\r
683     ;07|c9=cf\r
684     ora ($07), y\r
685 \r
686 \r
687     ;;done...\r
688     ;;infinite loop.\r
689 mainloop:\r
690         jmp     mainloop\r
691 .endproc\r
692 \r
693 \r
694 nmi_test:\r
695     ;;;;test...\r
696     STY   $0720\r
697     LDY   #$80\r
698     STY   $0721\r
699     ASL   \r
700     ASL   \r
701     ASL   \r
702     ASL   \r
703     STA   $06a0\r
704     DEC   $0730\r
705     DEC   $0731\r
706     DEC   $0732\r
707     LDA   #$0b\r
708     STA   $071e\r
709     ;;JSR   $9c22\r
710     LDA   $0750\r
711     ;;JSR   $9c09\r
712     AND   #$60\r
713     ASL   \r
714     ROL   \r
715     ROL   \r
716     ROL   \r
717     STA   $074e\r
718     ;;RTS   \r
719     TAY   \r
720     LDA   $0750\r
721     AND   #$1f\r
722     STA   $074f\r
723     LDA   $9ce0, y\r
724     CLC   \r
725     ADC   $074f\r
726     TAY   \r
727     LDA   $9ce4, y\r
728     STA   $e9\r
729     LDA   $9d06, y\r
730     STA   $ea\r
731     LDY   $074e\r
732     LDA   $9d28, y\r
733     CLC   \r
734     ADC   $074f\r
735     TAY   \r
736     LDA   $9d2c, y\r
737     STA   $e7\r
738     LDA   $9d4e, y\r
739     STA   $e8\r
740     LDY   #$00\r
741     LDA   ($e7), y\r
742     PHA   \r
743     AND   #$07\r
744     CMP   #$04\r
745     ;;BCC   +5\r
746     STA   $0741\r
747     PLA   \r
748     PHA   \r
749     AND   #$38\r
750     LSR   \r
751     LSR   \r
752     LSR   \r
753     STA   $0710\r
754     PLA   \r
755     AND   #$c0\r
756     CLC   \r
757     ROL   \r
758     ROL   \r
759     ROL   \r
760     STA   $0715\r
761     INY   \r
762     LDA   ($e7), y\r
763     PHA   \r
764     AND   #$0f\r
765     STA   $0727\r
766     PLA   \r
767     PHA   \r
768     AND   #$30\r
769     LSR   \r
770     LSR   \r
771     LSR   \r
772     LSR   \r
773     STA   $0742\r
774     PLA   \r
775     AND   #$c0\r
776     CLC   \r
777     ROL   \r
778     ROL   \r
779     ROL   \r
780     CMP   #$03\r
781     ;;BNE   5\r
782     STA   $0733\r
783     LDA   $e7\r
784     CLC   \r
785     ADC   #$02\r
786     STA   $e7\r
787     LDA   $e8\r
788     ADC   #$00\r
789     STA   $e8\r
790     ;;RTS   \r
791     LDA   $076a\r
792     ;;BNE   16\r
793     LDA   $075f\r
794     CMP   #$04\r
795     ;BCC   12\r
796     LDA   $075b\r
797     ;;BEQ   5\r
798     LDA   #$80\r
799     STA   $fb\r
800     LDA   #$01\r
801     STA   $0774\r
802     INC   $0772\r
803     ;;RTS   \r
804     LDA   $2002\r
805     ;PLA   \r
806     ORA   #$80\r
807     STA   $2000\r
808     rti\r
809 \r
810 palettes:\r
811         .byte   $0f, $00, $10, $20\r
812         .byte   $0f, $06, $16, $26\r
813         .byte   $0f, $08, $18, $28\r
814         .byte   $0f, $0a, $1a, $2a\r
815 \r
816 string:\r
817         .byte   "test2!"\r
818 \r
819 .segment "VECINFO"\r
820         .word   nmi_test\r
821         .word   Reset\r
822         .word   $0000\r
823 \r
824 ; character rom file.\r
825 .segment "CHARS"\r
826         .incbin "character.chr"\r