NefMoto

Technical => Reverse Engineering => Topic started by: elRey on March 29, 2012, 04:48:07 PM



Title: What does this line of assembly code mean?
Post by: elRey on March 29, 2012, 04:48:07 PM
Kind a general thread where one can ask what one or a small set of instructions is doing. NOT for asking what a whole function or several lines is doing. In the spirit of us newbies trying to wrap our heads around assembly language itself, not so much ME7.

I'll start.
Code:
extp    #0E1h, #1
the middle line in:
Code:
mov     r4, #1000h
extp    #0E1h, #1 ; 'ß'
mov     flamsl_w_word_3849F0, r4

So what's going on after r4 is set to 1
and before r4 (now 1) is moved to RAMword_3849F0 (flamsl_w)?

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: nyet on March 29, 2012, 04:54:46 PM
Not that I know anything about C166 ASM, but from the C166 manual:

Syntax EXTP op1, op2
Operation (count) ← (op2) [1 ≤ op2 ≤ 4]
Disable interrupts and Class A traps
Data_Page = (op1)
DO WHILE ((count) ≠ 0 AND Class_B_trap_condition ≠ TRUE)
Next Instruction
(count) ← (count) - 1
END WHILE
(count) = 0
Data_Page = (DPPx)
Enable interrupts and traps
Description Overrides the standard DPP addressing scheme of the long and
indirect addressing modes for a specified number of instructions.
During their execution both standard/PEC interrupts and class A
hardware traps are locked. The EXTP instruction becomes
immediately active such that no additional NOPs are required.
For any long (‘mem’) or indirect ([…]) address in the EXTP
instruction sequence, the 10-bit page number (address bits A23 -
A14) is not determined by the contents of a DPP register but by the
value of op1 itself. The 14-bit page offset (address bits A13 - A0)
is derived from the long or indirect address as usual. The value of
op2 defines the length of the effected instruction sequence.


Title: Re: What does this line of assembly code mean?
Post by: elRey on March 29, 2012, 04:56:49 PM
Yeah, I read that..... Over my head a little. I should add to 1st post 'For Dummies'

What I'm looking for in an answer is something like...

It jump to address 0E1+1000 (address 10E1) and runs one line of code (#1) then jumps back and continues.

Obviously that's not it, but explained liked that, please.


Title: Re: What does this line of assembly code mean?
Post by: nyet on March 29, 2012, 04:58:23 PM
So

EXTP #0E1h, #1

means

"ignore dpp for one (1) instruction following this EXP, and use page 0xe1 instead"



Title: Re: What does this line of assembly code mean?
Post by: nyet on March 29, 2012, 05:00:31 PM
In other words, I know the exact address is

flamsl_w_word_3849F0 | (0xe1 << 14)

and not

flamsl_w_word_3849F0 | (dpp << 14)


Title: Re: What does this line of assembly code mean?
Post by: nyet on March 29, 2012, 05:09:44 PM
You're telling the cpu that this is a location that is definitely not in the current page pointed to by dpp (but you know exactly where it is, since its a constant absolute, not relative, location)

If you're an x86 programmer, this is basically a "far" pointer deference (update both the segment and offset).

on the C166, you can do this in one fell swoop (protected atomically) w/o have to save/restore the segment.


Title: Re: What does this line of assembly code mean?
Post by: elRey on March 29, 2012, 05:10:31 PM
Thank you.


Title: Re: What does this line of assembly code mean?
Post by: elRey on May 09, 2012, 07:18:33 PM
Trying to figure out relative locations...

Starting @ address 8B41A:
Code:
mov     r12, #2148h
mov     r13, #206h
movbz   r14, byte_F89C
movbz   r15, byte_380A61
calls   83h, LookupM_833f24 ; KFLDRXO Lookup

What address does the first line refer to? (#2148h = what address?  xx148)

From another file starting @ address 8E398:
Code:
mov     r12, #19BAh
mov     r13, #206h
movbz   r14, byte_F89C
movbz   r15, byte_380A5F
calls   82h, LookupM_825eac ; KFLDRXO Lookup

I know the first line refers to address 199BA (#19BAh = 199BA)

When I see address references like this, how can I figure out what absolute address they are pointing to?

I don't understand the #1xxx vs #2xxx part.

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: nyet on May 09, 2012, 07:32:17 PM
i dont understand what you mean by #1xxx and #2xxx. that makes no sense :/

#19BAh is 0x19BA
#206h is 0x0206

the upper bits of the actual address are whatever is in the appropriate DPP register.



Title: Re: What does this line of assembly code mean?
Post by: nyet on May 09, 2012, 07:39:24 PM
I know the first line refers to address 199BA (#19BAh = 199BA)

the bottom 14 bits of 0x199BA is 0x199BA & 0x0x3fff = 0x19ba
the upper bits of 0x199BA is 0x18000>>14 = 6

So dpp is 6.

so dpp | 0x206 is 6<<14 | 0x206 = 0x18000 | 0x206 = 0x18206


Title: Re: What does this line of assembly code mean?
Post by: elRey on May 09, 2012, 07:48:49 PM
i dont understand what you mean by #1xxx and #2xxx. that makes no sense :/

sorry. b/c of my lack of understanding.

comparing the first line of the two files:

mov     r12, #2148h
vs
mov     r12, #19BAh

I know the 2nd (#19BAh) = 199BAH because I've mapped that file.
But the 1st (#2148h) I can't figure out.

Seemed to me that only the last 3 digits were part of the absolute address (148 and 9BA). I can't figure out the #1 and #2 that each begins with.


the bottom 14 bits of 0x199BA is 0x199BA & 0x0x3fff = 0x19ba

Can you explain this using #2148h please?


Title: Re: What does this line of assembly code mean?
Post by: nyet on May 09, 2012, 09:34:56 PM
#1 and #2 doesn't mean what you think it does.

ignore the #

it just means its a constant.

dpp | 0x2148 is 6<<14 | 0x2148 = 0x18000 | 0x2148 = 0x1a148

14 bits is halfway through that digit. You can't do it by digits.

8|2 = 10 = 0xa


Title: Re: What does this line of assembly code mean?
Post by: matchew on May 09, 2012, 09:39:51 PM

But the 1st (#2148h) I can't figure out.


0x1A148

The clue is in the 2nd line down in both examples. R12 and R13 are both used to describe an address outside of the current data page.


Title: Re: What does this line of assembly code mean?
Post by: rajivc666 on May 09, 2012, 11:22:19 PM
Ideally You will have to reverse the two functions that are called (calls   83h, LookupM_833f24 & calls   82h, LookupM_825eac) to understand which memory address they are referring to. But as matchew said it is most likely going to be 206H * 4000H + #2148h =  8, 1a148h in the first case and similar in the second.


Title: Re: What does this line of assembly code mean?
Post by: nyet on May 14, 2012, 01:27:30 PM
Also, you have to figure out what data segment each subroutine thinks they sit in, and keep an eye out for anything that modifies the segment register(s) (for this processor, the dpp registers)

Otherwise, you'll have no prayer at figuring out what a near pointer is actually pointing to.


Title: Re: What does this line of assembly code mean?
Post by: elRey on May 15, 2012, 01:49:06 PM
Quote
the bottom 14 bits of 0x199BA is 0x199BA & 0x0x3fff = 0x19ba
the upper bits of 0x199BA is 0x18000>>14 = 6

^I don't get this at all.

Wait. Oh I see.
11001100110111010

--001100110111010 = 19ba
11000000000000000 = 18000


Title: Re: What does this line of assembly code mean?
Post by: elRey on May 15, 2012, 02:00:55 PM
Code:
mov     r12, #0A17h
mov     r13, #206h
movbz   r14, byte_F89C
calls   82h, LookupI_825c24 ; References a lookupI table
movb    byte_381E4A, rl4
mov     r12, #848h
mov     r13, #207h
mov     r14, word_F89E
calls   82h, LookupJ_825c98 ; References a lookupJ table

mov     r12, #0A17h
mov     r13, #206h

#0A17h = 18A17 Looks right. It lands me at the map I expect.

mov     r12, #848h
mov     r13, #207h

#848h = 18848 Looks wrong. It lands me in the middle of a map (wrong map).

??


Title: Re: What does this line of assembly code mean?
Post by: matchew on May 15, 2012, 02:49:48 PM
mov     r12, #848h
mov     r13, #207h

#848h = 18848 Looks wrong. It lands me in the middle of a map (wrong map).

??

Try 0x1C848....

The difference is 206 vs 207


Title: Re: What does this line of assembly code mean?
Post by: elRey on May 15, 2012, 03:03:42 PM
right on the dot. Thanks. I can't say I understand it, but I believe I'm seeing the pattern.

Thanks guys.


Title: Re: What does this line of assembly code mean?
Post by: nyet on May 15, 2012, 04:05:13 PM
Try 0x1C848....

The difference is 206 vs 207

I'm curious as to why... is r13 used to modify dpp in the subroutine?


Title: Re: What does this line of assembly code mean?
Post by: ArgDub on May 15, 2012, 04:28:22 PM
I'm curious as to why... is r13 used to modify dpp in the subroutine?

What Andy's plugin names as LookupJ is a 1d map lookup function that returns a 16bit unsigned value, X axis is also 16bit unsigned. The parameters passed are: r12 = map address, r13 = Map DPP, r14: X variable.


Title: Re: What does this line of assembly code mean?
Post by: nyet on May 15, 2012, 04:33:33 PM
right on the dot. Thanks. I can't say I understand it, but I believe I'm seeing the pattern.

If R13 is used to pass DPP

0x207<<14 | 0x848 = 0x81c848

I'm assuming the rom is mapped to 0x80000, which means the offset into the ROM is 0x1c848

or, to make things easier

0x7<<14 | 0x848 = 0x1c848


Title: Re: What does this line of assembly code mean?
Post by: ArgDub on May 15, 2012, 04:46:12 PM
Correct, function LookupJ expects a pointer (r13 << 14 | r12) to map's X_AxisLength, following X_AxisLength is the X_Axis itself and the map is next to the axis


Title: Re: What does this line of assembly code mean?
Post by: elRey on October 20, 2012, 04:39:29 PM
Code:
mov     r12, #2B94h     ; KFZW2 Map
mov     r13, #3BC4h     ; KFZW2 Load axis
mov     r14, word_380CDE
mov     r15, word_380CEE
calls   0, sub_2B24     ; KFZW2 Lookup

How does the sub_2B24 WLookup2D_Spark function know where the RPM axis is? (which is @ 13B64)

code right before lookup:

Code:
ZWGRU:
mov     [-r0], r9
mov     [-r0], r7
mov     [-r0], r6
sub     r0, #2
mov     r4, word_382C14
extp    #20Ah, #1
cmp     r4, word_829FE4
jmpr    cc_NC, loc_8B8E4C

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: rajivc666 on October 21, 2012, 06:39:18 AM
The memory locations 380cde and 380cee contains a factor for load and rpm, since the dimensions of the tables are known, starting point and factors of the axes are sufficient to look up the table. 


Title: Re: What does this line of assembly code mean?
Post by: elRey on October 21, 2012, 11:03:14 AM
Map and axis are in different locations. i.e. the axis are not next to map. Nor are they next to each other. The code only references the map location and one of the axis location. How does it know where the other axis is located?

380cde and 380cee I assumed were the inputs for the lookup. Am I wrong?


Title: Re: What does this line of assembly code mean?
Post by: matchew on October 21, 2012, 11:35:51 AM
0x380CDE and 0x380CEE I assumed were the inputs for the lookup. Am I wrong?

No you are correct. These are the variables that each axis uses. One of which is tied to a specific axis, the other can be applied to various different axis.


Title: Re: What does this line of assembly code mean?
Post by: rajivc666 on October 21, 2012, 11:42:04 AM
One thing you should understand is that these axes in definitions are made for humans, the ecu may not be using it as projected in definitions. If you decode the part were the memory locations 0x380CDE and 0x380CEE get their values you will understand.


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on October 21, 2012, 01:18:16 PM
If you decode the part were the memory locations 0x380CDE and 0x380CEE get their values you will understand.

This.

The axis is referenced in the assignment of the Stutzstellen variables.

mov     r12, #0C1h ; '-' ; Move Word                  
movbz   r13, nmot       ; Move Byte Zero Extend        
mov     r14, SNM16ZUUB_w ; Move Word                  
calls   0, sub_75D2   ; Call Inter-Segment Subroutine
mov     SNM16ZUUB_w, r4 ; Move Word                    


Title: Re: What does this line of assembly code mean?
Post by: elRey on November 23, 2012, 10:13:19 AM
Ah I get it. That last line keeps the axis location in memory. Cool.


Title: Re: What does this line of assembly code mean?
Post by: elRey on February 12, 2013, 11:50:01 AM
Code:
movb    rl7, #40h ; bit6
movb    rl6, #0
mov     r12, #9957h
movbz   r4, rl6
add     r12, r4
movb    rl4, [r12]
orb     rl4, rl7
movb    [r12], rl4

Could someone explain these lines of code please? What do the square brackets [] do? I'll see if I can find what #9957h referes to.


And likewise, why does this look like it's redundant (repeating):
Code:
movb    rl7, #4
movb    rl6, #0
mov     r12, #9957h
movbz   r4, rl6
add     r12, r4
movb    rl4, [r12]
orb     rl4, rl7
movb    [r12], rl4
movb    rl7, #4         ; bit2
movb    rl6, #0
mov     r12, #9957h
movbz   r4, rl6
add     r12, r4
movb    rl4, [r12]
orb     rl4, rl7
movb    [r12], rl4

Do the [r12] increment places or something?

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: nyet on February 12, 2013, 12:12:20 PM
I believe [] is a dereference.

i.e. [r12] refers to the contents of memory at the location pointed to by the contents of r12, rather than just the contents of r12


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on February 12, 2013, 01:42:27 PM
I believe [] is a dereference.

i.e. [r12] refers to the contents of memory at the location pointed to by the contents of r12, rather than just the contents of r12

Bingo.

Memory is being read from 9957h rather than 9957h being read as data itself.


Title: Re: What does this line of assembly code mean?
Post by: elRey on February 12, 2013, 01:55:56 PM
Thanks, but why does it look like it runs the same thing twice where the outcome seems to be the same?


Title: Re: What does this line of assembly code mean?
Post by: nyet on February 12, 2013, 03:32:36 PM
elray: from my quick reading you appear to be right. Not sure why.


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on February 12, 2013, 04:35:55 PM
Hard to tell a whole lot from an out of context code snippet on the internet, but it looks some of the possible functionality is not being used.

The fact that 9957h is being offset by a hardcoded 0. I've seen alot of places in the code where some functionality that might be used in other applications is disabled in one way or another. It looks to be designed to use 9957h as a base and offset to different locations each timing or'ing with a hex value.


Title: Re: What does this line of assembly code mean?
Post by: Geremia on February 16, 2013, 08:54:23 AM
Thanks, but why does it look like it runs the same thing twice where the outcome seems to be the same?

Probably it's just compiler issue or lazyness about source code optimizing, given 9957 as a simple ram addr.
But, if 9957 is a memorymapped register for some peripheral (mmu, controller of something), the double writing 40 could assume a meaning.


Title: Re: What does this line of assembly code mean?
Post by: elRey on April 19, 2013, 12:31:27 PM
Disassembly:
Code:
mov     r4, word_3839C2

HEX:
Code:
F2 F4 C2 B9

Jump to xref doesn't show where word_3839C2 is written, only read. That part may not have been disassembled by plug-in. What do I search in HEX to find where word_3839C2 is written to?

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: Bische on June 19, 2013, 04:38:32 AM
Im trying to find an adress, but I got stuck on how it is pointed to:

Code:
loc_893730:
mov     r12, #215Ah
mov     r13, #206h
movbz   r14, tmot
calls   83h, sub_833D44
extp    #0E1h, #1 ; 'ß'
movb    byte_3848E6, rl4
movbz   r4, byte_FA1C  
movb    rl5, [r4+6A7Ch]
movb    [r0], rl5
mov     r4, [r0]
bmov    word_FD86.4, r4.0
bmov    word_FD86.5, r4.1
bmov    word_FD86.6, r4.2
bmov    word_FD86.7, r4.3
bmov    word_FD86.8, r4.4
bmov    word_FD86.9, r4.5
bmov    word_FD86.10, r4.6
bmov    word_FD86.11, r4.7
add     r0, #2
mov     r8, [r0+]
mov     r9, [r0+]
rets
; End of function sub_893660

movbz   r4, byte_FA1C  
movb    rl5, [r4+6A7Ch]
movb    [r0], rl5
mov     r4, [r0]


I initially thought it was as simple as FA1C+6A7C, since FA1C is a CAN adress(lws_w, steering angle), but that does not line up.

Or is it reading the content of the memory and adding 6A7C to point to the codeword? Seems unlikely to me..

In the known bin I have it is pointed to a hard adress.


Title: Re: What does this line of assembly code mean?
Post by: prj on June 20, 2013, 03:57:00 AM
Log with ME7Logger what value is stored in FA1C.
Looks like variant coding to me.

Then add what is stored in FA1C to 0x6A7Ch.
0x6A7Ch is the main address and FA1C stores an offset that is added to it.

In your known bin there is just one variant and it is not possible to have multiple values for different codings.
In this bin looks like 0x816A7Ch contains multiple values and they are accessed based on variant coding.

hth.


Title: Re: What does this line of assembly code mean?
Post by: Bische on June 22, 2013, 12:41:37 AM
Thanks, I will try that.


Title: Re: What does this line of assembly code mean?
Post by: elRey on June 27, 2013, 11:11:22 AM
Code:
movb    rl4, #0
bmov    r4.0, word_FD3E.6
cmpb    rl4, #1
jmpa    cc_NZ, loc_85A838

Is the third line byte comparing constants 00 and 01 ? If so, does that mean code never jmps to loc_85A838?
i.e. code at loc_85A838 has been permanently disabled?


Title: Re: What does this line of assembly code mean?
Post by: prj on June 27, 2013, 11:50:17 AM
No.

it checks if FD3E.6 is set, and branches if it's not.


Title: Re: What does this line of assembly code mean?
Post by: elRey on June 27, 2013, 12:10:33 PM
is r4.0 the same as r14 ???


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on June 27, 2013, 12:11:16 PM
It's rl4, as in the low byte of r4.


Title: Re: What does this line of assembly code mean?
Post by: elRey on June 27, 2013, 12:40:27 PM
wow. The whole time I'm reading r14 not rl4.  Thanks to both of you.


Title: Re: What does this line of assembly code mean?
Post by: elRey on October 28, 2013, 12:52:57 PM
I need help changing referenced mem location.

Code:
mov     [-r0], r9
mov     [-r0], r7
mov     [-r0], r6
sub     r0, #2
extp    #0E1h, #1 ; 'ß'
movb    rl4, fnwue_byte_384905
cmpb    rl4, #0FFh
jmpr    cc_NZ, loc_8A1922

in hex:
Code:
88 90 
88 70
88 60
28 02
D7 40 E1 00 
F3 F8 05 09
47 F8 FF 00
3D 10

I'd like to change it so instead of comparing fnwue_byte_384905 with #0FFh, it compares newvar_byte_380ACC.

I tried changing

F3 F8 05 09
to
F3 F8 CC 8A

but there seems to be a segment issue. It then references lamfaw_w_word_384ACC. How do I get it to 380xxx instead 384xxx ?

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: elRey on October 28, 2013, 01:44:16 PM
Funny thing, this seems to point back to the original post :)

I nop the extp line and it worked.


Title: Re: What does this line of assembly code mean?
Post by: elRey on July 08, 2014, 08:41:55 AM
Can someone explain why the lines circled in yellow are needed? I think I get the third circle. It's compiling the results of the mulu above.

edit: I included more of the function. Is the first circle needed because of r3 being the result of a divlu further up? Would it be needed if it were only udslsum_l_word_380E06 (move r3, udslsum_l_word_380E06) ?

This is ggdsas_ggdsl

Thanks,
Rey

(http://creativeion.com/rey/vw/help/me7/ggdsas_ggdsl.gif)


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on July 09, 2014, 02:05:31 PM
The first one is making input voltage and DSLGRAD like factors.

The last two are converting 32 to 16 bit.


Title: Re: What does this line of assembly code mean?
Post by: elRey on July 09, 2014, 02:38:47 PM
Thank you! So if I start with 'like factors' I don't need that first one. Got it.


Title: Re: What does this line of assembly code mean?
Post by: terminator on August 25, 2014, 12:18:58 PM
Seg0x209@824000:5C1C                 mov     r10, r14
Seg0x209@824000:5C1E                 extp    r13, #1
Seg0x209@824000:5C20                 mov     r14, [r12+]
Seg0x209@824000:5C22                 mov     r4, #0
Seg0x209@824000:5C24                 mov     r5, #0

Please give me a hint what does [r12+] mean?


Title: Re: What does this line of assembly code mean?
Post by: dream3R on August 25, 2014, 02:21:42 PM
Add indirect word memory to direct GPR and post-increment source pointer by 2.

(From the manual) :)


Title: Re: What does this line of assembly code mean?
Post by: terminator on August 25, 2014, 02:31:21 PM
Thanks!) Couldnt find it)


Title: Re: What does this line of assembly code mean?
Post by: terminator on September 23, 2014, 02:23:23 PM
I know its a noob question but extp changes only op2? Or both op1 and op2?

For example,
extp r13, #1;
mov op1, op2








Title: Re: What does this line of assembly code mean?
Post by: terminator on September 23, 2014, 04:32:22 PM
This is part of LDRXN subroutine:

extp    r13, #3 ; I dont understand it. Because if there are 20Ah pages (r13) after subtraction the final result will be 0, I mean without 20A pages, and looks like no sense to use EXTP in that case?
sub     r4, [r2]        ; nmot - LDRXN RPM
mov     r5, [r2+2]      ; LDRXN RPM to r5
sub     r5, [r2]


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on September 23, 2014, 05:20:52 PM
I know its a noob question but extp changes only op2? Or both op1 and op2?

For example,
extp r13, #1;
mov op1, op2

No op1 is the page and op2 is the number of lines affected.

This is part of LDRXN subroutine:

extp    r13, #3 ; I dont understand it. Because if there are 20Ah pages (r13) after subtraction the final result will be 0, I mean without 20A pages, and looks like no sense to use EXTP in that case?
sub     r4, [r2]        ; nmot - LDRXN RPM
mov     r5, [r2+2]      ; LDRXN RPM to r5
sub     r5, [r2]

r13 is the page and it is applied to the address that r2 points to for all three lines


Title: Re: What does this line of assembly code mean?
Post by: terminator on September 24, 2014, 12:56:42 AM
Thank you! I got it.


Title: Re: What does this line of assembly code mean?
Post by: terminator on October 11, 2014, 01:51:28 PM
Please help me with [-r0].

r15, byte_81ED35;        the offset contains 6
mov     [-r0], r15;           move 6 to r0, then r0 offset =  81ED33 ???


Title: Re: What does this line of assembly code mean?
Post by: phila_dot on October 11, 2014, 02:33:27 PM
No, that is a stack pointer


Title: Re: What does this line of assembly code mean?
Post by: terminator on October 11, 2014, 04:03:22 PM
Thank you very much as usual) Your help is always useful.


Title: Re: What does this line of assembly code mean?
Post by: terminator on October 17, 2014, 04:38:55 PM
Solved


Title: Re: What does this line of assembly code mean?
Post by: elRey on January 07, 2015, 10:36:02 AM
Code:
mov     r4, #1Eh
mov     r5, #120h
extp    r5, #1
movb    rl3, [r4]
movb    byte_3809B2, rl3
mov     r4, #20h ; ' '
mov     r5, #120h
extp    r5, #1
movb    rl2, [r4]
movb    byte_3809B3, rl2

How can I find out what is being moved into the RAM locations?

what are:

mov     r4, #1Eh
and
mov     r4, #20h

Also, what's the purpose of the mov     r5, #120h lines?

I'm guess #120h together with #1Eh point to somewhere. How can I decipher to where?

From the context I would guess an IRAM address like F71E or F61E.

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: terminator on January 07, 2015, 11:59:52 AM
mov     r4, #1Eh
mov     r5, #120h
extp    r5, #1
movb    rl3, [r4];               
movb    byte_3809B2, rl3; move byte from 48001E to 3809B2




Title: Re: What does this line of assembly code mean?
Post by: elRey on January 08, 2015, 12:07:13 PM
48001E ?

where that ?


Title: Re: What does this line of assembly code mean?
Post by: terminator on January 08, 2015, 01:05:55 PM
48001E ?

where that ?

I don't know, but its according to this part of code. Its Bosch or Siemens?
In my opinion the code could be much shorter also.


Title: Re: What does this line of assembly code mean?
Post by: MIL_on on January 21, 2015, 02:22:29 PM
i found this several times, but i dont get what it is good for to double the high and low byte of mul? I'm sure its kind of a standard structure and someone can give me a useful hint  ;D

Code:
mov     r5, word_FE0E
add     r5, r5
mov     r5, word_FE0C
addc    r5, r5          ; Warum 2*r5?
jmpr    cc_NC, loc_8064CA6


Title: Re: What does this line of assembly code mean?
Post by: elRey on February 17, 2015, 01:47:42 PM
extp    #120h, #1

I get when it's #204h - #208h, etc but where is #120h ?

Thanks,
Rey


Title: Re: What does this line of assembly code mean?
Post by: terminator on February 18, 2015, 11:09:42 AM
480000


Title: Re: What does this line of assembly code mean?
Post by: elRey on February 21, 2015, 08:03:59 PM
That didn't make any sense until I read this -> http://nefariousmotorsports.com/forum/index.php?topic=1386.0


Title: Re: What does this line of assembly code mean?
Post by: Cloudforce on March 13, 2015, 02:07:34 AM
(edit)

got it


Title: Re: What does this line of assembly code mean?
Post by: A4Rich on May 20, 2015, 08:32:58 PM
Trying my hand at IDA again...  I am looking for the axes for KFZKLAMFAW (@26B04) in the 518AK 003 bin.  I located the following code, am I heading in the right direction.  ???
 
Code:
sub_1BF574:
mov     [-r0], r6
mov     r12, #2B20h
movbz   r13, nmot
mov     r14, loc_AE62
calls   0, loc_2862
mov     loc_AE62, r4
movbz   r5, 2B04h ; 812B04h
and     r5, #1
jmpr    cc_NZ, loc_1BF596
bset    USR0
jmpr    cc_UC, loc_1BF598


Title: Re: What does this line of assembly code mean?
Post by: TijnCU on April 01, 2016, 02:13:11 AM
Bump. I thought this was a usefull topic!
I'm disassembling Phila_dot's map switching routine by first just naming every operation in the funtion. I am very unfamiliar with assembly code, so I feel I learn the operations better this way.
As I move further through the code, I begin to get a tiny bit of understanding about how this code works, but now I have arrived at a section where hex code gets moved into adresses.
Am I right to say that for example
Code:
mov     r6, #****h
mov     word_012345, r6
means move #****h as code into r6?
**=BSET bitoff.6   **=CMPD2 Rw, #data4 according to the C166 instruction set manual.
Or is it supposed to be just a hex value? Or an adress? I have not looked at word_012345 yet because I just copied the code section of the function into a txt file to get some basic understanding by "translating" it.
Any hints? Thanks!


Title: Re: What does this line of assembly code mean?
Post by: DT on April 01, 2016, 03:30:29 AM
I think you should ask phila if he wants to release the code to public instead of discussing his code which he also protected slightly from beeing stolen without giving him credit.
You really need to learn more before working with this. The 2 lines simply place #6fb0h at 383f54.


Title: Re: What does this line of assembly code mean?
Post by: TijnCU on April 01, 2016, 10:05:03 AM
DT was right, I needed to learn more about this.  ;D
To make up for my stupid question I will try to help A4Rich.

Trying my hand at IDA again...  I am looking for the axes for KFZKLAMFAW (@26B04) in the 518AK 003 bin.  I located the following code, am I heading in the right direction.  ???
 

To me it looks like your nmot axis could possibly be at 2B20h, but its hard to know from just this little section of code..  what size is the axis?

In my binary I dont have KF-ZKLAMFAW but there is ZKLAMFAW (time constant). It is a word and it is moved in r12 right after lamrlmn_w is moved in r8. I have an older ecu (4B), but maybe it is worth to check in your idb if your ecu uses similar code.
Code:
extp #0E1h, #1
cmp  r8, lamrlmn_w
jmpr  cc_ULE, loc_zklamfaw
extp  #0E1h, #1
mov  r8, lamrlmn_w

loc_zklamfaw:

extp  #207h, #1
mov  r12, word_81xxxx ; this is zklamfaw
mov  r13, r8
mov  r14, word_38xxxx
mov  r15, word_38xxxx
calls  0, sub_xxxx