Jump on absolute address
Discussion in "Project Addition or Changes" started by Utsavi Jun 6, 2017.
Tue Jun 06 2017, 05:29 pm
Hello,
I am using PXAG-49. I am using Tasking EDE which uses c166 compiler.
In project I have 2 different files one is in c and one is in assembly. The assembly code I placed on address 0F000H like., ORG 0F000H.
In c file i am running my mail program. On certain condition I want to jump on address 0F000H address. Can anybody tell me how to jump on this address in C.
I tried to write like.
#pragma asm
JMP 0F000H
#pragma endasm
with successfully compiled, on the otherside in asm program ,I placed debug point in my asm program that showing me program not jumping on this address.
Regards
Utsavi Bharuchwala
I am using PXAG-49. I am using Tasking EDE which uses c166 compiler.
In project I have 2 different files one is in c and one is in assembly. The assembly code I placed on address 0F000H like., ORG 0F000H.
In c file i am running my mail program. On certain condition I want to jump on address 0F000H address. Can anybody tell me how to jump on this address in C.
I tried to write like.
#pragma asm
JMP 0F000H
#pragma endasm
with successfully compiled, on the otherside in asm program ,I placed debug point in my asm program that showing me program not jumping on this address.
Regards
Utsavi Bharuchwala
[ Edited Tue Jun 06 2017, 05:46 pm ]
Wed Jun 07 2017, 03:46 am
to jump from c its better to use function pointers e.g.
/* define a pointer */ void (*fptr)(void); /* assign address */ fptr = 0xF000; /* then jump */ fptr();
Wed Jun 07 2017, 11:17 am
Hi Ajay,
Thanks for reply. I tried your code. But that is not working for me.It seems like program is reseting itself.
Any other suggestions?
Regards
Utsavi Bharuchwala
Thanks for reply. I tried your code. But that is not working for me.It seems like program is reseting itself.
Any other suggestions?
Regards
Utsavi Bharuchwala
Thu Jun 08 2017, 05:14 am
I suggest you write a very simple program.. just a few lines of C and assembly.
Then look at the lst file / map and see what code was actually created.
Is a jump what you want or a call ?
Then look at the lst file / map and see what code was actually created.
Is a jump what you want or a call ?
Thu Jun 08 2017, 11:14 pm
I think what phil has suggested is correct, you need to first check if you code is getting linked properly or not. what IDE are you using?
Mon Jun 12 2017, 04:16 pm
Hello
Thanks for quick reply.
Yes I am able to jump on absolute address using JMP instruction.
Problem is when I am merging my 2 files(.c ->main file, .asm->Work defined file) JMP is not working for this case.
Both files are compiled by Tasking EDE
Note that .asm file start at ORG 0F000H.
Why it is so?
Regards
Utsavi Bharuchwala
Thanks for quick reply.
Yes I am able to jump on absolute address using JMP instruction.
Problem is when I am merging my 2 files(.c ->main file, .asm->Work defined file) JMP is not working for this case.
Both files are compiled by Tasking EDE
Note that .asm file start at ORG 0F000H.
Why it is so?
Regards
Utsavi Bharuchwala
Tue Jun 13 2017, 03:13 am
Your 'c' file and your assembly file are created at different times then linked.
It may be that your assembly file is not actually being created.
The problem comes at the linking stage, it is often complicated and will
be different for each compiler/IDE.
I would avoid it like the plague !
Try to use in-line assembly or re-write your assembly code in 'c'.
It may be that your assembly file is not actually being created.
The problem comes at the linking stage, it is often complicated and will
be different for each compiler/IDE.
I would avoid it like the plague !
Try to use in-line assembly or re-write your assembly code in 'c'.
[ Edited Tue Jun 13 2017, 11:11 pm ]
Powered by e107 Forum System