flat assembler
Message board for the users of flat assembler.

Index > Windows > how to understand those assembly code well.

Author
Thread Post new topic Reply to topic
jacky_zz



Joined: 10 Oct 2007
Posts: 4
jacky_zz 10 Oct 2007, 09:00
i find some assembly code, but i can not unstandard it well, could someone convert it into c++ code?
****************code begin****************
procedure _FillLongwordRect(Src: Pointer; W, H, X1, Y1, X2, Y2: Integer; Value: Longword);
asm
PUSH EDI
PUSH EAX
PUSH EBX
PUSH ECX
PUSH EDX

MOV EDI, EAX
XOR EBX, EBX
XOR EAX, EAX
MOV EBX, W
MOV EAX, Y1
MUL EBX
ADD EAX, X1
ADD EDI, EAX
ADD EDI, EAX
ADD EDI, EAX
ADD EDI, EAX

MOV EBX, X2
SUB EBX, X1
INC EBX
TEST EBX,EBX
JS @exit

MOV EDX, Y2
SUB EDX, Y1
INC EDX
TEST EDX,EDX
JS @exit
MOV EAX, VALUE

@1:
PUSH EDI
MOV ECX, EBX
CLD
REP STOSD
POP EDI
POP ECX
ADD EDI, ECX
ADD EDI, ECX
ADD EDI, ECX
ADD EDI, ECX
PUSH ECX
DEC EDX
CMP EDX, 0
JNE @1

@exit:
POP EDX
POP ECX
POP EBX
POP EAX
POP EDI
end;
****************code end****************


Description: some assembly code
Download
Filename: assembly_code.txt
Filesize: 8.05 KB
Downloaded: 183 Time(s)

Post 10 Oct 2007, 09:00
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 10 Oct 2007, 21:06
Code:
unsigned int VideoMemory[800*600];
unsigned int Y,i,k,r,n,c,W = 800,H = 600, X1 = 0,Y1 = 0,X2 =10,Y2 = 10,Value = 0x00ffffff;

        if (X2 < X1 || Y2 < Y1)
           return ;

  Y = (Y1*W) + X1;
        i =  Y*4 ;                          
        c = (X2 - X1) ;                      
        r = (Y2 - Y1) ;                    
             
        do
          {
           
           for(n=0;n<=c;n++)
              {              
               VideoMemory[i+ n]= Value ;
              }
           i+= W*H*4;
           r--;
           }
            while (r>0);    
Post 10 Oct 2007, 21:06
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.