[Coco] Byte Order Question

David Gacke dgacke at ektarion.com
Wed Jul 28 01:17:48 EDT 2004


Many thanks Roger!


Dave

-----Original Message-----
From: coco-bounces at maltedmedia.com [mailto:coco-bounces at maltedmedia.com]
On Behalf Of Roger Taylor
Sent: Tuesday, July 27, 2004 11:42 PM
To: CoCoList for Color Computer Enthusiasts
Subject: Re: [Coco] Byte Order Question

At 09:35 PM 7/27/2004, you wrote:



| For instance, if I have a 32 bit value of say 0x41424344  ('ABCD') and
I
| were to write that to video display memory, what would I see?

This little program reveals exactly what you are asking:

	org	16384
start	jsr	43304		clear screen
	ldq	#$41424344	'ABCD'
	stq	1024
	
	ldd	#$4142
	std	1024+32
	
	ldd	#1536-96	move cursor out of the way
	std	<136
	rts
	end	start
		
First, try to view the CoCo's memory map with $0000 as being at the roof

top of the skyscraper, and $FFFF as being at the basement.  The CoCo's 
video screen is on the floor right below the rooftop, and it's address 
range travels downwards as the addresses increase.

For the CoCo, AB would be case if you stored $4142 into RAM.  If you
stored 
$4142 into address $0000, A($41) would be at address $0000 and B($42)
would 
be at address $0001.  If you stored $41424344 into $0000, the same
ordering 
would apply.  $44 would be at address $0003, the higher address.

HOWEVER, the $44 byte in $41424344 is the LEAST-significant byte and $41
is 
the MOST-significant byte.  So I think it's safe to say that a
register's 
least-significant byte will be stored at the higher address in memory
(or 
closer to the basement/floor).

----------
Roger Taylor




-- 
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco





More information about the Coco mailing list