News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Loop Backward

Started by RuiLoureiro, January 17, 2008, 02:41:40 PM

Previous topic - Next topic

RuiLoureiro

NightWare,
                I tried to compile it and this was the result:


Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: C:\MASM32\RuiTestes\Test323.asm
C:\MASM32\RuiTestes\Test323.asm(41) : error A2085: instruction or register not ac
cepted in current CPU mode
C:\MASM32\RuiTestes\Test323.asm(42) : error A2085: instruction or register not ac
cepted in current CPU mode
........................................
C:\MASM32\RuiTestes\Test323.asm(58) : error A2006: undefined symbol : Label01
C:\MASM32\RuiTestes\Test323.asm(71) : error A2006: undefined symbol : Label03
_
Assembly Error
Prima qualquer tecla para continuar . . .

     
                Whats wrong ?
Rui

jdoe

Rui,

Before using MMX instructions, the assembler must know that you will.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
    .686
    .MMX
    include \masm32\macros\timers.asm
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««



RuiLoureiro

Thanks  jdoe, it works

It waists 23 cycles only ! Good.

;------------------------------------------------------------------
    counter_begin 1000000, HIGH_PRIORITY_CLASS

    mov     eax, 20
    mov     esi, offset _Str1
    mov     edi, offset _Str2
    call    Mmx_MemMove                          ; 23 cycles

    counter_end
    print ustr$(eax)," cycles",13,10


Rui

NightWare

rui,
if you want to make speed test, you must compare equivalent code (here there is no alignment)... add "ALIGN 16" before each procs, and you will obtain more representative results  :P

jdoe

Quote from: NightWare on January 20, 2008, 12:47:24 AM
rui,
if you want to make speed test, you must compare equivalent code (here there is no alignment)... add "ALIGN 16" before each procs, and you will obtain more representative results  :P

Moreover, adding few nop before a loop could help to gain few cpu clock. Some cpu are more sensitive to alignment than other but, like NightWare said, a procedure should always start by "align 16".

:U


RuiLoureiro

Thanks   NightWare   and  jdoe.

    Before each proc i will go to put align 16 in all my set of procs.

Now i have one problem with menus. When a program is running i cannot access the menu. The program stops to run. how to solve this problem ? Anyone know ?

Thanks
Rui

jdoe

Quote from: RuiLoureiro on January 21, 2008, 01:34:52 PM

Now i have one problem with menus. When a program is running i cannot access the menu. The program stops to run. how to solve this problem ? Anyone know ?


Rui,

What do you mean by "when the program is running". Only the menus are freezed or all the controls.
I could be wrong about your problem but when you start a task that takes times to execute, it is normal that a form freeze if you don't use a new thread.


RuiLoureiro

Quote from: jdoe on January 21, 2008, 03:20:49 PM
... when you start a task that takes times to execute, it is normal that a form freeze if you don't use a new thread.

Hi  jdoe, thank you

             Yes when it is executing a task. So, the solution is using a new thread, no ?
Rui

jdoe

Rui,

You have a DialogProc/WindowProc for your dialog/window ?

Suppose BTN1_ID is the OK button and BTN2_ID the Cancel button


ThreadProc PROTO :DWORD

DialogProc PROC p_hWndDlg:DWORD, p_uMsg:DWORD, p_wParam:DWORD, p_lParam:DWORD

    mov eax, p_uMsg

    .if (eax == WM_INITDIALOG)


    .elseif (eax == WM_COMMAND)

        .if (p_wParam == BTN1_ID)

            invoke CreateThread, NULL, 0, addr ThreadProc, p_hWndDlg, 0, addr dwDummy
            invoke CloseHandle, eax

        .elseif (p_wParam == BTN2_ID)

            jmp End_Dialog

        .endif

    .elseif (eax == WM_CLOSE)

        End_Dialog:

        invoke EndDialog, p_hWndDlg, NULL

    .endif

    xor eax, eax

    ret

DialogProc ENDP

ThreadProc PROC lpParameter:DWORD

    ret

ThreadProc ENDP



Now, the thread proc can take the time it needs, the dialog won't freeze.


RuiLoureiro

Thank you, jdoe
                       i am going to try.
Rui