OpenCores
URL https://opencores.org/ocsvn/zet86/zet86/trunk

Subversion Repositories zet86

[/] [zet86/] [trunk/] [tests/] [08_rep.s] - Blame information for rev 49

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 zeus
.code16
2
start:
3
 
4
# Trivial cases. With %cx 0, nothing is executed
5
rep movsb
6
repz movsb
7
repnz movsb
8
rep cmpsb
9
repz cmpsb
10
repnz cmpsb
11
rep scasb
12
repz scasb
13
repnz scasb
14
rep lodsb
15
repz lodsb
16
repnz lodsb
17
rep stosb
18
repz stosb
19
repnz stosb
20
 
21
 
22
movw $0x40, %bx
23
push %bx
24
popf
25
 
26
# Now we have the zero flag set, nothing is executed because of %cx
27
 
28
rep movsb
29
repnz movsb
30
repz cmpsb
31
repnz cmpsb
32
repz scasb
33
repnz scasb
34
rep lodsb
35
repnz lodsb
36
rep stosb
37
repnz stosb
38
 
39
movw %di, %ax
40
movb $0x10, %ah
41
jmp *%ax            # jump to 0xf1000
42
hlt
43
 
44
.org 0x102
45
jmp rep_stos_z
46
 
47
.org 0x607
48
jmp rep_lods_nz
49
 
50
.org 0x809
51
jmp rep_movs_nz
52
 
53
.org 0x0ffc
54
jmp cont_n5
55
.org 0x0ffe
56
jmp cont_n10
57
# Prefixes do not affect normal instructions
58
.org 0x1000
59
movw $0, %cx
60
.byte 0xf3
61
push %cx
62
jmp *%sp
63
 
64
cont_n10:
65
movw $0x110a, %cx
66
.byte 0xf3
67
push %cx
68
jmp *%sp
69
 
70
cont_n5:
71
jmp *%cx
72
 
73
.org 0x110a
74
movw $0x5, %cx
75
 
76
movw $0, %dx
77
push %dx
78
popf
79
.byte 0xf2
80
pop  %cx
81
 
82
movw %cx, %ax
83
movb $0x20, %ah
84
jmp *%ax            # jump to 0xf200a
85
 
86
.org 0x122c
87
jmp repz_cmps_nz
88
 
89
.org 0x122f
90
jmp repz_scas
91
 
92
# rep movs ZF=1
93
.org 0x200a
94
push %bx
95
popf
96
movw $2, %cx
97
movw $0x3000, %si
98
movw $0xf000, %ax
99
movw %ax, %ds
100
movw $0x1000, %ax
101
movw %ax, %es
102
movw $0x0000, %di
103
 
104
rep movsb
105
 
106
movw %ax, %ds
107
movw (0x0000), %ax
108
movw %di, %bp
109
movw %ax, (%bp,%si)
110
jcxz comp_disi
111
hlt
112
comp_disi:
113
jmp *(0x3004)
114
 
115
.org 0x3000
116
.byte 0x09,0x08,0x07,0x06,0x5,0x4,0x3,0x2,0x1,0xa,0xb,0xc,0xd
117
 
118
 
119
# rep movs ZF=0
120
rep_movs_nz:
121
movw $0xf000, %ax
122
movw %ax, %ds
123
movw $0x1, %cx
124
movw $0, %ax
125
pushw %ax
126
popf
127
 
128
rep movsw
129
 
130
movw $0x1000, %ax
131
movw %ax, %ds
132
movw (0x0002), %ax
133
movw %di, %bp
134
movw %ax, (%bp,%si)
135
jcxz movs_nz
136
hlt
137
movs_nz:
138
jmp *(0x3008)
139
 
140
# rep lods ZF=0
141
rep_lods_nz:
142
movw $0xf000, %ax
143
movw %ax, %ds
144
movw $0x3, %cx
145
rep lodsb
146
 
147
jmp *%ax
148
hlt
149
rep_lods_z:
150
# rep lods ZF=1
151
movw $0x40, %bx
152
push %bx
153
popf
154
movw $0xf000, %ax
155
movw %ax, %ds
156
movw $0x1, %cx
157
rep lodsw
158
jmp *%ax
159
 
160
# rep stos ZF=1
161
rep_stos_z:
162
movw $0x2, %cx
163
movw $0x4000, %ax
164
rep stosw
165
movw $0x1000, %ax
166
movw %ax, %ds
167
jmp *(0x0006)
168
hlt
169
 
170
.org 0x4000
171
# rep stos ZF=0
172
movw $0x0, %bx
173
push %bx
174
popf
175
movw $0x4, %cx
176
rep stosw
177
jcxz repz_cmps_z
178
hlt
179
 
180
# repz cmps ZF=1, but ZF=0 before %cx=0
181
repz_cmps_z:
182
movw $0x40, %bx
183
push %bx
184
popf
185
movw $0x1234, %cx
186
movw $0x3000, %si
187
movw $0, %di
188
movw $0xf000, %ax
189
movw %ax, %ds
190
repz cmpsb
191
 
192
jmp *%cx
193
 
194
# repz scas ZF=1, but ZF=0 before %cx=0
195
repz_scas:
196
movw $0x40, %bx
197
push %bx
198
popf
199
movw $0x0040, %ax
200
repz scasw
201
jmp *%cx
202
 
203
# repz cmps scas ZF=0, they do only one iteration
204
repz_cmps_nz:
205
movw $0x0607, %ax
206
movw $0x5004, %cx
207
repz cmpsw
208
repz scasw
209
movw $0x40, %bx
210
push %bx
211
popf
212
movw $0x3000, %si
213
movw $0x0, %di
214
# repnz cmps scas ZF=1, they do only one iteration
215
repnz cmpsw
216
repnz scasw
217
jmp *%cx
218
hlt
219
 
220
.org 0x5000
221
# repnz movs ZF=1 all iterations
222
repnz_movs:
223
movw $0x2, %cx
224
repnz movsb
225
jcxz repnz_lods
226
hlt
227
 
228
# repnz lods ZF=1 all iterations
229
repnz_lods:
230
movw $0x2, %cx
231
repnz lodsb
232
jcxz repnz_stos
233
hlt
234
 
235
# repnz stos ZF=1 all iterations
236
repnz_stos:
237
movw $0x2, %cx
238
repnz stosb
239
jcxz repnz_cmps
240
hlt
241
 
242
# repnz cmps ZF=0, but ZF=1 before %cx=0
243
repnz_cmps:
244
movw $0, %bx
245
push %bx
246
popf
247
movw $0x6023, %cx
248
std
249
movw $0x6, %di
250
movw $0x3006, %si
251
repnz cmpsw
252
 
253
# repnz scas ZF=0, but ZF=1 before %cx=0
254
movw $0x1000, %ax
255
movw $0, %bx
256
push %bx
257
popf
258
cld
259
repnz scasw
260
jmp *%cx
261
hlt
262
 
263
.org 0x601b
264
movw $0, %dx
265
movw %dx, %ds
266
movw $0x1234, (4)
267
hlt
268
 
269
.org 0xf003
270
jmp rep_lods_z
271
 
272
.org 65520
273
movw $0x1000, %sp
274
movw %sp, %ss
275
jmp start
276
 
277
.org 65535
278
.byte 0xff

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.