Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fourspriter: Alternate Version
#4
Even more optimized:

The fspUpdateAsm routine can be optimized to this (please, click on the "Expand View" button on the right side of this message ==>)
Code:
SUB fastcall fspUpdate : REM This name will be used from BASIC
    asm
fspUpdateAsm:          ; This name will be used from ASM
         update_coordinates:
         ld     hl, datap+4     ; Points to data address
         ld     d, h
         ld     e, l            ; idem
         ld     b, 4            ; 4 iterations
i4chars4:
         ;; For each Sprite:
         ;; *(datap + 6) = *(datap + 4)
         ;; *(datap + 7) = *(datap + 5)
         inc    de
         inc    de
         ldi
         inc bc   ; Restores BC
         ldi
         inc bc   ; Restores BC
         ;; hl = hl + 40
         ld     hl, 44
         add    hl, de
         ld      d, h ; DE = HL
         ld      e, l
         djnz    i4chars4
END ASM
END SUB : REM There is an implicit RET here

Compare this routine with the previous one. I think this one is quite optimal (if not already). This should be done in all the code.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)