PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

ASM in eVC++ ?

Code:
Procedure Putpixel (X,Y : Integer; Col : Byte; where:word);
{ This puts a pixel on the screen by writing directly to memory. }
BEGIN
Asm
push ds {; Make sure these two go out the }
push es {; same they went in }
mov ax,[where]
mov es,ax {; Point to segment of screen }
mov bx,[X]
mov dx,[Y]
push bx {; and this again for later}
mov bx, dx {; bx = dx}
mov dh, dl {; dx = dx * 256}
xor dl, dl
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1 {; bx = bx * 64}
add dx, bx {; dx = dx + bx (ie y*320)}
pop bx {; get back our x}
add bx, dx {; finalise location}
mov di, bx {; di = offset }
{; es:di = where to go}
xor al,al
mov ah, [Col]
mov es:[di],ah {; move the value in ah to screen
point es:[di] }
pop es
pop ds
End;
END;



How can I implement this on eVC++? Is it possible? I havent tried it yet. Thanks.
No to be rude, but right above this post there is another post titled " ARM Assembler Programming PPC FAQ" which contains everything you need regarding writing interface ASM code with eVC.

:-)
Thanks Warmi :-) I'll search the links.
Uhm, first of all that's x86 16bit code which won't fit into any protected mode framework without modifications and it won't ever fit into a compiled RISC (ARM,MIPS) application.

(beside that it's not even a fast piece of asm code)

But you did know that already, didn't you ;)
xPeterx wrote:Uhm, first of all that's x86 16bit code which won't fit into any protected mode framework without modifications and it won't ever fit into a compiled RISC (ARM,MIPS) application.

(beside that it's not even a fast piece of asm code)

But you did know that already, didn't you ;)


xPeterx:
I'm writing a gfx library for PPC and hopefully, I'll have time to optimize it soon. As of this moment, my functions were written in C/C++.

Btw, what gfx library did u use on you 3d demo? Maybe I'm not reading/paying attention much on the post. Did u use GD? PF? GAPI? etc.

Regards.
If you want to get jumpstart with your gfx library , here is something that will help you.
http://www.warmi.net/pocketpc/files/Ppc-asm.zip
About a year ago I wrote bunch of ASM based blits for arm arch.
These are pretty well optimized - not as fast as StephC code because he is using RLE which is entirely different kind of optimization but my ASM code is faster than GapiDraw and PocketFrog blits.
warmi wrote: my ASM code is faster than GapiDraw and PocketFrog blits.


I've inspected your code, and it could be faster without RLE :)
denthorq wrote:Btw, what gfx library did u use on you 3d demo? Maybe I'm not reading/paying attention much on the post. Did u use GD? PF? GAPI? etc.

Regards.


Oh it's just plain GAPI... But i'm going to check out PocketHAL soon, it seems to be quite fast from what i've heard...
StephC:
Well, could very well be.

I am sure if someone tried hard enough it would be possible to make your code faster as well.

My code does multiple pixel transfers whenever possible - it is relatively optimized as far as cache is concerned but yeah if you were to rewrite it for Xscale it could probably even faster but I won't bother since at most it would be just another 5%-10% speedup.