It is currently Wed Jul 18, 2018 11:24 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Tue Jun 26, 2018 7:14 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 19
Verrryyy much post and I'm confused easily, when I just want to know if I did the examples of A X Y register right.

But, what is the complete abilities or restrictions differs of A X Y [and other 2 registers?]


Top
 Profile  
 
PostPosted: Tue Jun 26, 2018 10:11 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1154
A, X, and Y can all hold a single value in the range of 0 to 255. (Edit: 128 to 255 can optionally be interpreted as -128 to -1.) They can all load their value from and store their value to a specific location in memory.

A value in A can be manipulated in many ways X and Y can't be. (Addition and subtraction of any value, division and multiplication by 2 and other "bitwise operations".) If you wanted to do those things to a value in X or Y, you'd have to transfer them to A first, manipulate them, then transfer them back.

You can add and subtract exactly 1 from the value in X or Y. (A allows for adding and subtracting of any value.)

A also has more power to load and store its value to neighbors of a specific location in memory. If you're familiar with arrays, the value in X and Y can be used as an offset to access a specific array element. Y specifically allows a convenient way to access an array through a pointer. If that doesn't mean anything to you right now, that's totally fine.

The other registers are
1. Program Counter, which a programmer doesn't really work with directly. (JMP directly changes it, I guess...)
2. Stack Pointer, which until one learns a bit more is touched once at the start of the program and then not worked with directly.
3. Processor Status Flags. These are individual bits that are updated after each instruction is run. You can "branch" conditionally based on whether individual bits are true are false, which is basically how "if statements" can be constructed.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Wed Jun 27, 2018 2:04 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 898
Location: cypress, texas
DocWaluigean wrote:
Verrryyy much post and I'm confused easily, when I just want to know if I did the examples of A X Y register right.

unregistered wrote:
Code:
.enum $0000 ;declare names for variables starting at beginning of the zeropage (location $0000)
  BED .dsb 1 ;BED is now at location $0000
  LAMP .dsb 1 ;LAMP is now at location $0001
.ende ;ends this variable declaration section

...

ROOM:
lda #100 ;yes, this loads the A register with #100 (A = #100)
sta BED ;$0000 = #100

lda #10
sta LAMP ; $0001 = #10

rts ;ends function ROOM


...

I don't have time to use your second part but for the most part it looked ok to me. :)
Sorry DocWaluigean, too much post from me. :(


edited once to add some relevant code in my quote.


Top
 Profile  
 
PostPosted: Wed Jun 27, 2018 3:37 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 19
unregistered wrote:
DocWaluigean wrote:
Verrryyy much post and I'm confused easily, when I just want to know if I did the examples of A X Y register right.

unregistered wrote:
Code:
.enum $0000 ;declare names for variables starting at beginning of the zeropage (location $0000)
  BED .dsb 1 ;BED is now at location $0000
  LAMP .dsb 1 ;LAMP is now at location $0001
.ende ;ends this variable declaration section

...

ROOM:
lda #100 ;yes, this loads the A register with #100 (A = #100)
sta BED ;$0000 = #100

lda #10
sta LAMP ; $0001 = #10

rts ;ends function ROOM


...

I don't have time to use your second part but for the most part it looked ok to me. :)
Sorry DocWaluigean, too much post from me. :(


edited once to add some relevant code in my quote.


It's alright! I appreciate it though.

I'm going to see something else about it, I'm going toward Week 4 now.


Top
 Profile  
 
PostPosted: Sat Jun 30, 2018 8:20 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 19
Ok, I'm still on Week 4 because I just got NES Classic Editions, and I'm loving it so much. The fact I got Mario Adventure from DahrkDaiz [I wish xhe can tutor me xer style of 6502 programming] made me so happy, I didn't read any at all, just play play play.

Right now, I'm burned out from playing it, and I'm worried if that will affect my concentrations in trying to learn to make NES games. Anyone have tips?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 7 hours


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:  
Powered by phpBB® Forum Software © phpBB Group