New person with a question

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

Post Reply
cybersmudge
Posts: 2
Joined: Thu Mar 08, 2018 1:03 pm

New person with a question

Post by cybersmudge »

Hello,

I have loked through this site and I must say there are some great people here, so I thank you in advance and I apologize for a dumb question. I want to learn to program the NES. I want to learn and program in 6502 Assembly. I know this is not easy and is not a quick process. Its just ] something I would like to learn I thought about the Nerdy Nights tutorials, unless someone knows of a moe beginner type tutorial. My question is, what are the basic tools I will need to stat? I would just like a basic list to download and start.

I want to thank you all for your help. I look forward to many nights lerning from this great site and you great people.

Thanks,
Bj
cybersmudge
Posts: 2
Joined: Thu Mar 08, 2018 1:03 pm

Re: New person with a question

Post by cybersmudge »

I do not have any other experience other that Basic programming and using some of the more popular game engines like Gamemaker Studio and Clickteam Fusion.

I do have NESmaker and I think it is great. I was thinking that learning 6502, or atleast getting more of an understanding of the process would help.
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: New person with a question

Post by pubby »

You can try the easy6502 tutorial. It has a built-in assembler.

https://skilldrick.github.io/easy6502/
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: New person with a question

Post by Dwedit »

Suggested programming exercises:
Write `memset` and `memcpy`.
Write something that will clear a whole nametable to zeroes.
Write something that will display a string of text at a specific location in the nametable.

Any questions, just ask.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
toggle switch
Posts: 139
Joined: Fri Sep 30, 2016 8:57 pm

Re: New person with a question

Post by toggle switch »

i found using NESICIDE worked best for me. it has a 'hello world' program by tepples that'll give you a basic template to build off of.

in fact, my game (project blue) began it's life as the NROM hello world demo... literally none of the code from that remains, but it got me started with a program that was easy to modify and experiment with. plus there's a built-in emulator and several other helpful tools.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: New person with a question

Post by Oziphantom »

The NES is not a good machine to learn 6502 on, its not interactive, it doesn't have any helper functions, you will need to spend ages learning the hardware and how it works before you can print hello world. You would be better off learning at least the basics of 6502 on something more sane like a C64 and then once you understand how loops, indirect indexing, memory works etc coming back to the NES.

http://www.bombjack.org/commodore/books.htm see the MACHINE LANGUAGE and ASSEMBLY LANGUAGE section to which the "Machine Language on the Commodore 64, 128 and other Commodore Computers Revised and Expanded Edition" by Jim Butterfield is the book to learn 6502 from however I also find the "Commodore 64 Assembly Language" by Bruce Smith to also be quite good.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: New person with a question

Post by Bregalad »

Oziphantom wrote:The NES is not a good machine to learn 6502 on, its not interactive, it doesn't have any helper functions, you will need to spend ages learning the hardware and how it works before you can print hello world. You would be better off learning at least the basics of 6502 on something more sane like a C64 and then once you understand how loops, indirect indexing, memory works etc coming back to the NES.
Back then I've learnt 6502 assembly with NES and it was just fine.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: New person with a question

Post by tokumaru »

I too would like to jump in and disagree with the Commodore 64 suggestion, unless you actually have any interest in coding C64 games. Learning 6502 in the context of another machine won't help you much with becoming an NES developer, because you'll soon have to "unlearn" part of the stuff you learned, and being a beginner, it can be hard to tell apart what's pure 6502 and what's the machine's architecture, which might make the process unnecessarily confusing.

I do agree that learning 6502 before touching any of the NES-specific stuff is a good strategy, though. But instead of using another period machine such as the C64, which has its own idiosyncrasies, I second the suggestion of trying easy6502, which adds only the bare minimum on top of a raw 6502 so you can add a little interactivity to your programs. Michal Kowalski's 6502 Simulator does something similar, and is the tool I used to learn 6502 assembly myself, way back when.

So yeah, my advice is to either start out with a simulator that will allow you to practice 6502 programming without having to learn about (and get confused by!) hardware architectures you're not interested in, or dive straight into NES programming, as a lot of people here have done. You will probably mix up the CPU and the hardware's architecture in your head anyway, specially with no prior experience with computer architecture and low-level programming, but at least whatever you learn is stuff you can use for your end goal, even if you don't understand it 100%.

Another bit of advice: looking at your first post, I see it's full of typos and other errors, suggesting that you wrote it in a hurry. If you're serious about programming NES games, you can't do things in a hurry. You have to be very meticulous about how you express your ideas, because when you're working so close to the hardware, there isn't much room for error.
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: New person with a question

Post by gauauu »

tokumaru wrote: So yeah, my advice is to either start out with a simulator that will allow you to practice 6502 programming without having to learn about (and get confused by!) hardware architectures you're not interested in, or dive straight into NES programming, as a lot of people here have done. You will probably mix up the CPU and the hardware's architecture in your head anyway, specially with no prior experience with computer architecture and low-level programming, but at least whatever you learn is stuff you can use for your end goal, even if you don't understand it 100%.
I agree with just diving it. It's harder, but it's a lot easier to learn when you have a real project with a real goal in front of you. The reward of seeing sprites move around on a NES screen keeps you motivated.
pwnskar
Posts: 119
Joined: Tue Oct 16, 2018 5:46 am
Location: Gothenburg, Sweden

Re: New person with a question

Post by pwnskar »

I'm still on my first year learning assembly on the 6502 and I agree with what's been said about just diving in. Following a tutorial step-by-step was what got me started. Just go over it again and again until you can grasp something of what the code does and start thinking of how you can change it to do what you want to. And start with small goals!

I set up the goal that on day one I would have something compiled, even if it was just a ready-made tutorial with no code of my own. When I'd done that I started playing around with changing variables, graphic tiles and dissecting the code to grasp how they were combined to make bigger sprites (metasprites).

So in short, just dive in! Oh, and use the debugger in fceux or an equivalent in another emulator.
strat
Posts: 409
Joined: Mon Apr 07, 2008 6:08 pm
Location: Missouri

Re: New person with a question

Post by strat »

tokumaru wrote:Michal Kowalski's 6502 Simulator does something similar, and is the tool I used to learn 6502 assembly myself, way back when.
Even here, you have to learn the memory-mapped i/o of the virtual machine to see your code do anything. So it simplifies - but doesn't eliminate - the issue of separating pure machine code from the functionality of the system. Still, I agree it's a better platform for asm beginners than a real-life 6502 device.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: New person with a question

Post by tokumaru »

strat wrote:Even here, you have to learn the memory-mapped i/o of the virtual machine to see your code do anything.
I did acknowledge that these simulators add some bare bones "virtual hardware" on top of the 6502 so you can add interactivity to your programs. I personally didn't use any of that when learning ASM myself though, I merely used the debug tools to watch the CPU state and the memory. I didn't write anything interactive, I merely wrote subroutines that performed various tasks (array sorting, multiplication, etc.) and the auxiliary code needed to test them.
User avatar
OmegaMax
Posts: 80
Joined: Wed Sep 21, 2016 8:55 am
Location: Calgary.Alberta,Canada

Re: New person with a question

Post by OmegaMax »

tokumaru wrote:I merely used the debug tools to watch the CPU state and the memory.
I did the same
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: New person with a question

Post by unregistered »

pwnskar wrote:So in short, just dive in! Oh, and use the debugger in fceux or an equivalent in another emulator.
cybersmudge, welcome. :) Yes I dove right in, skipped C64, like many have said. Also try using Mesen as your emulator because it's debug features are beyond excellent. :) One other recommendation, that tokumaru suggested to me, is try using the asm6 assembler. It was written by loopy, a forum member, and in its readme he writes:
loopy[color=#40FF80] in asm6's README.TXT[/color] wrote:Yes, it's another 6502 assembler. I built it to do NES development, but you can probably use it for just about anything. Why use this instead of one of the other zillion assemblers out there? I don't know, but choice is good, right? :) I wrote it because I thought most others were either too finicky, had weird syntax, took too much work to set up, or too bug-ridden to be useful.
asm6 is written extremely well! :D

Also recommend you visit the nesdev wiki because it has potential to answer many specific NES related questions. :)
Post Reply