Last time around cd-w made a comment that led me to doing a test rewrite of one of the ball reposition kernels:
DS_GRP0 = DS1DATA DS_GRP1 = DS2DATA DS_HMP0_ENAM0 = DS3DATA DS_HMP1_ENAM1 = DS4DATA DS_HMMB_ENABL = DS5DATA ; HMxx for missile/ball, ENABL DS_COLOR = DS6DATA ; COLUP0, COLUP1, COLUPF - only used during reposition DS_SIZE = DS7DATA ; NUSIZ0, NUSIZ1, CTRLPF - only used during reposition DS_JUMP = DS8DATA RealResblStrobe73: ; 20 lda #<DS_SIZE ; 2 22 sta CTRLPF ; 3 25 lda #<DS_GRP0 ; 2 27 sta GRP0 ; 3 30 <- for next scanline, VDELP0 on lda #<DS_JUMP ; 2 32 sta NextKernel ; 3 35 sta HMCLR ; 3 38 <- reset missile/ball HMOVE ldx DS_HMP0_ENAM0 ; 4 42 stx HMP0 ; 3 45 ldy DS_HMP1_ENAM1 ; 4 49 sty HMP1 ; 3 52 lda #<HMMB_ENABL ; 2 54 sta HMBL ; 3 57 sta ENABL ; 3 60 <- for next scanline, VDELBL on lda #<DS_COLOR ; 2 62 sta COLUPF ; 3 65 lda #<AMPLITUDE ; 2 67 sta AUDV0 ; 3 70 sta RESBL ; 3 73 lda #<DS_GRP1 ; 2 75 sta.w HMOVE ; 4 3 sta GRP1 ; 3 6 stx ENAM0 ; 3 9 sty ENAM1 ; 3 12 jmp (NextKernel) ; 5 17
Basically by making 3 of the datastreams hold 2 TIA updates each (HMxx value in upper nybble, ENAxx in lower nybble) then we could do lda/sta/sta and squeeze in enough time to also update audio to support digitized samples for the Voice Alerts.
So as of Thursday around lunchtime I was planning to reboot Draconian yet again.
Then, later that night, this happened in the Bus Stuffing Demos topic:
On 3/30/2017 at 7:01 PM, ZackAttack said:
Could always enhance the driver to include a "fast jump" feature.
JMP FastJump would be detected and the 2 byte address is pulled from ARM memory instead of the ROM. Similar to how fast fetch works.
So like Fast Fetch where we turned this:
lda #DS_SIZE ; 4 4 sta CTRLPF ; 3 7
into this for a 2 cycle savings:
lda #<DS_SIZE ; 2 2 sta CTRLPF ; 3 5
Fast Jump would turn this:
lda #<DS_JUMP ; 2 2 sta NextKernel ; 3 5 jmp (NextKernel) ; 5 10 <- goes to jump table so we can do a single lda/sta for NextKernel instead of two for a 2 cycle savings ... JumpTable: jmp NextKernelReal ; 3 13
to just this:
jmp FASTJUMP ; 3 3
For a 10 cycle savings. If we could update the other 2 HMxx registers (so HMM0 and HMM1 during a ball reposition kernel) then the STA HMCLR is no longer needed, which yields up another 3 cycles. With that in mind, I worked up another test rewrite which resulted in this:
DS_GRP0 = DS1DATA DS_GRP1 = DS2DATA DS_HMP0 = DS3DATA DS_HMP1 = DS4DATA DS_MISSILE0 = DS5DATA ; HMM0 and ENAM0 DS_MISSILE1 = DS6DATA ; HMM1 and ENAM1 DS_BALL = DS7DATA ; HMBL and ENABL DS_COLOR = DS8DATA ; color change for players and ball only DS_SIZE = DS9DATA ; size change for all objects RealResblStrobe73: ; 20 lda #<DS_SIZE ; 2 22 sta CTRLPF ; 3 25 lda #<DS_GRP0 ; 2 27 sta GRP0 ; 3 30 <- for next scanline, VDELP0 on lda #<DS_BALL ; 2 32 sta ENABL ; 3 35 <- for next scanline, VDELBL on sta HMBL ; 3 38 lda #<DS_HMP0 ; 2 40 sta HMP0 ; 3 43 lda #<DS_HMP1 ; 2 45 sta HMP1 ; 3 48 lda #<DS_COLOR ; 2 50 sta COLUPF ; 3 53 lda #<AMPLITUDE ; 2 55 sta AUDV0 ; 3 58 ldx DS_MISSILE0 ; 4 62 stx HMM0 ; 3 65 ldy DS_MISSILE1 ; 4 69 sta.w RESP0 ; 4 73 sty HMM1 ; 2 75 sta HMOVE ; 3 78/2 lda #<DS_GRP1 ; 2 4 sta GRP1 ; 3 7 stx ENAM0 ; 3 10 sty ENAM1 ; 3 13 SLEEP 4 ; 4 17 jmp FASTJUMP ; 3 20
So we'd have digitized audio, diagonal shots, fancy station cores, etc that I was hoping to do using BUS Stuffing.
This is a significant improvement, so cd-w's going to look into updating the CDF driver to see if it's possible for him to squeeze in Fast Jump. Due to timing constraints in the driver he's not sure if can be done, and he won't be able to work on it for a few week due to prior obligations, so I'm going to hold off on the reboot until we know which of the two reboot options I'll be using.
In the meantime I'll be working on the audio support in Stella for BUS and CDF.