EASy68K  
It is currently Mon Jul 24, 2017 8:47 pm

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
PostPosted: Tue Nov 15, 2005 1:54 am 
Offline

Joined: Tue Nov 15, 2005 1:23 am
Posts: 2
Hello,

first of all, thanks for writing and maintaining this great program.
however, there seem to be some bugs related to assembling instructions with pc relative arguments.
pc indirect with displacement (programmers manual, 2.2.11) seems to be encoded wrong:
Code:
move.l   $7eaf(PC),d0

becomes 203a 6ead instead of 203a 7eaf ("The address of the operand is the sum of the address in the program counter (PC) and the sign-extended 16-bit displacement integer in the extension word")

also, the addressing mode pc indirect with index doesnt seem to be working at all, the instruction
Code:
move.l   ($f,PC,a3),d0

which should become 203B B80F (programmers manual 2.2.12 / 2.1 / 4-118) gives an "displacement out of range" error.


Top
 Profile  
 
PostPosted: Tue Nov 15, 2005 8:43 am 
Offline

Joined: Mon Dec 27, 2004 11:40 pm
Posts: 318
mak wrote:
pc indirect with displacement (programmers manual, 2.2.11) seems to be encoded wrong:
Code:
move.l   $7eaf(PC),d0

becomes 203a 6ead instead of 203a 7eaf ("The address of the operand is the sum of the address in the program counter (PC) and the sign-extended 16-bit displacement integer in the extension word")

Actually that is correct as the $7EAF is the absolute address of the target but is encoded relative to the current PC when the displacement is fetched, which is the word after the MOVE.l opcode.

mak wrote:
also, the addressing mode pc indirect with index doesnt seem to be working at all, the instruction
Code:
move.l   ($f,PC,a3),d0

which should become 203B B80F (programmers manual 2.2.12 / 2.1 / 4-118) gives an "displacement out of range" error.

Perhaps something is amis here... From Amiga assembly I seem to recall that

Code:
   MOVE.l   $xx(PC,Xn),d0
   MOVE.l   $xxxx(PC),d0

will calculate the displacement for you while

Code:
   MOVE.l   ($xx,PC,Xn),d0
   MOVE.l   ($xxxx,PC),d0

should accept the displacement value as is.

Anyone else?

Lee.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 4:06 pm 
Offline

Joined: Tue Nov 15, 2005 1:23 am
Posts: 2
That was quiet a quick response :-)
Quote:
Actually that is correct as the $7EAF is the absolute address of the target but is encoded relative to the current PC when the displacement is fetched, which is the word after the MOVE.l opcode.

I see, so the value in front of the brackets is interpreted absolute. It's a little bit confusing, as displacement suggests something relative (what happens with negative values?).
I just tested gcc and amiga phxass, and they don't seem to distinguish between $x(pc) and ($x,pc). if $x is a value, they always interpret it as relative displacement, if it is a label, they interpret it as absolute and calculate the displacement.
however, the addressing mode "pc indirect with index" doesn't seem to be working at all, neither $x(pc,dn) nor ($x,pc,dn).
thanks for looking into it.

martin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 8:44 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1040
EASy68K treats the numbers as absolute addresses and calculates the relative offset. This is consistent with the behavior of the Motorola, Teeside and Quelo assemblers.

Code:
00001000                org     $1000
00001000  203A 6EAD     move.l  ($7eaf,pc),d0
00001004  203B B009     move.l  ($100f,PC,a3),d0
00001008                end     $1000

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group