OT: Altair32: C arrays and pointers

From: Bob Withers <bwit_at_pobox.com>
Date: Sun May 20 05:46:02 2001

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]=
>{&regs[2],&regs[3],&regs[4],&regs[5],&regs[6],&regs[7],&dummy,&regs[0]} ;
>// B C D E H L trap! ACC
>
>// pointer array for rp addressing
>ushort * w_regs[4] =
>{ (ushort *)&regs[2], (ushort *)&regs[4], (ushort *)&regs[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