RomRaider Logo

RomRaider

Open Source ECU Tools
 FAQ •  Register •  Login 

RomRaider

Documentation

Community

Developers

It is currently Sat Feb 21, 2026 5:24 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: instruction for sh4b
PostPosted: Sun Oct 21, 2012 5:11 am 
Offline
Newbie

Joined: Thu Aug 09, 2012 2:58 am
Posts: 16
Hi i'm new to disassemble, someone can explain which is correct for the below SH4B instruction?

let assume R0=H'A

shll R0 ; R0 should shift left one bit, so it is H'A0 or H'B?

another question,

mov.w @R13, R6
cmp/gt R6,R14 ;if R6<R14, so T=0
bt loc_2D9A0
mov R6,R14
bra loc_2d976

since T=0 so need skip the bt loc_2D9A0, do we need execute mov R6,R14 or skip bt and mov all together?


Top
 Profile  
 
 Post subject: Re: instruction for sh4b
PostPosted: Sun Oct 21, 2012 1:39 pm 
Offline
RomRaider Developer

Joined: Thu May 21, 2009 1:49 am
Posts: 7323
Location: Canada eh!
Quote:
shll R0 ; R0 should shift left one bit, so it is H'A0 or H'B?
It would be H'14

Quote:
cmp/gt R6,R14 ;if R6<R14, so T=0
This is correctly stated as:
cmp/gt R6,R14 ;When signed and R14 > R6, T=1
(don't forget the condition when they are equal)
The move instruction would be skipped if T=1 as the BT instruction is not a BT/S instruction.

You'd be best to read the software manual, assuming this is a SH705x processor your are working with.
http://documentation.renesas.com/doc/pr ... h_2esm.pdf


Top
 Profile  
 
 Post subject: Re: instruction for sh4b
PostPosted: Sun Oct 21, 2012 5:14 pm 
Offline
Newbie

Joined: Thu Aug 09, 2012 2:58 am
Posts: 16
thanks for the explanation. read that manual many times just can't understand with just one example


Top
 Profile  
 
 Post subject: Re: instruction for sh4b
PostPosted: Mon Oct 29, 2012 5:31 pm 
Offline
Newbie

Joined: Thu Aug 09, 2012 2:58 am
Posts: 16
finally understand how is pull2d routine work. pull3d is much more complicated :oops:

how is the stack pointer R15 refer in below code?

fmov.s fr3,@(r0,r15)

r0 would be 8, but what is r15 refer to?


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject: Re: instruction for sh4b
PostPosted: Mon Oct 29, 2012 9:03 pm 
Offline
RomRaider Developer

Joined: Thu May 21, 2009 1:49 am
Posts: 7323
Location: Canada eh!
pull3D is just pull2D executed twice, once time against each axis. The result of the two intercept points in then blended together.
There is more that one pull2D and pull3D. There are quite a few of them depending on the data type table being pulled from. I know there's separate routines for tables with and without scaling entries, float, byte and word data.
There's also references to the data types in the pull routines, int8, unit8, int16, unit16 etc...

r15 is the stack pointer, so you will never know its true value. As code is executed the stack pointer changes with every call and interrupt. All you need to know is r15 is an address in RAM and all references to r15 is a reference to some address X (btw: at boot r15 is set to the 4-byte value stored at ROM address 0x04). So the statements:
mov.l r14, @-r15 means decrement r15 by 4 bytes then put the current value of r14 on the stack where r15 points.

For your example with r0 == 8;
fmov.s fr3,@(r0,r15) means, at the location pointed to by (r15+8) put the value of fr3. The value of r15 does not change.

You'll have to make your own map of where r15 points to in each routine. So if this routine calls another routine before this one is finished then r15 will change in the called routine and have a different map than the current routine.
More info is in the software manual section 5.2 Addressing Modes (Indirect indexed register addressing).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


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

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subsilver by phpBBservice.nl