pgmfi.org

Hacking up Honda's ECU
It is currently Fri Mar 29, 2024 4:31 am

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Oct 02, 2012 5:56 pm 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
Hi. I have a rather mind blowing question for me. Here is the code sample:

Code:
label1:
                CMP    A, X2
                JLT    label2
                ;...some more commands...

label2:     
                ST      A, 00000h[X1]
                L       A, er0
                ST      A, 00002h[X1]
                RT


"RT" instruction, according to "66201 Instruction Manual", is for returning from normal subroutine (subroutines that were called by "SCAL" or "CAL" commands). So, what will it do in the code above? Thanks a lot.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 04, 2012 6:40 am 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
When calling a routine by SCAL or CAL, the processor saves the return address ($SSP=PC+n & SSP=SSP-2).
RT instruction allows the return at the address saved (SSP=SSP+2 & PC=$SSP).

The instruction "jump" or another type of conditional or unconditional jump has nothing to do with "RT".


Top
 Profile  
Reply with quote  
PostPosted: Sat Oct 06, 2012 9:35 pm 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
dip wrote:
When calling a routine by SCAL or CAL, the processor saves the return address ($SSP=PC+n & SSP=SSP-2).
RT instruction allows the return at the address saved (SSP=SSP+2 & PC=$SSP).

The instruction "jump" or another type of conditional or unconditional jump has nothing to do with "RT".


I know that. That's why I'm asking. It is actual code that works and label2 is not called by SCAL or CAL command anywhere in the code.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 07, 2012 3:42 am 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
put the full code or the binary file because the listing in your message is too small.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2012 5:51 pm 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:09 am
Posts: 4383
Location: Cincinnati, Ohio
You're missing code flow.

Either Label1 or label2 (or label0 or label-1) could be the function call.

if you know C, think like this

void a_function(void) { a++; }

in assembly this will end up something like this:

label_a_function:
inc A
RT


When you want to use a_function, you use cal or scal a_function. You can do "bad things" by jumping in and out of functions that have pushed their return address on the stack. if you fail to pop the return address out of the stack but are "done" with the function, you can horribly smash the stack.

I'm probably not doing the BEST job explaining this but it's pretty standard programming architecture stuff. You're not looking at anything specific to the 66K here.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2012 6:27 pm 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
[Off topic]
Hello Blundar :D
This is very big pleasure to read you. 8)
[End of off topic]


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 14, 2012 12:46 am 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
blundar
Thanks a lot. I understood you fully. Finally, I really missed some cross reference calls. Now I found them and it makes perfect sense to me.

P.S. Does anyone still have an OKI 66k (66201 or 66207 or 66301) User Manual? Not an instructions manual (these things are all over the place). I have found only archive with the scans with a lot of missed pages.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 10:40 am 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
UP


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 12:47 pm 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
fl4r3 wrote:
I have found only archive with the scans with a lot of missed pages.
What pages do you want :?:


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 3:30 pm 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
dip wrote:
What pages do you want :?:

I'm missing the next pages:
1 to 12
16 to 24
page 40
58 to 66
122 to 123
132 to 148
173 - to the end

If you have any of them I will be more then happy to get them from you.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 3:40 pm 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
I don't have time for scan all pages you need.
What are the pages you need in the first time :?:


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 3:21 pm 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
For the time I'm missing pages 16-24 the most.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 4:00 pm 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
Ok, I do this in the week.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 5:09 pm 
Offline

Joined: Mon Mar 28, 2011 7:15 pm
Posts: 9
dip wrote:
Ok, I do this in the week.

Thank you a lot!


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 6:17 pm 
Offline
Senior Developer

Joined: Tue Jul 27, 2004 2:19 am
Posts: 653
Location: France
Attachment:
User Manual MSM66301 _ Page 16 to 24.rar
User Manual Page 16 to 24


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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 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

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