I tried tackling this project a few years ago but never got the time to finish it. Now, I'm wanting to revisit this and have a question which might be a matter of preference. I have a register structure as illustrated below:
Code:typedef struct{ union{ uword hi_lo; struct{ ubyte hi; //Program Counter Hi ubyte lo; //Program Counter Lo }val; }pc; ubyte ac; //Accumulator ubyte xr; //X Register ubyte yr; //Y Register ubyte sr; //Status Register ubyte sp; //Stack Pointer }registers; registers r;
Should I make the "r" variable which is of type 'struct registers' a global variable or should I declare it in my main method and pass a reference all over the place between method calls? It will be used extensively. Is there a pro/con to making it global/local?