flat assembler
Message board for the users of flat assembler.

Index > Main > error: symbol '...' out of scope.

Author
Thread Post new topic Reply to topic
Jin X



Joined: 06 Mar 2004
Posts: 133
Location: Russia
Jin X 09 Aug 2023, 10:30
Code:
    jne exit_addr
@after_jmp_on_fail:

. . .

exit_addr = 0
rept 256 addr:$100
{
  if addr >= @after_jmp_on_fail-128 & addr <= @after_jmp_on_fail+127
    load code_byte byte from addr
    if code_byte = $C3 & exit_addr = 0
      exit_addr = addr
    end if
  end if ; addr...
}
assert exit_addr <> 0    
error: symbol 'exit_addr' out of scope.

What's wrong?
Post 09 Aug 2023, 10:30
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 913
Location: Russia
macomics 09 Aug 2023, 11:08
1)
Code:
if (code_byte = $C3 | code_byte = $C2) & exit_addr = 0
...    
The retn command can be not only with the code $C3, but also $C2 XX XX
2) It is possible to refer to variables declared somewhere ahead only when it is assigned a value only once
Code:
    jne exit_addr_value ; forward reference
@after_jmp_on_fail:

. . .

exit_addr = 0
rept 256 addr:$100
{
  if addr >= @after_jmp_on_fail-128 & addr <= @after_jmp_on_fail+127
    load code_byte byte from addr
    if code_byte = $C3 & exit_addr = 0
      exit_addr = addr
    end if
  end if ; addr...
}
assert exit_addr <> 0
exit_addr_value = exit_addr ; only once        
Post 09 Aug 2023, 11:08
View user's profile Send private message Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 133
Location: Russia
Jin X 10 Aug 2023, 10:29
Thanks!
Post 10 Aug 2023, 10:29
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.