|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Pixel plotting or bank switching problem
Hi,
I'm having a little problem plotting a pixel to the screen! I can't believe this! But anyways, this is the function I'm using:
static void plotpixel(int x, int y, char color) {
asm {
mov ax, y
mov cx, 640
mul cx
add ax, x
mov bx, ax
}
setbank(_BX >> 16);
asm {
mov ax, 0a000h
mov es, ax
mov ax, bx
mov di, ax
mov ax, color
mov [es:di], ax
}
}
I'm not sure whether this is the exact function, I don't have the code in front of me, but it's something similar, anyway. Also, I think the problem might be with the bank switching (I'm using 640x480x256). This is my bank switching code:
void setbank(int bank) {
static int activebank;
if (activebank == bank) return;
asm {
mov ax, 4f05h
mov bx, 0h
mov dx, bank
int 10h
mov ax, 4f05h
mov bx, 1h
mov dx, bank
int 10h
mov ax, bank
mov activebank, ax
}
}
The plotting function is similar to what I use in Mode 13h, with the exception of calling the setbank() function to set the bank. So I think it's in the setbank() function. I wrote this function without much knowledge of how it works, I only did some research on VESA, and worked this out, so it might not be doing anything at all!
Anyways, this it was happens when I run (AFAIK anyway):
It sets mode 640x480x256, then it loads the palette (these two functions seem to be working, so I didn't include them), and then it dumps me back to the console. I (purposely) didn't switch back to Mode 3h, so I noticed that the palette DID indeed change (you quickly notice it if you see that the MS-DOS Editor is green and brown!). So any ideas?
Thanks in advance,
Lionel Pinkhard
P.s. The program is supposed to draw a circle, but I don't see a single pixel!
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once
To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html
|
|