6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 10:47 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Memory vs Value
PostPosted: Fri Jul 26, 2013 9:51 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 3:13 pm
Posts: 67
My noobiest question yet :mrgreen:
say I type this code

Code:
LDA $FFE0


does this act as a pointer to memory location FFE0 or does it use FFE0 as a value that I can write into a memory location

_________________
JMP $FFD2


Top
 Profile  
Reply with quote  
 Post subject: Re: Memory vs Value
PostPosted: Fri Jul 26, 2013 10:31 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
James_Parsons wrote:
My noobiest question yet :mrgreen:
say I type this code
Code:
LDA $FFE0
does this act as a pointer to memory location FFE0 or does it use FFE0 as a value that I can write into a memory location

LDA (LoaD Accumulator register) is precisely that-- a load. It does not store anything in memory-- ever. LDA $FFE0 reads the contents of address $FFE0 directly, and puts it in the accumulator. If you want to read the contents of the memory location pointed to by what's in $FFE0, that would be an indirect written LDA ($FFE0). Actually, that addressing mode doesn't exist for the LDA instruction in any of the 65-family processors, but the more typical use would be that the address would be in zero page, so you would do for example LDA ($E0) (which does exist), where $00E0 and $00E1 could be the 16-bit address to any other part of the memory map. ZP is kind of like 256 bytes of processor registers, having special significance, and more flexibility than the rest of the memory map. Indexing would be the next step when you're ready for that.

After the number is in the accumulator, yes, you can of course store it to a location in the memory map-- but that's with a different (STore) instruction, not a LoaD instruction. (I say "a location in the memory map" because it doesn't have to be memory. It could be I/O.)

_________________
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  
 Post subject: Re: Memory vs Value
PostPosted: Fri Jul 26, 2013 10:43 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
Hi James,

I see you're posting a lot of questions (which is good), but it's pretty clear all of this is really new to you.

You would probably be well to try your hand at a little assembly language, and learn how the 6502 works at a machine code level (it's architecture, memory maps, addressing modes, zero page, the stack, interrupts, etc.) before you start buying chips and wires and what not.

There are lots of 6502 simulators available, even some that run in a web browser. There are lots of assemblers available. You can work within an Apple ][ or Atari, or C64. You can find some that are the simplest of 6502s, etc. Play around in that domain for a bit and get a feel for things before you move farther. Getting an understanding of 6502 machine code and assembly will give you a very good foundation that will make the CPU schematics and computer design much more clear when you get to that point.


Top
 Profile  
Reply with quote  
 Post subject: Re: Memory vs Value
PostPosted: Fri Jul 26, 2013 11:29 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 3:13 pm
Posts: 67
ive done x86 for forever :P

_________________
JMP $FFD2


Top
 Profile  
Reply with quote  
 Post subject: Re: Memory vs Value
PostPosted: Sat Jul 27, 2013 8:42 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
I can't pass up the opportunity to recommend the excellent programming manual available on WDC's website, "Programming the 65816 including the 6502, 65C02, and 65802" by David Eyes and Ron Liechty.

_________________
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  
 Post subject: Re: Memory vs Value
PostPosted: Sun Jul 28, 2013 5:53 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8509
Location: Midwestern USA
Also, be sure to look at some of the code posted here for examples of style and coding technique (both good and no-so-good).

The 65xx family is different in many ways from the x86 architecture. A significant difference is that the 6502 is a lot more memory-oriented than x86 hardware and has many more addressing modes. So you need to do some studying to get the basic "rhythm" of 6502 assembly language. You'll be in for a pleasant surprise: 6502 assembly language is a lot less obtuse than anything associated with Intel silicon.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


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

All times are UTC


Who is online

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