;Copyright 2000 - Mark McDonald All rights reserved
; MROWS routine for PowerBASIC
; DECLARE: SUB MROWS(BYVAL integer, BYVAL integer)
; DESC:    Set Mouse horizontal limits.
; EXAMP:   MROWS Row%, Rows%

extrn   GETVMODE: Far

MCODE Segment Byte
      Assume  CS: MCODE

      Public  MROWS

MROWS Proc Far

ARG     Rows:   WORD, Row: WORD = Retbytes

        push    BP                      ;
        mov     BP, SP                  ;
        push    DS                      ;

        call    GETVMODE                ; get screen mode

        mov     CX, Row                 ; CX = Row
        dec     CX                      ; make zero based

        cmp     AX, 3                   ; 80 x 25 color?
        je      FixRow                  ; yes, adjust
        cmp     AX, 7                   ; 80 x 25 mono?
        jne     GetRows                 ; no, get rows
FixRow:
        add     CX, CX                  ; times 2
        add     CX, CX                  ; times 4
        add     CX, CX                  ; times 8
GetRows:
        mov     DX, Rows                ; DX = Rows
        dec     DX                      ; zero based

        cmp     AX, 3                   ; 80 x 25 color?
        je      FixRows                 ; yes, adjust
        cmp     AX, 7                   ; 80 x 25 mono?
        jne     SetLimit                ; no, get columns
FixRows:
        add     DX, DX                  ; times 2
        add     DX, DX                  ; times 4
        add     DX, DX                  ; times 8
SetLimit:
        add     DX, CX                  ; add Row and Rows

        mov     AX, 08H                 ;
        int     33h                     ;

        pop     DS                      ;
        pop     BP                      ;
        retf    Retbytes                ;

MROWS EndP
MCODE EndS
        End