Can a Commodore VIC 20 ASM Guide be used w/ a NES Assembler?
Moderator: Moderators
Can a Commodore VIC 20 ASM Guide be used w/ a NES Assembler?
Hi,
This weekend i found an old Commodore VIC 20 in a warehouse while volunteering for a 'rummage sale'. I grabbed it and a Tandy 1400 LT. The VIC still had the box and was missing a key, but i replaced it.
The roof of the warehouse was leaky, and the VIC was submerged in water that smelled like sulphur. I have yet to turn it on. But I dried out the manuals and I learned that the 'Programmer's Reference Guide' has a section on Assembly with the MOS 6502.
The 'Programmer's Reference Guide' has about half the book dedicated to 6502 Assembly; A complete list of opcodes is included, with tutorials. and further explanation.
So this is my question:
Since the RP2A023 is a 6502 without decimal mode, would I be able to use it to program a NES? I have a powerpak and a Toaster Nintendo with the 10NES chip disabled and grounded, as well as a battered AV-Modded Top Loader.
This weekend i found an old Commodore VIC 20 in a warehouse while volunteering for a 'rummage sale'. I grabbed it and a Tandy 1400 LT. The VIC still had the box and was missing a key, but i replaced it.
The roof of the warehouse was leaky, and the VIC was submerged in water that smelled like sulphur. I have yet to turn it on. But I dried out the manuals and I learned that the 'Programmer's Reference Guide' has a section on Assembly with the MOS 6502.
The 'Programmer's Reference Guide' has about half the book dedicated to 6502 Assembly; A complete list of opcodes is included, with tutorials. and further explanation.
So this is my question:
Since the RP2A023 is a 6502 without decimal mode, would I be able to use it to program a NES? I have a powerpak and a Toaster Nintendo with the 10NES chip disabled and grounded, as well as a battered AV-Modded Top Loader.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
It may help you to learn about 6502 assembly language, but it isn't going to teach you anything about the NES specifically: If you wish to target the NES you are going to have to learn about the PPU and/or APU and controller input.
- rainwarrior
- Posts: 7680
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
Aside from anything to do with graphics, sound, or input, and of course decimal mode, any 6502 assembly should work on NES.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
Assembly is not of much use if you don't know to interface with the hardware, and each platform has RAM/ROM/video/audio/input implemented differently. You can probably learn useful things about the 6502 with this VIC 20 book, but it will probably use a lot of platform specific code for input and output, and that won't help you on the NES at all.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
Once you have key presses (platform specific), you move the critters (not platform specific) and draw them in new positions (platform specific). Acceleration, collision detection, aiming, and the like are the same on all platforms that use 6502.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
so does anyone here know a guide to help me out? just a description of how to write 'hello world' or something? I am extremely new to Assembly and I have no idea how to address the PPU.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
Did you try looking through the Nerdy Nights tutorial?
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
"Hello World" isn't typically the first NES program people make, because the NES doesn't have a built-in font or a BIOS with a routine to print text to the screen, so "Hello World" gets quite more complex than in any modern programming language.wyatt8740 wrote:so does anyone here know a guide to help me out? just a description of how to write 'hello world' or something?
People often show colors or sounds in their first programs, because that's a lot easier. People who want to jump right into the interesting stuff start with the Nerdy Nights tutorials, like tepples suggested.
The CPU and the PPU run in parallel. While the CPU runs the program you coded, the PPU renders pictures to the TV. In order to change this picture, the CPU has to feed the PPU with new information. The PPU has its own memory, not directly accessible to the CPU, where the pattern tables, name tables, attribute tables, OAM and palletes (i.e. everything necessary to generate pictures - if you don't know what these are, read the wiki and play with FCEUX's PPU debugger) stay. Since this memory is not directly accessible to the CPU, there is an address port and a data port which are accessible to the CPU, and this is how the program writes to and reads from PPU memory (it first tells the PPU which address is to be accessed and then writes to / reads from the data port - the address auto increments, so that you don't have to specify an address for every byte). There are also other PPU registers that affect how the image is rendered, such as the scroll registers, which can be changed by the CPU. Most of these PPU updates must happen when the PPU is "resting" between frames (otherwise the picture gets all messed up), a period called VBlank.I am extremely new to Assembly and I have no idea how to address the PPU.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
Alright.tokumaru wrote:"Hello World" isn't typically the first NES program people make, because the NES doesn't have a built-in font or a BIOS with a routine to print text to the screen, so "Hello World" gets quite more complex than in any modern programming language.
People often show colors or sounds in their first programs, because that's a lot easier. People who want to jump right into the interesting stuff start with the Nerdy Nights tutorials, like tepples suggested.

So, since i don't need to get right to the intresting stuff, how would I color the screen? I seem to recall from the rick astley demo ROM that the PCM sound register is at... $0x4011 or something. Is that right?
Thanks for the... Pointers!tokumaru wrote: The CPU and the PPU run in parallel. While the CPU runs the program you coded, the PPU renders pictures to the TV. In order to change this picture, the CPU has to feed the PPU with new information. The PPU has its own memory, not directly accessible to the CPU, where the pattern tables, name tables, attribute tables, OAM and palletes (i.e. everything necessary to generate pictures - if you don't know what these are, read the wiki and play with FCEUX's PPU debugger) stay. Since this memory is not directly accessible to the CPU, there is an address port and a data port which are accessible to the CPU, and this is how the program writes to and reads from PPU memory (it first tells the PPU which address is to be accessed and then writes to / reads from the data port - the address auto increments, so that you don't have to specify an address for every byte). There are also other PPU registers that affect how the image is rendered, such as the scroll registers, which can be changed by the CPU. Most of these PPU updates must happen when the PPU is "resting" between frames (otherwise the picture gets all messed up), a period called VBlank.

(pun intended)
Thank you for the information; I will try that. And would you say it's easier to get into assembly with something like, say, a Z80 than a 6502 variant like the 2A03?
I started to; I will continue to now.tepples wrote:Did you try looking through the Nerdy Nights tutorial?
Last edited by wyatt8740 on Fri May 03, 2013 9:34 am, edited 2 times in total.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
Personally, I find 6502 a bit easier. Maybe because it was the first assembly language I learned, but objectively speaking, the design of the 6502 is simpler. This means that the Z80 can do more with less instructions in most cases, but the instructions are more complex. In the end, because of this inversely proportional relationship, the complexity of coding for each CPU doesn't vary much. The same can be said about the speed of both CPUs... The 6502 needs lower clock speeds to perform as well as a Z80, because even though instructions on the Z80 do more, they take longer to execute.wyatt8740 wrote:And would you say it's easier to get into assembly with something like, say, a Z80 than a 6502 variant like the 2A03?
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
I do play with the FCEUX Debugger. I did a simple hack to disable piracy protection in the EarthBound Zero Rom:tokumaru wrote:...play with FCEUX's PPU debugger...
http://forum.starmen.net/forum/Communit ... ingle-byte
Also, I modded the title screen of the same game in a hex editor.
http://forum.starmen.net/forum/Communit ... le-screen/

This is the english game with the original title screen. Done with a hex editor.
Is this knowledge of any real use? on the links i have info on how I did all of this stuff with the debugger and hex editor.
... Since i don't need to get right to the intresting stuff, how would I color the screen? I seem to recall from the Rick Rolling PCM demo ROM that the PCM sound register is at... $0x4011 or something. Is that right?
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
It's good for creating data later, as hacking shows you have somewhat of an understanding how data is stored and read.
Still, just look at a page like http://www.obelisk.demon.co.uk/6502/index.html to learn 6502. It explains instruction, addressing modes, registers, all of it. 


Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
And then use this 6502 simulator to try stuff out. This is the best way to study how the instructions work. Better than using some old machine with no debugging features, specially if it's not the one you're ultimately targeting.3gengames wrote:Still, just look at a page like http://www.obelisk.demon.co.uk/6502/index.html to learn 6502. It explains instruction, addressing modes, registers, all of it.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
That page is down.3gengames wrote:It's good for creating data later, as hacking shows you have somewhat of an understanding how data is stored and read.Still, just look at a page like http://www.obelisk.demon.co.uk/6502/index.html to learn 6502. It explains instruction, addressing modes, registers, all of it.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
It was up for me 20 seconds ago. Where do you live?