home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0000 - 0009 / ibm0000-0009 / ibm0003.tar / ibm0003 / TPOWER53.ZIP / TPASM.ARC / TPBCDLOW.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-07-10  |  2.1 KB  |  74 lines

  1. ;******************************************************
  2. ;          TPBCDLOW.ASM 5.07
  3. ;     Macros    and equates used by BCD    routines
  4. ;     Copyright (c) TurboPower Software 1987.
  5. ; Portions copyright (c) Sunny Hill Software 1985, 1986
  6. ;     and used under license to    TurboPower Software
  7. ;         All rights reserved.
  8. ;******************************************************
  9.  
  10. ;******************************************************    Macros
  11.  
  12. CopyReal    MACRO    R2,R1            ;Copies    var R1 to var R2
  13.         MOV    SI,offset R1
  14.         MOV    DI,offset R2
  15.         CALL    CopyTemptoTemp
  16.         ENDM
  17.  
  18. CopyConst    MACRO    R1,C1            ;Copies    const C1 to var    R1
  19.         MOV    BX,DS            ;Save DS
  20.         MOV    SI,CS
  21.         MOV    DS,SI            ;Set DS=CS
  22.         MOV    SI,offset C1
  23.         MOV    DI,offset R1
  24.         CALL    CopyTemptoTemp        ;Copy
  25.         MOV    DS,BX            ;Restore DS
  26.         ENDM
  27.  
  28. PushReal    MACRO    R1            ;Push address of var R1    on stack
  29.         MOV    DI,offset R1
  30.         PUSH    DS
  31.         PUSH    DI
  32.         ENDM
  33.  
  34. PushConst    MACRO    C1            ;Push address of const C1 on stack
  35.         MOV    DI,offset C1
  36.         PUSH    CS
  37.         PUSH    DI
  38.         ENDM
  39.  
  40. NegReal        MACRO    R1            ;Invert    sign of    var R1
  41.         LOCAL    IsZero
  42.         MOV    AL,R1
  43.         OR    AL,AL
  44.         JZ    IsZero
  45.         XOR    AL,SignBit        ;Flip sign bit
  46.         MOV    R1,AL
  47. IsZero:
  48.         ENDM
  49.  
  50. AbsReal        MACRO    R1            ;Return    absolute value of var R1
  51.         AND    BYTE PTR R1,NoSignBit
  52.         ENDM
  53.  
  54. ;******************************************************    Equates
  55.  
  56. BCDlength    =    10            ;# of bytes in packed BCD
  57. MantissaLength    EQU    BCDlength - 1        ;size of packed    mantissa
  58. MantissaDigits    EQU    MantissaLength shl 1    ;# of digits in    unpacked mantissa
  59. SigDigits    EQU    MantissaDigits + 1    ;# of significant digits for addition, etc.
  60. UnpLength    EQU    BCDlength shl 1        ;# of bytes in unpacked    BCD
  61. WordsInBCD    EQU    BCDlength shr 1        ;# of words in packed BCD
  62. MSDoffset    EQU    Offset TempReal2 + MantissaDigits   ;offset in DS for MSD of TempReal2
  63. OverflowInt    =    0            ;INT generated when overflow
  64.                         ; occurs
  65. DivZeroInt    =    0            ;INT generated for divide by 0
  66. SignBit        =    10000000b        ;bit mask for 7th bit
  67. NoSignBit    =    01111111b        ;bit mask for bits 0-6
  68. ExponentsOnly    =    0111111101111111b
  69. SignsOnly    =    1000000010000000b
  70. HighNibble    =    11110000b        ;bit mask for high nibble
  71. LowNibble    =    00001111b        ;bit mask for low nibble
  72. AsciizLength    =    127
  73.  
  74.