projects
/
sx
/
simavr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
regExp
home
|
summary
|
tags
|
heads
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
raw
|
patch
| inline |
side by side
(parent:
2c407d6
)
Commit
c7a4f0ed2b24d36d13c80af60ce536e3d44b7e0c
author
bsekisser
<squirmyworms@embarqmail.com>
Sun, 13 Oct 2013 17:09:53 +0000
(13:09 -0400)
committer
bsekisser
<squirmyworms@embarqmail.com>
Sun, 13 Oct 2013 17:09:53 +0000
(13:09 -0400)
prior implimentation just cleared n flag while specification states n should be set or cleared according to the most significant bit of the result.
bug find credit goes to: Shay Green <gblargg@gmail.com>
modified: simavr/sim/sim_core.c
simavr/sim/sim_core.c
patch
|
blob
|
history
|
download
diff --git
a/simavr/sim/sim_core.c
b/simavr/sim/sim_core.c
index 03d46ffd6fe83e512a56451ecbf15a321897d419..8e7af22ef623ebec63ebd4d217380f8804adae9a 100644
(file)
--- a/
simavr/sim/sim_core.c
+++ b/
simavr/sim/sim_core.c
@@
-1118,7
+1118,7
@@
avr_flashaddr_t avr_run_one(avr_t * avr)
_avr_set_r(avr, r, res);
avr->sreg[S_Z] = res == 0;
avr->sreg[S_C] = vr & 1;
- avr->sreg[S_N] =
0
;
+ avr->sreg[S_N] =
res >> 7
;
avr->sreg[S_V] = avr->sreg[S_N] ^ avr->sreg[S_C];
avr->sreg[S_S] = avr->sreg[S_N] ^ avr->sreg[S_V];
SREG();