Recent Posts

Pages: [1] 2 3 ... 10
1
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by jj2007 on Today at 05:19:58 PM »
A quick help, please...

I need to iterate through an array of structures. [ebx*Bullet ] wont do it, but [2*Bullet] does. Pre compile thing? How do I do this?
Code: [Select]
xor ecx, ecx
@@:
mov edi, offset man.bullets[ecx*Bullet].active
.IF dword Ptr [edi] == 1
printf (" Bullet %d is active\n", dword Ptr [edi])
.ENDIF
inc ecx
cmp ecx, 100
jnz @B

Marinus is right, ecx gets trashed - MB Print Str$() preserves ecx, but printf() doesn't. Simple solution:

Code: [Select]
.IF dword Ptr [edi] == 1
push ecx
printf (" Bullet %d is active\n", dword Ptr [edi])
pop ecx
.ENDIF

Btw no need for edi - this should work, too (not tested):
Code: [Select]
.IF man.bullets[ecx*Bullet].active == 1
push ecx
printf (" Bullet 1 is active\n")  ; 1 is it's value, for sure, so a constant will do ;-)
pop ecx
.ENDIF
2
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by Siekmanski on Today at 02:29:01 PM »
Hi Alex,

Maybe ebx/ecx is trashed by the function "printf" ?

try this,

Code: [Select]
mov edi,offset Player.bullets
 mov esi,0
find_active_bullets:
 .if dword ptr[edi].Bullet.active == 1
    printf (" Bullet %d is active\n", esi)
 .endif
 add edi,sizeof Bullet
 inc    esi
 cmp    esi, 100
 jne find_active_bullets

little hint: you can align the struct to 4 like this,
Player STRUCT 4
3
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by LordAdef on Today at 10:17:59 AM »
A quick help, please...


I need to iterate through an array of structures. [ebx*Bullet ] wont do it, but [2*Bullet] does. Pre compile thing? How do I do this?
   xor ecx, ecx
   @@:
   mov edi, offset man.bullets[ecx*Bullet].active
   .IF   dword Ptr [edi] == 1
      printf (" Bullet %d is active\n", dword Ptr [edi])
   .ENDIF
   inc ecx
   cmp ecx, 100
   jnz @B

Quote
        Bullet STRUCT
           active   dd      ?
               speed   dd     ?
               x      dd      ?
               y      dd      ?               
        Bullet ENDS

        Player STRUCT
           align 4
               x          dd ?
               y          dd ?
             sprite   dd   ?
               frmx   dd   ?
               frmy   dd   ?
               bullets   Bullet   100 dup (<>)  <==== These guys HERE
               kState   dd   ?   
        Player ENDS

Quote
If Olly is installed as \Masm32\OllyDbg\ollydbg.exe, hit F6 and have a look at eax and the error message.
Thanks, I´ll have a look
4
The Workshop / Re: Symbols mapped to non-existing object files
« Last post by jj2007 on Today at 09:54:41 AM »
This is not C++, my friend. Assembler sources are always rebuilt.
5
The Workshop / Re: Symbols mapped to non-existing object files
« Last post by newrobert on Today at 07:57:33 AM »
try to recompile or rebuild;
6
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by jj2007 on Today at 06:33:54 AM »
I´m only using hdc to retrieve the default font, and restore it back when I´m done.
            invoke SelectObject, hdc, eax
            int 3
            mov OldFont, eax

If Olly is installed as \Masm32\OllyDbg\ollydbg.exe, hit F6 and have a look at eax and the error message.

Otherwise,
- activate MasmBasic.inc
- OxPT_Susy (disactivates the option, console will be default)
- fonts.asm, line 7:
Code: [Select]
            invoke SelectObject, hdc, eax
ifdef MbBufferGet
fdeb 4, "SelObj", eax, hdc, $Err$()
endif
            mov OldFont, eax
7
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by LordAdef on Today at 05:52:34 AM »
Quote
pIniFonts proc hdc:DWORD
            ;----------------------------------------- MAP FONT -----------------------------------------------------------------------------------------------------------
            invoke CreateFont,12,0,0,0,400,0,0,0,OEM_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                                           DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT, chr$("Courier New") ;ADDR FontName1 ;Lucida Console
            mov Font1, eax
            invoke SelectObject, hdc, eax
            mov OldFont, eax
           
            ;---------------------------------------- MAN FONT -----------------------------------------------------------------------------------------------------------
            invoke CreateFont,18,0,0,0,400,0,0,0,OEM_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                                           DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT,  chr$("Arial")
            mov Font2, eax
           
            ;---------------------------------------- LABEL FONT --------------------------------------------------------------------------------------------------------
            invoke CreateFont,52,0,0,0,400,0,0,0,OEM_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                                           DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT, chr$("Arial Black")
            mov Font3, eax
           
            ;---------------------------------------- LABEL FONT 2 -----------------------------------------------------------------------------------------------------
            invoke CreateFont,28,0,0,0,400,0,0,0,OEM_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                                           DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT, chr$("Arial")
            mov Font4, eax
           
            ;---------------------------------------- TEST FONT -----------------------------------------------------------------------------------------------------
            invoke CreateFont,12,0,0,0,400,0,0,0,OEM_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                                           DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT, chr$("MapTst")
            mov Font5, eax

     ret
pIniFonts endp

I´m only using hdc to retrieve the default font, and restore it back when I´m done.
            invoke SelectObject, hdc, eax
            mov OldFont, eax

I made it as a proc but it was previously sitting in there.
8
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by LordAdef on Today at 05:37:49 AM »
I understand JJ, no worries.

Double buffering is not flickering for me. For scrolling, I even think it gets a worse result than compared to double buffering. the three exes in the zip.



9
GoAsm / Re: Nasm to Goasm
« Last post by bartc on Today at 05:17:45 AM »
missing option /console
That did the trick, thanks.

But a problem has come up which I can't explain. If I create a new program hello.asm64 (generated from my compiler) like this:
...
And actually, while trying to paste the code, I've think I've just seen the cause. The compiler generates asm code with LF line endings only. GoAsm doesn't like it, but it just says this:

 Error!
 No code or data found in assembler source file
 OBJ file not made

If I made any change with my text editor, even nothing at all, just saving the same text, it would appear to fix it. But my editor writes CRLF. GoAsm doesn't mind CR only, but then my editor doesn't like it! So it'll have to be CR,LF.
10
The Campus / Re: "Hello masm32", not a BOT, new member
« Last post by jj2007 on Today at 04:23:30 AM »
ScrollWindow must use BitBlt internally, I doubt that it can be much faster.

I am too busy (and too tired) to look into the double buffering, Alex - but if it's done correctly, it should not flicker at all. For comparison, try sizing the Gdi+ example in File/New Masm source; the only item that flickers is the yellow box in the lower right...

Re pIniFonts:
Code: [Select]
004023A8        ³.  50                      push eax                               ; ÚhObject
004023A9        ³.  FF75 08                 push dword ptr [ebp+8]                 ; ³hDC => [Arg1]
004023AC        ³.  E8 E7010000             call <jmp.&gdi32.SelectObject>         ; ÀGDI32.SelectObject

Returns 0, invalid handle.
Pages: [1] 2 3 ... 10