I've changed
LOOP l_asm_test_loop_label
to
LOOP ll_asm_test_loop_label
because I'm using 5.31 and a "l" has been added for "l"ocal.
Anyway, I confirm the problem you have encountered, but it's there only if you compile the code for a debug build.
In the debug build code is added behind the scene (it could interfere with your byte counting) so maybe that's the cause.
I'm just guessing, didn't check.
But if you write your code this way:
Code: Select all
ProcedureDLL.L ASM_TEST_LOOP()
;EnableASM
!MOV ECX,100
label:
!NOP
!NOP
!NOP
!NOP
!NOP
!NOP
!NOP
!NOP
!NOP
!NOP
!NOP ; <- NOW IT WORKS
!LOOP ll_asm_test_loop_label
!MOV EAX,ECX
ProcedureReturn
;DisableASM
EndProcedure
Debug ASM_TEST_LOOP() ; 0
...you can bypass the problem entirely since PB it's not looking at that as PB code anymore, in fact you can't even put a breakpoint on those lines anymore while with EnableASM you can.
EDIT:
I've checked it:
Release build
Code: Select all
401080 : B9 64 00 00 00 mov ecx, 00000064h
401085 : 90 nop
401086 : 90 nop
401087 : 90 nop
401088 : 90 nop
401089 : 90 nop
40108A : 90 nop
40108B : 90 nop
40108C : 90 nop
40108D : 90 nop
40108E : 90 nop
40108F : E2 F4 loop 00401085h
401091 : 89 C8 mov eax, ecx
Debug build
Code: Select all
4010CB : 68 15 00 00 00 push 00000015h
4010D0 : E8 00 01 00 00 call 004011D5h
4010D5 : B9 64 00 00 00 mov ecx, 00000064h
4010DA : 68 19 00 00 00 push 00000019h
4010DF : E8 F1 00 00 00 call 004011D5h
4010E4 : 90 nop
4010E5 : 68 1A 00 00 00 push 0000001Ah
4010EA : E8 E6 00 00 00 call 004011D5h
4010EF : 90 nop
4010F0 : 68 1B 00 00 00 push 0000001Bh
4010F5 : E8 DB 00 00 00 call 004011D5h
4010FA : 90 nop
4010FB : 68 1C 00 00 00 push 0000001Ch
401100 : E8 D0 00 00 00 call 004011D5h
401105 : 90 nop
401106 : 68 1D 00 00 00 push 0000001Dh
40110B : E8 C5 00 00 00 call 004011D5h
401110 : 90 nop
401111 : 68 1E 00 00 00 push 0000001Eh
401116 : E8 BA 00 00 00 call 004011D5h
40111B : 90 nop
40111C : 68 1F 00 00 00 push 0000001Fh
401121 : E8 AF 00 00 00 call 004011D5h
401126 : 90 nop
401127 : 68 20 00 00 00 push 00000020h
40112C : E8 A4 00 00 00 call 004011D5h
401131 : 90 nop
401132 : 68 21 00 00 00 push 00000021h
401137 : E8 99 00 00 00 call 004011D5h
40113C : 90 nop
40113D : 68 22 00 00 00 push 00000022h
401142 : E8 8E 00 00 00 call 004011D5h
401147 : 90 nop
401148 : 68 26 00 00 00 push 00000026h
40114D : E8 83 00 00 00 call 004011D5h
401152 : E2 86 loop 004010DAh
401154 : 68 28 00 00 00 push 00000028h
401159 : E8 77 00 00 00 call 004011D5h
40115E : 89 C8 mov eax, ecx
For each of your NOP you have 10 bytes used by the debugger, that's why your byte counting is off and why not using the debugger or bypassing the compiler with the "!" makes all work as expected.
Also you can just wrap your code with DisableDebugger/EnableDebugger which also seems to stop the generation of the extra code.
But it's not a bug.