no link but you must mov values (x,y,color) in registers and calc (mul add) the pixel position in videomemory.
i'm shure you will do more gfx in assemler.
let me know if you need more infos or help.
Code:
option explicit
'asm.bas
#define scr_w 1024
#define scr_h 768
sub set_clip32(byval memory as integer ptr,byval x as integer,byval y as integer,byval c as integer)
if (x<0) or (x>(scr_w-1)) then exit sub
if (y<0) or (y>(scr_h-1)) then exit sub
x=x shl 2:y=y shl 2
asm
mov dword ptr edi,[memory] ' videoadr
mov eax,scr_w
mul dword ptr [y] ' adr = y * 4 * scr_W
add eax,dword ptr [x] ' adr = y * 4 * scr_w + x * 4
mov ebx,dword ptr [c]
mov [edi+eax],ebx ' poke videoadr + y * 4 * scr_w + x * 4,color
end asm
end sub
sub set_32(byval memory as integer ptr,byval x as integer,byval y as integer,byval c as integer)
x=x shl 2:y=y shl 2
asm
mov dword ptr edi,[memory]
mov eax,scr_w
mul dword ptr [y]
add eax,dword ptr [x]
mov ebx,dword ptr [c]
mov [edi+eax],ebx
end asm
end sub
'!!! only with screenwidth=1024 !!!
sub set_fast32(byval memory as integer ptr,byval x as integer,byval y as integer,byval c as integer)
asm
mov eax, dword ptr [y]
shl eax, 10 ' = y * 1024
add eax, dword ptr [x] ' = y * 1024 + x
shl eax, 2 ' = (Y * 1024 + x) * 4
add eax, dword ptr [memory]
mov ebx, dword ptr [c]
mov dword ptr [eax],ebx
end asm
end sub
sub pset_32(byval x as integer,byval y as integer,byval c as integer)
pset (x,y),c
end sub
screenres scr_w,scr_h,32
dim as integer ptr videomemory
dim as integer i,x,y
dim as double stime,etime,pset_32time,set_clip32time,set_32time,set_fast32time
screenlock:videomemory=screenptr
stime=timer
for i=1 to 100
for y=0 to scr_h-1
for x=0 to scr_w-1
set_clip32 videomemory,x,y,rgb(255,0,0)
next
next
next
etime=timer
set_clip32time=etime-stime
screenunlock
screenlock:videomemory=screenptr
stime=timer
for i=1 to 100
for y=0 to scr_h-1
for x=0 to scr_w-1
set_32 videomemory,x,y,rgb(0,255,0)
next
next
next
etime=timer
set_32time=etime-stime
screenunlock
screenlock:videomemory=screenptr
stime=timer
for i=1 to 100
for y=0 to scr_h-1
for x=0 to scr_w-1
set_fast32 videomemory,x,y,rgb(0,0,255)
next
next
next
etime=timer
set_fast32time=etime-stime
screenunlock
screenlock
stime=timer
for i=1 to 100
for y=0 to scr_h-1
for x=0 to scr_w-1
pset_32 x,y,rgb(255,255,255)
next
next
next
etime=timer
pset_32time=etime-stime
screenunlock
print "set_clip32 ="; set_clip32time
print "set_32 ="; set_32time
print "set_fast32 ="; set_fast32time
print "pset(x,y) ="; pset_32time
sleep
end