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

  1. ;[]-----------------------------------------------------------------[]
  2. ;|      H_PADA.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 long pointers.
  14.  
  15. _TEXT           SEGMENT BYTE PUBLIC 'CODE'
  16.                 ASSUME  CS:_TEXT
  17.  
  18.                 public  PADA@
  19.                 public  F_PADA@
  20.                 public  N_PADA@
  21.  
  22. N_PADA@:
  23.                 pop     es                      ;fix up far return
  24.                 push    cs
  25.                 push    es
  26. PADA@:
  27. F_PADA@:
  28.         mov    es,dx
  29.         xchg    ax,bx
  30. ;
  31. ;        Pointer to memory cell to increment is in es:bx
  32. ;        Increment amount is ax:cx
  33. ;
  34.         mov    dx, es:2[bx]    ; DX <- Selector
  35.         push    bx
  36.         mov    bx, es:[bx]    ; BX <- Offset
  37.         or    cx,cx        ; Is increment negative?
  38.         jge    ada1        ; No, ...
  39.         not    ax        ; Yes, ...
  40.         not    cx
  41.         add    ax,1
  42.         adc    cx,0
  43.         jmp    sba1
  44. ada1:
  45.         add    bx,ax        ; Add offsets
  46.         jnc    adaok
  47.         add    dx,1000h
  48. adaok:
  49.         mov    ah,cl
  50.         mov    cl,4
  51.         shl    ah,cl
  52.         xor    al,al
  53.         add    dx,ax
  54.         mov    ch,bl
  55.         shr    bx,cl
  56.         add    dx,bx
  57.         mov    al,ch
  58.         and    ax,0fh
  59.         pop    bx
  60.         mov    es:[bx], ax
  61.         mov    es:2[bx], dx
  62.                 retf
  63.  
  64.                 public  PSBA@
  65.                 public  F_PSBA@
  66.                 public  N_PSBA@
  67.  
  68. N_PSBA@:
  69.                 pop     es                      ;fix up far return
  70.                 push    cs
  71.                 push    es
  72. PSBA@:
  73. F_PSBA@:
  74.         mov    es,dx
  75.         xchg    ax,bx
  76. ;
  77. ;        Pointer to memory cell to increment is in es:bx
  78. ;        Increment amount is ax:cx
  79. ;
  80.         mov    dx,es:2[bx]
  81.         push    bx
  82.         mov    bx,es:[bx]
  83.         or    cx,cx
  84.         jge    sba1
  85.         not    ax
  86.         not    cx
  87.         add    ax,1
  88.         adc    cx,0
  89.         jmp    ada1
  90. sba1:
  91.         sub    bx,ax
  92.         jnc    sbaok
  93.         sub    dx,1000h
  94. sbaok:
  95.         mov    ah,cl
  96.         mov    cl,4
  97.         shl    ah,cl
  98.         xor    al,al
  99.         sub    dx,ax
  100.         mov    ch,bl
  101.         shr    bx,cl
  102.         add    dx,bx
  103.         mov    al,ch
  104.         and    ax,0fh
  105.         pop    bx
  106.         mov    es:[bx],ax
  107.         mov    es:2[bx],dx
  108.                 retf
  109. _TEXT           ENDS
  110.                 END
  111.