This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Can a Commodore VIC 20 ASM Guide be used w/ a NES Assembler?

Can a Commodore VIC 20 ASM Guide be used w/ a NES Assembler?
by on (#111492)
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.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#111494)
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.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#111495)
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
by on (#111515)
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
by on (#111516)
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
by on (#111542)
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
by on (#111543)
Did you try looking through the Nerdy Nights tutorial?
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#111549)
wyatt8740 wrote:
so does anyone here know a guide to help me out? just a description of how to write 'hello world' or something?

"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.

Quote:
I am extremely new to Assembly and I have no idea how to address the PPU.

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.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#111713)
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.


Alright. :P I've done enough ram editing and rom hacking to understand that that can get complex.
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?

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.


Thanks for the... Pointers! :D
(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?

tepples wrote:
Did you try looking through the Nerdy Nights tutorial?


I started to; I will continue to now.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#111715)
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?

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.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#111719)
tokumaru wrote:
...play with FCEUX's PPU debugger...

I do play with the FCEUX Debugger. I did a simple hack to disable piracy protection in the EarthBound Zero Rom:
http://forum.starmen.net/forum/Community/PKHack/I-found-out-how-to-fix-anti-piracy-Screens-in-hacked-EarthBound-Zero-ROMs-by-Changing-a-single-byte

Also, I modded the title screen of the same game in a hex editor.
http://forum.starmen.net/forum/Community/PKHack/Earthbound-Zero-with-MOTHER-title-screen/

Image
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
by on (#111747)
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
by on (#111748)
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. :)

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.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#112119)
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. :)

That page is down.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#112120)
It was up for me 20 seconds ago. Where do you live?
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#112722)
tepples wrote:
It was up for me 20 seconds ago. Where do you live?

Sorry for very slow response; I live in Fort Wayne, Indiana. Frontier is my ISP. I am redirected to webring.
Re: Can a Commodore VIC 20 ASM Guide be used w/ a NES Assemb
by on (#112736)
wyatt8740 wrote:
I live in Fort Wayne, Indiana. Frontier is my ISP.

I too live in Fort Wayne, except I'm on Xfinity. (If you feel like it, you could try PMing me your IRL contact info so we can meet up.) None of the four browsers I tried (Firefox for Ubuntu, Chromium Browser for Ubuntu, Firefox for Android, and Chrome for Android) forced a redirect to WebRing.