There are 9 instances of ReadBit. You could make it half a macro and half a subroutine to save a 12-cycle jsr/rts pair for 7 of the 8 bits in a compressed byte. For a 4 KiB segment compressed to 2500 bytes, this saves 7 frames at the cost of 36 bytes. Given how much you're already saving over the original Codemasters code, this
might be worth it.
FROM the following:
Code: Select all
+ReadBit:
;read a bit from the stream and return it in the carry flag
asl BitBuffer
bne +Return
+ lda (InputStream), y
iny
bne +
inc InputStream+1
+ rol
sta BitBuffer
+Return:
;return
rts
TO the following: (I'm not too familiar with asm6, so this is a sort of ca65/asm6 amalgamation)
Code: Select all
.macro ReadBit
.local Return
asl BitBuffer
bne +Return
jsr +ReadByte
+Return
.endmacro
+ReadByte:
lda (InputStream), y
iny
bne +
inc InputStream+1
+ rol
sta BitBuffer
rts
On several other forums I used to be active on (pocketheaven, gbadev), there was seldom a new library release thread without constructive criticism about its license. From readme.txt:
Feel free to use this in your projects if you'd like. You can also modify the compressor or the decompressor if you think you can improve them in any way. I just ask that you let me know if you make any improvements to these programs.
I take it that was supposed to be a request, much like the "giftware" license of the Allegro library. Or is it a requirement? It's OK if it's a requirement as long as one can fulfill it by just publishing the source code of the modified compressor or decompressor; in that case, it acts like a weak copyleft like the Classpath license, MPL, or LGPL.
(License discussion continues in
another topic.)