Posted By
Mad on 2022-06-01 08:28:39
| Re: cc65 compressor too slow: help needed optimizing
I cannot help you.. All three suggestions above can copy changing numbers of bytes (the amount is in the x register at start).. But anyhow have fun.. lda #$00 ; somewhere at program init sta $f0 ; somewhere at program init
copyBytes:
lda rtstablehi,x sta $f1 ldy rtstablelo,x lda #OPCODE_RTS sta ($f0),y ; places an rts in the unrolled part jsr loop lda #OPCODE_LDA_ABS sta ($f0),y ; removes the rts in the unrolled part again rts
unrolledPart "\ttlda\t_vo3_cur+0\n" "\tsta\t_vo3_best+0\n" "\ttlda\t_vo3_cur+1\n" "\tsta\t_vo3_best+1\n" "\ttlda\t_vo3_cur+2\n" "\tsta\t_vo3_best+2\n" "\ttlda\t_vo3_cur+3\n" "\tsta\t_vo3_best+3\n" "\ttlda\t_vo3_cur+4\n" "\tsta\t_vo3_best+4\n" .. "\ttlda\t_vo3_cur+255\n" "\tsta\t_vo3_best+255\n" rts ; if you want to copy all 256 values this byte needs to be here
Just to clarify that..
edit: BTW sorry, you do a compression programm, unrolling maybe is not an option then (because of program size :) )..
edit2 :) :
lda jmptablo,x sta j + 1 lda jmptabhi,x sta j + 2 j: jmp unrolledPart unrolledPart: "\ttlda\t_vo3_cur+255\n" "\tsta\t_vo3_best+255\n" "\ttlda\t_vo3_cur+254\n" "\tsta\t_vo3_best+254\n" .. "\ttlda\t_vo3_cur+0\n" "\tsta\t_vo3_best+0\n"
|