Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #1005

Re: MS-DOS direct screen output - native and in a window

From pete@nospam.demon.co.uk
Newsgroups comp.os.msdos.programmer
Subject Re: MS-DOS direct screen output - native and in a window
Date 2013-09-29 06:45 +0000
Organization PDL
Message-ID <1380437121snz@nospam.demon.co.uk> (permalink)
References <kvn372$vnt$1@dont-email.me> <l26b6m$s68$1@speranza.aioe.org>

Show all headers | View raw


On 28th Sep 2013 at 20:34 "Ed" <invalid@invalid.com> wrote:

> James Harris wrote:
> > ...
> > However, how should things like the screen size (rows and columns) be
> > determined? I know there is a BIOS call int 0x10-0f to get the columns but
> > not the rows.
> 
> Here's how I did it.
> 
> 
>         mov     ax,0500h                ; set video page = 0
> cold1:  call    video
>         call    gmode                   ; get video mode
>         cmp     al,7                    ; 80 col mono
>         jz      cold2
>         cmp     al,3                    ; 80 col color
>         jz      cold2
>         cmp     al,2                    ; 80 col b/w
>         jz      cold2
>         mov     ax,3                    ; set video mode = 80 col color
>         jmp     cold1                   ; (screen will blank)
> cold2:  dec     bh                      ; cols
>         mov     wmax,bh
>         sub     bh,bh
>         sub     dl,dl                   ; assume old CGA card
>         mov     ax,1130h
>         call    video
>         or      dl,dl                   ; rows if EGA+
>         jnz     cold3
>         mov     dl,24
> cold3:  mov     wmax+1,dl
>         ...
> 
> 
> ;       get video mode  AL=mode AH=page BH=cols
> 
> gmode:  mov     ah,0fh
>         call    video
>         xchg    bh,ah
>         mov     word ptr cmode,ax       ; save
>         ret
> 
> video:  push    si
>         push    bp
>         int     10h
>         pop     bp
>         pop     si
>         ret

Sorry, I don't appear to have received the original article from 
James.  Provided you are using EGA or later and only interested in 
text modes, just look in the bios data area at seg 40h:

        mov     ax, 40h
        mov     es, ax
        mov     dl, es:[4Ah]    ; DL is nr of screen columns
        mov     dh, es:[84h]    ; max screen row index
        inc     dh              ; DH is nr of screen rows

Pete
-- 
Believe those who are seeking the truth.
Doubt those who find it.  -  André Gide

Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

MS-DOS direct screen output - native and in a window "James Harris" <james.harris.1@gmail.com> - 2013-08-29 10:10 +0100
  Re: MS-DOS direct screen output - native and in a window "R.Wieser" <address@not.available> - 2013-08-29 12:58 +0200
  Re: MS-DOS direct screen output - native and in a window "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 05:59 -0500
    Re: MS-DOS direct screen output - native and in a window "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 07:23 -0500
      Re: MS-DOS direct screen output - native and in a window "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 08:35 -0500
  Re: MS-DOS direct screen output - native and in a window "Ed" <invalid@invalid.com> - 2013-09-28 20:34 +1000
    Re: MS-DOS direct screen output - native and in a window pete@nospam.demon.co.uk - 2013-09-29 06:45 +0000
      Re: MS-DOS direct screen output - native and in a window "Ed" <invalid@invalid.com> - 2013-09-29 19:33 +1000
        Re: MS-DOS direct screen output - native and in a window "James Harris" <james.harris.1@gmail.com> - 2013-09-29 16:06 +0100
          Re: MS-DOS direct screen output - native and in a window "Ed" <invalid@invalid.com> - 2013-10-01 11:28 +1000

csiph-web