News:

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

Video mode 06, direct addressing

Started by lianergoist, January 06, 2007, 07:31:38 PM

Previous topic - Next topic

lianergoist

Hi

I would like to write direct to video memory in video mode 06. It's a 640x200 monocrome CGA mode. The problem is every second line is skipped. The following code should draw on the first quarter of the screen, but it use half of the screen, with every second line missing. What is wrong?


.MODEL SMALL
.STACK 64
VIDEO_SEG SEGMENT AT 0B800H ;Page 0 of video area
VID_AREA DB 1000H DUP(?)
VIDEO_SEG ENDS
; --------------------------------------------------
.CODE
MAIN PROC FAR
MOV AX,VIDEO_SEG ;Addressability for
MOV ES,AX ;  video area
ASSUME ES:VIDEO_SEG
MOV AH,0FH ;Request get
INT 10H ;  and save
PUSH AX ;  current mode
MOV AX,0006H ;Set mode 06,
INT 10H ;  clear screen
CALL DISPLY ;Process display area
MOV AH,10H ;Wait for keyboard
INT 16H ;  response
POP AX ;Restore video
MOV AH,00H ;  mode (in AL)
INT 10H
MOV AX,4C00H ;End of processing
INT 21H
MAIN ENDP

; -----------------------------------------
DISPLY PROC NEAR
MOV AX,1111111111111111b ;
MOV DI,0 ;start of display area
MOV CX,2000 ;number of words to move
@@10: MOV ES:WORD PTR[DI],AX ;move word to video mem
ADD DI,2 ;
LOOP @@10 ;
RET ;
DISPLY ENDP
END MAIN



Thomas Jensen, aka lianergoist

sinsi

CGA graphics modes are interlaced, so even lines (0,2,4...) start at B800:0000 and odd lines at B800:2000.
Some more info at http://www.seasip.info/VintagePC/cga.html
Light travels faster than sound, that's why some people seem bright until you hear them.

lianergoist

Quote from: sinsi on January 06, 2007, 10:11:35 PM
CGA graphics modes are interlaced, so even lines (0,2,4...) start at B800:0000 and odd lines at B800:2000.
Some more info at http://www.seasip.info/VintagePC/cga.html

Thanks a lot. Funny my book didn't mention that... Well, with that information I think I can get it to works. Thanks again...


Thomas