rp2040js 0.17.14 → 0.17.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -606,13 +606,12 @@ class CortexM0Core {
606
606
  const Rm = (opcode >> 3) & 0x7;
607
607
  const Rd = opcode & 0x7;
608
608
  const input = this.registers[Rm];
609
- const result = imm5 ? input >> imm5 : (input & 0x80000000) >> 31;
609
+ const shiftN = imm5 ? imm5 : 32;
610
+ const result = shiftN < 32 ? input >> shiftN : (input & 0x80000000) >> 31;
610
611
  this.registers[Rd] = result;
611
612
  this.N = !!(result & 0x80000000);
612
613
  this.Z = (result & 0xffffffff) === 0;
613
- if (imm5) {
614
- this.C = input & (1 << (imm5 - 1)) ? true : false;
615
- }
614
+ this.C = input & (1 << (shiftN - 1)) ? true : false;
616
615
  }
617
616
  // ASRS (register)
618
617
  else if (opcode >> 6 === 0b0100000100) {
@@ -624,9 +623,7 @@ class CortexM0Core {
624
623
  this.registers[Rdn] = result;
625
624
  this.N = !!(result & 0x80000000);
626
625
  this.Z = (result & 0xffffffff) === 0;
627
- if (shiftN) {
628
- this.C = input & (1 << (shiftN - 1)) ? true : false;
629
- }
626
+ this.C = input & (1 << (shiftN - 1)) ? true : false;
630
627
  }
631
628
  // B (with cond)
632
629
  else if (opcode >> 12 === 0b1101 && ((opcode >> 9) & 0x7) !== 0b111) {
@@ -603,13 +603,12 @@ export class CortexM0Core {
603
603
  const Rm = (opcode >> 3) & 0x7;
604
604
  const Rd = opcode & 0x7;
605
605
  const input = this.registers[Rm];
606
- const result = imm5 ? input >> imm5 : (input & 0x80000000) >> 31;
606
+ const shiftN = imm5 ? imm5 : 32;
607
+ const result = shiftN < 32 ? input >> shiftN : (input & 0x80000000) >> 31;
607
608
  this.registers[Rd] = result;
608
609
  this.N = !!(result & 0x80000000);
609
610
  this.Z = (result & 0xffffffff) === 0;
610
- if (imm5) {
611
- this.C = input & (1 << (imm5 - 1)) ? true : false;
612
- }
611
+ this.C = input & (1 << (shiftN - 1)) ? true : false;
613
612
  }
614
613
  // ASRS (register)
615
614
  else if (opcode >> 6 === 0b0100000100) {
@@ -621,9 +620,7 @@ export class CortexM0Core {
621
620
  this.registers[Rdn] = result;
622
621
  this.N = !!(result & 0x80000000);
623
622
  this.Z = (result & 0xffffffff) === 0;
624
- if (shiftN) {
625
- this.C = input & (1 << (shiftN - 1)) ? true : false;
626
- }
623
+ this.C = input & (1 << (shiftN - 1)) ? true : false;
627
624
  }
628
625
  // B (with cond)
629
626
  else if (opcode >> 12 === 0b1101 && ((opcode >> 9) & 0x7) !== 0b111) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rp2040js",
3
- "version": "0.17.14",
3
+ "version": "0.17.15",
4
4
  "description": "Raspberry Pi Pico (RP2040) Emulator",
5
5
  "repository": "https://github.com/wokwi/rp2040js",
6
6
  "keywords": [