Speech prep finished
I've freed up enough RAM so I'll be able to add back in the speech routines. Part of it was freed up by changing the sprite variables from INT (4 bytes) to UNSIGNED CHAR (1 byte). The routines can handle 24 sprites, and there are 9 different values stored for each sprite (such as X, Y, Image ID, Animation Frame, etc), so the original RAM usage was 864 bytes. After the change that only took 216 bytes. The rest was freed up by moving variables from the Display Data area into the Frequency table area (for speech I only need a few frequency table entries).
An issue with sprite corruption appeared after changing the variables to UNSIGNED CHAR. The problem occurred whenever a sprite had what used to be a negative value(just above the top of the screen) became a positive value (-1 is considered 255 when using UNSIGNED CHAR). In this screenshot, the humanoid had just shifted off the top of the screen. CHAR can be used as a signed value but then it's range would be -128 to 127, which isn't enough positive values to cover the screen. So I changed the Y to SHORT INT (2 bytes), which allows Y to be from -32768 to 32767. This increased the sprite data storage to 240 bytes(from 216).
There is a tradeoff in switching from INTs to UNSIGNED CHARs(and SHORT INT). The ARM code's ROM usage increases. However, it only increased by 100 bytes. Additional ROM usage does mean extra code is in there, so the routines will most likely be slightly slower than before.
Originally sprites that were partially offscreen were not drawn at all, this was mostly noticeable when Otto would appear and disappear as he bounced at the top of the screen. I've updated the sprite driver to handle clipping at the top and bottom of the screen.
I also made a few changes in how the Right Difficulty switch is used. Before setting it to A would fill the room with the maximum number of supported robots. It still does, but now it's only checked when you hit RESET instead of at the start of each room. Besides controlling the robot, it also disables the lives decrement logic in the Humanoid Died routines. This lets you play forever - I added that so it'll be easier to test for when screen jitter starts (so I'll be able to address performance issues). The score is now shown in red to let you know unlimited lives/max robots is in effect.
Sprite animation routines have also been added back, with some limited animation.
ROM
Source
7 Comments
Recommended Comments