Author [EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [ID] Topic: Theou Aegis' Rookie Guide To 6502 ASM Reading  (Read 18068 times)

0 Members and 1 Guest are viewing this topic.

Offline Lelygax

  • The Wanderer
  • Master Hunter
  • *****
  • Posts: 4552
  • Its useless, its all useless.
  • Awards 2017-07-Sprite Contest First Place Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Castlevania: Harmony of Dissonance (GBA)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #30 on: September 26, 2012, 06:55:50 AM »
0
I never post here because I cant understand these things, but you are doing a good job, it will be helpful for someone that knows how to hack games :)
(click to show/hide)
Hau auu~     

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #31 on: September 26, 2012, 09:16:07 AM »
0
I never hacked a game in my life until about three or four months ago.I learned how to read ROM data and hack NES games because reVamp had too many limitations and I couldn't figure out why movements in CV3 were so random. So I self-taught myself how to read ASM and have been learning how Konami's R&D team made CV3. Now I can look at something in the game and make a pretty good guess as to how they did something.

Finding the code is still the hard part, hence that last post.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Gunlord

  • Wandering Mendicant
  • Global Moderator
  • Master Hunter
  • *****
  • Posts: 2724
  • Gender: Male
  • Meow.
  • Awards Capable of resolving arguments/fights peacefully without mod/admin intervention. Permanent Resident: Seems to always be around to post/reply. Master Debater: Gracefully argues 'til the cows come home about topics.
    • My blog
    • Awards
  • Favorite Game: Castlevania: Symphony of the Night (PS1/SS)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #32 on: October 08, 2012, 08:27:02 PM »
0
You gotta be smart to understand all dis stuff...I dun get it T_T

Check me out at gunlord500.wordpress.com!
https://www.youtube.com/watch?v=phhCrFZek44

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #33 on: October 10, 2012, 02:48:16 AM »
0
I'm convinced that the computer engineers that came up with ASM all had a neurochemical imbalance that was itself engineered by the Devil. Therefore, ASseMbly language is the spawn of Lucifer.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #34 on: October 10, 2012, 08:25:03 PM »
+1
ASM are the first three letters in the demon Asmodeus' name.  :o

I'm not smart. ... Ok, I'm smarter than a lot of people, but I'm not smart-smart. Behold the power of ejoocayshuN!
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Lelygax

  • The Wanderer
  • Master Hunter
  • *****
  • Posts: 4552
  • Its useless, its all useless.
  • Awards 2017-07-Sprite Contest First Place Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Castlevania: Harmony of Dissonance (GBA)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #35 on: October 11, 2012, 07:12:04 AM »
+1
"ejoocayshuN" means "education" right? lol
(click to show/hide)
Hau auu~     

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #36 on: October 11, 2012, 09:40:23 PM »
0
Once you become a little more comfortable reading ASM, you can start learning how some of your favorite games did what they did. Everyone knows I'm working on CV3, but tonight I just now took a glance at Bionic Commando. I see requests for "rope physics" in the Game Maker forums, but the simplest rope physics were right there on the NES. ... It's actually not that simple. It's kinda hard-coded, but in a sensible way. At a very quick glance, it would seem to me that it stores how many chains of the arm gets extended then checks the x of the hook part against the player and then moves the player that way. But like I said, it was at a very, very brief glance. I didn't like Bionic Commando's coding. Compared to CV3's, it seemed cruder. While CV3 has some coding issues that I've mentioned before, Bionic Commando's issues just at a glance are it uses too many indirect references. EEEEVVVVERYTHING is a variable referenced via indexing. And one value can be assigned to three or four different variables. What I do like though is it's very, very easy to find the tile map. You scroll through the hex editor and then BAM! It's right there, plain as day when you stumble upon it. ... You'd have to actually see it to understand how glaringly obvious it is. I was just like, "scroll down to find x, scroll down to find x, scroll do-- Oh. Gee, that must be the tile map!" But as for actually finding the player's x coordinate, nope, that wasn't easy. In CV3, finding variables is a cinch.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #37 on: October 12, 2012, 08:14:36 PM »
0
The rope physics in BC would be good to know and I'm sure a whole lot of people would appreciate having that info besides myself.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #38 on: October 14, 2012, 08:20:01 AM »
0
Well you'll all just have to wait on that or do it yourselves. I have the same problem hacking BC that I do trying to help people on the GMC forums -- I can't understand very well coding methods that I'm not familiar with. Studying CV3's code then jumping into BC's code is like going from reading Steinbeck to reading Shakespeare. ... Not implying that BC's coding is Shakespearean, just saying the styles are so different that it's hard to easily read one and then the other. Seriously though, BC may as well be like a play -- there's literally page after page after page of straight JSR commands. When I first saw it I was like, "WTF?!" Although to be fair, I've done my share of complaining about CV3's address indexing.

Also, if you want to make a game as close to the original as possible, use some sensibility. The spiders in CV3 are SLOW. Each piece of thread is an object. The spider creates the first thread and stores the index in a byte, then the thread stores the spider's index in a byte and creates a thread of its own and stores that index. It's one convoluted stream of parent-child object relations. I opted out in favor of just drawing sprites, since the threads have their "illusion" flag set.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #39 on: October 16, 2012, 11:49:18 PM »
0
OK. That is convoluted, but then again, it is very limited hardware we're talking about. When recreating that sort of thing in a modern video game SDK it's better to ignore the technicality of how the original did it and just try to get it as close as possible. I've been recreating the SMB physics for about a week now and I keep running into problems with either the background layers or the player sprite being jittery depending on how I do certain things. I'm sure this wouldn't be an issue at all if I wasn't trying to use the exact hexadecimal values from the original and just settled for rounder numbers.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #40 on: October 21, 2012, 08:44:16 PM »
0
Doubt that would help with the jittering.

You're remembering to truncate to single bytes, right? Nothing can be greater than 255 in an NES game, remember. SNES may give you a little more leeway, but you'd still need to watch your truncations.

Did you do what I've been doing and handle the carry bit manually? I mean, if you really want to use fractions, you'd take the fractional speed denominator value, divide it by 256, then add the integral speed. So if you have horz_2=$40 and horz_3=$01, hspeed would be $01+$40/$100 or $140/$100 or 5/4. In GM8, at least on my computers, that suffices to prevent jitteriness (I never use decimals because that's always caused jitters for me). Gravity, friction, and other acceleration is almost always fractional and follows the same rule. If you apply a gravity of $10 each step (as CV3 does with Living Armors and zombies), you'd set gravity to $10/$100 or 1/16.

Actually I'm veering away from the carry bit. In most situations it's not necessary. The only time you really need it is when dealing with bitwise rotations. For adding and subtracting, you can just compare the previous result to what was added. So if x+$10 < $10 would mean the carry bit was set, so you'd use y+=x+$10<$10 to increase y only when x+$10 is greater than $FF. For subtraction, you'd use y+=x-$10&$FF<$FF-$10. (Edit: Had to reverse the sign. Carry bit gets set when the subtraction doesn't cause an overflow. That's why CMP->BCC is used for less-than conditionals.)

Also, I'm feeling really happy with myself because while working on the Axe Knights (god, I hate their actual code) I thought up some codes for boomerangs. I had an idea for a boomerang that simply rises up if thrown from a crouch or down when thrown from a standing position so it still returns to the enemy that threw it (like the Quick Boomerang in MM2). I also had an idea for a boomerange that would be thrown downward and then arches back up subtly. I am quite pleased with that idea. :D

I'm kinda interested in the programming methods used by NR&D1 and NEAD, especially NR&D1 though. Think it'd be interesting to see how pioneers of console gaming used to program. Konami's "phase" system in CV3 is kinda hard to read even with a GM translation, but I like it. Logically, it's fairly sound -- increase a variable and only process the code defined by that variable. Even though all the code still gets dumped into the RAM, the CPU skips most of it. I think it also makes AI easier to interpret once you get past the messiness of it all.

To illustrate this, here's my translated Axe Knight code:
(click to show/hide)

As much as I hate it, it's one of the simpler codes. Compare that to something as deceptively simple as a fuzzy:
(click to show/hide)

And then there's my favorite so far, the owls.
(click to show/hide)

OMG BRAINSTORM! DISCUS SKELETON! He throws it down toward the ground and it bounces up then arches back toward the ground (or off the screen, whichever). Like skipping a Frisbee. I could so totally program that in CV3's style!
« Last Edit: October 21, 2012, 09:29:20 PM by TheouAegis »
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #41 on: October 22, 2012, 12:12:36 AM »
0
You're remembering to truncate to single bytes, right? Nothing can be greater than 255 in an NES game, remember. SNES may give you a little more leeway, but you'd still need to watch your truncations.

I'm handling each of 4 bytes individually.


Did you do what I've been doing and handle the carry bit manually? I mean, if you really want to use fractions, you'd take the fractional speed denominator value, divide it by 256, then add the integral speed. So if you have horz_2=$40 and horz_3=$01, hspeed would be $01+$40/$100 or $140/$100 or 5/4. In GM8, at least on my computers, that suffices to prevent jitteriness (I never use decimals because that's always caused jitters for me). Gravity, friction, and other acceleration is almost always fractional and follows the same rule. If you apply a gravity of $10 each step (as CV3 does with Living Armors and zombies), you'd set gravity to $10/$100 or 1/16.

Actually I'm veering away from the carry bit. In most situations it's not necessary. The only time you really need it is when dealing with bitwise rotations. For adding and subtracting, you can just compare the previous result to what was added. So if x+$10 < $10 would mean the carry bit was set, so you'd use y+=x+$10<$10 to increase y only when x+$10 is greater than $FF. For subtraction, you'd use y+=x-$10&$FF<$FF-$10. (Edit: Had to reverse the sign. Carry bit gets set when the subtraction doesn't cause an overflow. That's why CMP->BCC is used for less-than conditionals.)

Completely ignoring the carry bit since I'm using only the hex values and not the original code. Someone else interpreted the code and determined the exact values and explained how those values interact under different circumstances.


Also, I'm feeling really happy with myself because while working on the Axe Knights (god, I hate their actual code) I thought up some codes for boomerangs. I had an idea for a boomerang that simply rises up if thrown from a crouch or down when thrown from a standing position so it still returns to the enemy that threw it (like the Quick Boomerang in MM2). I also had an idea for a boomerange that would be thrown downward and then arches back up subtly. I am quite pleased with that idea. :D

Cool beans!


I'm kinda interested in the programming methods used by NR&D1 and NEAD, especially NR&D1 though. Think it'd be interesting to see how pioneers of console gaming used to program. Konami's "phase" system in CV3 is kinda hard to read even with a GM translation, but I like it. Logically, it's fairly sound -- increase a variable and only process the code defined by that variable. Even though all the code still gets dumped into the RAM, the CPU skips most of it. I think it also makes AI easier to interpret once you get past the messiness of it all.

I would too. That sort of info could be invaluable.


OMG BRAINSTORM! DISCUS SKELETON! He throws it down toward the ground and it bounces up then arches back toward the ground (or off the screen, whichever). Like skipping a Frisbee. I could so totally program that in CV3's style!

Kinda like the Jack o' Bones enemy from SotN? That would be cool.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #42 on: October 22, 2012, 05:25:28 AM »
0
Your "exact values" could be off. I'd double check that or get a second opinion.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #43 on: October 22, 2012, 06:47:48 PM »
0
Your "exact values" could be off. I'd double check that or get a second opinion.

Well, so far they seem to be pretty damn close, I really just think my execution is just a bit off.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Theou Aegis' Rookie Guide To 6502 ASM Reading
« Reply #44 on: October 25, 2012, 04:25:04 PM »
0
Actually, without even looking at BC's code, I think I can surmise how they did it or at least the general idea of how to do similar whip mechanics.

The lowest point of the swing will be at (hook.x,hook.y+arm_length). The speed of the swing is derived from how far from hook.x Ladd is at the time he starts swinging. To make sure he can swing, Ladd jumps up a height relative to the length of the arm. Gravity and horizontal acceleration are applied toward hook.x. When Ladd.x==hook.x, vertical speed is set upward retaining the gravity and horizontal speed is set away from hook.x and friction is reversed. At the highest point of the swing relative to the whip length, horizontal and vertical speeds are reset to 0 while gravity and "friction" dictate movement back toward the lowest point of the swing. To increase the swing, pressing right would add to the "friction" and left would subtract from the "friction", so pressing right while you're swinging to the left would reduce the speed, whereas pressing right while swinging to the right would increase the speed.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Tags:
 

anything