• 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

    towlerg-21522

    PIC18F1330 PLL problem

    Thread Starter: rcurl

    I'm just starting out on a new project that uses a PIC18F1330. I haven't used this specific chip before, so I began by trying to blink an LED just...

    towlerg Today, 16:26 Go to last post
    towlerg-21522

    Pic16f18877 oread

    Thread Starter: evoortman

    Hi, On a PIC16F18877 the OREAD command doesn't seem to work. The code is working on a PIC16F1939. Both controllers use 32MHz int osc. If i...

    towlerg Today, 16:25 Go to last post
    palamont-28794

    MID$ Problem with a PIC18F25K22

    Thread Starter: palamont

    Hi everybody, I encounter a strange problem : I have a string of 230 characters. This string is divided into 10 segments of 23 characters, with a...

    palamont Today, 10:08 Go to last post