home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / extra18 / toolbox / turboptr.asm < prev    next >
Encoding:
Assembly Source File  |  1992-01-21  |  3.7 KB  |  156 lines

  1. ;* -------------------------------------------------- *
  2. ;*                  TURBOPTR.ASM                      *
  3. ;*   Maschinen-Prozeduren zur Unit "TurboPtr.Pas"     *
  4. ;*       (c) 1989, 1992  H.Zorba & DMV-Verlag         *
  5. ;* -------------------------------------------------- *
  6.  
  7. Code       Segment
  8.  
  9. Public IncPtr,DecPtr,GetWPtr,GetBPtr,PutWPtr,PutBPtr
  10.  
  11.            Assume CS:Code
  12.  
  13. ;* -------------------------------------------------- *
  14. IncPtr     Proc Far
  15.  
  16.            push   bp            ;üblicher Interface-
  17.            mov    bp,sp         ;Header
  18.  
  19.            les    bx,[bp+8]     ;POINTER-Adresse nach
  20.                                 ;ES:BX  (legt nie an
  21.                                 ;Segment-Grenze )
  22.            mov    ax,[bp+6]     ;Inkrement in den Akku
  23.            add    es:[bx],ax
  24.            jc     OvFl1         ;Wenn Segmentwechsel
  25.  
  26. OutInc:    pop    bp
  27.            ret    3             ;zurück zu TURBO
  28.  
  29. OvFl1:     mov    ax,1000h      ;Segmentüberlauf..
  30.            add    es:[bx+2],ax  ;..behandeln
  31.  
  32.            jmp    OutInc
  33.  
  34. IncPtr     endp
  35.  
  36. ;* -------------------------------------------------- *
  37. DecPtr     Proc Far
  38.  
  39.            push   bp
  40.            mov    bp,sp
  41.  
  42.            les    bx,[bp+8]
  43.            mov    ax,[bp+6]     ;Dekrement in den Akku
  44.            sub    es:[bx],ax
  45.            jc     OvFl2
  46.  
  47. OutDec:    pop    bp
  48.            ret    3
  49.  
  50. OvFl2:     mov    ax,1000h
  51.            sub    es:[bx+2],ax
  52.  
  53.            jmp    OutDec
  54.  
  55. DecPtr     endp
  56.  
  57. ;* -------------------------------------------------- *
  58. GetWPtr    Proc Far
  59.  
  60.            push   bp
  61.            mov    bp,sp
  62.  
  63.            mov    dx,ds         ;TURBO-Datensegment
  64.                                 ;merken
  65.            lds    bx,[bp+10]    ;POINTER-Adresse nach
  66.                                 ;DS:BX
  67.            mov    al,[bx]       ;Low-Byte holen
  68.            inc    bx
  69.            jz     IncSegP       ;Wenn Wort auf Segment-
  70.                                 ;ende liegt
  71. MoveW1:    mov    ah,[bx]       ;High-Byte holen
  72.  
  73.            lds    bx,[bp+6]     ;VAR-Adresse nach
  74.                                 ;DS:BX
  75.            mov    [bx],al       ;Low-Byte schreiben
  76.            inc    bx
  77.            jz     IncSegV       ;Segmentende erreicht
  78. MoveW2:    mov    [bx],ah       ;High-Byte schreiben
  79.  
  80.            mov    ds,dx
  81.            pop    bp
  82.            ret    4
  83.  
  84. IncSegP:   mov    cx,ds
  85.            add    cx,1000h
  86.            mov    ds,cx
  87.            jmp    MoveW1
  88.  
  89. IncSegV:   mov    cx,ds
  90.            add    cx,1000h
  91.            mov    ds,cx
  92.            jmp    MoveW2
  93.  
  94. GetWPtr    endp
  95.  
  96. ;* -------------------------------------------------- *
  97. GetBPtr    Proc Far
  98.  
  99.            push   bp
  100.            mov    bp,sp
  101.  
  102.            les    si,[bp+10]
  103.            lodsb
  104.            les    di,[bp+6]
  105.            stosb
  106.  
  107.            pop    bp
  108.            ret    4
  109.  
  110. GetBPtr    endp
  111.  
  112. ;* -------------------------------------------------- *
  113. PutWPtr    Proc Far
  114.  
  115.            push   bp
  116.            mov    bp,sp
  117.  
  118.            les    bx,[bp+8]
  119.            mov    ax,[bp+6]
  120.            mov    es:[bx],al
  121.            inc    bx
  122.            jz     IncSegP2
  123.  
  124. MoveW3:    mov    es:[bx],ah
  125.  
  126.            pop    bp
  127.            ret    3
  128.  
  129. IncSegP2:  mov    cx,es
  130.            add    cx,1000h
  131.            mov    es,cx
  132.            jmp    MoveW3
  133.  
  134. PutWPtr    endp
  135.  
  136. ;* -------------------------------------------------- *
  137. PutBPtr    Proc Far
  138.  
  139.            push   bp
  140.            mov    bp,sp
  141.  
  142.            les    di,[bp+8]
  143.            mov    ax,[bp+6]
  144.            stosb
  145.  
  146.            pop    bp
  147.            ret    3
  148.  
  149. PutBPtr    endp
  150.  
  151. Code       ends
  152.  
  153.            end
  154. ;* -------------------------------------------------- *
  155. ;*             Ende von TURBOPTR.ASM                  *
  156.