flat assembler
Message board for the users of flat assembler.

Index > Main > Indexed Variables

Author
Thread Post new topic Reply to topic
ml64



Joined: 17 Jul 2020
Posts: 12
ml64 20 Jul 2020, 14:48
How does fasm reach indexed members of arays?
I need to jump to the n-th member of the array/ Like this:
Code:
section '.data' data readable writeable
 lpCase dq 0,0,0,0
section '.text' code readable executable
  mov rax,2
 ;Select Case
  jmp lpCase[rax]    

or at least:
Code:
 jmp lpCase[2]    


Last edited by ml64 on 24 Aug 2020, 08:21; edited 1 time in total
Post 20 Jul 2020, 14:48
View user's profile Send private message Send e-mail Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 20 Jul 2020, 15:06
Code:
 mov rax,2
;...
 jmp [lpCase+rax*8]    


Code:
 jmp [lpCase+2*8]    


Code:
 lea rdx,[lpCase]
;...
 mov rax,2
;...
 jmp qword [rdx+rax*8]    

_________________
smaller is better
Post 20 Jul 2020, 15:06
View user's profile Send private message Reply with quote
ml64



Joined: 17 Jul 2020
Posts: 12
ml64 24 Aug 2020, 08:22
Thank You, CandyMan!
Post 24 Aug 2020, 08:22
View user's profile Send private message Send e-mail 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.