I want to learn 6502 asm but don't know where to start

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
I want to learn 6502 asm but don't know where to start
by on (#28245)
Can any one help? I read the docs but don't understand them.

by on (#28246)
Start learning number systems (decimal vs hexadecimal vs binary), boolean gates and generally how CPU work internally (registers, addressing, ALU, stack).

by on (#28247)
How and where?

by on (#28248)
atariarchive.com used to have plenty books on the subject but they seem to be down...

by on (#28249)
http://en.wikipedia.org/wiki/Hexadecimal
http://computer.howstuffworks.com/boolean1.htm
http://en.wikipedia.org/wiki/Cpu
Stacks: http://en.wikipedia.org/wiki/Lifo

Rough instruction summary:

-Programs are lists of instructions for the CPU to carry out

-Load/Store instructions are used to get and put data into registers (memory inside the CPU) or memory (memory outside the CPU)

-Arithmetic / logical instructions perform operations between registers (particularly the main register--the accumulator) and memory or immediate data

-Subroutines are used to modularize programs

-Jump/Branch instructions are used to control the program flow

----------

6502 addressing modes: http://www.obelisk.demon.co.uk/6502/addressing.html

by on (#28250)
thanks! I'll get back to you when I'm done reading all of them.

by on (#28251)
now I need a compiler 6502 speaking to experimnet.

by on (#28252)
There are a few things you can do. You could pick up a compiler that is common around here such as WLA-DX, or CA65, but I don't know too much about CA65/CC65 or whatever. I use WLA-DX. It's kind of hard to get used to, and learn all about how to set everything up. There is also the NESASM route. It's good for learning how to do everything on the NES. Once you've learned, it's time to move on. NESASM is very very limited, and a nightmare to try to make a game on. I started out with it though. It's not hard to set up. If you can find that document by joker something or other, it'll show you how to set up a simple demo.

by on (#28255)
NotTheCommonDose wrote:
now I need a compiler 6502 speaking to experimnet.

Michal Kowalski's 6502 simulator is the best thing to experiment on and see how the instructions work. You don't have to worry about writing a full program, or initializing anything, which can be hard if you don't even understand the instructions right yet.

You just need an "org" directive before the code, so that it's assembler know where to place it in memory. When you want to try the program out, just hit the "assemble" button, and then the "debug" button. Then you can order the code to run all at once, step by step, etc (and you can use the debug windows to check out the status of memory, registers, etc).

I suggest you try out the simple things in the simulator, like adding and subtracting numbers numbers, shifting bits around, etc, to get acquainted with the instructions.

In my opinion, it's best that you learn 6502 ASM separated from NES stuff at first, because when you don't understand things it's easy to get the 2 mixed up. This simulator is pure 6502, it has nothing to do with the NES. Although you can use it to write NES programs and compile them into ROMs, the simulator will not simulate anything that's specific to the NES in debug mode, just the processor.

by on (#28264)
I agree with Tokumaru. I really like 6502 simulator.

I use the 6502 simulator to double check small snippets of code to make sure the flags, etc.. are doing what I expect them to be doing.

This site is very good.
http://www.obelisk.demon.co.uk/6502/

6502 simulator has contexxtual help but I dont find that there is enough details about the inner working of the instructions compared to that of the obelisk docs.
I'm half tempted to update my 6502 simulator help docs with the info from obelisk so I dont need to go to 2 different sources.

Al

by on (#28273)
I'm going to take a few days to start fiddling around with the programs and info.
Re: I want to learn 6502 asm but don't know where to start
by on (#30459)
NotTheCommonDose wrote:
Can any one help? I read the docs but don't understand them.


Hi,

This is a relatively old post but I'm also just getting started. Check out this archive of free e-books on machine language (assembly language). Atari Roots is a good one.

http://www.atariarchives.org/

Also the C64 manual chapter 5 has a nice intro to assembly (aka. machine language).

http://www.freewebs.com/laserbeak43/COM ... 0GUIDE.pdf

The converting from decimal to hex or binary is no big deal just takes practice to do it manually. You can also use a calculator that has the ability to do those conversions automatically for you, saves time.

(By the way thanks to whoever made the C64 page there available, very helpful).

Good luck,
T
Re: I want to learn 6502 asm but don't know where to start
by on (#30461)
electro wrote:
NotTheCommonDose wrote:
Can any one help? I read the docs but don't understand them.



Also the C64 manual chapter 5 has a nice intro to assembly (aka. machine language).

http://www.freewebs.com/laserbeak43/COM ... 0GUIDE.pdf

The converting from decimal to hex or binary is no big deal just takes practice to do it manually. You can also use a calculator that has the ability to do those conversions automatically for you, saves time.

(By the way thanks to whoever made the C64 page there available, very helpful).

Good luck,
T


sweet. someone used it!! :D

anyway, send me a message on aim or look for me in the #nesdev channel if you wanna collab with another noob. i'm sure i'd pay a lot more attention and learn faster with an extra person working with me.
Re: I want to learn 6502 asm but don't know where to start
by on (#30462)
Quote:
sweet. someone used it!! :D

anyway, send me a message on aim or look for me in the #nesdev channel if you wanna collab with another noob. i'm sure i'd pay a lot more attention and learn faster with an extra person working with me.


Sounds good, would be very helpful.

Thanks,
Tony
Re: I want to learn 6502 asm but don't know where to start
by on (#30463)
electro wrote:
Quote:
sweet. someone used it!! :D

anyway, send me a message on aim or look for me in the #nesdev channel if you wanna collab with another noob. i'm sure i'd pay a lot more attention and learn faster with an extra person working with me.


Sounds good, would be very helpful.

Thanks,
Tony


P.S.
if i'm offline, just send me an offline message, i'll keep in touch. also, I too am using the 6502 simulator at the moment. though i'm only learning how to use it right now. but it's pretty cool.

by on (#30476)
This is cool, a 6502 assembler and simulator on a web page (in JavaScript, no less). Even has some demos and a simple graphics area: http://www.6502asm.com/

by on (#30489)
yeah kinda ignored this one, but it's really cool and deserves to be stickied

by on (#30534)
"Atari Roots", I believe, is a great book for a beginner (like myself). It doesn't lay on too much extra tech stuff. Just plain english, easy to undertsand.

I found the web calculator, very helpful for converting between hex and binary numbers.

http://www.easycalculation.com/hex-converter.php

T