Discussion in "Project Addition or Changes" started by    Utsavi    Jun 6, 2017.
Tue Jun 06 2017, 05:29 pm
#1
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


[ Edited Tue Jun 06 2017, 05:46 pm ]
Wed Jun 07 2017, 03:46 am
#2
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
#3
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
Thu Jun 08 2017, 05:14 am
#4
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 ?

Thu Jun 08 2017, 11:14 pm
#5
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
#6
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

Tue Jun 13 2017, 03:13 am
#7
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'.


[ Edited Tue Jun 13 2017, 11:11 pm ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

EdwardFew
Mon Mar 18 2024, 01:14 pm
EmeryPah
Mon Mar 18 2024, 11:51 am
RobertMax
Sun Mar 17 2024, 10:22 pm
DanielJar
Fri Mar 15 2024, 06:52 pm
Tuzaimecor
Fri Mar 15 2024, 02:32 am
PromotionFoode
Thu Mar 14 2024, 08:11 pm
EdwardGeawn
Sun Mar 10 2024, 12:24 pm
ZacharyShado
Sat Mar 09 2024, 10:04 am