VGA mode 12h

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jiakk

VGA mode 12h

Post by jiakk »

I can switch to mode 12h, but how can i draw a pixel?
Gamer

RE:VGA mode 12h

Post by Gamer »

mov al,colornumber
mov bh,displaypage       // cud ignore this thing if dont have idea
mov cx,column
mov dx,row

i hope this will solve ur pro.
Xenos

RE:VGA mode 12h

Post by Xenos »

Finally:

int 10h
jiakk

RE:VGA mode 12h

Post by jiakk »

i'm in protected mode. i can't use bios interrupt. how can i draw a pixel using only vga registers and direct access to the video memory?
jiakk

RE:VGA mode 12h

Post by jiakk »

have you got any code to do that?
Ramanan

RE:VGA mode 12h

Post by Ramanan »

try this link for pmode graphics...
http://my.execpc.com/~geezer/osd/graphics/

u can find some code samples in this zip file...
http://alexfru.narod.ru/miscdocs/ega_vga/tauron30.zip

rgds,
YogaRamanan.T
DrivingMeNuts

RE:VGA mode 12h

Post by DrivingMeNuts »

Any idea how to display text in mode 12h? i'm trying to write a c function to display unicode characters on screen but can't find any useful infro on 12h. Help!
wasiliy

RE:VGA mode 12h

Post by wasiliy »

maybe a bit too late, but here is some code for TASM:

.model  tiny,pascal

.code
        org     100h
main:
        mov     ax,12h
        int     10h
repeat:
.386
        CALL    rand,offset X,-200,200
        add     [X],320
        CALL    rand,offset Y,-200,200
        add     [Y],240
        CALL    randb,offset COL,0,15
        CALL    pix,X,Y,word ptr COL
.8086
        in      al,60h
        dec     al
        jnz     repeat

        mov     ax,03h
        int     10h

        ret

.286
pix proc near USES ax bx cx dx es,Xc,Yc : word,COLOR : byte
        mov     ax,0A000h
        mov     es,ax
        mov     bx,[Xc]
        mov     ax,[Yc]
        mov     cl,bl
        and     cl,07h
        shr     bx,3
        shl     ax,6
        add     bx,ax
        shr     ax,2
        add     bx,ax

        mov     dx,3CEh
        mov     al,08h
        mov     ah,80h
        shr     ah,cl
        out     dx,ax

        mov     al,01h
        mov     ah,0Fh
        out     dx,ax

        xor     al,al
        mov     ah,[COLOR]
        out     dx,ax

        mov     cl,es:[bx]
        mov     es:[bx],cl

        inc     al
        xor     ah,ah
        out     dx,ax

        mov     al,08h
        mov     ah,0FFh
        out     dx,ax

        ret
pix     endp
.8086

rand proc near uses ax bx dx di,ofsVAR,min,max : word
     inc      [max]
     mov      ax,[seed]
     mov      bx,[seed]
     xchg     bh,bl
     sub      bx,[seed]
     mov      bl,ah
     mov      ah,bh
     xchg     ah,al
     in       al,40h
     add      ax,[seed]
     xchg     ah,al
     mov      [seed],ax
     mov      bh,al
     mov      ax,bx
     mov      bx,[max]
     sub      bx,[min]
     xor      dx,dx
     div      bx
     mov      di,[ofsVAR]
     add      dx,[min]
     mov      word ptr [di],dx
     ret
rand endp

randb proc near uses ax bx dx di,ofsVAR,min,max : word
     inc      [max]
     mov      ax,[seed]
     mov      bx,[seed]
     xchg     bh,bl
     sub      bx,[seed]
     mov      bl,ah
     mov      ah,bh
     xchg     ah,al
     in       al,40h
     sub      ax,[seed]
     xchg     ah,al
     sub      [seed],ax
     mov      bh,al
     mov      ax,bx
     mov      bx,[max]
     sub      bx,[min]
     xor      dx,dx
     div      bx
     mov      di,[ofsVAR]
     add      dl,byte ptr [min]
     mov      byte ptr [di],dl
     ret
randb endp

X dw ?
Y dw ?
seed dw ?
COL db ?

end     main
Post Reply