home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / TBASIC / GETDTA.ASM < prev    next >
Assembly Source File  |  1987-04-01  |  2KB  |  57 lines

  1.  
  2. ; This  routine expects two pointers to be passed on  the stack that point
  3. ; to Turbo Basic integers.   The integers will be assigned the segment and
  4. ; offset of the current DTA.
  5. ;
  6. ;  STACK after saving BP
  7. ;
  8. ;   │ 32 bit(segment and offset) │
  9. ;   │ pointer to TB integer rep- │ <----- BP + 0Ah
  10. ;   │ resenting segment of DTA     │
  11. ;   ├────────────────────────────┤
  12. ;   │ 32 bit(segment and offset) │
  13. ;   │ pointer to TB integer rep- │ <----- BP + 6
  14. ;   │ resenting offset of DTA     │
  15. ;   ├────────────────────────────┤
  16. ;   │   return address that TB     │
  17. ;   │   will go to after comple- │ <----- BP + 2
  18. ;   │   tion of routine         │
  19. ;   ├────────────────────────────┤
  20. ;   │         saved BP         │ <----- BP
  21. ;   │                 │
  22. ;   └────────────────────────────┘
  23.  
  24.  
  25. DosCall  equ  21h    ; equates for this module
  26. GetDTA   equ  2Fh
  27.  
  28. program segment    ; begin program segment
  29.   assume cs:program
  30.  
  31.   push  bp      ; save bp
  32.   mov   bp, sp
  33.   push  es      ; save es because we'll use it for pointer manipulation
  34.   push  ds      ; ditto
  35.  
  36.   ; call dos function to get current DTA's location
  37.   mov   ah, GetDTA
  38.   int   DosCall
  39.  
  40.   ; now get pointers to Turbo Basic integers and store segment and
  41.   ; offset of DTA in them
  42.  
  43.   lds   di, [bp + 6h]    ; load pointer to offset variable
  44.   mov   ds:[di], bx    ; mov offset of DTA into Turbo Basic integer
  45.  
  46.   lds   di, [bp + 0Ah]  ; load pointer to segment variable
  47.   mov   ds:[di], es    ; mov offset of DTA into Turbo Basic integer
  48.  
  49.   pop   ds
  50.   pop   es    ; restore registers
  51.   pop   bp
  52.  
  53. program ends    ; end program segment
  54.  
  55. end
  56.  
  57.