Here is a new version of .for - .endfor MACROS
some more examples:
;--------------------------------------------------------------------
xstrlenA PROC FRAME wpString:PTR CHAR
.if (!rcx)
xor rax,rax
jmp aexit
.endif
.for rax=rcx:BYTE PTR[rax]:rax++
.endfor
sub rax,rcx
aexit:
ret
xstrlenA ENDP
;--------------------------------------------------------------------
xstrlenA PROC FRAME wpString:PTR CHAR
1264: .if (!rcx)
000000000044AF31 push rbp
000000000044AF32 mov rbp,rsp
000000000044AF35 and rcx,rcx
000000000044AF38 jne xstrlenA+0Eh (44AF3Fh)
1265: xor rax,rax
000000000044AF3A xor rax,rax
1266: jmp aexit
000000000044AF3D jmp xstrlenA+21h (44AF52h)
1267: .endif
1268: .for rax=rcx:BYTE PTR[rax]:rax++
000000000044AF3F mov rax,rcx
000000000044AF42 jmp xstrlenA+17h (44AF48h)
000000000044AF44 add rax,1
000000000044AF48 cmp byte ptr [rax],0
000000000044AF4B je xstrlenA+1Eh (44AF4Fh)
1269: .endfor
000000000044AF4D jmp xstrlenA+13h (44AF44h)
1270: sub rax,rcx
000000000044AF4F sub rax,rcx
1271: aexit:
1272: ret
000000000044AF52 add rsp,0
000000000044AF56 pop rbp
000000000044AF57 ret
1273: xstrlenA ENDP
;----------------------------------------------------------------------
xstrlenW PROC FRAME wpString:PTR wchar_t
.if (!rcx)
xor eax,eax
jmp aexit
.endif
.for rax=rcx:WORD PTR[rax]:rax+=2
.endfor
sub rax,rcx
sar eax,1
aexit:
ret
xstrlenW ENDP
;----------------------------------------------------------------------
xstrlenW PROC FRAME wpString:PTR wchar_t
000000000044AF58 push rbp
000000000044AF59 mov rbp,rsp
000000000044AF5C and rcx,rcx
000000000044AF5F jne xstrlenW+0Dh (44AF65h)
1277: xor eax,eax
000000000044AF61 xor eax,eax
1278: jmp aexit
000000000044AF63 jmp xstrlenW+24h (44AF7Ch)
1279: .endif
1280: .for rax=rcx:WORD PTR[rax]:rax+=2
000000000044AF65 mov rax,rcx
000000000044AF68 jmp xstrlenW+16h (44AF6Eh)
000000000044AF6A add rax,2
000000000044AF6E cmp word ptr [rax],0
000000000044AF72 je xstrlenW+1Eh (44AF76h)
1281: .endfor
000000000044AF74 jmp xstrlenW+12h (44AF6Ah)
1282: sub rax,rcx
000000000044AF76 sub rax,rcx
1283: sar rax,1
000000000044AF79 sar rax,1
1284: aexit:
1285: ret
000000000044AF7C add rsp,0
000000000044AF80 pop rbp
000000000044AF81 ret
1286: xstrlenW ENDP
;----------------------------------------------------------------------
_________________________
I added cool smileys to this message... if you don't see them go to: http://s.exps.me
It looks like none like it
so I have added parentheses
It works the same but looks better
I hope you'll like it because I do
now it looks like this:
xstrlenA PROC FRAME wpString:PTR CHAR
.if (!rcx)
xor rax,rax
jmp aexit
.endif
.for (rax=rcx:BYTE PTR[rax]:rax++)
.endfor
sub rax,rcx
aexit:
ret
xstrlenA ENDP
;--------------------------------------------------------------------
xstrlenW PROC FRAME wpString:PTR wchar_t
.if (!rcx)
xor rax,rax
jmp aexit
.endif
.for (rax=rcx:WORD PTR[rax]:rax+=2)
.endfor
sub rax,rcx
sar rax,1
aexit:
ret
xstrlenW ENDP
;----------------------------------------------------------------------
_________________________
I added cool smileys to this message... if you don't see them go to: http://s.exps.me
QuoteIt looks like none like it
:P
nothing wrong with your stuff
not that many of us like 64-bit code - lol
As I said before, these macros work with JWasm32, as well as masm32
they can not be used only with ml64
here is JWasm32 version:
xstrlenA PROC wpString:PTR CHAR
.if (!wpString)
xor eax,eax
jmp aexit
.endif
.for (eax=wpString:BYTE PTR[eax]:eax++)
.endfor
sub eax,wpString
aexit:
ret
xstrlenA ENDP
profor!xstrlenA:
00401194 55 push ebp
00401195 8bec mov ebp,esp
00401197 837d0800 cmp dword ptr [ebp+8],0
0040119b 7504 jne profor!xstrlenA+0xd (004011a1)
0040119d 33c0 xor eax,eax
0040119f eb12 jmp profor!xstrlenA+0x1f (004011b3)
004011a1 8b4508 mov eax,dword ptr [ebp+8]
004011a4 eb03 jmp profor!xstrlenA+0x15 (004011a9)
004011a6 83c001 add eax,1
004011a9 803800 cmp byte ptr [eax],0
004011ac 7402 je profor!xstrlenA+0x1c (004011b0)
004011ae ebf6 jmp profor!xstrlenA+0x12 (004011a6)
004011b0 2b4508 sub eax,dword ptr [ebp+8]
004011b3 c9 leave
004011b4 c20400 ret 4
;----------------------------------------------------------------------
xstrlenW PROC wpString:PTR wchar_t
.if (!wpString)
xor eax,eax
jmp aexit
.endif
.for (eax=wpString:WORD PTR[eax]:eax+=2)
.endfor
sub eax,wpString
sar eax,1
aexit:
ret
xstrlenW ENDP
;----------------------------------------------------------------------
profor!xstrlenW:
004011b7 55 push ebp
004011b8 8bec mov ebp,esp
004011ba 837d0800 cmp dword ptr [ebp+8],0
004011be 7504 jne profor!xstrlenW+0xd (004011c4)
004011c0 33c0 xor eax,eax
004011c2 eb15 jmp profor!xstrlenW+0x22 (004011d9)
004011c4 8b4508 mov eax,dword ptr [ebp+8]
004011c7 eb03 jmp profor!xstrlenW+0x15 (004011cc)
004011c9 83c002 add eax,2
004011cc 66833800 cmp word ptr [eax],0
004011d0 7402 je profor!xstrlenW+0x1d (004011d4)
004011d2 ebf5 jmp profor!xstrlenW+0x12 (004011c9)
004011d4 2b4508 sub eax,dword ptr [ebp+8]
004011d7 d1f8 sar eax,1
004011d9 c9 leave
004011da c20400 ret 4
Quotenot that many of us like 64-bit code - lol
I am a little bit worried about you people
I think that we can not spend whole our life on our mum's lap because we fill secure there
we have to grow up and move forward
we have to embrace the future, we can not stay in the past
regards