Commit 4759887051b5c72ac8674515cba6114e49ff22dd
authorMichel Pollet <buserror@gmail.com>
Wed, 20 Sep 2017 10:43:11 +0000 (11:43 +0100)
committerMichel Pollet <buserror@gmail.com>
Wed, 10 Jan 2018 10:06:22 +0000 (10:06 +0000)
Tweaks, some opcodes were borken.

Signed-off-by: Michel Pollet <buserror@gmail.com>
2 files changed:
simavr/sim/sim_core.c
simavr/sim/sim_core_jit.h

index 281914e84fd338822c07a206a3c5c84f45586a83..197fbc9beea0ee4168d1df55510cf6d57e427d29 100644 (file)
@@ -1039,7 +1039,7 @@ run_one_again:
                                        _sreg = _avr_set_r(avr, _sreg, 0, avr->flash[z]);
                                }       end_emit;
                                case 0x95d8: {  // ELPM -- Load Program Memory R0 <- (Z) -- 1001 0101 1101 1000
-                                       if (!avr->rampz)
+                                       if (!avr_rampz)
                                                _avr_invalid_opcode(avr);
                                        emit {
                                                uint32_t z = avr->data[R_ZL] | (avr->data[R_ZH] << 8) | (avr->data[avr_rampz] << 16);
@@ -1081,7 +1081,7 @@ run_one_again:
                                                                _sreg = _avr_set_r(avr, _sreg, d, avr->flash[z]);
                                                                if (op) {
                                                                        z++;
-                                                                       _sreg = _avr_set_r(avr, _sreg, avr->rampz, z >> 16);
+                                                                       _sreg = _avr_set_r(avr, _sreg, avr_rampz, z >> 16);
                                                                        _avr_set_r16le_hl( R_ZL, z);
                                                                }
                                                                cycle += 2; // 3 cycles
index 45f7ea242ae9331435934942295ffbf147b649f8..6cfb341512c8328af912b4aa1f85924e5609ffd2 100644 (file)
@@ -396,7 +396,7 @@ jit_generate(opcode, "uint16_t z = avr_data[R_ZL] | (avr_data[R_ZH] << 8);\n"
 );
                                }       break;
                                case 0x95d8: {  // ELPM -- Load Program Memory R0 <- (Z) -- 1001 0101 1101 1000
-                                       if (!avr->rampz)
+                                       if (!avr_rampz)
                                                _avr_invalid_opcode(avr);
                                         {
 jit_generate(opcode, "uint32_t z = avr_data[R_ZL] | (avr_data[R_ZH] << 8) | (avr_data[avr_rampz] << 16);\n"
@@ -441,7 +441,7 @@ jit_generate(opcode, "uint32_t z = avr_data[R_ZL] | (avr_data[R_ZH] << 8) | (avr
 "_sreg = _avr_set_r(avr, _sreg, d, avr_flash[z]);\n"
 "if (op) {\n"
 "z++;\n"
-"_sreg = _avr_set_r(avr, _sreg, avr->rampz, z >> 16);\n"
+"_sreg = _avr_set_r(avr, _sreg, avr_rampz, z >> 16);\n"
 "_avr_set_r16le_hl( R_ZL, z);\n"
 "}\n"
 "cycle += 2; // 3 cycles\n"