help on putpixel using bankswitching

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
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

help on putpixel using bankswitching

Post by digo_rp »

guys at linear flat mode I can do putpixel
but I would like to now
how do I can use using bankswitching cuz some pc´s "older" I cannot use linear flat mode
I´m using C with nasm

could anyone help me? and give to me some examples ?
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post by JAAman »

for bankswitching in VESA (modes with resolution or color depth greater than 640x480x4), you must either:
1) return to RMode or use VMode and use the video-card supplied BIOS code to switch banks using int 0x10

2) use VBE3 from PMode (but that wont work for 'older' cards)

3) use a card-specific driver written for that specific card (each card is different, and requires code written specially for it)

modes up through 13 (but not mode 12), are standard VGA/EGA/etc modes, and none require banking (iirc)

mode 12 uses planes, not banks, and should be standardised -- and very well documented -- search for 'programming VGA' for more information
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

This is how to set vesa bank switching up.

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                           ;;
;; fasm example.By Craig Bamford (Dex) 2002. ;;
;; 640*480 8bpp (256 colors) vesa1           ;;
;; C:\fasm vesa1.asm vesa1.com               ;;
;;                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG    100h

Start:
        mov ax,4f02h
        mov bx,101h
        int 10h

        mov dx,0xa000
        mov es,dx
        call window

StartAgain:
        xor dx,dx
MainLoop:
        push dx
        call window
        xor bx,bx
        mov al,0x00
        call static
         pop dx
        cmp dx,4
        je StartAgain
        inc dx ; next bank
        mov ah,00h
        int 16h
        jz MainLoop
        mov ax,0003h
        int 10h
        ret

window:
        mov ax,4f05h    
        mov bx,0
        int 10h
        xor bx,bx
        ret

static:
        stosb
        inc bx
        cmp bx,0x00000
        jne static
        ret
Now to putpixel, is the same as if you were doing a putpixel in mode 13h, but for every 64k you need to shift bank and the X Y starts at 00 again.
eg:
$*********bank 0********
* first 64k
&*********bank 1********
* second 64k
*********bank2*********
* and so on

So if you putpixel at adress 0xa000 bank 0 it would end up where $ is, if you did the same address bank1 it would end up where & is and so on.
Post Reply