aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* partial: Account for frame dropsMiquel Sabaté Solà2025-05-151-1/+22
| | | | | | | | Define tracing variables when PARTIAL=1, which is only on a development environment. This way we can detect whether we are dropping frames or not. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Simplify the cycling on the rest of spritesMiquel Sabaté Solà2025-05-151-19/+22
| | | | | | | | | | | | After all sprites have been properly put through the cycle, there is an amount of sprites which are just leftovers and need to be reset to an out of screen position. The loop that did this was unnecessarily complex and we could just rely on the 'y' register wrapping around. This has the benefit that is less error prone, even if there's still some glitches which most probably come from by-one errors and such. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Don't touch zp_arg2 on background checksMiquel Sabaté Solà2025-05-141-4/+3
| | | | | | | | This was a leftover from a previous implementation and is no longer needed. Moreover, I have also added a comment clarifying that the 'y' register is preserved. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Implement the base for moving bulletsMiquel Sabaté Solà2025-05-144-2/+467
| | | | | | | | | | | This establishes a way for bullets to move, be displayed as independent sprites, cycle these sprites, and check for the collision on the background. This is still lacking the collision check with enemies and has some obvious bugs that will be fixed on the next commits. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* reset: Do not zero out RAMMiquel Sabaté Solà2025-05-122-25/+23
| | | | | | | | | | | | | | | | This is usually done so the programmer can forget about initializing in the future, but it not only hides programming mistakes, but we are also resetting memory addresses which are never to be used by this simple game. Hence, just skip resetting RAM altogether. Last but not least, sprite initialization in `reset` code has also been optimized so instead of around 2000 cycles it takes half of that. This is done by only touching the first byte of the four bytes for a sprite in OAM, which is enough for hiding random sprites and the cost of extra `inx` instructions is far cheaper than all the extra `sta` to absolute address with X-index from the old code. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Fix comment that still referended "throttle"Miquel Sabaté Solà2025-05-112-3/+3
| | | | | | See: 132b7b1cc807 ("Rename throttle to the proper wording") Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* github: Add basic build pipelineMiquel Sabaté Solà2025-04-073-0/+50
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* assets: Exclude these files from git statisticsMiquel Sabaté Solà2025-04-061-0/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* assets: Add all enemies and bulletsMiquel Sabaté Solà2025-04-062-31/+31
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add the ability to pause the gameMiquel Sabaté Solà2025-04-033-3/+63
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* title: Allow selecting with the A buttonMiquel Sabaté Solà2025-04-021-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* config: Reduce the velocities when airborneMiquel Sabaté Solà2025-04-022-9/+9
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Implement hoverMiquel Sabaté Solà2025-04-021-0/+12
| | | | | | | | | This is a way to stop vertical velocity mid-air, which is something I did not know you could do until I read the original manual. The down arrow has been picked since it was the same choice of the original game when played on joystick. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Rename throttle to the proper wordingMiquel Sabaté Solà2025-04-024-40/+38
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Full stop when not moving on walking stateMiquel Sabaté Solà2025-04-021-3/+8
| | | | | | | | Before this commit the same logic as in throttle state was applied in which acceleration was applied. This brings back the logic more closely to the original game. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Switch to a throttle state when fallingMiquel Sabaté Solà2025-04-021-0/+22
| | | | | | | As it's done in the original game, switch to a throttle state when falling off a platform. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Adapt velocity constants for PALMiquel Sabaté Solà2025-04-028-19/+193
| | | | | | | | | | | | | | | | | | | In 2f140cfb7ea7 ("player: First PAL implementation") the rate of acceleration was adapted for PAL. Now the values for velocities have been adapted as well, in a way that we get (virtually) the same experience in PAL and in NTSC. This has been done by moving the velocity constants into configurable values, which are then picked up by a new bin/values.rb script. This script allows us to write the constants in plain floating point numbers, does the conversion to fixed point numbers as expected, and it also does the same for PAL by applying the proper NTSC to PAL conversion. As a cherry on top, some values have also been tuned to match the original game more closely, even if some more fine tuning might still be needed here and there. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* player: First PAL implementationMiquel Sabaté Solà2025-04-024-7/+91
| | | | | | | | | The steps by which a player increases its current velocity to reach the target one has been adapted on PAL, so every five frames it takes an extra step compared to NTSC. This at least brings PAL to grow its values at the same rate as NTSC. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* player: Implement background collisionMiquel Sabaté Solà2025-04-015-92/+305
| | | | | | | This adds a first implementation of collision checks between the player and the background. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add some notes on the changelogMiquel Sabaté Solà2025-03-212-14/+40
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* title: Fix toggle with the Select buttonMiquel Sabaté Solà2025-03-211-8/+10
| | | | | | | Fixes: b3cb545c6ebc ("player: Update its sprites on heading and throttle") Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* player: Inline the position to screen translationMiquel Sabaté Solà2025-03-201-49/+35
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add walking animationMiquel Sabaté Solà2025-03-205-43/+120
| | | | | | This also corrects a pixel from one of the animations on the chr file. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* player: Add initial code for horizontal motionMiquel Sabaté Solà2025-03-201-15/+92
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* player: Update its sprites on heading and throttleMiquel Sabaté Solà2025-03-192-58/+147
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>