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

Subversion Repositories zet86

[/] [zet86/] [tags/] [INITIAL/] [tests/] [i86/] [addsub.s] - Blame information for rev 49

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 zeus
.code16
2
a:
3
 
4
#
5
# ADC
6
#
7
# 1: A negativo, B positivo: A: ffff B: 0001, A+B=0, ZAPC
8
movw $0xffff,%ax
9
movw $1,%bx
10
adcw %bx,%ax
11
 
12
# 2: A negativo, B positivo, A+B < 16 bits: A: ffff B: ffff, C A+B=ffff SAPC
13
movw $0xffff,%ax
14
movw $0xffff,%bx
15
adcw %bx,%ax
16
 
17
# 3: A positivo, B positivo, A+B < 16 bits: A: 0001 B: 0002, A+B=3, P
18
movw $0x0001,%ax
19
movw $0x0002, %bx
20
adcw %bx,%ax
21
 
22
# 4: A pos, B pos, A+B = 16 bits: A: 7fff B: 0001, A+B=8000, OSAP
23
movw $0x7fff,%ax
24
movw $0x0001,%bx
25
adcw %bx,%ax
26
 
27
# 5: A neg, B neg, A+B = 16 bits: A: 8000 B: ffff, A+B=0fff OPC
28
movw $0x8000,%ax
29
movw $0xffff,%bx
30
adcw %bx,%ax
31
 
32
# 6: A aleat, B aleat: A: 1a62 B: ed8a, A+B=
33
movw $0x1a62,%ax
34
movw $0xed8a,%bx
35
adcw %bx,%ax
36
 
37
#
38
# ADD
39
#
40
# 7: A negativo, B positivo: A: ffff B: 0001, A+B=0, ZAPC
41
movw $0xffff,%ax
42
movw $1,%bx
43
addw %bx,%ax
44
 
45
# 8: A negativo, B positivo, A+B < 16 bits: A: ffff B: ffff, C A+B=ffff SAPC
46
movw $0xffff,%ax
47
movw $0xffff,%bx
48
addw %bx,%ax
49
 
50
# 9: A positivo, B positivo, A+B < 16 bits: A: 0001 B: 0002, A+B=3, P
51
movw $0x0001,%ax
52
movw $0x0002, %bx
53
addw %bx,%ax
54
 
55
# 10: A pos, B pos, A+B = 16 bits: A: 7fff B: 0001, A+B=8000, OSAP
56
movw $0x7fff,%ax
57
movw $0x0001,%bx
58
addw %bx,%ax
59
 
60
# 11: A neg, B neg, A+B = 16 bits: A: 8000 B: ffff, A+B=0fff OPC
61
movw $0x8000,%ax
62
movw $0xffff,%bx
63
addw %bx,%ax
64
 
65
# 12: A aleat, B aleat: A: 027f B: 846c, A+B=
66
movw $0x027f,%ax
67
movw $0x846c,%bx
68
addw %bx,%ax
69
 
70
#
71
# INC
72
#
73
# 13: A-, -1: A: ffff. Da carry, no debería cambiar el flag de C
74
movw $0xffff,%ax
75
incw %ax
76
 
77
# 14: A+: 7fff. Overflow
78
movw $0x7fff,%ax
79
incw %ax
80
 
81
# 15: A aleat. 4513
82
movw $0x4513,%ax
83
incw %ax
84
 
85
#
86
# DEC
87
#
88
# 16: A: 0000.
89
movw $0x0000,%ax
90
decw %ax
91
 
92
# 17: B: 8000. Underflow
93
movw $0x8000,%ax
94
decw %ax
95
 
96
# 18: A aleat. c7db
97
movw $0xc7db,%ax
98
decw %ax
99
 
100
#
101
# NEG
102
#
103
# 19: A: 0
104
movw $0x0000,%ax
105
negw %ax
106
 
107
# 20: A: 8000. Overflow
108
movw $0x8000,%ax
109
negw %ax
110
 
111
# 21: A aleat. fac4
112
movw $0xfac4,%ax
113
negw %ax
114
 
115
#
116
# SBB
117
#
118
# 22: A+, B+, A-B siempre será menor de 16 bits: A: 0001 B: 0002 A-B=ffff SAPC
119
movw $0x0001,%ax
120
movw $0x0002,%bx
121
sbbw %bx,%ax
122
 
123
# 23: A-, B-, A-B siempre será menor de 16 bits: A: ffff B: ffff A-B=0 ZP
124
movw $0xffff,%ax
125
movw $0xffff,%bx
126
sbbw %bx,%ax
127
 
128
# 24: A-, B+, A-B < 16 bits: A: ffff B:1 A-B=fffe S
129
movw $0xffff,%ax
130
movw $0x0001,%bx
131
sbbw %bx,%ax
132
 
133
# 25: A-, B+, A-B = 16 bits: A: 8000 B:1 A-B=7fff OAP
134
movw $0x8000,%ax
135
movw $0x0001,%bx
136
sbbw %bx,%ax
137
 
138
# 26: A aleat, B aleat, con carry: A: a627 B: 03c5, C A-B=
139
movw $0xa627,%ax
140
movw $0x03c5,%bx
141
stc
142
sbbw %bx,%ax
143
 
144
#
145
# SUB
146
#
147
# 27: A+, B+, A-B siempre será menor de 16 bits: A: 0001 B: 0002 A-B=ffff SAPC
148
movw $0x0001,%ax
149
movw $0x0002,%bx
150
subw %bx,%ax
151
 
152
# 28: A-, B-, A-B siempre será menor de 16 bits: A: ffff B: ffff A-B=0 ZP
153
movw $0xffff,%ax
154
movw $0xffff,%bx
155
subw %bx,%ax
156
 
157
# 29: A-, B+, A-B < 16 bits: A: ffff B:1 A-B=fffe S
158
movw $0xffff,%ax
159
movw $0x0001,%bx
160
subw %bx,%ax
161
 
162
# 30: A-, B+, A-B = 16 bits: A: 8000 B:1 A-B=7fff OAP
163
movw $0x8000,%ax
164
movw $0x0001,%bx
165
subw %bx,%ax
166
 
167
# 31: A aleat, B aleat, con carry: A: a627 B: 03c5, C A-B=
168
movw $0xa627,%ax
169
movw $0x03c5,%bx
170
stc
171
subw %bx,%ax
172
 
173
#
174
# CMP
175
#
176
# 32: A+, B+, A-B siempre será menor de 16 bits: A: 0001 B: 0002 A-B=ffff SAPC
177
movw $0x0001,%ax
178
movw $0x0002,%bx
179
cmpw %bx,%ax
180
 
181
# 33: A-, B-, A-B siempre será menor de 16 bits: A: ffff B: ffff A-B=0 ZP
182
movw $0xffff,%ax
183
movw $0xffff,%bx
184
cmpw %bx,%ax
185
 
186
# 34: A-, B+, A-B < 16 bits: A: ffff B:1 A-B=fffe S
187
movw $0xffff,%ax
188
movw $0x0001,%bx
189
cmpw %bx,%ax
190
 
191
# 35: A-, B+, A-B = 16 bits: A: 8000 B:1 A-B=7fff OAP
192
movw $0x8000,%ax
193
movw $0x0001,%bx
194
cmpw %bx,%ax
195
 
196
# 36: A aleat, B aleat, con carry: A: aa97 B: 3b46, C A-B=
197
movw $0xaa97,%ax
198
movw $0x3b46,%bx
199
stc
200
cmpw %bx,%ax
201
 
202
 
203
.org 65520
204
jmp a
205
 
206
.org 65535
207
.byte 0xff

powered by: WebSVN 2.1.0

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