Author Topic: DelAllocFPS without B_CALLs  (Read 2223 times)

0 Members and 1 Guest are viewing this topic.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
DelAllocFPS without B_CALLs
« on: December 11, 2010, 11:44:58 pm »
I'm trying to avoid the use of B_CALL routines whenever possible.  In Correlation, I have the following:

ld hl, 2
B_CALL _DelAllocFPS
res numOP1,(iy+ParsFlag2)

or 1
ret


What are the steps I need to take to replace this with a non-b_call function?  I don't need code, just what to do.
« Last Edit: December 11, 2010, 11:45:16 pm by Hot_Dog »

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: DelAllocFPS without B_CALLs
« Reply #1 on: December 12, 2010, 12:28:10 am »
If you're dealing with the parser, I'm not sure how much of a speedup you can really expect to get by avoiding B_CALLs.  But anyway...

I assume by DelAllocFPS you mean DeallocFPS.  That routine is very, very simple: it multiplies the input by 9, then subtracts that value from the current (FPS).  It doesn't check that there are actually that many entries allocated on the FPS.  So you could simply do
Code: [Select]
ld hl, (FPS)
ld de, -18
add hl, de
ld (FPS), hl

(Depending on the situtation, it might be good to verify that you're not popping past the start of the FPS, but the OS routines don't do that.)
« Last Edit: December 12, 2010, 12:28:38 am by FloppusMaximus »