ASM Questions
Posted: Sun May 29, 2005 10:06 am
HI all freaks.
Newly I try to code ASM in Purebasic.
Here the first try:
And here are the question:
Why do I get an "illegal instruction" error ( ASM ) if I enable the test.s in the 3rd line.
Why do i get a "garbage to the end of line" error ( Compiler ) if I enable the 2nd MOV d1, byte [ebx] statement.
I do not need it here but later I want to work with 2 strings. And for me it is codeable.
Any help would be appreciated.
Best regards.
W. Bückmann
WIN XP JAPBE 1.4.4.25 PB 3.92
Newly I try to code ASM in Purebasic.
Here the first try:
Code: Select all
Declare MyTest(dwoffset.l,anza.l)
testa.s=" DFDGHJKGHJKGbHJKDHSKJGADHJKHGJ"
; test.s= ""
a=MyTest(@testa,Len(testa))
Debug a
MessageRequester("ASM Example", "Should be 101: "+Str(a), 0)
End
Procedure.l MyTest(dwoffset.l,anz.l)
MOV eax, 0
MOV ebx, dwoffset ;ebx = ptr to buffer
MOV ecx, anz ;ecx = length of buffer (counter)
schleif:
MOV dl, byte [ebx]
CMP dl,"b"
JNE l_scha
ADD eax,1
scha:
;MOV dl, byte [ebx]
CMP dl,"A"
JNE l_schb
ADD eax,100
schb:
INC ebx
DEC ecx
JNZ l_schleif
ProcedureReturn
EndProcedure
; ExecutableFormat=Windows
; EnableAsm
; EOF
Why do I get an "illegal instruction" error ( ASM ) if I enable the test.s in the 3rd line.
Why do i get a "garbage to the end of line" error ( Compiler ) if I enable the 2nd MOV d1, byte [ebx] statement.
I do not need it here but later I want to work with 2 strings. And for me it is codeable.
Any help would be appreciated.
Best regards.
W. Bückmann
WIN XP JAPBE 1.4.4.25 PB 3.92