Hello, new here, and need best recommandations.

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Sat Sep 22, 2018 10:01 am

Sorry for looong time. You pretty much know why. It's bad luck days for me earlier.

Could you give me another examples or mnemonics about the ,x ,y stuff? I been reading it and I don't get it.

---

-So the ,x ,y situations is that it allows you to copy from one Address Code into another Address Code upon the directions of what 'Address Code + X/Y = 2ND Address Code'?

$0001 has 5

$0004 has 10

-
LDX #2

LDA $1, x ; === $0003 now has number 0

INX ; Making X = 3

LDA $0001, X ; Now copied number 5 from Address $0001 into the "additions of X locations", which means Address $0004 now is carrying number 5, replacing the previous number, 10.

-

I'm guessing I'm going to call it, "Map Comma" tech. Or "Sextant Comma" or "Charter Comma" or something that involves map and directions to Address. Maybe Compass Comma.

Been wondering if I should give every tech. new names so anyone can learn more easier with mnemonic or idioms.

User avatar
Kasumi
Posts: 1292
Joined: Wed Apr 02, 2008 2:09 pm

Re: Hello, new here, and need best recommandations.

Post by Kasumi » Sat Sep 22, 2018 2:11 pm

Whenever it seems complicated, take a step back.

The mnemonic is separate from the addressing mode.

LDA always copies a new number into A. It reads, rather than writes. It does nothing else. So LDA absolutely anything will never change a value stored at an address. (Well... in some specific hardware cases a read can appear to change the value stored at an address, but it's something else. And the something else affects all reads, not just ,x or ,y ones. )

In LDA's case, the addressing mode specifies how to get the value to copy to A.
In STA's case, the addressing mode specifies how to get the address to write A's value to.

$???? is one addressing mode.
LDA $0000 means copy the value from $0000. $0000 is the "given address".
STA $0002 means write the value in A into address $0002. $0002 is the "given address".

Let's call the address that LDA ends up copying from/the address STA ends up writing to the "final address." In the $???? addressing mode, the given address and the final address are always the same.


The $????,x addressing mode lets you use an address that's X places from the given address (Address $????).


Like in
LDA $0001,x
$0001 is the given address, but what's in $0001 doesn't matter for the calucation of the final address. X is added to the given address' number itself ($0001 in the example) to get the final address, and then A gets the value stored at that final address as usual.

For STA, similarly, the value in A would get written to that final address.

If X is 0, the final address is the given address just like the $???? addressing mode. If X is 1, the final address is the given address + 1.

If X is 5, and the address is $0100, the final address is $0105 because $0100+5=$0105.

Code: Select all

ldx #5
lda $0100,x
;will use the same address to get the value for A as
lda $0105
inx;Now X is 6
;So now
lda $0100,x
;will use the same address to get the value for A as
lda $0106
If X is 7 and the address is $02FF, the address used is $0306 because $02FF+7=$0306.

Code: Select all

ldx #7
lda $02FF,x
;will use the same address to get the value for A as
lda $0306

dex;Now X is 6
lda $02FF,x
;will use the same address to get the value for A as
lda $0305

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Wed Sep 26, 2018 11:45 pm

Kasumi wrote:Whenever it seems complicated, take a step back.

The mnemonic is separate from the addressing mode.

LDA always copies a new number into A. It reads, rather than writes. It does nothing else. So LDA absolutely anything will never change a value stored at an address. (Well... in some specific hardware cases a read can appear to change the value stored at an address, but it's something else. And the something else affects all reads, not just ,x or ,y ones. )

In LDA's case, the addressing mode specifies how to get the value to copy to A.
In STA's case, the addressing mode specifies how to get the address to write A's value to.

$???? is one addressing mode.
LDA $0000 means copy the value from $0000. $0000 is the "given address".
STA $0002 means write the value in A into address $0002. $0002 is the "given address".

Let's call the address that LDA ends up copying from/the address STA ends up writing to the "final address." In the $???? addressing mode, the given address and the final address are always the same.


The $????,x addressing mode lets you use an address that's X places from the given address (Address $????).


Like in
LDA $0001,x
$0001 is the given address, but what's in $0001 doesn't matter for the calucation of the final address. X is added to the given address' number itself ($0001 in the example) to get the final address, and then A gets the value stored at that final address as usual.

For STA, similarly, the value in A would get written to that final address.

If X is 0, the final address is the given address just like the $???? addressing mode. If X is 1, the final address is the given address + 1.

If X is 5, and the address is $0100, the final address is $0105 because $0100+5=$0105.

Code: Select all

ldx #5
lda $0100,x
;will use the same address to get the value for A as
lda $0105
inx;Now X is 6
;So now
lda $0100,x
;will use the same address to get the value for A as
lda $0106

If X is 7 and the address is $02FF, the address used is $0306 because $02FF+7=$0306.

Code: Select all

ldx #7
lda $02FF,x
;will use the same address to get the value for A as
lda $0306

dex;Now X is 6
lda $02FF,x
;will use the same address to get the value for A as
lda $0305
LDA always copies a new number into A. It reads, rather than writes. It does nothing else. So LDA absolutely anything will never change a value stored at an address. (Well... in some specific hardware cases a read can appear to change the value stored at an address, but it's something else. And the something else affects all reads, not just ,x or ,y ones. )

In LDA's case, the addressing mode specifies how to get the value to copy to A.
In STA's case, the addressing mode specifies how to get the address to write A's value to.

$???? is one addressing mode.
LDA $0000 means copy the value from $0000. $0000 is the "given address".
STA $0002 means write the value in A into address $0002. $0002 is the "given address".[/i]


Why does everything need to have complex explanation, when people like I could understand it more if the wording was much simpler? Re-reading in my calm mood, it's basically unnecessary-complex repeat of the early tutorials of what we learnt. Like I said earlier, it's more of a "Map Comma", "Carto-Comma" "Cartographic Comma" to me. If I somehow forgot and reread the previous post about Register, I'd understand it more than this...

=====

Code: Select all

LDA #$04
LDX #$1F

TOPHAT1:
  STA $0200, X
  DEX
  BNE TOPHAT1

SIDEHAT:
 sta $0200
 sta $0220
 sta $023F
 sta $0240
 sta $025F
 sta $0260
 sta $027F
 sta $0280
 sta $029F
 sta $02A0
 sta $02BF
 sta $02C0
 sta $02DF
 sta $02E0
 sta $02FF
 sta $0300
 sta $031F
 sta $0320
 sta $033F
 sta $0340
 sta $035F
 sta $0360
 sta $037F
 sta $0380
 sta $039F

;-------

HATLOOP:

 STA $03A0, X
 DEX
 BNE HATLOOP

User avatar
Kasumi
Posts: 1292
Joined: Wed Apr 02, 2008 2:09 pm

Re: Hello, new here, and need best recommandations.

Post by Kasumi » Thu Sep 27, 2018 2:51 am

I/easy6502/Nerdy Nights/whatever think way more about how to present information than I think you give us credit for. To be really frank, I do not think the simplest explanations are the ones that have had the most success here. "LDA will never change the value stored at an address." is a valid and simple response to your last post. I spent extra time presenting something I thought would be more helpful.

Remember that how I present the information in my posts is based on your posts. If I explain something again, reexamine if you really know it or just think you do because it means something you said implied to me that you didn't understand. If I thought you understood it, why would I spend time trying to explain it a different way especially after the 18th when I said I'd help much less?

Always think about this. "Why did they spend the time?" If ever you think an explanation is complex (and not just one of mine), it can be very helpful to think about what factors may have gone into deciding to spend more time to present the explanation that way. Often when someone thinks something can be made simpler, they're missing something. Flipping the perspective can help one realize the holes in one's understanding without needing to ask.

If you think you've got the concepts, then complete the assignment.

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Thu Sep 27, 2018 10:28 am

Kasumi wrote:I/easy6502/Nerdy Nights/whatever think way more about how to present information than I think you give us credit for. To be really frank, I do not think the simplest explanations are the ones that have had the most success here. "LDA will never change the value stored at an address." is a valid and simple response to your last post. I spent extra time presenting something I thought would be more helpful.

Remember that how I present the information in my posts is based on your posts. If I explain something again, reexamine if you really know it or just think you do because it means something you said implied to me that you didn't understand. If I thought you understood it, why would I spend time trying to explain it a different way especially after the 18th when I said I'd help much less?

Always think about this. "Why did they spend the time?" If ever you think an explanation is complex (and not just one of mine), it can be very helpful to think about what factors may have gone into deciding to spend more time to present the explanation that way. Often when someone thinks something can be made simpler, they're missing something. Flipping the perspective can help one realize the holes in one's understanding without needing to ask.

If you think you've got the concepts, then complete the assignment.
I don't understand the concepts. There's an error I found which draws the entire line like paintbrush I submitted a while ago.

EDIT: Sorry for my behaviour though.

User avatar
Kasumi
Posts: 1292
Joined: Wed Apr 02, 2008 2:09 pm

Re: Hello, new here, and need best recommandations.

Post by Kasumi » Thu Sep 27, 2018 1:00 pm

Help me help you. What specifically don't you understand about the concepts? Assume whenever I make a post, I feel I have already made it as simple and clear as I can.

So telling me the explanation is complicated is not really feedback I can use beyond trying to explain some different way which may not target the part you don't understand. If I reexplain addressing modes (which I've done in the the rest of the post), but your issue is with looping then no one has won. You've got to be specific about the issues you're having or I have to guess.

In the ,x addressing mode. X is treated as a number. The 16 bit address before the ,x (not the value stored in that address) is treated as a number. These two numbers are added together to get a new number. This new number is the address that gets used.

In LDA, the value from the new address is copied to A.
In STA, the value in A is stored to the new address.

Edit: To help you help me, with the descriptions above, look at the code examples. The behavior exactly matches. Which of the steps from which example gives you a result you do not fully understand? Walk through each step of what should happen. (X is added to the address. So the result in the example should be this.) And stop whenever your result following the steps is different than what I said the result should be. And then I'll try to explain that difference.

Edit2: Assuming the paintbrush error you described was in your last piece of code. Above the "TOPHAT1" label, you initialize X to 31. Then you use dex and bne in a loop together. This loops 31 times, because to get below the bne, X must be zero.

Above the "HATLOOP" label, you do not initialize X. This means it is still zero from after the TOPHAT1 loop. You still use dex and bne in a loop together. This loops 256 times, because to get below the bne, X must be zero.

It starts at 0. 1 is subtracted to get 255. 255 is not equal to zero, so it loops.
Then 254, etc.

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Thu Sep 27, 2018 8:11 pm

Kasumi wrote:Help me help you. What specifically don't you understand about the concepts? Assume whenever I make a post, I feel I have already made it as simple and clear as I can.

So telling me the explanation is complicated is not really feedback I can use beyond trying to explain some different way which may not target the part you don't understand. If I reexplain addressing modes (which I've done in the the rest of the post), but your issue is with looping then no one has won. You've got to be specific about the issues you're having or I have to guess.

In the ,x addressing mode. X is treated as a number. The 16 bit address before the ,x (not the value stored in that address) is treated as a number. These two numbers are added together to get a new number. This new number is the address that gets used.

In LDA, the value from the new address is copied to A.
In STA, the value in A is stored to the new address.

Edit: To help you help me, with the descriptions above, look at the code examples. The behavior exactly matches. Which of the steps from which example gives you a result you do not fully understand? Walk through each step of what should happen. (X is added to the address. So the result in the example should be this.) And stop whenever your result following the steps is different than what I said the result should be. And then I'll try to explain that difference.

Edit2: Assuming the paintbrush error you described was in your last piece of code. Above the "TOPHAT1" label, you initialize X to 31. Then you use dex and bne in a loop together. This loops 31 times, because to get below the bne, X must be zero.

Above the "HATLOOP" label, you do not initialize X. This means it is still zero from after the TOPHAT1 loop. You still use dex and bne in a loop together. This loops 256 times, because to get below the bne, X must be zero.

It starts at 0. 1 is subtracted to get 255. 255 is not equal to zero, so it loops.
Then 254, etc.
I'll try...

Code: Select all

HATLOOP:

 STA $03A0, X
 DEX
 BNE HATLOOP
On this part of code, as you did say it's exactly as it's exampled, it just colored it all in, but I am not sure how BNE is useful when I want to make a line in the middle of the number of the code instead from any number to zero. And I'm not sure how to write it in a way it can go vertically [up and down] instead of always left and right.

-

Is there any history or motivation about programming and 6502 beside the one posted before this? I want to force myself to be encouraged, but I keep feeling it's just myself, and it's not other stuff..

User avatar
tokumaru
Posts: 11862
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Hello, new here, and need best recommandations.

Post by tokumaru » Thu Sep 27, 2018 8:48 pm

DocWaluigean wrote:And I'm not sure how to write it in a way it can go vertically [up and down] instead of always left and right.
Drawing horizontally is easier because the screen is arranged in rows, so adding one goes one pixel to the right, subtracting one goes one pixel to the left. To move up and down, you need to skip an entire row. Each row is 32 pixels, so you need to add (to go down) or subtract (to go up) 32 to/from the current position in order to move vertically.

What makes this slightly more complicated is that the entire screen doesn't fit in 256 bytes (it's actually 1024 bytes), so you can't go everywhere using just one 8-bit index register (X or Y) as you can with horizontal lines.

The best way to do this would be to use indirect indexed addressing, but I'm not sure if you learned that yet. The basic idea is that the address to access is not in the instruction, it's in the memory location indicated by the instruction. That's why it's called "indirect". LDA $0050, Y will load a byte from the address $0050+y, while LDA ($50), Y will load a byte from the address formed by the numbers at $0050 and $0051, plus Y (e.g. if $0050 contains $07, $0051 contains $90, and Y contains $04, LDA ($50), Y will read the byte at $9007 + $04 = $900B).

I'm not gonna show any code for drawing vertical lines because it might not be time for that yet, but keep in mind that it is somewhat more complex and will most likely require the new addressing mode I mentioned before (indirect indexed). It might be a good idea to make a subroutine to draw lines too, to encapsulate that complexity so that the code that does the drawing can remain simple, just making calls to this subroutine whenever a line is needed.

User avatar
Kasumi
Posts: 1292
Joined: Wed Apr 02, 2008 2:09 pm

Re: Hello, new here, and need best recommandations.

Post by Kasumi » Fri Sep 28, 2018 3:06 am

as you did say it's exactly as it's exampled,
Except for the ldx #$1F above it. Like I said, you did not initialize X above the HATLOOP label.

Compare:

Code: Select all

LDA #$04
LDX #$1F

TOPHAT1:
  STA $0200, X
  DEX
  BNE TOPHAT1
to

Code: Select all

HATLOOP:

 STA $03A0, X
 DEX
 BNE HATLOOP
At the TOPHAT1 label, X is #$1F, so it draws 31 pixels.
At the HATLOOP label, X is #$00 (because it never changes after BNE TOPHAT1 doesn't branch), so it loops 256 times.

To fix it, add an ldx #$1F above the HATLOOP label.
I am not sure how BNE is useful when I want to make a line in the middle of the number of the code instead from any number to zero.
Use an address that's the middle of a line. If X is 0, you get the given address. The given address doesn't have to be at the start of a line.
2 pixels starting from the top left corner:

Code: Select all

LDA #$04;Color
LDX #$02;2 pixels

loop:
  STA $0200, X
  DEX
  BNE loop
  STA $0200;Do the last pixel
2 pixels starting from three pixels to the right of the top left corner.

Code: Select all

LDA #$04;Color
LDX #$02;2 pixels

loop:
  STA $0203, X
  DEX
  BNE loop
  STA $0203;Do the last pixel
Tokumaru covered why vertical is trickier. This is why I assigned only horizontal lines since you don't yet have those concepts.
I want to force myself to be encouraged
I may have said this before, but I feel like that's a backwards way to go about motivation. If you don't already have something that motivates you to learn, why are you learning it? Learning 6502 isn't the difference between getting a degree or not, or something like that. If what you want to use it for isn't motivating enough, you can stop or take a break or anything else. There are no consequences for stopping.

I only understand forcing motivation if it's to do something you don't want to do AND there are consequences for not doing it. Here you're no worse off if you stop for a day, for a week or forever.

Edit: If you learn the things vertical lines will require, you can actually start making a pixel "character" move around. But I make no commitment to teaching those things, I am still here because I felt it'd be pretty bad to not check the last assignment after the deadline.

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Sun Sep 30, 2018 6:20 pm

Kasumi wrote:
as you did say it's exactly as it's exampled,
Except for the ldx #$1F above it. Like I said, you did not initialize X above the HATLOOP label.

Compare:

Code: Select all

LDA #$04
LDX #$1F

TOPHAT1:
  STA $0200, X
  DEX
  BNE TOPHAT1
to

Code: Select all

HATLOOP:

 STA $03A0, X
 DEX
 BNE HATLOOP
At the TOPHAT1 label, X is #$1F, so it draws 31 pixels.
At the HATLOOP label, X is #$00 (because it never changes after BNE TOPHAT1 doesn't branch), so it loops 256 times.

To fix it, add an ldx #$1F above the HATLOOP label.
I am not sure how BNE is useful when I want to make a line in the middle of the number of the code instead from any number to zero.
Use an address that's the middle of a line. If X is 0, you get the given address. The given address doesn't have to be at the start of a line.
2 pixels starting from the top left corner:

Code: Select all

LDA #$04;Color
LDX #$02;2 pixels

loop:
  STA $0200, X
  DEX
  BNE loop
  STA $0200;Do the last pixel
2 pixels starting from three pixels to the right of the top left corner.

Code: Select all

LDA #$04;Color
LDX #$02;2 pixels

loop:
  STA $0203, X
  DEX
  BNE loop
  STA $0203;Do the last pixel
Tokumaru covered why vertical is trickier. This is why I assigned only horizontal lines since you don't yet have those concepts.
I want to force myself to be encouraged
I may have said this before, but I feel like that's a backwards way to go about motivation. If you don't already have something that motivates you to learn, why are you learning it? Learning 6502 isn't the difference between getting a degree or not, or something like that. If what you want to use it for isn't motivating enough, you can stop or take a break or anything else. There are no consequences for stopping.

I only understand forcing motivation if it's to do something you don't want to do AND there are consequences for not doing it. Here you're no worse off if you stop for a day, for a week or forever.

Edit: If you learn the things vertical lines will require, you can actually start making a pixel "character" move around. But I make no commitment to teaching those things, I am still here because I felt it'd be pretty bad to not check the last assignment after the deadline.
I'm not sure what you mean about motivation if I think way too hard.

I'm learning it because why not? I said before that when I saw DahrkDaiz, when I saw Shiru, then I saw NIKI homebrews about NES, along with NESMaker which I still can't do atm, it's a form of childhood reasons why I am still trying to learn; can't explain why I want to learn, but something in heart [originated from childhood] knows why I REALLY want to learn. Looking at DSi games like WarioWare: D.I.Y. graphics kind of helps me, then I remember about the lessons, which I still feel iffy about it.

After this lesson, can we learn about how to turn program on from scratch with blank screen before we can go on to the next lesson? I don't want to feel like I'm learning only by reading, and then I feel I didn't code at all. I re-read about branching yesterday, and I understand way more, as I'm believing Unregistered was right.

So my question on the lecture:

-Do I ALWAYS have to put LDX #$## at the start of each? or Each label always reset if outside of the labels or the BME/BDA labels stuff?

[I'm re-reading this lesson, as it takes time a little since I keep getting different result like the code I show earlier.]

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Hello, new here, and need best recommandations.

Post by Banshaku » Sun Sep 30, 2018 7:33 pm

@DocWaluigean

If your goal is to make a nes game only then you don't need to write code in asm: you can write it in C too. This is a lot easier to write actually.

Even though I understand enough 6502 asm, I write my code in C and asm based on my need. For experimenting with the nes, you don't need asm, C is more than enough. Since you mention Shiru, most of his game were in C too so it's possible to write C only code and only write ASM when there is no other way.

So if you goal is only making game, asm is not required. Just my opinion, the rest is up to you. It will make you life a lot easier.

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Sun Sep 30, 2018 7:55 pm

Banshaku wrote:@DocWaluigean

If your goal is to make a nes game only then you don't need to write code in asm: you can write it in C too. This is a lot easier to write actually.

Even though I understand enough 6502 asm, I write my code in C and asm based on my need. For experimenting with the nes, you don't need asm, C is more than enough. Since you mention Shiru, most of his game were in C too so it's possible to write C only code and only write ASM when there is no other way.

So if you goal is only making game, asm is not required. Just my opinion, the rest is up to you. It will make you life a lot easier.
Since I'm complex to understand or explain [If you weren't reading the whole thread], I'll try to explain this:

When I see more what I could do with 6502 Assembly, I admire and value the code more and more as time progresses. If I change my learning desires, I would feel terrible losing my knowledge or wasting my skills from 6502 to C. I believe you when C is easier; there's C++, there's C# which is hybrid of Java, and the C code is often the answer for everyone who want's to, BY BASE, get started on learning to code. But for 6502, there aren't many good tutorials or really effective tutorials for people who is "down-to-earth" determined to try and pay attention and know how it works. [At least for me.]

What I see for 6502, that language is much more than a toy. Much more than Minecraft if on hypnosis attitude [Or like Steve Jobs when he stare at program and see extreme potentials.]
On usual random days of taking breaks, I see JP homebrews utilizing NES not just for games, but also for image slideshow, for music, for other things. Maybe I'm wrong because I haven't see image slideshows, but maybe I'm right if I saw the music-only programs made by NIKI/NIKKI.

Or I'm being delusional. Again. By saying the same thing earlier. But to the point:

I would feel waste of time if I go to C/C++/C#, and 6502 is one of the least elementary-documented popular languages for homebrews, [at least for me], and I want to help out in any way to make it understand not just for me, but for all. If I want to learn C, I want to learn 6502 first to understand comparison. Alongside, I understand enough that it's too late for me to go back. Register, Program Counter, etc.


I don't know why I feel avoidances on this assignment... Going to try and re-read it the third time. If I finally understood the Branching, I could finally understand this. I said earlier I don't want anyone going through what I've been through..

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Hello, new here, and need best recommandations.

Post by Banshaku » Sun Sep 30, 2018 8:15 pm

No problem ;) If you want to use 6502 asm only it's fine too. What I just meant is C could have been easier if you just want to make a game.

When you know enough 6502 you can try to use your 6502 with some C and that will be quite interesting to do! Knowing how 6502 and nes work is quite useful when you do C code so what you are learning is not wasted: it will be used later.

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Sun Sep 30, 2018 8:26 pm

Kasumi wrote:Help me help you. What specifically don't you understand about the concepts? Assume whenever I make a post, I feel I have already made it as simple and clear as I can.

So telling me the explanation is complicated is not really feedback I can use beyond trying to explain some different way which may not target the part you don't understand. If I reexplain addressing modes (which I've done in the the rest of the post), but your issue is with looping then no one has won. You've got to be specific about the issues you're having or I have to guess.

In the ,x addressing mode. X is treated as a number. The 16 bit address before the ,x (not the value stored in that address) is treated as a number. These two numbers are added together to get a new number. This new number is the address that gets used.

In LDA, the value from the new address is copied to A.
In STA, the value in A is stored to the new address.

Edit: To help you help me, with the descriptions above, look at the code examples. The behavior exactly matches. Which of the steps from which example gives you a result you do not fully understand? Walk through each step of what should happen. (X is added to the address. So the result in the example should be this.) And stop whenever your result following the steps is different than what I said the result should be. And then I'll try to explain that difference.

Edit2: Assuming the paintbrush error you described was in your last piece of code. Above the "TOPHAT1" label, you initialize X to 31. Then you use dex and bne in a loop together. This loops 31 times, because to get below the bne, X must be zero.

Above the "HATLOOP" label, you do not initialize X. This means it is still zero from after the TOPHAT1 loop. You still use dex and bne in a loop together. This loops 256 times, because to get below the bne, X must be zero.

It starts at 0. 1 is subtracted to get 255. 255 is not equal to zero, so it loops.
Then 254, etc.
-The Register limits added:

A : You CANNOT use Register A for absolute effect! [Only X and Y can do it.]
A : You CANNOT INCrement A directly!
A : ??????????

---

Code: Select all

lda #$0F
sta $0200
lda #$02
sta $0201
lda #$08
sta $0202

ldx #1
lda $0200,x;A now holds the value 2. $0200+X (which holds 1) is $0201. Inside $0201 is #$02
inx;Now X = 2
lda $0200,x;A now holds the value 8. $0200+X (which holds 2) is $0202. Inside $0201 is #$08

-The Absolute Effect [Or The "Compass-Comma" I made it up] is making certain codes that can potentially make it get treated like a file cabinet? The numbers in STA 200/1/2 is treated as a file cabinet, and when you did LDA 200,X which is 1, you "basically pull out the file cabinet box, and take the numbers that's stored into Address Code $0201, which is 2." And that result, Register A is now holding number 2?

-So yeah... it feels more of "Cabinet Comma" over "Compass-Comma" which is somewhat like go-to codings.. or the "Compass-Comma" is actually the BNE/BEQ...?

- I'm guessing I have to nickname each code name to make it easier. BNE would be, "Begone, No-Equations!" [Meaning if it's number zero, it will "GO TO" the labels needed or loop back to the beignning of code / beginning of where label is, otherwise if it's OTHER than zero, it will pass like a door.]

-BEQ would be, "Begone, Equated Quell!" [Meaning if it's any number that is not zero, it will "GO TO" to the labels needed or go back to the beginning of code / beginning of where label is. Otherwise, it will go through or pass like a door.]

The quell is, ironically, synonym of "contain" which is the best word for making it easier I guess. I'm also guessinf Equated is the same similar word of "Equations"???

=====

Way shorter, yes? And to briefly explain this one. Imagine you want to draw a 2 pixel line.
You'd load X with 1. After a single dex, there wouldn't be a branch and you've only drawn one pixel. So you draw the next one after the loop. If you had loaded X with 2, it would take two dex before the branches would stop. ETC.

Your assignment this time is to convert ALL horizontal lines in your old face code to loops like this.


Re-reading it again, Oooooh. Just horizontal [at least most-horizontal lines] line of the code, not the entire thing... I hope this doesn't demotivate me if I didn't understand it.

But you see what I mean about names with BNE and BEQ. [[Come to think of it, I'm finally starting to recognize BNE or BEQ since I made up names. Every teacher should know this for elementary school if they keep asking to teach programming at young ages..]]
Last edited by DocWaluigean on Sun Sep 30, 2018 9:03 pm, edited 2 times in total.

DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean » Sun Sep 30, 2018 8:29 pm

Banshaku wrote:No problem ;) If you want to use 6502 asm only it's fine too. What I just meant is C could have been easier if you just want to make a game.

When you know enough 6502 you can try to use your 6502 with some C and that will be quite interesting to do! Knowing how 6502 and nes work is quite useful when you do C code so what you are learning is not wasted: it will be used later.
The C++/C#/C and 6502 hybrid would be the MOST amazing thing ever! ^^ But I don't know how yet sadly. Also, I seen far more than potentials to just use 6502 for games, so...yes?

If I want to make a game, I would use Game-Maker, Unreal / Unity, etc. And coding would be wayyy longer for me to learn C++ / C# / C if I'm going that road atm.

I don't know if I'm explaining right. It's a curse of mentalities. T-T But it would give insight if I know the differences of C / C++ / C# [Even though it's off-topic. but not sure how implemented and similarities it can be to put 6502 code languages into those.]

Post Reply