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

  1. ;
  2. ;  Title:RESTWIND.ASM           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 offset
  38. Array_seg      DW       ?                       ;pointer to array memory segment address
  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   Restwind
  50.  
  51. Restwind       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.                MOV      SI,[BP].Row1            ;di -> row1
  72.                MOV      DX,[SI]                 ;di will -> regen buffer
  73.                DEC      DX                      ;make zero-rel
  74.                MOV      AX,160                  ;multiplier
  75.                MUL      DL                      ;ax=offset to row
  76.                MOV      DI,[BP].Col1            ;di -> col1
  77.                MOV      DI,[DI]
  78.                DEC      DI                      ;make col zero-rel
  79.                SHL      DI,1                    ;di=offset in row to col
  80.                ADD      DI,AX                   ;total offset in di
  81.  
  82.                CALL     Getvid                  ;get video address
  83.  
  84.                MOV      ES,AX
  85.  
  86.                PUSH     BX
  87.                MOV      BX,[BP].Array_off
  88.                MOV      SI,[BX]
  89.                MOV      BX,[BP].Array_seg
  90.                MOV      DS,[BX]
  91.                POP      BX
  92.  
  93.                CLD
  94.  
  95.                MOV      AX,CX                   ;save col count
  96.                MOV      DX,AX
  97.                ADD      DX,AX                   ;twice because 2 bytes per char
  98.  
  99. ;
  100. LOOP_BACK:
  101.                CLI
  102.                REPZ     MOVSW
  103.                STI
  104.  
  105.                ADD      DI,160                  ;new row
  106.                MOV      CX,AX                   ;cx=col count
  107.                SUB      DI,DX                   ;move back to right place
  108.  
  109.                DEC      BX                      ;row count
  110.                JNZ      Loop_back
  111.  
  112.                Basic_cleanup
  113.  
  114.                RET      14                      ;get rid of 7 parms
  115. Restwind       ENDP
  116.  
  117. ;
  118. Getvid         PROC     NEAR
  119.                PUSH     BX                      ;save bx register
  120.  
  121.                MOV      AX,0                    ;clear ax
  122.                MOV      AH,15                   ;video mode bios call
  123.                INT      010H                    ;do the bios call
  124.                CMP      AL,07H                  ;see if it's monochrome
  125.                JZ       Ismono                  ;yes
  126.  
  127.                MOV      AX,0B800H               ;set it up for graphics
  128.                JMP      Endvid                  ;exit
  129. ISMONO:
  130.                MOV      AX,0B000H               ;set it up for monochrome
  131. ENDVID:
  132.                POP      BX                      ;restore bx register
  133.                RET
  134.  
  135. Getvid         ENDP
  136.                END
  137.