[Coco] Byte Order Question

Roger Taylor rtaylor at bayou.com
Wed Jul 28 00:42:06 EDT 2004


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






More information about the Coco mailing list