aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* debug: Add general debugging counterMiquel Sabaté Solà2026-03-021-0/+3
| | | | | | | | This counter is useful to account for certain numbers in hot spots. This way, and with a memory viewer or a debugger, you can directly tell whenever something is off. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Small optimization on bullet initializationMiquel Sabaté Solà2026-03-022-4/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Implement de 'chase' algorithmMiquel Sabaté Solà2026-03-022-37/+247
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Improve some comments in enemies.sMiquel Sabaté Solà2026-03-021-4/+4
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Check for all corners on the 'basic' algorithmMiquel Sabaté Solà2026-03-012-18/+26
| | | | | | | | | | There were still some gaps where the check was failing, and trying to be smart about it was going the "it's too complex for what I need here" route. Hence, just go to the good old dumb algorithm of "check all corners". For now the performance has not dropped, so let's hope that we don't have to re-visit this one. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix bottom collision for fighter jet 1sMiquel Sabaté Solà2026-03-012-3/+10
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Finish up the 'homing' algorithmMiquel Sabaté Solà2026-03-012-16/+22
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Allow the 'basic' algorithm to go up or downMiquel Sabaté Solà2026-03-012-6/+13
| | | | | | This is in preparation to the 'homing' algorithm to re-use this one. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Remove the usage to zp_enemy_arg in most placesMiquel Sabaté Solà2026-02-282-74/+31
| | | | | | | | | | | | | | Everywhere except the 'basic' algorithm don't really need this argument. In the beginning I was using it to define some custom velocities, but in the end tweaking the inner timer on the 'extra' value for all enemies turned out to be more productive. Hence, remove this usage almost everywhere and make the code simpler as a side-effect. The usage on 'basic' is still under revision, just to check if 'homing' really needs to set a special argument whenever the 'homing' attack needs this sort of behavior. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Move the 'extra' initialization to a functionMiquel Sabaté Solà2026-02-282-52/+54
| | | | | | | | This allows us to be able to initialize each enemy separately, giving a more random appearance to it all. This will also come in handy whenever we want to make enemies re-appear. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Make 'basic' more true to the original gameMiquel Sabaté Solà2026-02-272-23/+45
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Initial implementation for the homing algorithmMiquel Sabaté Solà2026-02-272-3/+120
| | | | | | | Not the whole thing has been implemented, as it needs a rebump on the 'basic' algorithm so I can re-use it for 'homing' as well. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update values on the RNG tableMiquel Sabaté Solà2026-02-132-19/+20
| | | | | | | This way enemies are a bit more off from the boundaries, avoiding visually distracting scenarios. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Set the enemy pool size on 'init_pool' loop's initMiquel Sabaté Solà2026-02-132-5/+4
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Implement the 'erratic' algorithm for enemiesMiquel Sabaté Solà2026-02-132-5/+174
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Remove vector.sMiquel Sabaté Solà2026-02-134-71/+72
| | | | | | | | | | | | | | | | | Instead of this, the 'reset' function can go into 'jetpac.s', as we could consider it's part of the 'main' work. As a bonus, doing this alignment gives us 3 bytes back from ROM space. Not that we care too much about space, but it's amusing nonetheless. The debug scope has been moved into its own file in include/. Admittedly it's not the most crucial file in the project, but it makes things more logical and it opens the door to more debugging utilities. This leaves us with a vector.s file only containing interrupt code. Thus, it just makes sense to rename it to interrupts.s, which in the end makes things more organized. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix sprites and waves for fighter jetsMiquel Sabaté Solà2026-02-121-6/+6
| | | | | | | I apparently got them all messed up. Let's put them as they were originally. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Implement the 'bounce' algorithm for enemiesMiquel Sabaté Solà2026-02-122-8/+203
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Initial iteration of enemy movementMiquel Sabaté Solà2026-02-126-43/+327
| | | | | | | For now only the basic algorithm has been written, but the framework for adding the rest has also been written down. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Replace some todo's with the safe __fallthrough__Miquel Sabaté Solà2026-02-112-4/+2
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* bin: improve the style and add more documentationMiquel Sabaté Solà2026-02-115-18/+43
| | | | | | And also run rubocop on the CI for good measure. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* nasm: always save memory/segments statsMiquel Sabaté Solà2026-02-114-8/+61
| | | | | | | And don't let git ignore it. From now on this will be available in git as well so to detect regressions. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Remove target velocities from the playerMiquel Sabaté Solà2026-02-101-4/+0
| | | | | | This was mostly from an old implementation and no longer relevant. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Improve the "other" states from fighter jetsMiquel Sabaté Solà2026-02-103-26/+28
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add a sanity check for the LEVEL variableMiquel Sabaté Solà2026-02-101-0/+5
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Simplify the random_valid_y_coordinate functionMiquel Sabaté Solà2026-02-103-38/+42
| | | | | | | | | | | | | | | | | | | | | | | | | This function relies on a pre-computed table to get the "random" numbers from, but most of the times this is used, it needs to be between some safe boundaries. Before this commit, this was done inside of the function, correcting the fetched value to be above or below these limits. But there was a bug on the below the grounds limit, in which the 'sbc' instruction could subtract too much from the fetched value and make enemies appear below the sky. Now, this is easy to correct, but since we are cheating with a pre-computed table, I thought it would be vastly easier to just get a random table with the "proper" values. That is, random but within the required boundaries already. Plus, it makes the 'random_valid_y_coordinate' function much faster. This commit adds a ruby script in bin/ which produces a pseudo-random table when called, making sure all the requirements are met. We have to make sure to call this script if we ever change the boundaries at some point. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Simplify allocation for the rest of bulletsMiquel Sabaté Solà2026-02-101-6/+10
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Allocate all enemies on sprite cyclingMiquel Sabaté Solà2026-02-103-4/+43
| | | | | | | The previous commit only tackled the first enemy, this one handles the "rest_o_enemies" code flow, which was entirely missing. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* enemies: add inner movement and facing logicMiquel Sabaté Solà2026-02-103-27/+238
| | | | | | | | | Enemies now have the ability to be displayed on screen, face at the direction that they were assigned to at random during initialization time, and they also have a timer that dictates some inner movement, similarly as it happened in the original game. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Re-order the build-* targets on buildMiquel Sabaté Solà2026-02-091-1/+1
| | | | | | | If we passed the --strict flag to nasm, then we want the statistics from the full build, not the one specific to PAL systems. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Use constants on asan:reserveMiquel Sabaté Solà2026-02-091-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add the __fallthrough__ pseudo-instructionMiquel Sabaté Solà2026-02-032-2/+11
| | | | | | | | The 'nasm' assembler now implements this, which is quite convenient. Define also a fake macro for it when the assembler is not 'nasm' just to bridge the gaps. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix typo on MakefileMiquel Sabaté Solà2026-02-031-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Increase the upper Y limit for spritesMiquel Sabaté Solà2026-02-031-1/+1
| | | | | | | | Some sprites like enemies and objects are meant to appear maximum at a certain Y coordinate. Increase that as the former could mean sprites going on about the scores, whereas that shouldn't be possible. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add missing enemy tile definitionsMiquel Sabaté Solà2026-02-031-4/+36
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Initial work on sprite cycling for enemiesMiquel Sabaté Solà2026-02-031-8/+47
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Remove the .nasm/ directory on 'clean'Miquel Sabaté Solà2025-12-151-0/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Only use --stats if V=1Miquel Sabaté Solà2025-12-151-1/+5
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Adapt the code to play well with nasm's asanMiquel Sabaté Solà2025-12-1513-144/+145
| | | | | | | The address sanitizer from nasm provides quite a few goodies, so let's adapt the code more to it to benefit from those. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add patch files into gitignoreMiquel Sabaté Solà2025-12-141-0/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update assets with the latest changesMiquel Sabaté Solà2025-10-132-24/+24
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Don't handle frame drops unless PARTIAL is setMiquel Sabaté Solà2025-10-121-0/+4
| | | | | | | | | | This fixes commit 6e274fb50251 ("partial: Account for frame drops") in the sense that the accounting of frame drops should _never_ affect production binaries. Even if the two instructions would've never been reached if PARTIAL=0, they would still be included in the final binary, which is not necessary. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Pick xa65 by default if that existsMiquel Sabaté Solà2025-10-123-11/+18
| | | | | | | And let it pass the --strict and --stats parameters to the underlying nasm command. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Initialize enemies at a random Y coordinateMiquel Sabaté Solà2025-05-165-1/+76
| | | | | | | | | The randomness comes from a pre-computed table of "random" numbers. This is of course the most simple technique you can come across a code base for the NES/Famicom, but for the purposes of this game is good enough and (most importantly) fast. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add the skeleton code for enemiesMiquel Sabaté Solà2025-05-153-0/+60
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* assets: Duplicate the UFO kind of spriteMiquel Sabaté Solà2025-05-152-57/+62
| | | | | | | | | | At first I thought that I could save up some space and then mirror the sprite horizontally, but it actually makes things easier to have the UFO enemy in its entirety as it makes initialization and moving the object easier. This is indeed possible because we have plenty of room left on the CHR bank. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* bullet: Do not clash with the poolMiquel Sabaté Solà2025-05-151-9/+9
| | | | | | | | | | One of the glitches as hinted by commit ae857d302cd6 ("Implement the base for moving bullets") actually came from the fact that the temporary screen coordinates were pointing at the first sprite from the pool of bullets. This commit moves these variables into a memory region where there won't be any clashes. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add the segment on globals.sMiquel Sabaté Solà2025-05-151-0/+2
| | | | | | Possibly not an issue, but it's better to be safe than sorry. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Define the notion of a levelMiquel Sabaté Solà2025-05-153-0/+28
| | | | | | | | | This is for now just a variable that will be set during initialization, and that it can be influenced through the `LEVEL` make variable. Both the level and the level "kind" notions are used tracking, at least, which kind of enemy wave we have to send. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Decrease the capacity of bullets on screenMiquel Sabaté Solà2025-05-151-1/+1
| | | | | | | | | This fixes any frame drops I have experienced so far. This is not a real fix since it is more likely that there's some part of the code that is simply too slow. At some point I should investigate where is that, but it will probably reappear whenever I start looking into enemies. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>