[Coco] 6309 Weirdness ??
    Darren A. 
    darccml at hotmail.com
       
    Wed May 16 00:34:16 EDT 2007
    
    
  
>From: Robert Gault
>Subject: Re: [Coco] 6309 Weirdness ??
>Date: Tue, 15 May 2007 22:04:53 -0400
>
><snip>
>
>My tests indicate that you are misinterpreting your results.
>
>When I run the program
>	org $7000
>start	ldx #$1234
>$7003	addr pc,x
>$7006	swi
>	end
>the result is that regX contains $1234+$7003+3=$823A.
><snip>
>Your example LDX #-4  ADDR X,PC  will lead to disaster. Using -3, the 
>program should loop indefinitely at the addr x,pc instruction. But with -4, 
>the program will jump into the middle of the ldx #-4 instruction. The 
>result in most cases will be an illegal instruction resulting in the 6309 
>jumping to a special trap which in most cases will not have a vector 
>installed.
>
>--
-
Robert,
Did you run your test on real 6309 hardware or with an emulator?  When I run 
the example you provided:
  ORG   $7000
7000  LDX   #$1234
7003  ADDR  PC,X
..I get the same results you did if I run it on MESS (X = $823A), but I get 
a different result (X = $823B) when I run it on real hardware. This 
indicates to me that the CPU is calculating it as ($1234 + $7003 + 4).
Thus the example I gave:
      LDX   #-4
      ADDR  X,PC
...will, as you say, lead to disaster if run on MESS, but works on a real 
6309 (as long as interrupts are masked).  That was the point of my post; 
that the real CPU isn't behaving the way I was led to believe. I even tried 
it with two different processors (a 63B09E and a 63C09E) just to see if I 
had a defective one.
Darren
_________________________________________________________________
More photos, more messages, more storageget 2GB with Windows Live Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507
    
    
More information about the Coco
mailing list