10 FORI=0TO255:POKE4096+I,SIN(I*π/128)*127.5+128:NEXT
LDX #$40 LDY #$00 lp LDA sinsrc,X STA sin,X STA sin+64,Y EOR #$FF STA sin+128,X STA sin+192,Y INY DEX BPL lp
.var sineAmp = $100 .var loStart .var loAddAdd .if (sineAmp == $40) { .eval loStart = $1c .eval loAddAdd = $03 } .if (sineAmp == $80) { .eval loStart = $18 .eval loAddAdd = $07 } .if (sineAmp == $100) { .eval loStart = $14 .eval loAddAdd = $0f } lda #$00 pha tax ldy #$40 loop: loAdd: lda #loStart adc #loAddAdd sta loAdd+1 bcc lo inc hiAdd+1 clc lo: adc #$00 sta lo+1 pla hiAdd: adc #$00 pha sta sine,x sta sine+$bf,y eor #sineAmp-1 sta sine+$80,x sta sine-$80+$bf,y inx dey bne loop
... tSin = $5f00 ... value = $3c ; 16 bits delta = $3e ; 16 bits ... * = $0326 !word codeStartAddress codeStartAddress ; fill&clear memory - lda #$f6 : setByte = *-1 ; !word $f6a9 sta ($2b),y iny bne - inc $2c ldx $2c cpx #$10 bcc - sty setByte bpl - ;sinus calculation ldx #$40 - pha clc adc value sta value lda tSin+$c0-1,y adc delta+1 sta tSin+$c0,y sta tSin+$80-1,x eor #$ff sta tSin+$00-1,x sta tSin+$40,y pla adc #$10 bcc + inc delta+1 + iny dex bne -
I'm also usually using Graham's mirror trick in bigger productions, even with only a 64 byte table. :)
Of course, it's possible a delta compression scheme might end up winning out over a calculation.. and any entry of more than 256 bytes of code is pretty much an automatic fail!
... what i want to say really, is, why dont someone make a c64 tool ? if its so important, then make a c64 generator? :)
sin=$4000 v3ctrl = $d40e+4 v3AD = $d40e+5 v3SR = $d40e+6 env3 = $d41c initSin ldx#$50 stx v3AD inc v3ctrl lda#127 clc lp ly ldy#63 eor#$ff sta sin-$50,x sta sin+64,y eor#$ff sta sin+128-$50,x sta sin+192,y ;26 cycles rol ; note this will clear carry ldy env3 ; increases by 1 every 208 cycles for attack=5, sbc dt,y lsr inx dec ly+1 bpl lp ; 22+26 =48 for entire loop rts dt .byt 5,5,5,5,5, 4,4,3,3,2, 2,1,0,255