PB 5.11 assembler and local labels

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

PB 5.11 assembler and local labels

Post by User_Russian »

Why assembler preprocessor, not work correctly with a local label?

Code: Select all

Procedure Test()
  EnableASM
  
  jmp m1
  
  m1:
EndProcedure
We have to explicitly specify the name of the label.

Code: Select all

Procedure Test()
  EnableASM
  
  jmp l_test_m1
  
  m1:
EndProcedure
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: PB 5.11 assembler and local labels

Post by STARGÅTE »

Label: is a PB-Syntax, use the ASM Syntax:

Code: Select all

Procedure Test()
  EnableASM
  
  jmp m1
  
  !m1:
EndProcedure
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PB 5.11 assembler and local labels

Post by User_Russian »

STARGÅTE, In the case of a variable, do not use ASM-syntax.

Code: Select all

Procedure Test()
  x=0
  EnableASM
  mov x, 10
  DisableASM
  
  Debug x
EndProcedure

Test()
Then why is he (ASM-syntax) is required in the case of the labels?
Obviously flaw, ASM preprocessor.
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: PB 5.11 assembler and local labels

Post by Demivec »

User_Russian wrote:Test()[/code]Then why is he (ASM-syntax) is required in the case of the labels?
Obviously flaw, ASM preprocessor.
The variable or label has to be declared first. In your example code declared the variable 'x' by using it before the assembler code, but the label was declared after the assembler code.

Not a bug. Same as your other bug report. Read the information in the manual on assembly use or post in the Assembly Programming or Coding Questions forum if you have a question on use.
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PB 5.11 assembler and local labels

Post by User_Russian »

Demivec wrote:The variable or label has to be declared first.
It does not matter.
Still does not work.

Code: Select all

Procedure Test()
  EnableASM
  m1:
  
  jmp m1
  DisableASM
  
EndProcedure

Test()
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: PB 5.11 assembler and local labels

Post by Demivec »

User_Russian wrote:We have to explicitly specify the name of the label.

Code: Select all

Procedure Test()
  EnableASM
  
  jmp l_test_m1
  
  m1:
EndProcedure
You already know how to do it correctly, why are you confused? Are you trying to make a feature request instead of a bug report?
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Re: PB 5.11 assembler and local labels

Post by LuCiFeR[SD] »

I'm pretty convinced he doesn't understand that the "!" bypasses the PBcompiler and gives him the access to fasm directly. but equally, I don't think he understands that there is a possibility of his label clashing with a pb internal label and giving him just as many headaches when code that should work, suddenly doesn't. which is why PB's procedural syntax requires the "l_test_m1"

but yes, it does sound more like a feature request than a bug :)
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PB 5.11 assembler and local labels

Post by User_Russian »

Friends, this ASM code handles preprocessor pbcompiler, before it processes the fasm.
And this preprocessor should change the name of the label, as it does with the variable names.
After all, the preprocessor replaces

Code: Select all

mov x, 10
on

Code: Select all

mov dword [p.v_x], 10
Why can not he do the same with the labels?
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Re: PB 5.11 assembler and local labels

Post by LuCiFeR[SD] »

then make this a feature request and NOT a bug report, because it is not a bug as is explained in the documentation.
Post Reply