3 ms·
I read the source code, and here are 2 improvements: 1) in get_block, we can replace "dec count" with "cpy count" It should save one or 2 cycles, if I'm not mi
by jcmeyrignac 8y ago
I read the source code, and here are 2 improvements:
1) in get_block, we can replace "dec count" with "cpy count"
It should save one or 2 cycles, if I'm not mistaken
2) get_countdown can be rewritten as follows:
ldy #$89
c4:
cpy #$89
bne c1
c0:
jsr get_byte
c1:
ldy #$89
bne c2
cx:
jsr get_byte
c2:
sty tmp_cntdwn
cmp tmp_cntdwn
bne c4
dey
cpy #$80
bne cx
rts
which saves probably 4 bytes
- Luc 8y ago> 1) in get_block, we can replace "dec count" with "cpy count" It should save one or 2 cycles, if I'm not mistaken It would, but wouldn't it also set the carry flag? Thus the routine would always return with carry flag set.
- tom_ 8y agoIt would, but the routine already modifies the carry flag, so no problem.
- jcmeyrignac 8y agoYou are completely right, I missed this carry. Thanks !
- Razengan 8y agoThis is why I love and cherish HN. :)
- oh5nxo 8y agoRegarding 1) could you offset ptr backwards and y forward, so that last iny makes zero?