News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

( need help! )

Started by wolfgang, November 28, 2005, 01:23:39 PM

Previous topic - Next topic

wolfgang

hallo!

very nu to this forum ::) . i have sme questions,anyone can help plzz :'(?
why 13h 4 graphical application in Dos? how to change into 13h or other modes?how to write in video buffer?how the commands will look like?

Gustav


I'm very sorry, but my english is not good enough to understand anything you have posted.

HosAh

Hi man

dont worry man  :U , actually 13h is used simply because its easy to use :U ,
The screen is constantly being redrawn by the
video card so in order to affect what the card draws, it is necessary to write to the screen buffer(in 13h mode its at segment:offset--->A000:0000)


so for Changing the video mode to 13h you simply have to use the following commands:
    xor  ah, ah          this command is for---> VIDEO Function 00h: Change screen
    mov  al, 13h       this command is for---->Put the desired graphics mode into AL
    int  10h            this command is to Call VIDEO

  ; for writing to the video buffer
    mov  di, 0a000h     this command is to Put the video segment into DI
    mov  es, di          this command is for you to put into ES
    xor  di, di         this command is to Start writing at coordinates (0,0)

this is what i know man hope i helped something!
                                                                                                                           ciaooo! :U

MichaelW

#3
Hello wolfgang,

Welcome to the forum.

As Hpin demonstrated, you change video modes by calling the VGA BIOS Set Video Mode function, Interrupt 10h, Function 0 (AH = 0) with the mode number in AL. The adapter will normally operate in mode 3 (alphanumeric, character resolution = 80x25, character box = 9x16, 16 colors, 8 display pages, pixel resolution = 720x400), and running under DOS this would be the mode that you would normally return to.

Mode 13h (graphics, character resolution = 40x25, character box = 8x8, 256 colors, 1 display page, pixel resolution = 320x200) is a special mode, introduced with the VGA, that was designed to be easy to program. For mode 13h each pixel is represented, in the display buffer on the display adapter, by a 1-byte (8-bit) color value (actually an index that selects one of the 256 color registers that hold the actual color values) and thanks to a special hardware design the entire display buffer fits in a single 64000-byte segment. The upper left pixel is at address A000:0000 and the lower right at address A000:F9FF. Drawing on the display is simply a matter of writing byte values to the display buffer. For example, using the code that Hpin provided, the instruction to draw a red pixel at row 0,  column 0 would be:

mov BYTE PTR es:[di], 4


The VGA BIOS provides other functions than can be used to further control the display adapter, write text to the screen (even in the graphics modes), change the colors that are displayed, etc. For the graphics modes, the VGA BIOS also provides functions to read/write individual pixels, but these are so slow that most graphics programmers ignore them.

The DOS-era high-level languages commonly provided various graphics functions that would allow the programmer to easily draw lines, circles, polygons, etc. For MASM, you could use a library to provide this functionality, but you would probably learn a lot more by creating your own. The necessary algorithms are well established and well known. As a start, try searching for "Bresenham".



eschew obfuscation

LL

Hi wolfgang,

When I was learning DOS, I often used a program called: "HELPPC". I think, but I'm not sure, that the person who created "HELPPC" is Raymond Moon. Check it out at:

http://www.cs.nyu.edu/~yap/classes/machineOrg/helppc/

The file is ZIP, or called: "helppc21.zip".  I'm now using windows xp, which is not too friendly towards stuff written in DOS. So good luck !  :U

LL

LL

Hi again,

In a Document with Helppc21.zip, I found the Copyright (c) 1991, David Jurgens.  :bg

LL