Posted by Weasel on 1999-04-25
Benjamin Johnston wrote:
>
> Hi,
> I'm writing a program that uses mode 10h.
Ok as far as I can remember, 10h is 16 colors (4 bit) at 640x350.
correct me if I'm wrong.
I've written many procedures (fading, drawing lines, putting/reading
pixels...) for 16 color modes in Pascal's inline Assember. If you need
some more, contact me. It should be not that hard to port this to native
assembler.
And with asm it should be fast enough. Note that I used the fact that it
is possible to put 8 pixels at once in these modes.
(I just modified it a bit to work with 10h and with pageoffset. did not
test it :)
the pageoffset for the 1st page is zero, for the second its 28000 dez.
HTH
--
Weasel
const
planeMaskRegAdrport= $003C4;
planeMaskRegIndex = $00002;
bitMaskRegAdrport = $003CE;
bitMaskRegIndex = $00008;
bitMaskRegDatport = $003CF;
modeRegAdrport = $003CE;
modeRegIndex = $00005;
videoRam = $0A000;
<...>
procedure ClearDevice(color, pageoffset : word);
assembler;
asm
mov ax,videoram
mov es,ax {Video Seg to es, the code might be
better if we used ds, since it was
one byte smaller for every mem
operation, since the segop prefix
was not needed, but who cares?}
mov dx,bitmaskregadrport
mov al,bitmaskregindex
out dx,al {Index for bit mask}
mov dx,bitmaskregdatport
mov al,0ffh
out dx,al
mov cx,pageoffset
mov ax,color
mov bx,28000
add bx,cx
@loop:
dec bx
mov ah,es:[bx] ; I really ask myself why this line is in here. Try
without it!
mov es:[bx],al
cmp bx,cx
jne @loop
end;
<..>
--
Weasel mailto:palfrader@xxxxxxx.xxx
Peter http://www.cosy.sbg.ac.at/~ppalfrad/
------------------------------------------------------------
We have full klingon console support just in case.
-- Alan Cox on linux-kernel
Previous post | Next post | Timeline | Home