Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,476,159
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-24-24 07:28 AM
Guest: Register | Login

0 users currently in ROM Hacking | 1 guest | 1 bot

Main - ROM Hacking - Do you want to learn 6502 ASM? (Think again) New thread | New reply

Pages: 1 2

mickevincent
Posted on 10-19-12 07:07 PM (rev. 5 of 10-19-12 11:33 PM) Link | Quote | ID: 152697


Leever
Level: 32

Posts: 154/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
So.. after 4 years I finaly decided to actualy LEARN 6502 asm.

As you know I've yet released two hacks but just without any new asm programming. As everyone knows, you are very stricted on what you can do without any coding knowledge and the hack will just end up beeing just a graphical edit.
Of course, most people starts with that but after a while it's gonna get boring. And I decided once and for all that I just had to learn 6502 asm.

Thats why I made this thread. Because I have found two of the best sites for begginers that's surely is gonna give you a really good start.
Skilldrick's page will explain every bassic thing you need to know first. And when you feel that you understands the most of the things he writes about you should go to the Atari archives and read Richard Mansfield's book Machine Language For Beginners from 1983. The whole book is up there for free with his permission.

Why I had to share this with everyone is simply because I have learned more the last 2-3 days than I have done in 4 years. You need these sites

Begginers guide by Skilldrick

Machine coding(full book)

Good luck!


Update -

I just found another good book that probably is good to read after the first two as a complement. After all, the second one wasnt actually aimed directly towards NES programming. I havent realy got into to it yet but it looks like it covers the most. It's also made for learning to program the SNES, but it starts with the NES.

http://www.westerndesigncenter.com/wdc/datasheets/Programmanual.pdf

Program manual


infidelity
Posted on 10-19-12 10:57 PM Link | Quote | ID: 152699


Fuzz Ball
Level: 66

Posts: 278/968
EXP: 2367643
Next: 94208

Since: 05-24-07

Last post: 956 days
Last view: 812 days
If i ever get around to making my video tutorial on basic nes asm, i know now where to post it. :-) Id love to share my tidbits from what was taught to me, and what i learned on my own. :-)

mickevincent
Posted on 10-19-12 11:28 PM Link | Quote | ID: 152700


Leever
Level: 32

Posts: 155/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Posted by infidelity
If i ever get around to making my video tutorial on basic nes asm, i know now where to post it. :-) Id love to share my tidbits from what was taught to me, and what i learned on my own. :-)


Yeah that would be nice . I just found something else that probably needs to be readed to complement the first two, I'll post it.

NovaYoshi
Posted on 10-20-12 12:04 AM Link | Quote | ID: 152701


Red Goomba
Level: 15

Posts: 31/35
EXP: 14357
Next: 2027

Since: 02-24-11

Last post: 4196 days
Last view: 1285 days

I started with this tutorial that my cousin wrote, and it's actually intended for NES homebrew, but I think actually getting to test out code in the language you're trying to learn and see the effects of it is much better than just reading documents.

It expects this assembler and linker, and doesn't cover clearing the screen, reading the controllers, or sprites, but those were pretty easy to figure out with other sources.

____________________


mickevincent
Posted on 10-20-12 12:12 AM (rev. 2 of 10-20-12 12:12 AM) Link | Quote | ID: 152702


Leever
Level: 32

Posts: 156/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Posted by NovaYoshi
I started with this tutorial that my cousin wrote, and it's actually intended for NES homebrew, but I think actually getting to test out code in the language you're trying to learn and see the effects of it is much better than just reading documents.

It expects this assembler and linker, and doesn't cover clearing the screen, reading the controllers, or sprites, but those were pretty easy to figure out with other sources.


Ok thanx! I will check them up later.

Yeah it is better to test yourself then to only read documents. But I have messed with FCEUX's debugger for many years now. It's just that I need some theoretical knowledge now.
Hehe I didnt know the difference between LDA #$02 and LDA $02 a few days ago. Heck I didn't even know what LDA ment....... That wont get you anywhere. But of course, only reading wont get you anywhere either


infidelity
Posted on 10-20-12 06:11 AM Link | Quote | ID: 152705


Fuzz Ball
Level: 66

Posts: 279/968
EXP: 2367643
Next: 94208

Since: 05-24-07

Last post: 956 days
Last view: 812 days
Oh i remember my early days. For the life of me, i couldnt grasp the concept of branching, and when i think back, im like, wtf was my issue? Haha! It was only a few months ago where i started doing custom pushes/pulls, and various transfers here to there.

za909
Posted on 10-20-12 08:23 AM Link | Quote | ID: 152706


Cheep-cheep
Level: 32

Posts: 151/196
EXP: 189030
Next: 17412

Since: 04-27-11

Last post: 3050 days
Last view: 2761 days
Very interesting and useful topic indeed!
I need to ask though, does it cover the "DPCM bug" of the 2A03 that was fixed for the 2A07 in PAL consoles? Something about stalling the CPU for a couple cycles, and if you happen to be messing with the PPU or the Controller ports at that time, it gets ruined.

NovaYoshi
Posted on 10-20-12 08:32 AM (rev. 2 of 10-20-12 09:23 AM) Link | Quote | ID: 152707


Red Goomba
Level: 15

Posts: 32/35
EXP: 14357
Next: 2027

Since: 02-24-11

Last post: 4196 days
Last view: 1285 days

Posted by za909
and if you happen to be messing with the PPU or the Controller ports at that time, it gets ruined.

The controller ports aren't really a problem, though, because you can read the controller twice and check if the results match. If they do, they're reliable. Details on why this happens are are here.

PPU writes aren't bothered at all by it, it's only reads, and there's not a lot of reasons you'd want to read from the PPU in games big enough to have enough space for DPCM samples. I know Solomon's Key stored level data in the CHR ROM due to not having enough space in the normal PRG ROM and had to read its level data in through the PPU, and I know SMB1 stores titlescreen data there, but those are both early games and I doubt you'd have to do anything like that nowadays. :p

____________________


mickevincent
Posted on 10-20-12 11:40 AM (rev. 11 of 10-20-12 04:22 PM) Link | Quote | ID: 152708


Leever
Level: 32

Posts: 157/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Posted by za909
Very interesting and useful topic indeed!
I need to ask though, does it cover the "DPCM bug" of the 2A03 that was fixed for the 2A07 in PAL consoles? Something about stalling the CPU for a couple cycles, and if you happen to be messing with the PPU or the Controller ports at that time, it gets ruined.


If so, probably the program manual, it seems to cover the most. But I don't know for sure.


Edit -

Okey.. so I've tried to work out some things now when I got a little bit of knowledge of asm. So I got a tip from someone on youtube about my hack Maverick Revenge 2. When you select boss/level RAM adress $20 is suppose to get loaded with C0 as you can see in the first picture. STA $0020. And this happens on ALL level select stages.

But, when you select Charge Man there is a glitch for wathever reason. Then suddenly the A register at the exact same location is loaded with 80. So I went up a bit and thought maybe the A register is just loaded with a wrong value somewhere. Strangely it looks exactly the same... Is it because of the PLA(means Pull from stack to A? Right?) If so, I guess it's the stack that has got the wrong value on top?

This would help me alot if someone could explain .

Note one thing. I don't want help with this because Iam planning on finnishing Maverick 2, I will probably never do that. This just seemed easy enough to start with.

(This glitch screws the graphics when you see Charge Man on the level intro screen. But it's the correct graphics loaded to the PPU)





Matrixz
Posted on 10-20-12 05:37 PM Link | Quote | ID: 152709


Ninji
Level: 35

Posts: 213/225
EXP: 266328
Next: 13608

Since: 04-07-07
From: Norway

Last post: 3104 days
Last view: 1781 days
The value is based on what the contents of A is when the program is at D7B9.. from there it's pushed to the stack with PHA and pulled back with PLA. Then all the ASL and ROLs you see actually multiplicates the original value with decimal 32 (causing the new value in A to be $C0 or $80). So.. to see what goes wrong you need to go before D7B9 and see what gets loaded into A. The value, at that point should be $04 or $06.

mickevincent
Posted on 10-20-12 06:15 PM (rev. 3 of 10-20-12 09:14 PM) Link | Quote | ID: 152710


Leever
Level: 32

Posts: 158/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Yeah.. I found this

LDA $A900,Y @ $A903 = #$02

On a working level it want's to load 03 instead. I tried to change it and it did work. It's just that everything else got messed up .... like my computer will soon ...

Edit -
Nevermind, I managed to fix it. My first own bugfix in hex But.. all this for such a small glitch? How am I suppose to make my own bosses, enemies and other cool things? Geez ...

Edit 2 -
It's not healthy to do this 4 days in a row straight.

za909
Posted on 10-21-12 05:19 PM Link | Quote | ID: 152712


Cheep-cheep
Level: 32

Posts: 152/196
EXP: 189030
Next: 17412

Since: 04-27-11

Last post: 3050 days
Last view: 2761 days
Ok so I went through Skilldrick's tutorial and understood a lot of things that I didn't understand before. However there are still a couple things that are missing for me, and it's better for me to ask here than registering a new account at nesdev and ask as a complete noob and stranger.

While I do get the concept of the stack and all, I'm not really sure about its usage. Is the only purpose of the stack to serve as a "safe house" for processor register values when you jump to a subroutine for example, that actively uses a lot of registers, but when you return from the subroutine, you need everything the way it was before you jumped to the subroutine? Also, can I use the stack space as extra RAM? (I know it would get pushed and pulled around as my program is being executed, but still)

Something else I really don't get, is how to do timed waiting periods. Do you cause the processor to do useless instructions until the amount of time passes you need to wait for? How do you "convert" clock cycles to a frame?

I was really hoping that I would get an easy to understand explanation on the whole "Interrupts concept" I really don't know how these work, is it that you put certain routines to be executed automatically every time X event happens? (Like a Vblank cycle completes)

mickevincent
Posted on 10-21-12 05:26 PM (rev. 2 of 10-21-12 05:27 PM) Link | Quote | ID: 152713


Leever
Level: 32

Posts: 159/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Posted by NovaYoshi
I started with this tutorial that my cousin wrote, and it's actually intended for NES homebrew, but I think actually getting to test out code in the language you're trying to learn and see the effects of it is much better than just reading documents.

It expects this assembler and linker, and doesn't cover clearing the screen, reading the controllers, or sprites, but those were pretty easy to figure out with other sources.


I have opened the files in FCEUX now and tried to do different things with it in hex and the debugger and so on. I don't understand anything at all. I think it's easier to learn Japanese without a translation book. Iam sorry if I sound a bit dull at the moment..

NovaYoshi
Posted on 10-21-12 05:35 PM (rev. 4 of 10-21-12 07:18 PM) Link | Quote | ID: 152714


Red Goomba
Level: 15

Posts: 33/35
EXP: 14357
Next: 2027

Since: 02-24-11

Last post: 4196 days
Last view: 1285 days

Posted by mickevincent
I have opened the files in FCEUX now and tried to do different things with it in hex and the debugger and so on. I don't understand anything at all.

Which would be why the source code, with lots of comments explaining everything, is included, so you can make edits with a text editor and then use the assembler. :p
I was able to edit the text displaying demo into a text scroller without very much difficulty, but who knows where my source went.

Posted by za909
Also, can I use the stack space as extra RAM? (I know it would get pushed and pulled around as my program is being executed, but still)
No game's going to realistically need the whole 256 bytes, and as long as something else isn't already using that RAM you should be able to do whatever you want with a big (maybe 3/4 of it beginning at $100?) portion of it if you're running low elsewhere.

Posted by za909
Something else I really don't get, is how to do timed waiting periods. Do you cause the processor to do useless instructions until the amount of time passes you need to wait for? How do you "convert" clock cycles to a frame?
I guess it really depends on what you're trying to do. A really short wait for some effect you'd use useless instructions for, waiting for a specific scanline you'd want to use the sprite zero thing or a mapper interrupt for and waiting for the next frame you'd want to use the vblank interrupt (NMI) for.
I think a good way to wait for the next vblank would be to have the NMI routine do an INC instruction on some memory address, and have a routine that loads that memory address and compares against it until it changes.

Posted by za909
I was really hoping that I would get an easy to understand explanation on the whole "Interrupts concept" I really don't know how these work, is it that you put certain routines to be executed automatically every time X event happens? (Like a Vblank cycle completes)

Pretty much. There's a Non Maskable Interrupt that you can enable that runs some code of your choice whenever a vblank starts, and there's a general purpose interrupt that can be set to trigger on a couple different things. (DPCM samples ending, mapper features, etc)

____________________


mickevincent
Posted on 10-21-12 07:27 PM (rev. 2 of 10-21-12 07:28 PM) Link | Quote | ID: 152715


Leever
Level: 32

Posts: 160/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Which would be why the source code, with lots of comments explaining everything, is included, so you can make edits with a text editor and then use the assembler. :p
I was able to edit the text displaying demo into a text scroller without very much difficulty, but who knows where my source went.
------------------------------------------------------------------------------

Ok, yeah... I guess you mean the files that can be opened with the windows text pad.

It just feels so impossible to learn this by myself. Like change what to be in the PPU on some special location in a Mega Man game. Change AI routines for enemies... I mean I could figure out a small glitch with the help of Matrixz after alot of time. In that speed it would take a year to add a enemy.

How has people like Kuja Killer, Matrixz and Puresabe learned this? I can't understand that.

kuja killer
Posted on 10-21-12 07:36 PM (rev. 4 of 10-21-12 07:45 PM) Link | Quote | ID: 152716


Level: 55

Posts: 315/628
EXP: 1243662
Next: 70527

Since: 03-20-07
From: Lake Havasu City, Arizona

Last post: 280 days
Last view: 5 days
Ehhh.. i've wasted 5 whole years on trying to do stupid boss AI.

The problem with me is "not" about being able to program in NES asm.
My problem is, i have purely zero "thinking" skills or creativity or imagination. So i stall for months or years trying to do 1 boss at a time.

In this case, duplex, bolt, and necro for my game...

But man... if i had a brain like puresabe.. then i would of been light years ahead with my game already. His creativity and imagination for rock 4 MI blows me out of the universe a trillion times over.

mickevincent
Posted on 10-21-12 07:43 PM (rev. 2 of 10-21-12 07:56 PM) Link | Quote | ID: 152717


Leever
Level: 32

Posts: 161/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Posted by kuja killer
Ehhh.. i waste years on trying to do stupid boss AI.

The problem with me is "not" about being able to program in NES asm.
My problem is, i have purely zero "thinking" skills or creativity or imagination. So i stall for months or years trying to do 1 boss at a time.

In this case, duplex, bolt, and necro for my game...

But man... if i had a brain like puresabe.. then i would of been light years ahead with my game already. His creativity and imagination for rock 4 MI blows me out of the universe a trillion times over.


And my problem is not beeing able to program. I got tons of ideas both for bosses but specialy for level design. Maverick Revenge 2 is only a graphic demo of what I realy want to do.

It's wierd when I make a level I can just sit and do it while listening to music and ideas just pops up in my head the more I make. It's on the other hand, annoying as hell that I most of the time can't do anything with those ideas

Thanatos-Zero
Posted on 10-22-12 02:28 AM Link | Quote | ID: 152721


Nipper Plant
Level: 45

Posts: 282/423
EXP: 652720
Next: 7444

Since: 11-25-08
From: Germany - Rheinlandpfalz - Wittlich - Zur Phillippsburg 25

Last post: 1089 days
Last view: 1051 days
Posted by kuja killer
Ehhh.. i've wasted 5 whole years on trying to do stupid boss AI.

The problem with me is "not" about being able to program in NES asm.
My problem is, i have purely zero "thinking" skills or creativity or imagination. So i stall for months or years trying to do 1 boss at a time.

In this case, duplex, bolt, and necro for my game...

But man... if i had a brain like puresabe.. then i would of been light years ahead with my game already. His creativity and imagination for rock 4 MI blows me out of the universe a trillion times over.

That is not true. The lack of creativity and imagination can be easly explained.

First, you do not dare to take other ideas from others and adjust them for your own needs.
Second, stop with the mental self-deprecation. You are more able then you think!
Third, there is nothing new under the sun, so take ideas from other games or even real life!

It is no SIN nor is it a CRIME to make use from the ideas of others, except they are protected from the goverment to make sure you do not make money out of this.

Think about it! Your idea with Duplexman 1 was later taken and used by Puresabe for Cossack 1!
He did exactly those things.
Where did he got the ideas? From other games and from real life.
All what you need to do is, is to pay more attention to your games and the world you live in. Take what you need, what you think is cool.

____________________
I was a prisoner enclosed in the void, were everything might end up just as myself.
There I was called the death in the void, but after a long sleep my drill was ready to pierce the void.
I came back... to guide those who are in doubt and to crush any corrupted mind.
"Just who in the hell do you think I am?!".

mickevincent
Posted on 10-22-12 03:04 AM Link | Quote | ID: 152723


Leever
Level: 32

Posts: 162/193
EXP: 205973
Next: 469

Since: 02-26-08

Last post: 3355 days
Last view: 968 days
Posted by Thanatos-Zero
Posted by kuja killer
Ehhh.. i've wasted 5 whole years on trying to do stupid boss AI.

The problem with me is "not" about being able to program in NES asm.
My problem is, i have purely zero "thinking" skills or creativity or imagination. So i stall for months or years trying to do 1 boss at a time.

In this case, duplex, bolt, and necro for my game...

But man... if i had a brain like puresabe.. then i would of been light years ahead with my game already. His creativity and imagination for rock 4 MI blows me out of the universe a trillion times over.

That is not true. The lack of creativity and imagination can be easly explained.

First, you do not dare to take other ideas from others and adjust them for your own needs.
Second, stop with the mental self-deprecation. You are more able then you think!
Third, there is nothing new under the sun, so take ideas from other games or even real life!

It is no SIN nor is it a CRIME to make use from the ideas of others, except they are protected from the goverment to make sure you do not make money out of this.

Think about it! Your idea with Duplexman 1 was later taken and used by Puresabe for Cossack 1!
He did exactly those things.
Where did he got the ideas? From other games and from real life.
All what you need to do is, is to pay more attention to your games and the world you live in. Take what you need, what you think is cool.


Yes. And also... think about it.. the whole thing with making a Mega Man hack is to take an idea of a whole game.



kuja killer
Posted on 10-22-12 12:02 PM (rev. 2 of 10-22-12 12:03 PM) Link | Quote | ID: 152724


Level: 55

Posts: 316/628
EXP: 1243662
Next: 70527

Since: 03-20-07
From: Lake Havasu City, Arizona

Last post: 280 days
Last view: 5 days
i know already... but what i really mean is, i dont know "what" to pick.. or take from other games. I know i can just do that, but i dont ever know what to think.

I really cant manage to explain. i even suck at trying to just explain THIS very sentence even. :| (above)
Pages: 1 2


Main - ROM Hacking - Do you want to learn 6502 ASM? (Think again) New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.029 seconds. (340KB of memory used)
MySQL - queries: 122, rows: 162/162, time: 0.018 seconds.