News:

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

using jmp or compare instead of 'or'

Started by bcddd214, December 24, 2011, 02:52:45 AM

Previous topic - Next topic

bcddd214

It looks like I just have to fix defining lpString:WORD correctly.

http://pastebin.com/CYJnLm0h

bcddd214

this is a 32 bit program, I forgot. dword is correct.  Hmmmm?

bcddd214

I think I am almost there. getting a syntax error but I think I am now defining correctly.

http://pastebin.com/JuWiUe30


Assembling: flipTest2.asm
flipTest2.asm(40) : error A2008: syntax error : dwLength
flipTest2.asm(54) : error A2008: syntax error : ,
flipTest2.asm(57) : fatal error A1010: unmatched block nesting : stringLengthPro
c
Press any key to continue . . .

dedndave

it is a dword
however you still have a line that is messing you up - line 54

1) that line does not belong in the string length function
i think the SwapIt function calls StringLength or is passed the length - i forget

2) CALL cannot pass parameters - just the name of the routine is allowed

dedndave

you have that all screwed up

SwapIt           PROTO :DWORD,:DWORD
;
;
;
SwapIt  PROC

stringLengthProc PROTO :DWORD
;
;
;
stringLengthProc PROC lpString:DWORD dwLength:DWORD


the prototype, PROC line, and the function must match parms   :P

for the string length proc, there is only 1 parm - a pointer (lp) to the string
for the SwapIt proc, there are 2 parms, a pointer to the string and the string length

this also means that you do not want to call the swapit function from inside the length function
you want to call the string length function to get the length and use that as one of the parms for SwapIt

dedndave

oh - one more thing...

parms on the PROC line are seperated by commas
SwapIt PROC lpString:DWORD,dwLength:DWORD

bcddd214

It doesn't seem to like that either my friend.
http://pastebin.com/TnUrJWwP

I think I made your requested changes correctly?

Assembling: flipTest2.asm
flipTest2.asm(40) : error A2111: conflicting parameter definition
flipTest2.asm(61) : error A2008: syntax error : PROTO
flipTest2.asm(65) : error A2008: syntax error : offset
flipTest2.asm(85) : fatal error A1010: unmatched block nesting : SwapIt
Press any key to continue . . .

dedndave

no
you have the PROTOtypes correct - leave those as they are

for SwapIt
SwapIt  PROC    lpString:DWORD,dwLength:DWORD

for stringLengthProc
stringLengthProc PROC lpString:DWORD

bcddd214

last one. It doesn't like my line 64. I moved that off the proc definition and tried to bring it into the proc. It's telling me I am stoopid.  :(

http://pastebin.com/u7AfuFKq


Assembling: flipTest2.asm
flipTest2.asm(64) : error A2001: immediate operand not allowed
Press any key to continue . . .

donkey

remove the line completely, it doesn't appear to do anything anyway. FYI, an offset can be treated as an immediate, you can't change it's value (its calculated at compile time as an RVA then fixed up by the loader). Trying to mov the value in EAX into it is like trying to do a mov 1, eax, the assembler will throw the error you've indicated.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

bcddd214


dedndave

i don't know how many times i have told you to remove line 53
also uncomment line 92 and it should work

bcddd214

Here is what I have left.

Assembling: flipTest2.asm
flipTest2.asm(16) : error A2008: syntax error : ConsoleScreen
Press any key to continue . . .

http://pastebin.com/R5q6pa4N


dedndave

that's because you have line 94 commented out
remove the semicolon from that line

once you have changed that...
remove line 66
remove line 55
not commented out - delete the lines altogether   :bg