[comp.sys.apple] Format of LongInt, etc...

zach@pro-pac.cts.com (Zach Taft) (11/20/88)

Hi,

        Well I certainly appreciated the last advice (from Kevin) on
some of the programming quirks of the 65816, but I've run into another
problem that I would like some help on.

        Can someone please describe the way that Integers and Long
Integers are stored in memory?  The reason I ask is that I want to
write some routines that will be able to convert 8-bit results into
16-bit Integers and Long Integers.  From what I've been able to read
I assume that they are stored in reverse order, just as pointers and
other addressing variables are.  That is:

        $E04F21 -- is stored as -- 21 4F E0 00

          $DEFB -- is stored as -- FB DE

        So one would assume that the 16-bit Integers and Long Integers
would be stored in the same way:

     #$13B4185E -- is stored as -- 5E 18 B4 13

         #$4152 -- is stored as -- 52 41

           #256 -- is stored as -- 00 01

         #65536 -- is stored as -- 00 00 01 00

         #65792 -- is stored as -- 00 01 01 00

        Well, that's it.  If you can shed some light on this, please do!

Zach Taft

--
UUCP: {nosc, cacilj, sdcsvax, hplabs!hp-sdd, sun.COM}
                        ...!crash!pnet01!pro-nsfmat!pro-pac!zach
ARPA: crash!pnet01!pro-nsfmat!pro-pac!zach@nosc.MIL   
INET: zach@pro-pac.CTS.COM - BITNET: pro-pac.UUCP!zach@PSUVAX1

zach@pro-pac.cts.com (Zach Taft) (11/24/88)

Hi again,

        Listen, I don;t know how anyone got on this tangent about
processors having different storage methods of integers...  All I
need to know is HOW long and short integers are stored and used
in the APW programming environment, and this includes their use
in assembly language programming toolkit calls...  The reason that
I want to know is so I can create a routine which converts TWO
8-bit numbers into a 16 bit number.  Again the examples I showed
before are:


        $E04F21 -- is stored as -- 21 4F E0 00

          $DEFB -- is stored as -- FB DE

        So one would assume that the 16-bit Integers and Long Integers
would be stored in the same way:

     #$13B4185E -- is stored as -- 5E 18 B4 13

         #$4152 -- is stored as -- 52 41

           #256 -- is stored as -- 00 01

         #65536 -- is stored as -- 00 00 01 00

         #65792 -- is stored as -- 00 01 01 00

        Now, I realize that there are a number of other discussions
that can come from this subject, but PLEASE someone just tell me if
the examples I listed above are correct.  I have been looking through
all of the available manuals here in Hawaii, but I cannot get ahold
of the Apple SANE manual anywhere, so maybe I this is where I am
missing out.  That's why I'm asking all of you!  So, again, please
tell me if the examples above are correct or incorrect.  I sure would
like to hear from some of the examples programming people at Apple! :-)
Thanks for any help!

Zach Taft

--
UUCP: {nosc, cacilj, sdcsvax, hplabs!hp-sdd, sun.COM}
                        ...!crash!pnet01!pro-nsfmat!pro-pac!zach
ARPA: crash!pnet01!pro-nsfmat!pro-pac!zach@nosc.MIL   
INET: zach@pro-pac.CTS.COM - BITNET: pro-pac.UUCP!zach@PSUVAX1

shawn@pnet51.cts.com (Shawn Stanley) (11/30/88)

zach@pro-pac.cts.com (Zach Taft) writes:
>Hi again,
>
>        Listen, I don;t know how anyone got on this tangent about
>processors having different storage methods of integers...  All I
>need to know is HOW long and short integers are stored and used
>in the APW programming environment, and this includes their use
>in assembly language programming toolkit calls...  The reason that
>I want to know is so I can create a routine which converts TWO
>8-bit numbers into a 16 bit number.  Again the examples I showed

An integer of $1234 is stored as ADDR:34 12
A long of $12345678 is stored as ADDR:78 56 34 12

Integers with the APW C compiler are stored in memory from low byte to high
byte.

UUCP: {rosevax, crash}!orbit!pnet51!shawn
INET: shawn@pnet51.cts.com