6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue May 07, 2024 10:16 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Jul 26, 2013 11:28 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 3:13 pm
Posts: 67
say I have memory location $FF how do I write $00(basically clear it) or $E4(something random) into this location

_________________
JMP $FFD2


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 27, 2013 12:15 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8432
Location: Southern California
James_Parsons wrote:
say I have memory location $FF how do I write $00(basically clear it) or $E4(something random) into this location

Put the value you want to write to it into a processor register, then store it, something like:
Code:
        LDA #$E4
        STA $FF

In many if not most cases, the value you want to store is the result of an operation that just took place, so it's already in the processor register, so you just do the one store instruction.

You could use X or Y also (so the "LD" and "ST" above are followed by X or Y instead of A), if A is not available, or if you already have the desired value in X or Y. With the 65c02, if you want to clear that location, you can do it without using any processor registers, using STZ (STore a Zero), like:
Code:
        STZ $FF

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 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: