hello,
I'm hacking a old real mode DOS game for fun these days, and it did work good and all until I tried to make some order in the global variables, by using a structure.
when recompiling, I get this error A2048: Operands must be the same size
I understand why it gives me this, the compiler wants a cast, but in my opinion it should be just a warning, since the resulting operation is pretty obvious: copy the two bytes AX is made of into the two bytes starting at ds:GLOBALS.free_flight_accel_x, even if the compiler knows it's a dword, and even if the variable don't really exists … the cpu should get:
MOV [7BCh] , AX
a simple 16 bit operation, anything else … maybe with a DS: prefix, but it's not needed really.
i compile with the latest jwasm (JWasm v2.08a, Sep 7 2012) with
jwasm -mz
shouldn't be implicit what to do ?
the type cast (is it even the right term, in such a low level context ?) could be desireable to better clarify intentions, but hardly needed … or am I missing something here ?
thanks !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, it is. But the Masm-style assembly syntax wants you to make a typecast ( it's called type coercion by MS ) - so just do it. I agree you'll have to make a few more key presses then, but on the other side you'll gain the advantage that your code can be assembled by more than just one assembler.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it's not laziness: in the sources written by me, I follow conventions to not have problems but in this case the sources are for the main part produced by IDA (a reversing tool), which make them this way.
and the sources are many and long, so having a way to auto-coerce would be handy.
it's IDA's fault, you would agree, but I have little control on how it works … I didn't found a way to tell jwasm my needs, so I was wondering if there was a way to do it I didn't thought of.
so, it seems that to move on, the only way is to script inside IDA or to build some post processing tool …
still, I think this convention … aaah, who cares.
thanks !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello,
I'm hacking a old real mode DOS game for fun these days, and it did work good and all until I tried to make some order in the global variables, by using a structure.
when recompiling, I get this error A2048: Operands must be the same size
I understand why it gives me this, the compiler wants a cast, but in my opinion it should be just a warning, since the resulting operation is pretty obvious: copy the two bytes AX is made of into the two bytes starting at ds:GLOBALS.free_flight_accel_x, even if the compiler knows it's a dword, and even if the variable don't really exists … the cpu should get:
a simple 16 bit operation, anything else … maybe with a DS: prefix, but it's not needed really.
this code generates the error:
i compile with the latest jwasm (JWasm v2.08a, Sep 7 2012) with
jwasm -mz
shouldn't be implicit what to do ?
the type cast (is it even the right term, in such a low level context ?) could be desireable to better clarify intentions, but hardly needed … or am I missing something here ?
thanks !
> shouldn't be implicit what to do ?
Yes, it is. But the Masm-style assembly syntax wants you to make a typecast ( it's called type coercion by MS ) - so just do it. I agree you'll have to make a few more key presses then, but on the other side you'll gain the advantage that your code can be assembled by more than just one assembler.
it's not laziness: in the sources written by me, I follow conventions to not have problems but in this case the sources are for the main part produced by IDA (a reversing tool), which make them this way.
and the sources are many and long, so having a way to auto-coerce would be handy.
it's IDA's fault, you would agree, but I have little control on how it works … I didn't found a way to tell jwasm my needs, so I was wondering if there was a way to do it I didn't thought of.
so, it seems that to move on, the only way is to script inside IDA or to build some post processing tool …
still, I think this convention … aaah, who cares.
thanks !