Monday, May 22, 2017

After spending several hours implementing a faster SQR function, there isn't enough space left in the ROM for it. :(

3 comments:

  1. Hi, I am doing a new basic for color computer, I am interested in all kinds of improved routines for basic functions and commendations. I am in retrowiki.es, in Spanish

    ReplyDelete
  2. There are some key differences between the 6809 and 6309, so you'll have to adapt any code I'd give you.
    The first thing I'd do is yank out the Microsoft Easter egg.
    Then add the code at the start of the main interpreter loop that reduces the calls to test for BREAK. It doesn't need to do that every pass, an I already posted the code if I remember right. You just need to find space to store the counter.
    Then switch the multiply to use the hardware multiply if there is room.
    And finally, I *think* the CoCo BASIC used relocatable code. Eliminate all PC relative addressing and you save a clock cycle everywhere it's used.
    The SQR code is pretty large vs the existing version, you'll have to see where you are on ROM space before even thinking about that. The standard one is only a few lines of code and then it drops into LOG or something like that if I remember right.

    ReplyDelete
  3. Alter CLS so that is points S to the end of the screen, clears multiple registers, and then push those registers to the screen in a loop.

    Switch memory copies so they use 16 bits.

    Switch string compares so they use 16 bits.

    PCLS should be optimized the same way as CLS

    If you get that far, you have taken care of the "low hanging fruit"

    I'm still revising things in my code and haven't made a cleanup pass, so I'm not quite ready to release it.

    ReplyDelete