From e4a6b1f9b4085db9ce642079fc665bd79a20fc8c Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Mon, 28 Aug 2023 19:39:18 +0200 Subject: [PATCH] decoder - Simplify RST command We can calculate the rst address directly from the op code. --- cpu/decoder.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/cpu/decoder.cpp b/cpu/decoder.cpp index 9e0d257..f0f2a50 100644 --- a/cpu/decoder.cpp +++ b/cpu/decoder.cpp @@ -298,21 +298,9 @@ void Cpu::step() mcycles = 2; } } - else if(op & 0xC7 == 0xC7) + else if(op & 0xC7 == 0xC7) // RST { - u16 rst_addr; - switch((op >> 3) & 0x7) - { - case 0x0: rst_addr = 0x00; break; - case 0x1: rst_addr = 0x08; break; - case 0x2: rst_addr = 0x10; break; - case 0x3: rst_addr = 0x18; break; - case 0x4: rst_addr = 0x20; break; - case 0x5: rst_addr = 0x28; break; - case 0x6: rst_addr = 0x30; break; - case 0x7: rst_addr = 0x38; break; - } - + u16 rst_addr = op & 0x38; doCall(rst_addr); } else