home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / baswind8.zip / SAVEWIND.ASM < prev    next >
Assembly Source File  |  1990-09-14  |  5KB  |  140 lines

  1. ;
  2. ;Title:SAVEWIND         SEPT 1 , 1990
  3.  
  4. Basic_setup    MACRO
  5.                PUSH     BP
  6.                MOV      BP,SP
  7.  
  8.                PUSH     AX
  9.                PUSH     BX
  10.                PUSH     CX
  11.                PUSH     DX
  12.  
  13.                PUSH     SI
  14.                PUSH     DI
  15.                PUSH     DS
  16.                PUSH     ES
  17.                ENDM
  18.  
  19. Basic_cleanup  MACRO
  20.                CLD
  21.                POP      ES
  22.                POP      DS
  23.                POP      DI
  24.                POP      SI
  25.                POP      DX
  26.                POP      CX
  27.                POP      BX
  28.                POP      AX
  29.                POP      BP
  30.                ENDM
  31.  
  32. Stack          STRUC
  33. Bpsav          DW       ?                       ;saved by us
  34. Retoff         DW       ?                       ;from callf
  35. Retseg         DW       ?                       ;from basic
  36. Return_code    DW       ?
  37. Array_off      DW       ?                       ;pointer to array in ds
  38. Array_seg      DW       ?                       ;pointer to array in ds
  39. Col2           DW       ?                       ;get characters from row1,col1
  40. Row2           DW       ?                       ;to row2,col2
  41. Col1           DW       ?
  42. Row1           DW       ?
  43. Stack          ENDS
  44.  
  45. ;
  46.                .Model Medium
  47.                .Code
  48.  
  49.                PUBLIC   Savewind
  50.  
  51. Savewind       PROC
  52.                Basic_setup
  53.  
  54.                MOV      BX,[BP].Return_code
  55.                MOV      WORD PTR [BX],0
  56.  
  57.                MOV      SI,[BP].Row2            ;si -> row2
  58.                MOV      AX,[SI]                 ;ax has last row
  59.                MOV      SI,[BP].Row1            ;si -> row1
  60.                MOV      BX,[SI]                 ;form # of rows in ax
  61.                SUB      AX,BX                   ;ax=rows-1
  62.                INC      AX                      ;ax=rows
  63.                MOV      SI,[BP].Col2            ;si -> col2
  64.                MOV      CX,[SI]                 ;now form # of cols in cx
  65.                MOV      SI,[BP].Col1            ;si -> col1
  66.                MOV      BX,[SI]                 ;bx=col1
  67.                SUB      CX,BX                   ;cx has # of cols-1
  68.                INC      CX                      ;cx has # of cols
  69.                MOV      BX,AX                   ;bx=# of rows
  70.  
  71.                PUSH     DS                      ;save ds
  72.                POP      ES                      ;es points to basic's ds
  73.  
  74.                MOV      SI,[BP].Row1            ;si -> row1
  75.                MOV      DX,[SI]                 ;si will -> regen buffer
  76.                DEC      DX                      ;make zero-rel
  77.                MOV      AX,160                  ;multiplier
  78.                MUL      DL                      ;ax=offset to row
  79.                MOV      SI,[BP].Col1            ;si -> col1
  80.                MOV      SI,[SI]
  81.                DEC      SI                      ;make col zero-rel
  82.                SHL      SI,1                    ;si=offset in row to col
  83.                ADD      SI,AX                   ;total offset in si
  84.  
  85.                CALL     Getvid                  ;get video address
  86.  
  87.                PUSH     BX
  88.                MOV      BX,[BP].Array_off
  89.                MOV      DI,[BX]
  90.                MOV      BX,[BP].Array_seg       ;locate the memory block that is to hold
  91.                MOV      ES,[BX]                 ;a copy of a rectangular screen area
  92.                POP      BX
  93.  
  94.                MOV      DS,AX                   ;ax=segment address of video regeb buffer
  95.  
  96.                CLD
  97.  
  98.                MOV      AX,CX                   ;save col count
  99.                MOV      DX,AX
  100.                ADD      DX,AX                   ;twice because 2 bytes per char
  101.  
  102. ;
  103. LOOP_BACK:
  104.                CLI
  105.                REPZ     MOVSW
  106.                STI
  107.  
  108.                ADD      SI,160                  ;new row
  109.                MOV      CX,AX                   ;cx=col count
  110.                SUB      SI,DX                   ;move back to right place
  111.  
  112.                DEC      BX                      ;row count
  113.                JNZ      Loop_back
  114.  
  115.                Basic_cleanup
  116.  
  117.                RET      14                      ;get rid of 7 parms
  118. Savewind       ENDP
  119.  
  120. ;
  121. Getvid         PROC     NEAR
  122.                PUSH     BX                      ;save bx register
  123.  
  124.                MOV      AX,0                    ;clear ax
  125.                MOV      AH,15                   ;video mode bios call
  126.                INT      010H                    ;do the bios call
  127.                CMP      AL,07H                  ;see if it's monochrome
  128.                JZ       Ismono                  ;yes
  129.  
  130.                MOV      AX,0B800H               ;set it up for graphics
  131.                JMP      Endvid                  ;exit
  132. ISMONO:
  133.                MOV      AX,0B000H               ;set it up for monochrome
  134. ENDVID:
  135.                POP      BX                      ;restore bx register
  136.                RET
  137.  
  138. Getvid         ENDP
  139.                END
  140.