Date : Mon, 18 Jul 1994 19:12:10 +0100
From : jfid@... (James Fidell)
Subject: Calculating branch addresses
I've rethought the way I was calculating branch addresses, and in the
spirit of doing the absolute minimum of work, I've come up with the
following.
I declare the array of 65536 bytes of memory. Unsigned chars are (I
think) easiest for this, because it makes addresses easy to calculate
when you have to do anything with an absolute address.
unsigned char mem [ 65536 ];
Then I declare a pointer to signed char which will effectively
overlay the first array :
signed char *smem = (signed char*) mem;
Which means that in my branch instructions I can do :
PC += smem [ PC ];
It only gives me a 2% increase in performance, but it's a fairly tidy
solution.
James.
--
"Yield to temptation -- |
it may not pass your way again" | jfid@...
|
- Lazarus Long | James Fidell