Proton BASIC Compiler - Multiply routine for DW=W * W. Smaller than library "al@mul" for PIC18


  • PicŪ Basic


  • Multiply routine for DW=W * W. Smaller than library "al@mul" for PIC18

    I have developed a smaller code version of the library multiply routine (al@mul)
    - this multiplies WORD * WORD, to produce DWORD (as al@mul)
    - uses same library variables (as PDS Beta 3.5.2.2)
    - mine uses 120 program bytes, compared to library 184 bytes (both including CALL)

    I attach a ZIP with example use of code (using Macro), with the routine in its own BAS include.

    Also included is the resultant ASM for "MUL_WW"
    - the BAS uses ALIAS so that the library variables can be "shared"
    - as these locations will vary in typical application code, ASM version would be used (instead of source BAS)

    I hope it is of interest.

    I also have a version (MUL_SWW, 200 bytes) which treats the WORDs as signed, producing the expected DWORD result for all sign combinations.

    Alan.

    Attachment 1165
    This article was originally published in forum thread: Multiply routine for DW=W * W. Smaller than library "al@mul" for PIC18 started by RanOx View original post
  • Recent Activity

    david-48000

    Valid time in NMEA sentance

    Thread Starter: SimonJA

    Is there any way to know that a GPS nmea sentence has the correct time? I use a module to keep a pic rtc accurate but have noticed that when...

    david Yesterday, 20:40 Go to last post
    towlerg-21522

    I'm over the moon with joy. :-)

    Thread Starter: Les

    I just had to show you this, because I am over the moon with it. LOL I've just about finished procedures on the Proton 8-bit compiler so I am busy...

    towlerg Yesterday, 16:13 Go to last post
    david-48000

    GPS speed logger for RC planes.

    Thread Starter: david

    Hi All, This is a simple project to allow the logging of RC plane speeds to help determine battery, motor and prop variables. The code is crude and...

    david Yesterday, 21:01 Go to last post