OT: Altair32: C arrays and pointers
At 08:26 PM 5/19/2001 -0400, you wrote:
>Hello, all:
>
> Futher errors have been found in the Altair32 8080 processor
> emulator code
>by some eagle-eyed users. So, I'm trying to fix them, but my lack of depth
>in C programming has become evident. So, I'd like to enlist some help again.
>
> Here's the code (cut and paste; written by Claus Giloi):
>
>uchar regs[8] ; // A, F, B, C, D, E, H, L - actual storage order!
> // 0 1 2 3 4 5 6 7
>
>// pointer array for sss, ddd addressing
>uchar * b_regs[8]=
>{®s[2],®s[3],®s[4],®s[5],®s[6],®s[7],&dummy,®s[0]} ;
>// B C D E H L trap! ACC
>
>// pointer array for rp addressing
>ushort * w_regs[4] =
>{ (ushort *)®s[2], (ushort *)®s[4], (ushort *)®s[6], &SP } ;
>// B D H SP
>
This arrangement looks like it would work on a big endian machine but fail
on a little endian. Is that the symptom you are seeing?
Bob
--------------------------------------------------------
"If you pick up a starving dog and make him prosperous,
he will not bite you. This is the principal difference
between a dog and a man."
-- Mark Twain
Received on Sun May 20 2001 - 05:46:02 BST
This archive was generated by hypermail 2.3.0
: Fri Oct 10 2014 - 23:34:09 BST