??? 03/02/04 17:01 Read: times |
#65822 - RE: How does ORG command work? Responding to: ???'s previous message |
ORG simply tells the assembler where to start putting the assembled code.
Well, I wish it were that simple, but it's not. From the Keil A51 Manual... "When an ORG statement is encountered, the assembler calculates the value of the expression and changes the location counter for the current segment. If the ORG statement occurs in an absolute segment, the location counter is assigned the absolute address value. If the ORG statement occurs in a relocatable segment, the location counter is assigned the offset of the specified expression. The ORG directive changes the location counter but does not produce a new segment. A possible address gap may be introduced in the segment. With absolute segments, the location counter may not reference an address prior to the base address of the segment." Note that the ORG statement DOES NOT specify a physical address if used in a relocatable segment. Instead, it specifies an OFFSET from the beginning of where that segment is located. Additionally, on most assemblers, if you create an absolute segment that starts at 0 (with CSEG at 0) and then use an ORG 0x8000 statement, the location counter changes to 0x8000. However, all that space from 0x0000 to 0x7FFF must be filled with something. And, it is. For example, the following program: cseg at 0 org 0x8000 nop end is 32,769 bytes long. However, the following program: cseg at 0x8000 nop end is only 1 byte long. Be careful using ORG. Jon |
Topic | Author | Date |
How does ORG command work? | 01/01/70 00:00 | |
RE: How does ORG command work? | 01/01/70 00:00 | |
RE: didnt work | 01/01/70 00:00 | |
RE: How does ORG command work? | 01/01/70 00:00 | |
You mean uPSD3234A? | 01/01/70 00:00 | |
RE: You mean uPSD3234A? | 01/01/70 00:00 | |
RE: How does ORG command work? | 01/01/70 00:00 | |
RE: How does ORG command work? | 01/01/70 00:00 | |
RE: How does ORG command work? | 01/01/70 00:00 | |
RE: How does ORG command work? | 01/01/70 00:00 | |
RE: The beloved Keil C51/A51 | 01/01/70 00:00 | |
RE: The beloved Keil C51/A51 | 01/01/70 00:00 | |
RE: The beloved Keil C51/A51![]() | 01/01/70 00:00 |