Author Topic: a faster _satb_update routine  (Read 454 times)

touko

  • Hero Member
  • *****
  • Posts: 953
a faster _satb_update routine
« on: May 07, 2015, 08:15:30 AM »
Hi guy, i post my optimised _satb_update routine .

As it use self modifying code ,it must be used for CD projects only .
Code: [Select]
#asm
_satb_update:
; // Use TIA, but BLiT 32 words at a time (64 bytes)
; // Because interrupt must not deferred too much
; // 8 sprites at a time

stw #_satb , .vram_tia_satb + 1    ; // Source

       ; // Set VRAM destination address
st0 #0
st1 #$00
st2 #$7F

       ; // Enable VDC write mode 
st0 #2

ldx #8

  .vram_tia_satb:
tia $0000 , $0002 , $40
addw        #$40 , .vram_tia_satb + 1
dex
bne .vram_tia_satb
 
rts
#endasm

i can post a rom version if someone is interested .
« Last Edit: May 07, 2015, 10:21:43 PM by touko »

Debvgger_

  • Newbie
  • *
  • Posts: 27
Re: a faster _satb_update routine
« Reply #1 on: May 07, 2015, 08:17:01 AM »
Thanks :-)

Debvgger_

  • Newbie
  • *
  • Posts: 27
Re: a faster _satb_update routine
« Reply #2 on: May 07, 2015, 10:41:22 AM »
I would like to take a peek at the ROM version if you want to post it, too :-)

touko

  • Hero Member
  • *****
  • Posts: 953
Re: a faster _satb_update routine
« Reply #3 on: May 07, 2015, 10:13:40 PM »
I would like to take a peek at the ROM version if you want to post it, too :-)
Ok no problem ;-)

Code: [Select]
#asm
_satb_update:
; // Use TIA, but BLiT 32 words at a time (64 bytes)
; // Because interrupt must not deferred too much
; // 8 sprites at a time

; // set source,destination and size for executing tia in RAM
stw #_satb , _ram_hdwr_tia_src    ; // Source
stw #$0002 , _ram_hdwr_tia_dest ; // Destination
stw #$40 , _ram_hdwr_tia_size ; // Size

    ; // Set VRAM destination address
st0 #0
st1 #$00
st2 #$7F

    ; // Enable VDC write mode 
st0 #2

ldx #8

  .vram_tia_satb:
jsr _ram_hdwr_tia
addw #$40 , _ram_hdwr_tia_src
dex
bne .vram_tia_satb
 
rts
#endasm

All _ram_hdwr_tia variables are already declared in huc (in library.asm)
« Last Edit: May 07, 2015, 10:25:37 PM by touko »

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: a faster _satb_update routine
« Reply #4 on: May 09, 2015, 04:49:35 AM »
Ahhhhhh .... It always warms my heart to see self-modifying code!  :)

Debvgger_

  • Newbie
  • *
  • Posts: 27
Re: a faster _satb_update routine
« Reply #5 on: May 09, 2015, 09:29:38 PM »
elmer: Me too; as I always say, damn caches  :lol:

touko

  • Hero Member
  • *****
  • Posts: 953
Re: a faster _satb_update routine
« Reply #6 on: May 10, 2015, 05:13:45 AM »
LOL, CPU's cache is the evil  :evil: