flat assembler
Message board for the users of flat assembler.

Index > Main > moving from memory pointers

Author
Thread Post new topic Reply to topic
cubeoid



Joined: 22 Jan 2007
Posts: 19
cubeoid
can someone explain why this does not compile

Code:
_256bmem dd 256 dup(?)


mov eax, dword [_256bmem+ch*4]

    



im trying to move data from _256bmem + (ch*4)

kind of like a jmp table


it says ERROR: reserved word used as symbol
Post 18 Mar 2007, 18:26
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Because you are using an inexistent addressing mode. You can't use CH*4 but you can use ECX*4 if you want adjusting ECX to proper value first or use

Code:
movzx eax, ch
mov   eax, [_256bmem+eax*4]    


Tomasz, really, that error message is very bad to see the real problem.
Post 18 Mar 2007, 18:51
View user's profile Send private message Reply with quote
cubeoid



Joined: 22 Jan 2007
Posts: 19
cubeoid
thanks
but that messes up the regs i set up for a ppc interpreter now


EDIT:
got code going

Code:


_ppcgekkointaddx:

mov ecx,opcode
mov edx,ecx     ; faster than from opcode again

shr ch,01H
and ch,01H       ;ch now has Oe
and cl,01H       ;cl now has Rc
xor ch,cl       ;[xor] or [or] doesnt matter here
shr ecx,08H      ;cl now has Oe and Rc
and ch,01FH      ;ch now has rA

shr edx,0BH
shr dh,02H
and dl,01FH      ;dl now has rB
and dh,01FH      ;dh now has rD

movzx ebp,ch
add eax, dword [_ppcggprptr+ebp*4]  ;gpr[rA] now in eax

movzx ebp,dl
add ebx, dword [_ppcggprptr+ebp*4]  ;gpr[rB] now in ebx

add eax,ebx                        ;added together

movzx ebp,dh
mov dword [_ppcggprptr+ebp*4],eax   ;moved into gpr[rD]

movzx ebp,cl
jmp dword [_ppcgOeRccheck+ebp*4]
ret  

    


Last edited by cubeoid on 18 Mar 2007, 19:40; edited 1 time in total
Post 18 Mar 2007, 19:30
View user's profile Send private message Reply with quote
cubeoid



Joined: 22 Jan 2007
Posts: 19
cubeoid
important data already in eax

ill use ebp instead

thanks again

it doent really matter because im using this to help get ideas for recompiler
Post 18 Mar 2007, 19:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.