home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / H_PADD.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-06-07  |  1.9 KB  |  87 lines

  1. ;[]-----------------------------------------------------------------[]
  2. ;|      H_PADD.ASM -- long pointer routines                          |
  3. ;|                                                                   |
  4. ;|      Turbo-C Run Time Library        Version 3.0                  |
  5. ;|                                                                   |
  6. ;|      Copyright (c) 1987,1988,1990 by Borland International Inc.   |
  7. ;|      All Rights Reserved.                                         |
  8. ;[]-----------------------------------------------------------------[]
  9.  
  10.                 INCLUDE RULES.ASI
  11.  
  12. ; calls to these routines are generated by the compiler to perform
  13. ; arithmetic operations on huge pointers.
  14.  
  15. _TEXT           SEGMENT BYTE PUBLIC 'CODE'
  16.                 ASSUME  CS:_TEXT
  17.  
  18.                 public  PADD@
  19.                 public  F_PADD@
  20.                 public  N_PADD@
  21.  
  22. N_PADD@:
  23.                 pop     es                      ;fix up far return
  24.                 push    cs
  25.                 push    es
  26. PADD@:
  27. F_PADD@:
  28.         or    cx,cx
  29.         jge    add1
  30.         not    bx
  31.         not    cx
  32.         add    bx,1
  33.         adc    cx,0
  34.         jmp    sub1
  35. add1:
  36.         add    ax,bx
  37.         jnc    addok
  38.         add    dx,1000h
  39. addok:
  40.         mov    ch,cl
  41.         mov    cl,4
  42.         shl    ch,cl
  43.         add    dh,ch
  44.         mov    ch,al
  45.         shr    ax,cl
  46.         add    dx,ax
  47.         mov    al,ch
  48.         and    ax,0fh
  49.                 retf
  50.  
  51.                 public  PSUB@
  52.                 public  F_PSUB@
  53.                 public  N_PSUB@
  54.  
  55. N_PSUB@:
  56.                 pop     es                      ;fix up far return
  57.                 push    cs
  58.                 push    es
  59. PSUB@:
  60. F_PSUB@:
  61.         or    cx,cx
  62.         jge    sub1
  63.         not    bx
  64.         not    cx
  65.         add    bx,1
  66.         adc    cx,0
  67.         jmp    add1
  68. sub1:
  69.         sub    ax,bx
  70.         jnc    subok
  71.         sub    dx,1000h
  72. subok:
  73.         mov    bh,cl
  74.         mov    cl,4
  75.         shl    bh,cl
  76.         xor    bl,bl
  77.         sub    dx,bx
  78.         mov    ch,al
  79.         shr    ax,cl
  80.         add    dx,ax
  81.         mov    al,ch
  82.         and    ax,0fh
  83.                 retf
  84. _TEXT           ENDS
  85.                 END
  86.  
  87.