From 3ad9f6d8df5220fcc0f37fd2ae6da628b14381ec Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Mon, 28 Sep 2020 00:13:47 -0700 Subject: [PATCH] patch check_cond abstraction, now works properly with thumb and arm --- src/crab/arm/arm.cr | 2 +- src/crab/cpu.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crab/arm/arm.cr b/src/crab/arm/arm.cr index 8e8424f..f0a6d3b 100644 --- a/src/crab/arm/arm.cr +++ b/src/crab/arm/arm.cr @@ -5,7 +5,7 @@ module ARM def arm_execute(instr : Word) : Nil - if check_cond instr + if check_cond bits(instr, 28..31) hash = hash_instr instr lut[hash].call instr else diff --git a/src/crab/cpu.cr b/src/crab/cpu.cr index 6434632..c0ade5f 100644 --- a/src/crab/cpu.cr +++ b/src/crab/cpu.cr @@ -62,7 +62,7 @@ class CPU end def check_cond(cond : Word) : Bool - case bits cond, 28..31 + case cond when 0x0 then @cpsr.zero when 0x1 then !@cpsr.zero when 0x2 then @cpsr.carry