Page 1 of 1
help on putpixel using bankswitching
Posted: Wed Feb 21, 2007 11:18 am
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 ?
Posted: Wed Feb 21, 2007 12:50 pm
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
Posted: Wed Feb 21, 2007 12:52 pm
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.