this works:
mov edi, phFont
mov [edi], eax
this doesn't work:
mov DWORD ptr phFont, eax
am I insane?
thanx,
DC
Hi DC. Try:
mov dword ptr [phFont],eax
:8)
thanx Mark,
I tried that too...
doesn't seem to be working...
maybe it's the other that isn't working...
still scatchin' my nogin,
DC
If you can post some of the code, one of us can surely help ya. Are you trying to change a control's font?
DC,
How is phFont defined? Is is a constant or an address? An address will work, a constant will not. You left out some critical information on your post. Ratch
Quote
= 00000005 YYY = 5
00000000 .DATA?
00000000 00000000 XXX DWORD ?
00000000 .DATA
00000000 .CODE
00000000 START:
00000000 A3 00000000 R MOV DWORD PTR [XXX],EAX
MOV DWORD PTR [YYY],EAX
TEST.ASM(24) : error A2001: immediate operand not allowed
it's a pointer to a handle, passed to the proc:
xCreateFont proc uses edi esi phFont:ptr HANDLE, pLF:ptr LOGFONT, pColor:ptr COLORREF, pChrFmt:ptr CHARFORMAT
I'm just experimenting with the code at the bottom of 'xCreateFont' proc in the proc.inc file. I sent my project with this post.
[attachment deleted by admin]
DC,
The PROC directive strikes again! On one of my previous posts, I was ranting about how PROC usage gets in between the programmer and the problem. Especially for inexperienced users. Well, I am very inexperienced with PROC usage. If I had to debug this code, I would assemble it with the /Sn and /Sg options so that I could see the code generated by the PROC. Then it would be a hell of a lot easier to deduce what is happening within the PROC. It would also have been nice if a .bat file for assembly was included so a listing could have been gen'ed with the above options. And maybe send a simplified example displaying the problem without all the other bloat that is irrelevant. The bottom line is that you appear to be trying to write into a location on the stack. You should be able to do that. No doubt some PROC whiz will be able to tell you what is wrong without a listing, but I am not that person. Until I can see a proper listing, I am clueless. Ratch
DC,
For indirect memory operands the address of the operand must be in a register. In the following equivalent statements phFont is a direct memory operand:
mov DWORD ptr [phFont], eax
mov phFont, eax
...
00401043 894508 mov [ebp+8],eax
00401046 894508 mov [ebp+8],eax
To use phFont as an indirect memory operand, that is as a pointer, the value must be loaded into a regster and the register enclosed in square brackets.
mov ebx, phFont
mov [ebx], eax
Quote from: MichaelW on February 21, 2006, 05:00:35 PM
... these two statements are equivalent:
mov DWORD ptr [phFont], eax
mov phFont, eax
...
00401043 894508 mov [ebp+8],eax
00401046 894508 mov [ebp+8],eax
Hi Michael. This is true if phFont is a LOCAL but consider this:
.data
phFont DD 0
.code
mov DWORD PTR [phFont],ecx
Quote from: OllyDbg
00401000 >/$ C705 62324000>MOV DWORD PTR DS:[403262],123
I'm SO surprised someone hasn't made an assembly trainer yet. :wink
Hi Mark,
What exactly do you mean by assembly trainer?
thanx everyone,
Slowly he turned...
into a progger,
DC
Quote from: MichaelW on February 21, 2006, 11:40:01 PM
Hi Mark,
What exactly do you mean by assembly trainer?
Well tutorials are fine to learn this hard language but hasn't someone coded an assembly game or puzzle yet (to make learning easier?) I was thinking maybe a game like tetris, where blocks scroll down the screen and you must line up the parts that go together. But instead of being just colored blocks, they represented assembly commands... for instance only the PUSH EAX could match with the CALL <&ExitProcess> to make it disappear, etc. Higher levels would use blocks like EBP+16, etc.. :bdg