Riatoju's Feed

Riatoju
08-11-2019 at 10:52 AM
7 Comments
Rate this Entry

Time to relearn 6502 Assembly Language!


I decided to refresh on 6502 Assembly. One of the best books ever written on the subject is "How to Program the Apple 2 Using 6502 Assembly Language" By Randy Hyde.

I also downloaded DiStella, a disassembler for Atari 2600 games, DOSBox to use in order to run DiStella, Ophis a great assembler I used years ago for dabbling with NES programing, and finally NotePad++ for editing assembly language source code.



In 2012 I began attempting to port my game engine to the NES, one of the biggest hurdles was finding a way to get the NES to scroll in multiple directions. The NES was only designed to scroll horizontally or vertically but not both. In order to get it to scroll in 8-directions, I had to develop a multi-directional scrolling library. At the time, there were no tutorials or usable source code with multi-directional scrolling available. Even though I made serious progress with it, I abandoned it.


I can still understand 6502 Assembly Language, unfortunately I forgot many of the rules and constraints of the actual processor, including techniques needed to handle arithmetic, multiplication and division.

My goal is a one off project, something I have put off for years. I don't really want to get back into programming honestly, I have been doing it as a hobby for over 15 years. However I have never reverse engineered a game before, and I'd like to do that and publish my work. I'd like for once in my life to do a project and follow through with it till the end. I have so many great projects I never polished and finalized. So reverse engineering a game would be a great achievement for me, and a good reason to retire from programming with something to show for myself.

Because this is a part time project, it may take months, a year or 2 years. I am trying to learn to become a comic book artist now, so that has higher priority. Unfortunately training myself to become a better artist has its limits, and in between that I need something to fill in the gap.

I'll keep you guys updated on my progress, wish me luck!

Thanksdatagod, francoisadt thanked this post
Likesdatagod, Jace Hall, nads, CageFreeman, Barthax and 1 others liked this post
Comments
  1. datagod's Avatar

    I really look forward to your progress. I hope to learn enough to keep up with you and Snowflake's analysis of the game. Can you imagine if you prove that 5.51 is actually possible?

    You can't get much more retro than Assembly. Also, your scrolling project is awesome. We have talked about that before.

    Welcome back!

    ThanksRiatoju thanked this post
  2. Riatoju's Avatar

    Quote Originally Posted by datagod

    I really look forward to your progress. I hope to learn enough to keep up with you and Snowflake's analysis of the game. Can you imagine if you prove that 5.51 is actually possible?

    You can't get much more retro than Assembly. Also, your scrolling project is awesome. We have talked about that before.

    Welcome back!

    Thanks, and I'll be sure to share my notes with you. Eric Tessler said he's interested as well. I think you and Rosa helped nudge me into making this decision. The detailed Dragrace ROM you showed me allowed me to see I can still read 6502 code. Strange to say, 6502 Assembly Language is the only form of programming I really liked, besides C and maybe C++. It's too the point, combined with the Atari 2600, there is no way around it, unlike the NES which has cookie cutter game world builders which I HATE! Programming is a great art form but it's being dumbed down by tools that do all the work for you. However I get the reasoning for it.
    Likesdatagod liked this post
  3. datagod's Avatar

    I myself have always been more interested in batch processing. Converting data, reading data from telecom switches, inter-process communication, etc. That is what I love so much about python. If you can think it, there is an example out there to help you program it. Just this morning I saw how to qeury a website for localized weather data. With a little tinkering, I got it to display Celsius instead of Fahrenheit.


    LikesRiatoju liked this post
  4. Snowflake's Avatar

    I’ve had ah idea fir an Atari game forever where learning how to program will help that. These needed skills benefit more than just dragster

    LikesRiatoju, datagod liked this post
  5. Riatoju's Avatar

    Quote Originally Posted by Snowflake

    I’ve had ah idea fir an Atari game forever where learning how to program will help that. These needed skills benefit more than just dragster


    You have no idea how learning this form of assembly language can improve your skills. The things I took from learning 6502 improved my skills dramatically. If you can do this, you can do anything. I pretty much mastered programming, but there was one last thing I really wanted to learn, 68000 assembly. The architecture is completely different from the 6502 and more complex, coming from the original Macintosh background, I would have loved to get ahold of that book as a kid. Things would have been very different today if I did. Sadly it was an expensive book at that time, now you can get it as a PDF!

    LikesCageFreeman, datagod liked this post
    Updated 08-11-2019 at 01:35 PM by Riatoju
  6. Riatoju's Avatar

    When i quit my NES demo, I took everything I learned from assembly and was able to really improve my game engine, there was nothing I couldn't do, only three things held me back, OS changes, deprecated libraries, and the last was an artist. I wanted to make a game that would last forever, but the PC isn't the platform for that. I was going to design my game for the Sega Genesis, but my personal issues got so bad I gave up. I don't think I'll ever really get into that kind of scale of programming again, but you got me to bite when it comes to 6502, I really love this language because my first gaming console (2600) and first computer computer I was exposed to and owned (the Apple 2) used this processor.

    LikesCageFreeman, datagod liked this post
    Updated 08-11-2019 at 01:36 PM by Riatoju
  7. datagod's Avatar

    Games got me interested in programming. I did nifty tech demos in the 80's, some really psychadelic stuff. Using analog yousticks to control circles and lines on a screen with graphics page flipping (8 pages on TRS-80). Really trippy stuff. Then in the 90's I was working on a tank game. I built a tile editor from scratch, used it to draw little animations and tiles. Then college killed with me "business programming" and I stopped with the graphics. That was 1991.

    My game? Tank Wars 2002. I had animations of tanks running over stick men, grinding them into bones and blood. Tanks shooting missile. Missiles bouncing off the ground, etc. But alas.


    LikesRiatoju liked this post
Join us