pgmfi.org

Hacking up Honda's ECU
It is currently Tue May 14, 2024 1:41 pm

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: using "off" in asm
PostPosted: Mon Nov 24, 2003 3:30 am 
Offline

Joined: Tue Jul 27, 2004 2:13 am
Posts: 22
i'm trying to use JBR and i am not sure what the "off" does. it looks like the JBR intruction can only take an 8 bit number so it uses the Offset and add it to the number. well, how do i know what off is set to and how can i change it?


Top
 Profile  
Reply with quote  
 Post subject: Re: using
PostPosted: Tue Nov 25, 2003 6:25 pm 
Offline

Joined: Tue Jul 27, 2004 2:21 am
Posts: 268
Location: Milwaukee, WI
Yes, "off N8" is an addressing mode in 66k assembler. My disassembler tends to produce confusing output, but it outputs what it does so you more easily can see what's really going on.

When you use off(xx), the address is really #yyxx. The LRB register controls what the upper eight bits (yy) are. The latest version of the disassembler tracks this:

MOV LRB, #00021h ; 03E6 1 108 ??? 572100

The '108' is the LRB, or Local Register Base. It means that the registers r0-r7/er0-er4 are located at #0108 in RAM. It also means that off(xx) is located at #01xx. (The ??? in this case is in the USP, or user stack pointer, column, and means USP hasn't been set yet).

The 66k User's Manual documentation explains more about addressing modes, and how the bitfields inside LRB are broken down.

A full example is here:

MOV LRB, #00021h ; 03E6 1 108 ??? 572100
MOV USP, #00280h ; 03E9 1 108 280 A1988002
L A, (00212h-00280h)[USP] ; 03ED 1 108 280 E392
ST A, off(00112h) ; 03EF 1 108 280 D412

(0212h-0280h)[USP] = 92h[USP], which is the value that appears in a USP-relative addressing instruction; in this case the disassembler has predicted USP to be 0280 and thus the actual address being accessed is 0212h.

off(0112h) = off(12h), since the field is truncated to 8 bits. The disassembler has predicted the offset register to be 01xx, so the actual address being accessed here is 0112h.

[%sig%]

Post Edited (11-25-03 17:28)


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

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:  
Powered by phpBB® Forum Software © phpBB Group