Mercurial > hg > Members > kono > os9 > sbc09
comparison README.txt @ 184:ef64e3f4e229 current
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jul 2022 18:22:06 +0900 |
parents | 2088fd998865 |
children |
comparison
equal
deleted
inserted
replaced
183:0eb94a8e4d0d | 184:ef64e3f4e229 |
---|---|
168 +--------------- $80 | 168 +--------------- $80 |
169 | 169 |
170 | 170 |
171 # differences from real 6809: | 171 # differences from real 6809: |
172 | 172 |
173 ldd #$0fc9 | 173 ldd #$0fc9 |
174 addb #$40 | 174 addb #$40 ; $C9+$40 -> $09 -> C=1 |
175 adca #$00 | 175 adca #$00 ; $0F+C -> $10 -> H=1 |
176 | 176 |
177 H is set on VCC but not on real 6809, sim6809 does what? | 177 Should Set the half-carry! |
178 | |
179 For this example the half-carry is set on a real 6809, also correctly | |
180 emulated on the VCC. v09s does the same. | |
181 | |
182 According to "Motorola 6809 and Hitachi 6309 Programmer's Reference" | |
183 the half-carry is only properly set for ADD and ADC (on 8-bit accumulators). | |
184 For ASR, ASL (= LSL), CMP, SBC, SUB this condition flag is undefined. | |
185 The v09s simulator calculates the half-carry also for ASR and ASL. | |
186 | |
187 ASL does the following: | |
188 * sets H if bit 4 was set. | |
189 * clears H if bit was not set. | |
190 | |
191 ASR (=LSR) does the following: | |
192 * xxx1 xxxx --- (LSR|ASR) ---> xxxx 1xxx => H=1 | |
193 * xxx0 xxxx --- (LSR|ASR) ---> xxxx 0xxx => H=0 | |
194 | |
195 | |
196 But note: LSR never touches the half-carry! | |
197 | |
198 | |
199 ## TFR/EXG with unaligned register sizes | |
200 | |
201 See http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=5512 | |
202 Points to the 6309 behavior which is not compatible to 6809! | |
203 | |
204 tfr x,b ; 6809,6309: b low byte of x, a unchanged | |
205 tfr x,a ; 6809, a low byte of x, b unchanged | |
206 ; on a 6309: a high(!) byte of x, b unchanged | |
207 | |
208 Might be used to get the low byte out of an index register without harm | |
209 the A register: | |
210 | |
211 instead of | |
212 pushs a | |
213 tfr x,d | |
214 andb #$1f | |
215 it could be used | |
216 tfr x,b | |
217 andb #$1f ; a left untouched! | |
218 | |
219 REF: http://www.6809.org.uk/dragon/illegal-opcodes.shtml | |
220 REF: http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4886 | |
221 | |
222 tfr a,x ; low byte of x has value of a, high byte is $FF | |
223 tfr b,x ; low byte of x has value of b, high byte is $FF | |
224 | |
225 exg a,x ; low byte of x has value of a, high byte is $FF | |
226 exg b,x ; low byte of x has value of b, high byte is $FF | |
227 | |
228 According to Motorola 6809 and Hitachi 6309 Programmer's Reference | |
229 | |
230 Except for the case where the first operand is 8 bit and register CC or DP: | |
231 In this case the 16-bit register has the value of the 8-bit register in | |
232 high and low byte! | |
178 | 233 |
179 | 234 |
180 ### special behavior | 235 ### special behavior |
181 | 236 |
182 swi2 output character (STDOUT) in register B | 237 swi2 output character (STDOUT) in register B |