Koffi Redux 2020 part 3
Updated 10/12/20 with the results, see bottom.
I'm running out of ROM memory with the new code I'm adding for the 2-player mode of the game. Koffi: Yellow Kopter was programmed in 32k back in 2002. It seemed like a huge amount of ROM at the time, so I didn't try much to keep things small. There ended up being huge graphics tables and repetitive code routines, just because that was easiest to do. Also, before I finished Koffi, I used up as much remaining memory as I could.
Over summer 2020, I went back and rewrote several routines, and I've ditched the original game's credits / names text and freed up 1k or 2k. I thought this would be enough to add some fun new stuff, but I'm once again running low on ROM space, so I am now rewriting the routines/data tables which are the biggest ROM wastes: those that create the image of the Trees.
Stage 1 Mountain Valley's Tree / leaves graphics take up 1,000 bytes originally. But most of the bytes are the value of $55. I am now trying to store a big rectangular block of $55's (no need to code these into the ROM now) programmatically, and then just have left-edge and right-edge tables to provide the more rounded tree details.
To illustrate, an original code section:
;************ Draw Leaves Layer2 ****************** ; RWL 2001 lda #<leaves2 sta Ptr1 lda #>leaves2 sta Ptr1+1 lda #$32 ;row 4 starts at $3208 sta $81 lda #$08 sta $80 jsr CommonMVTreeDrawLoop ; rewritten as common routine RWL 072520, saved hundreds of bytes
Using data tables like this one:
leaves2 .byte $15,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55 ;line 7 .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$50 ; ; .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55 ;line 8 .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$50 ; ; .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55 ;line 9 .byte $55,$55,$55,$55,$55,$55,$55,$54,$55,$50 ; ; .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55 ;line 10 .byte $55,$55,$55,$55,$55,$55,$55,$51,$15,$54 ; ; .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55 ;line 11 .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$54 ; ; .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55 ;line 12 .byte $55,$55,$55,$55,$55,$55,$55,$55,$55,$54 ; ;
See all those $55 values? A compression routine would also reduce ROM needs, I could compress these tables and expand them into screen RAM directly. But I'm not wanting to add a compress/decompress routine to this game this late in the game, which would take up some ROM itself anyway. So, I'm reducing these tables with my own custom draw routines.
10/12/2020 Monday night. Results: Success! I got the same basic tree image but at a cost of about 640 bytes less!
prior Blog entries:
https://atariage.com/forums/blogs/entry/16854-koffi-redux-2020-part-2/
https://atariage.com/forums/blogs/entry/16763-koffi-2020/
- 1
10 Comments
Recommended Comments