NES Code Library

I have been searching for a code library that keeps track of some basic functions but can't find anything. I can find forums that have 1000s of posts of people's questions on how to perform some tasks, but trying to search them can be a pain to get the result you are looking for. I have also found some free to download source code and dug through the code to see how people performed some tasks.





Is there such a library that some one has started to keep track of this? Such a library could include code for making a sprite jump, basic directional movement (I know, it's in Nerdy Nights), or other basic functions that many games use. I have also found many tutorials that some of these functions are covered in the tutorial (outside of NA). I also know many here are very helpful and will help with anything I can't figure out, but I hate to be a burden and constantly badger them as they have their own projects to tend. I also, like to find and figure things out on my own for better understanding.



Thanks!

Comments

  • There should be one attached to the Programming Resources thread.  ETA:  See below.
  • Thanks.



    Paul: I have been digging there quite a bit. Lots of good stuff, they have some of what I was talking about, but not to the extent.



    MRN: I found that attachment after you posted the message. Great write up on each command, but not quite what I was looking for.



    I don't know, maybe I am asking for the moon on this one. I was just wondering if there was a searchable library of coding examples to perform certain actions (jump, run faster, similate gravity, etc). It would be laid out somewhat like MRN posted or in an organized webpage with links to each set of code. If not, no biggie. I just figured I could cut down my questions I keep bothering other developers with when I get stuck. I know most of you are more than happy to help, but I don't want to hinder your progression on your projects for my wee little game.



    Sorry if this still isn't clear, I am not the best at describing what I am trying to ask.



  • A good way to find these things is to find an open source homebrew game. I learned a lot from looking at the source from Solar Wars http://www.chrismcovell.com/data/SolarWarsSource.zip
  • On that wiki there are a couple of things here: http://wiki.nesdev.com/w/index.php/Programming_Libraries

  • Originally posted by: Roth



    On that wiki there are a couple of things here: http://wiki.nesdev.com/w/index.ph...



    This is on the right path! I've been through that site a bunch and missed this. If they could expand on it, that would be great. I like the layout.


  • Things like character's jump or movement aren't NES or 6502 specific at all, and their implementations can't really be generalized that much to be interchanged between games. So you probalby won't find such a specific library. But you sure can find tons of articles on these topics if you'll search for them without relation to the NES. It'll be up to you to implement them in 6502 code, though, but that's what game programmers actually do.
  • Even though it's not going to be perfect, I still think it's a good idea to have a code library.

  • Originally posted by: Aaendi



    Even though it's not going to be perfect, I still think it's a good idea to have a code library.



    Then you loose the uniqueness between all the games made using those resources. Wouldn't it get a bit boring if every NEW game had the same scrolling style, jump physics, etc.  Sure you can keep your OWN library and that can be YOUR style, but chances are most people will want to do things there own way.



    There aren't even that many sequels that handle these types of things the same way. Once you make your own game, you will have a list of things you will want to do differently next time. 
  • What is possible is to have a 6502 code library, but the code is not for some high level concepts like jump physics, but for math routines, scroll routines, etc - this has been done for Commodore 64: http://codebase64.org/doku.php?id=base:start (there are many things useful on the NES too)
  • So, what I am picking up here is that no such thing really exists. No problem, I was just wondering. Thanks for the responses!



  • I agree such a library would be useful, perhaps we could start one up? Like Shiru and others said, it may be of limited usability just due to how much customisation you'd need to do to the code anyway. Perhaps the way forward is just the "general algorithm for x" kind of sites, which then just need converting to 6502 and shoehorning in to your game.

  • UNless you are making a high level language converter, 99% of the time, other people's code will not help. They will need different variables, different ranges, work on different data types, and be differently optimized. Even if you had some, 99% of the code wouldn't be usable directly. So honest, there really is no point unless you want detailed examples on how to build your own, of which there are plenty in nerdy nights.
  • Even those are meant to be working examples. I usually rewrite my code from scratch for each game. You can cut and paste stuff like controller reading and game states, but that's about it.



    Most has to be Tailored for the context. You'll be surprised how fast you can write a compression routine the third or forth time you do it... And how much cleaner it becomes.
  • So, I am going to give an example of what I am talking about. I just wrote this code last night and it has been something I have beed researching how to do for a few days. This process checks to see if a button is no longer being held and does something once it detects it. This is pretty low level and can be editted to fit the needs of the game but it could be put into just about any game. I used this in my game because when you hold A, the beer glass fills and the Tap Handle taps. When the A button is released, the mug stops filling and the Tap Handle returns to it's original upright position.



     

    ;Variables

      joypad1            rs .1

      joypad1_old    rs .1



    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

      LDA joypad1                                              ;Put this section in the joypad section in the button loop you are checking when released, such as Button A. I usually make it the last piece of code of the subroutine.

      STA joypad1_old



    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



    CheckJoypad:                                            ;Put this in the game playing state of your code

      LDA joypad1                                            ;Check to see if the button on joypad 1 has been released

      CMP joypad1_old

      BEQ CheckJoypadDone

                                                                          ;DO SOME STUFF HERE

                                                                          ;DO SOME STUFF HERE

                                                                          ;DO SOME STUFF HERE

                                                                          ;DO SOME STUFF HERE         

    CheckJoypadDone:
Sign In or Register to comment.