zephyr wrote:I made some more changes:
(1) Minor speed optimization.
(2) Added extra code to make the program DOS compatible.
(3) No longer uses the S register for writing to $FF20 (this modification was suggested by John).
(4) Removed the "anda #$C0" before writing to $FF20 (this modification was suggested by John and Simon).
so, you want 8% more speed....
well here you go.... (i'm hard pressed for time so someone else will have to patch the .asm files and make new .wav/.cas files):
I had a good discussion with John Kowalski (Sock Master) about the routine, where he pointed out to be there was an single instruction inside the main 15 cycle loop that was redundant....
he would not tell me which one... (obvisously wanted to make me work for it)...., but after some single stepping of the code in EDTASM, i discovered that the lda <bord2+1 was getting loaded every pass without being used.... so, it needed to be moved (and repeated) to a less critical area....
so if your looking at code, this would be the new code:
bord2 adda #00
sta ,y
;*****************************************************************
; lda <bord2+1 ;WRONG POSITION (gets executed in critical loop without reason)
;*****************************************************************
dec <ch2count
bne l806d
;*****************************************************************
lda <bord2+1 ;NEW POSITION
;*****************************************************************
xore2 eora #00
sta <bord2+1
ch2freq ldb #00
stb <ch2count
ch2ix ldb #00
cmpb #$20
bcc l806d ; if A > $20 then this is not a drum effect, skip the INC D
inc <ch2freq+1 ; create the "fast falling pitch" percussion effect
l806d dec <ltemp2
bne l8073
;*****************************************************************
lda <bord2+1 ;NEW POSITION 2 (extra instruction)
;*****************************************************************
xore2b eora #00
by moving the lda <bord2+1 outside the critical loop we achive an 8% speed increase.... that, coupled with the removal of the anda #$c0 gives us a 12% speed increase inside the "core" loop, definately worth the effort....
result can be heard in the 2 previous youtube videos from my last post......
hopefully others will pitch in and make this the "definative" player for the coco /dragon.....
/Simon