This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to arrange ORG and jump to position in Keil C

Here is my original .asm program, very simple:

ORG 0000H
LJMP 0200H
ORG 0003H
LJMP 0100H

ORG 0100H
P1=03H
P2=04H
RETI

ORG 0200H
P1=00H
P2=0FFH;
SJMP $

Now, I have the following Keil C code:
#include <reg51.H>
#include <stdio.h>

void main(void)
{

P1=0x06; P2=0x0a;

}

after compiling and linking, I saw the asm code:

in code address 0000H, it generates a
LJMP 0447H

which means, in my computer, when the program starts from 0000H, its default jump to address in code is 0447H.

My questions are:

1) How to re-direct the jump address ? if I want the main program jump to 0200H instead of 0447H, how to write the code in keil C51 ?

2) How to arrange the INTER0 interruption jump to address?
In .asm I can arrange it jump to 0100H, how to implement it in Keil C51 ?

3) I use AT89S51. before I use the P0, P1 ports, I need to initialize it as Input or Output at the beginning of the program, such like:

P0=01h
P1=0ffh

do I need to do this in keil C51 ?

Thank you very much for your reply.

0