6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri May 10, 2024 6:46 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: assembled instructions.
PostPosted: Wed Dec 20, 2006 4:38 am 
Offline

Joined: Thu Dec 14, 2006 6:47 am
Posts: 4
how do the instructions from the source file look like after they have been assembled by the assembler?

I know this much:

Mnemonic Code ---- Assembled Code
PLA------------------------->$68
BEQ $03 ---------------- > $F0 $9F
JMP $A5B6 ---------------->$4C $B6 $A5

but what about the instructions like ADC $A5,X. Will this instruction look like this after it has been assembled: $75 X $A5?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 20, 2006 4:54 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
Two bytes, $75, $A5. The 75 already tells it to add the value in X (whatever it is at execution time) to the operand to get the target address.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 20, 2006 5:00 am 
Offline

Joined: Thu Dec 14, 2006 6:47 am
Posts: 4
Where can i find this information, is there a website you can refer me too?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 20, 2006 5:08 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
Quote:
Where can i find this information, is there a website you can refer me too?

Download the programming manual from WDC's website, www.westerndesigncenter.com. The manual is really, really good. We used to have to pay $65 for it, but now it's free for the download.

Your BEQ instruction above will not normally end up with the operand you show. Some assemblers may take that to mean BEQ forward 3 bytes, and others may take it to mean BEQ to address 0003. The operand is a count from the address of the first byte of the next instruction. So for example, F0 00 would end up in the same place whether the zero flag was set or not, although there will be a one-clock difference in execution time. F0 FE, if the branch is taken, will repeat itself endlessly, because it goes two bytes back to the beginning of the same instruction., ie, to itself.

You won't normally have numbers there in the source code though, but rather label references. This is not only so you don't have to count the offset yourself (which is prone to errors), but also so you can insert and delete portions of code without having to manually fix the offset. Typical examples would be BEQ NEXT_CHR, BEQ INIT_LINE, etc..


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: