This is the structure of the test program:
;==============================================================================
; Test_mov3todw.asm
; ------------------------------------------------------------------------
; Example to test instructions that mov 3 bytes vars into dwords.
; The test uses 48 bytes string to be read 3 bytes each time, into 16 DW.
; ------------------------------------------------------------------------
; Frktons 20-jan-2013 @Masm32 Forum
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.nolist
.686
.xmm
include \masm32\macros\timers.asm
; get them from the
;[url=http://www.masm32.com/board/index.php?topic=770.0]Masm32 Laboratory[/url]
AxCPUid_Print PROTO
LOOP_COUNT EQU 1000
include \masm32\include\MyLib.inc
;==============================================================================
.data
align 16
Area DB "Here it is a string with 48 characters inside me",0
AreaLn = ($ - Area - 1)
align Four
AreaLen dd 0
Counter dd 0
PtrSource dd Area
PtrDest dd ArrayDW
align Four
LineSep db 72 dup("-"),0,0,0,0
align Four
PtrLineSep dd LineSep
.data?
align 16
ArrayDW dd 16 DUP (?)
align Four
CPU_Count DD ? ; Number of Cycles elapsed
.code
;==============================================================================
align Four
MovProc proc
mov edx, 1000 ; Number of cycles to perform
align Four
TotCycles:
mov esi, PtrSource
mov edi, PtrDest
mov ecx, 16
align Four
cycle:
mov eax, [esi]
and eax, 00FFFFFFH
mov [edi], eax
add esi, 3
add edi, Four
dec ecx
jnz cycle
dec edx
jnz TotCycles
ret
MovProc endp
;==============================================================================
align Four
DisplayArrayDW proc
mov ecx, 0
mov edx, PtrDest
Display:
pushad
print DWORD PTR edx
popad
add edx, Four
inc ecx
cmp ecx, 16
jnz Display
ret
DisplayArrayDW endp
;==============================================================================
align Four
Main proc
invoke GetLocaleInfo,LOCALE_USER_DEFAULT,LOCALE_STHOUSAND,offset Tsep,Four
invoke CharToOem,offset Tsep,offset Tsep
CALL FillMyArray
CALL FillMyArray0
INVOKE ConsoleSize, 40, 100
print PtrLineSep, 13, 10
invoke AxCPUid_Print
print PtrLineSep, 13, 10
REPEAT Four
;---------------------------------------------------------------------------------
invoke Sleep, 100
counter_begin LOOP_COUNT, HIGH_PRIORITY_CLASS
CALL MovProc
counter_end
mov edi, PtrFmtNum16
lea esi, InitString
movdqa xmm0, [esi]
movdqa [edi], xmm0
INVOKE FormatNumDW, eax, PtrFmtNum16
print PtrFmtNum16, 9, "cycles for Dave - MOV 4 bytes / AND", 13, 10
;---------------------------------------------------------------------------------
print PtrLineSep, 13, 10
ENDM
; CALL DisplayArrayDW
ret
Main endp
;-------------------------------------------------------------
include AxCPUid.inc
;-------------------------------------------------------------
;==============================================================================
start:
;==============================================================================
;==============================================================================
call Main
inkey
exit
;==============================================================================
end start
If you are still awake, try to adapt your code for the task.
Attached the files you need.
Frank