Jump to content
IGNORED

ORG $F000


Thelen

Recommended Posts

quote:

Originally posted by thelen:

i was just thinking,what does the instuction ORG $F000 do in the beginning of a game ?

 

It defines the base address (or ORiGin) of the program.

 

If you JMP to the start of your program, with ORG $F000 the assembler writes JMP $F000 ($4C $00 $F0) into the binary, with an ORG of $1000 that would be JMP $1000 ($4C $00 $10).

Link to comment
Share on other sites

i still don't get it really, when i power on the atari 2600, the 6507 will be on reset for a moment, then it starts execute adress $0000 (i thought) , but the cartridge rom starts at $1FFF ?, i don't get it, how the processor jumps to 1FFF.

 

thanks,TheleN

Link to comment
Share on other sites

The ORG instruction is for the assembler only, not for the 6502. It deals with how the assembly language instructions are generated when labels are encountered.

 

Take the following code:

MYGAME:

JMP MYGAME

 

Lets say we wanted to convert those two labels to ASM manually. How would we know where MYGAME: was in the ROM? It could be $0000, $3456, $F000, etc.

 

The ORG tells it specifically that it is $F000, so that makes the code:

 

$F000 JMP $F000

 

Hope that helps,

calamari

Link to comment
Share on other sites

When the 6507 processor in the 2600 resets it reads whatever address is stored at memory location 1FFC/1FFD and then jumps to that address to start execution.

 

As mentioned above .ORG simply tells the assembler the origin address of you program. So if you have this in your source code:

 

.ORG $1000

 

start

jmp start

 

"start" is a label, so the assembler would know that start=$1000. When it assembled the jmp instruction it would be assembled to jmp $1000.

 

One other thing to note about the 2600. Since the 6507 processor only 13 address lines, the highest memory location it can access is $1FFF. But this doesn't stop you from putting your code at $F000. If the 6507 encountered a JMP $F000 for example, the top 3 bits of the address would be dropped and the jump would go to $1000 instead.

 

Dan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...