News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

[First timer]Window will not show up

Started by carre89, November 21, 2012, 07:33:52 AM

Previous topic - Next topic

dedndave

for this line: .if x<0 || mf.FieldWidth <= x || y<0 || mf.FieldHeight <= y

mf.FieldWidth <= x
and
mf.FieldHeight <= y

are both problematic
you cannot compare one memory value to another memory value
one of the operands  must be in register

for this line: invoke IncSp, mf, eax, tempX, tempY
that line does not appear to be a problem

if you had: invoke IncSp, mf, eax, tempX, addr tempY
that would be a problem because the assembler uses EAX to hold the address of tempY

be sure you are showing us the correct line

nidud

#46
deleted

dedndave

Quote from: dedndave on November 30, 2012, 11:30:06 AM
you cannot compare one memory value to another memory value
one of the operands  must be in register
correction:
one of the operands  must be in register or a constant   :P

carre89

So I fixed the bool expression but I don't know what to do to fix the invoke statement. Any ideas?

dedndave

if you attach the complete source, i will have a look at it
i need all of it - the INC files, batch files, etc

the reason i say that - i am not sure you are showing us the offending line of code
no use troubleshooting something that isn't broken   :P

qWord

Quote from: carre89 on December 01, 2012, 06:05:24 AM
So I fixed the bool expression but I don't know what to do to fix the invoke statement. Any ideas?
DO NOT pass structures by value -> use pointers instead.
MREAL macros - when you need floating point arithmetic while assembling!

dedndave

invoke IncSp, mf, eax, tempX, tempY

that should pass the address of the mf structure - not a value
either way, it should not interfere with the contents of EAX

nidud

#52
deleted

jj2007

See also Tips, Tricks & Traps, "The .if eax<0 trap"

Workaround is very simple:
signed   EQU sdword ptr ; with a trailing blank - borrowed from MasmBasic ;-)

.if signed eax<0
   print "voilĂ , it works!"
.endif

For memory variables, it is even simpler:
.data
MyX SDWORD 123

dedndave

i don't think the "<0" comparisons are necessary, at all
negative values will fail the max limit test because, in unsigned comparison, they appear to be very large values

for example, -1 will be compared as +4294967295
-2147483648 will be compared as +2147483648

.if mf.FieldWidth <= x || mf.FieldHeight <= y
almost works - lol

you still have to get one of each operand into register...
mov ecx,x
mov edx,y
.if ecx >= mf.FieldWidth || edx >= mf.FieldHeight

give that a try

dedndave

Quote from: qWord on November 30, 2012, 06:55:31 AM
Quote from: dedndave on November 30, 2012, 06:41:18 AMi didn't think you could use IMUL with a memory operand
Yes, we can!  :P

now i remember   :biggrin:

you can't IMUL by a register - it has to be a constant or a memory operand

qWord

Quote from: dedndave on December 03, 2012, 07:19:40 AM
now i remember   :biggrin:

you can't IMUL by a register - it has to be a constant or a memory operand
we can IMUL by a register (or at least, I can). Also, what to remember?  - a quick look up in the manuals should clarifies it  :badgrin:
MREAL macros - when you need floating point arithmetic while assembling!

dedndave

one of the operands can be a register - but one cannot - at least, that's what i get - lol
imul eax,5    ;works
imul eax,edx  ;doesn't work


remember - i try to memorize everything so i don't have to look it up all the time   :biggrin:

anyways, here's what i have so far
the array is also initialized with mines and numbers
now - a few easy routines to manipulate things and i will let Carre do the rest of it   :P


qWord

MREAL macros - when you need floating point arithmetic while assembling!

dedndave

ok - i had trouble with that one
i will play with it later
i just remember there was something i was trying to do and had to use MUL
it may be i had a typo in my code or something

getting old - my brain isn't what it used to be   :P