NefMoto

Technical => Reverse Engineering => Topic started by: davetuner on July 04, 2013, 03:49:59 AM



Title: Keil C166 Question
Post by: davetuner on July 04, 2013, 03:49:59 AM

Hi,

I've got my head now round the dis-assembly with IDA and before I write the new function I had in mind I wanted to assemble the NLS function from asm code to make sure I get the same binary result.

When I try to assemble the function in Keil I get the following error on each line of code.

NLS.A66(39): error A44: NO CURRENTLY ACTIVE SECTION

Anybody knows what I'm doing wrong here?


I'm using this code:

Code:
;8E800:					
jnb FD38.8, 8E82Ah
mov r4, 380E40h
exts #81h, #1 ; ''
mov r9, 17E00h
cmp r4, r9
jmpr cc_NC, 8E82Ah
mov r4, F87A
exts #81h, #1 ; ''
mov r9, 17E02h
cmp r4, r9
jmpr cc_ULE, 8E82Ah
movb 380DACh, ZEROS
jmpr cc_UC, 8E888h
; ---------------------------------------------------------------------------

;8E82A:
jnb FD38.8, 8E880h
jb FD38.6, 8E876h
mov r4, F87A
exts #81h, #1 ; ''
mov r9, 17E06h
cmp r4, r9
jmpr cc_ULE, 8E876h
movbz r4, 380B02h
exts #81h, #1 ; ''
movbz r9, 17E08h
cmp r4, r9
jmpr cc_ULE, 8E876h
exts #38h, #1 ; '8'
mov r4, 384FF0h
exts #81h, #1 ; ''
mov r9, 17E04h
cmp r4, r9
jmpr cc_NC, 8E888h
movb 380DACh, ZEROS
add r4, #1
exts #38h, #1 ; '8'
movb 384FF0h, rl4
jmpr cc_UC, 8E888h
; ---------------------------------------------------------------------------

;8E876:
exts #38h, #1 ; '8'
mov 384FF0h, ONES
jmpr cc_UC, 8E888h
; ---------------------------------------------------------------------------

;8E880:
exts #38h, #1 ; '8'
mov 384FF0h, ZEROS

;8E888:
movb rl4, 380AF3h
rets
end;

Cheers,
Dave


Title: Re: Keil C166 Question
Post by: prj on July 04, 2013, 04:49:40 AM
$MOD167
$SEGMENTED


<define your constants here>

yourname SECTION CODE 'NCODE'

proc1 proc far

<your code here>

proc1 endp

...

procx proc far

<your code here>

procx endp

yourname ends

END


Title: Re: Keil C166 Question
Post by: marrakech on July 03, 2015, 02:37:03 PM
I'm trying to find option, which allow me write code for Keil asm from selected address...

For example. I want to patch some code in IDA from addr  0x1blablabla
But firstly, i want to test this patch in Keil. I create new project, asm project. Then  write, check, compile... but code addressing from reset_handler  goind bytes by bytes... +1 +1 +1 ...

How can i tell to keil compile some routine and put this to specific address ?
reser_hadler:
      call  routine

0xblablabla:  routine:
   ............
   ..........
   .......
                  rets


Thanks. :)





Title: Re: Keil C166 Question
Post by: prj on July 09, 2015, 10:40:36 AM
I'm trying to find option, which allow me write code for Keil asm from selected address...

For example. I want to patch some code in IDA from addr  0x1blablabla
But firstly, i want to test this patch in Keil. I create new project, asm project. Then  write, check, compile... but code addressing from reset_handler  goind bytes by bytes... +1 +1 +1 ...

How can i tell to keil compile some routine and put this to specific address ?
reser_hadler:
      call  routine

0xblablabla:  routine:
   ............
   ..........
   .......
                  rets


Thanks. :)





Why would you put it at specific address?
Put it in a normal binary file and then put it into an address by hand.

You will have to enter the calls in hex anyway into the locations you need, so what does it matter?

Or are you trying to compile the entire disassembly?!?