home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / db3wind.zip / SAVEREST.ASM next >
Assembly Source File  |  1986-04-30  |  4KB  |  98 lines

  1. ;     Last revision: April 30, 1986 at 12:11
  2.  
  3. TITLE 'SaveRest for dBASEIII'
  4.  
  5. ;       Placed into the Public Domain by the programs author
  6. ;       H.M. Van Tassell
  7.  
  8. ;    To generate .BIN file for for dBaseIII LOAD/CALL    
  9. ;       1. MASM saverest
  10. ;       2. LINK saverest
  11. ;       3. EXE2BIN saverest
  12. ;    Use the file saverest.BIN with your dBaseIII program
  13. ;       Syntax CALL SaveRest WITH "S" or "R"
  14. ;     see demo program SAVEREST.PRG
  15.  
  16. code_seg segment byte 
  17.     assume    cs:code_seg
  18.  
  19. saverest proc far
  20.         cld                     ; make sure we auto increment
  21.         mov al,Byte Ptr[bx]     ; get passed dBASEII parameter character
  22.         and al,05Fh             ; make sure it is upper case
  23.         cmp al,'S'              ; if Save screen
  24.         je save_screen          ;    jump to save screen routine
  25.         cmp al,'R'              ; if Restore screen 
  26.         je restore_screen       ;    jump to restore screen routine 
  27.         ret                     ; else return back to dBASEIII
  28. ;
  29. save_screen:
  30.         xor al,al               ; first get screen mode and page                                       
  31.         mov ah,15               ; function 15 return mode in AL
  32.         int 10h                 ; and page in BH
  33.         mov Byte Ptr CS:screen_mode,al  ; store em 
  34.         mov Byte Ptr CS:screen_page,bh  ; for future use
  35.         xor al,al               ; now get the current cursor position
  36.         mov ah,3                ; function 3 reads cursor position
  37.         int 10h                 ; returns DH,DL=cursor row,col 
  38.         mov Word Ptr CS:cursor_pos,dx   ; store it
  39.         mov ax,0B000h           ; preload mono buffer segment
  40.         cmp Byte Ptr CS:screen_mode,07h ; is 7 if mono mode
  41.         je save_mono
  42.         mov ax,0B800h           ; opps, it is not mono mode
  43. save_mono:
  44.         mov ds,ax               ; DS:SI must point start of screen memory
  45.         mov si,0
  46.         push cs
  47.         pop es                  ; ES:DI must point to screen buffer        
  48.         mov di,offset CS:screen_buffer
  49.         mov cx,25*80            ; number of words to save        
  50.         rep movsw               ; move the screen memory to the buffer
  51.         ret                     ; and return back to dBASEIII 
  52. ;
  53. restore_screen:
  54.         ;
  55.         cmp Byte Ptr CS:screen_mode,0FFh; if the screen mode byte hasn't
  56.         jne saved                       ; changed, we havn't first saved
  57.         ret                             ; a screen, so return to dBASEIII
  58. saved:  mov bh,Byte Ptr CS:screen_page  ; BH = current display page
  59.         mov dx,Word Ptr CS:cursor_pos   ; DH,DL = row,col of current position
  60.         xor al,al               ; first restore prior cursor position
  61.         mov ah,2                ; function 2 sets cursor position with
  62.         int 10h                 ; DH,DL=cursor row,col and BH = page
  63.         mov ax,0B000h           ; preload mono buffer segment
  64.         cmp Byte Ptr CS:screen_mode,07h ; is 7 if mono mode
  65.         je restore_mono
  66.         mov ax,0B800h           ; opps, it is not mono mode
  67. restore_mono:
  68.         mov ES,ax               ; ES:DI must point start of screen memory
  69.         mov di,0
  70.         push cs
  71.         pop ds                  ; DS:SI must point to screen buffer        
  72.         mov si,offset CS:screen_buffer
  73.         mov cx,25*80            ; number of words to restore
  74.         rep movsw               ; move the buffer to the screen memory
  75.         ret                     ; and return back to dBASEIII
  76. ;
  77. ;   we will put the data area within this code segment
  78. ;
  79. screen_mode     db      0FFh    ; screen mode, 7 = mono
  80. screen_page     db      0       ; current page here
  81. cursor_pos      dw      0       ; store cursor position here 
  82. screen_buffer   dw  25*80 DUP(?); local screen buffer storage area
  83. ;
  84. saverest endp
  85. code_seg ends
  86.     END 
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.