Posts: 163
Threads: 41
Joined: Jan 2005
I wanted to do a little toy Doom1 style render, completely in software. However gfxlib's pset command is a little slow. Does anyone have a remedy for it? Also, how would I use inline asm to fill an array?
am part of the legion of n00b. We are numerous if dumb. We will enslave you all!
Posts: 163
Threads: 41
Joined: Jan 2005
so..umm...does anyone have any ideas on how to do the asm thing?
am part of the legion of n00b. We are numerous if dumb. We will enslave you all!
Posts: 1,272
Threads: 36
Joined: Feb 2003
Cha0s's code with Inline assembler:
Code:
screen 13
dim shared as integer screen_x = 320, screen_y = 200
screeninfo screen_x, screen_y
dim p as ubyte ptr ' 8 bits for 8-bit color ;p
dim as integer x = 200
dim as integer y = 100
dim as integer col = 15
p = screenptr
screenlock
' p [( y * screen_x ) + x] = col
' Ported to assembler:
' for more speed, try a look up table instead of mul
asm
mov edi, [p]
mov eax, [screen_x]
mul dword ptr [y]
add eax, [x]
mov dl, [col]
mov [edi+eax], dl
end asm
screenunlock
Posts: 163
Threads: 41
Joined: Jan 2005
So if I wanted to extract info from a 1d array I'd just find the pointer to it then use it like in the code?
am part of the legion of n00b. We are numerous if dumb. We will enslave you all!
Posts: 1,272
Threads: 36
Joined: Feb 2003
Quote:So if I wanted to extract info from a 1d array I'd just find the pointer to it then use it like in the code?
Sure, the above asm would work for a
2d array of bytes. For a 1d array, or something other than bytes, the asm needs to be modified slightly. It would also need to be changed to extract instead of overwrite data in the array.
Posts: 3,288
Threads: 167
Joined: Nov 2001
http://rel.betterwebber.com/junk.php?id=29
Warning: Code is FB pre-beta release. :*)