1 ;-----------------------------------------------------------
\r
3 ; MXVS.ASM - Set/get virtual screen
\r
4 ; Copyright (c) 1993,1994 by Alessandro Scotti
\r
6 ;-----------------------------------------------------------
\r
11 PUBLIC mxSetVirtualScreen
\r
12 PUBLIC mxGetVirtualScreen
\r
14 EXTRN mxRowAddress : FAR
\r
15 EXTRN mxSetSysClipRegion : FAR
\r
17 MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'
\r
18 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING
\r
20 EXTRN mx_BytesPerLine : WORD
\r
21 EXTRN mx_CodeSegment : WORD
\r
23 mx_VirtualWidth DW ? ; Virtual screen size
\r
24 mx_VirtualHeight DW ?
\r
26 ;-----------------------------------------------------------
\r
28 ; Sets the virtual screen.
\r
31 ; Width = virtual screen width
\r
32 ; Height = virtual screen height
\r
34 ; 0 on success, else invalid parameters
\r
36 mxSetVirtualScreen PROC FAR
\r
38 Width:WORD = ARG_SIZE
\r
43 ; Set DS to code segment
\r
44 mov ds, [mx_CodeSegment]
\r
47 mov ax, 1 ; Assume an error
\r
48 cmp [Width], 320 ; Check width
\r
50 push ax ; Save return code
\r
52 xor ax, ax ; DX:AX = 256K
\r
53 div [Width] ; Max height in AX
\r
55 pop ax ; Restore return code
\r
56 ja @@Exit ; Exit if bad heigth
\r
59 and ax, 0FFF8h ; Align to byte
\r
60 mov [mx_VirtualWidth], ax
\r
63 mov [mx_BytesPerLine], ax
\r
66 call mxRowAddress ; Set row address
\r
68 mov [mx_VirtualHeight], ax
\r
72 call mxSetSysClipRegion
\r
78 mxSetVirtualScreen ENDP
\r
80 ;-----------------------------------------------------------
\r
82 ; Returns the current virtual screen size.
\r
85 ; Width = pointer to virtual screen width
\r
86 ; Height = pointer to virtual screen height
\r
90 mxGetVirtualScreen PROC FAR
\r
92 Width:DWORD = ARG_SIZE
\r
97 mov ax, [mx_VirtualWidth]
\r
100 mov ax, [mx_VirtualHeight]
\r
107 mxGetVirtualScreen ENDP
\r