diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-11 11:55:26 +1000 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-11 11:55:26 +1000 |
commit | 3f3574efb1e1c27d2f471c9b4a87a9786326e773 (patch) | |
tree | 856a3d24011eba1d13998967926e477de3bc8587 /addressing.h | |
parent | 2cf25a4fb232939191147896366b0c68d09c985e (diff) |
work on instruction table data and interpreter
Diffstat (limited to 'addressing.h')
-rw-r--r-- | addressing.h | 23 |
1 files changed, 14 insertions, 9 deletions
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 |