;       EEA.ASM - support for EnvEdt.C

.model small,c

.code

max_xy  proc    x:word,y:word

        public  max_xy
; void max_xy( int *x, int *y );
        mov     ax,1130h        ; try EGA/VGA routines
        xor     dx,dx
        push    bp              ; save BP around INT 10h
        int     10h             ; in case we're running on
        pop     bp              ; an old BIOS that trashes BP
        or      dl,dl
        jnz     mxy2            ; nope, not EGA or VGA
        mov     dl,24           ; so set for 25 lines
mxy2:   xor     dh,dh
        inc     dx
        mov     bx,y
        mov     ds:[bx],dx      ; store maxy value

        mov     ah,0fh          ; use bios mode call
        push    bp
        int     10h
        pop     bp
        xchg    ah,al
        cbw
        mov     bx,x
        mov     ds:[bx],ax      ; store maxx value
        ret
max_xy  endp

col     proc

        public  col
; int col( void );
        mov     ah,3            ; Get Cursor Position
        xor     bx,bx
        push    bp
        int     10h
        pop     bp
        mov     al,dl           ; return x coordinate
        cbw
        ret
col     endp

row     proc

        public  row
; int row( void );
        mov     ah,3            ; Get Cursor Position
        xor     bx,bx
        push    bp
        int     10h
        pop     bp
        mov     al,dh           ; return y coordinate
        cbw
        ret
row     endp

setrc   proc    r:byte, c:byte

        public  setrc
; void setrc( int r, int c );
        xor     bx,bx
        mov     dl,c
        mov     dh,r
        mov     ah,2            ; Set Cursor Position
        push    bp
        int     10h
        pop     bp
        ret

setrc   endp

        end
