Permalink
Browse files

Fix dump output for 24bit mode

  • Loading branch information...
shinh committed Mar 11, 2016
1 parent 82f99d0 commit 13c624109a3ed07ef8adf928427cbea31631a670
Showing with 3 additions and 3 deletions.
  1. +1 −1 bfi.rb
  2. +2 −2 bfopt.cc
View
2 bfi.rb
@@ -89,7 +89,7 @@ def run
a = []
[['PC', NPC], ['A', A], ['B', B], ['C', C], ['D', D],
['BP', BP], ['SP', SP]].each do |n, i|
v = @mem[i] * 256 + @mem[i+1]
v = @mem[i-1] * 65536 + @mem[i] * 256 + @mem[i+1]
if i == NPC
v -= 1
end
View
@@ -173,7 +173,7 @@ void alloc_mem(size_t mp, vector<byte>* mem) {
}
int read_mem(const vector<byte>& mem, int index) {
return mem[index] * 256 + mem[index+1];
return mem[index-1] * 65536 + mem[index] * 256 + mem[index+1];
}
void dump_state(const vector<byte>& mem) {
@@ -183,7 +183,7 @@ void dump_state(const vector<byte>& mem) {
for (int i = 0; i < 7; i++) {
if (i)
printf(" ");
int v = read_mem(mem, 5 + 4 * i);
int v = read_mem(mem, 7 + 5 * i);
if (i == 0)
v--;
printf("%s=%d", kRegs[i], v);

0 comments on commit 13c6241

Please sign in to comment.