home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
WNDTOOL5.ZIP
/
SAVEWIND.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-24
|
6KB
|
119 lines
;Title:Savewind
BASIC_SETUP MACRO
PUSH BP
MOV BP,SP
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH DI
PUSH DS
PUSH ES
ENDM
BASIC_CLEANUP MACRO
CLD
POP ES
POP DS
POP DI
POP SI
POP DX
POP CX
POP BX
POP AX
POP BP
ENDM
Stack STRUC
Bpsav DW ? ;saved by us
Retoff DW ? ;from callf
Retseg DW ? ;from basic
Array DW ? ;pointer to array in ds
Col2 DW ? ;get characters from row1,col1
Row2 DW ? ;to row2,col2
Col1 DW ? ;
Row1 DW ? ;
Stack ENDS
Code SEGMENT PUBLIC 'CODE'
ASSUME CS:Code,DS:Code
PUBLIC Savewind
;
Savewind PROC FAR
Basic_setup
MOV SI,[BP].ROW2 ;si -> row2
MOV AX,[SI] ;ax has last row
MOV SI,[BP].ROW1 ;si -> row1
MOV BX,[SI] ;form # of rows in ax
SUB AX,BX ;ax=rows-1
INC AX ;ax=rows
MOV SI,[BP].COL2 ;si -> col2
MOV CX,[SI] ;now form # of cols in cx
MOV SI,[BP].COL1 ;si -> col1
MOV BX,[SI] ;bx=col1
SUB CX,BX ;cx has # of cols-1
INC CX ;cx has # of cols
MOV BX,AX ;bx=# of rows
PUSH DS ;save ds
POP ES ;es points to basic's ds
; PUSH ES ;restore on stack
MOV SI,[BP].ROW1 ;si -> row1
MOV DX,[SI] ;si will -> regen buffer
DEC DX ;make zero-rel
MOV AX,160 ;multiplier
MUL DL ;ax=offset to row
MOV SI,[BP].COL1 ;si -> col1
MOV SI,[SI]
DEC SI ;make col zero-rel
SHL SI,1 ;si=offset in row to col
ADD SI,AX ;total offset in si
MOV DI,[BP].ARRAY ;di points to array element 0
CALL Getvid ;get video address
MOV DS,AX ;
loop_back:
PUSH CX ;save col count
REP MOVS WORD PTR ES:[DI],WORD PTR [SI]
ADD SI,160 ;new row
POP CX ;cx=col count
SUB SI,CX ;move back to right place
SUB SI,CX ;twice because 2 bytes per char
DEC BX ;row count
JNZ Loop_back
Basic_cleanup
RET 10 ;get rid of 5 parms
Savewind ENDP
;
Getvid PROC NEAR
PUSH BX ;save bx register
MOV AX,0 ;clear ax
MOV AH,15 ;video mode bios call
INT 010H ;do the bios call
CMP AL,07H ;see if it's monochrome
JZ Ismono ;yes
MOV AX,0B800H ;set it up for graphics
JMP Endvid ;exit
ismono:
MOV AX,0B000H ;set it up for monochrome
endvid:
POP BX ;restore bx register
RET
Getvid ENDP
Code ENDS
END