From 3f3574efb1e1c27d2f471c9b4a87a9786326e773 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Tue, 11 Apr 2023 11:55:26 +1000 Subject: work on instruction table data and interpreter --- addressing.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'addressing.h') diff --git a/addressing.h b/addressing.h index 87b2079..cf32561 100644 --- a/addressing.h +++ b/addressing.h @@ -34,10 +34,22 @@ typedef struct AddData AddData; //Holds address of current instruction. -void (*current_instruction)(Addressing, address); +void (*current_instruction)(address); +Addressing fAddressGetLength(Addressing addr){ + switch(addr){ + case eAbsolute: case eAbsoluteIndexedX: case eAbsoluteIndexedY: + return 3; + case eAccumulator: + return 1; + default: + return 2; + } +} + + AddData fAddress(Addressing addr, short x) { AddData ret; @@ -102,14 +114,7 @@ AddData fAddress(Addressing addr, short x) { // LENGTH - switch(addr){ - case eAbsolute: case eAbsoluteIndexedX: case eAbsoluteIndexedY: - ret.length = 3; break; - case eAccumulator: - ret.length = 1; break; - default: - ret.length = 2; break; - } + ret.length = fAddressGetLength(addr); // CYCLES -- cgit v1.2.3