home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / asmutl / usoftpd.arc / BA.ASM next >
Assembly Source File  |  1987-07-31  |  1KB  |  46 lines

  1.  
  2. .MODEL medium
  3. .CODE
  4.  
  5. ; BASIC    function for QuickBASIC, Version 4 and future versions
  6. ;   of Microsoft and IBM BASIC Compilers
  7.  
  8.     PUBLIC    Power2
  9. Power2    PROC
  10.     push    bp        ; Entry    sequence - save    old BP
  11.     mov    bp,sp        ; Set stack framepointer
  12.  
  13.     mov    bx,[bp+8]    ; Load Arg1 into
  14.     mov    ax,[bx]        ;   AX
  15.     mov    bx,[bp+6]    ; Load Arg2 into
  16.     mov    cx,[bx]        ;   CX
  17.     shl    ax,cl        ; AX = AX * (2 to power    of CX)
  18.                 ; Leave    return value in    AX
  19.  
  20.     pop    bp        ; Restore old framepointer
  21.     ret    4        ; Exit,    and restore 4 bytes of args
  22. Power2    ENDP
  23.  
  24. ; BASIC    subprogram for QuickBASIC, Versions 1, 2, and 3;
  25. ;     for the Microsoft    BASIC Compiler through Version 5.36
  26. ;     for the IBM BASIC    Compiler through Version 2.02
  27.  
  28.     PUBLIC    Power2S
  29. Power2S    PROC
  30.     push    bp        ; Entry    sequence - save    old BP
  31.     mov    bp,sp        ; Set stack framepointer
  32.  
  33.     mov    bx,[bp+10]    ; Load Arg1 into
  34.     mov    ax,[bx]        ;   AX
  35.     mov    bx,[bp+8]    ; Load Arg2 into
  36.     mov    cx,[bx]        ;   CX
  37.     shl    ax,cl        ; AX = AX * (2 to power    of CX)
  38.     mov    bx,[bp+6]    ; Store    result in
  39.     mov    [bx],ax        ;   Arg3
  40.  
  41.     pop    bp        ; Restore old framepointer
  42.     ret    4        ; Exit,    and restore 4 bytes of args
  43. Power2S    ENDP
  44.     END
  45.  
  46.