How to draw pixel in protected mode? That is very easy, both to make system friendly or quick-and-dirty. Demo programmers may use this combinations like this:
add eax,[table+ebx*4] mov [eax],clWhere
EAX
is the X
coordinate, EBX
the Y
coordinate, CL
color and [table] a table containing A0000+320*0, A0000+320*1, A0000+320*2, ....
up to 200
. The main drawback is that you need to work in large selectors - more like flat mode - the way I code is somewhat like this:add eax,[table+ebx*4] mov [es:eax],clThis is a tad slower. Everything is the same, except the table, which now contain
320*0, 320*1, 320*2, ....
up to 200
. Now you need to sacrifice a segment register, but it is more system friendly and you can have small selector sizes. The program is now also less likely to flunk under DPMI.
If you want another width or height, it is easy, just expand the table to height, and exchange 320
with width.