summaryrefslogtreecommitdiff
path: root/addressing.h
diff options
context:
space:
mode:
Diffstat (limited to 'addressing.h')
-rw-r--r--addressing.h23
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