EnableASM and PureBasic labels

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

EnableASM and PureBasic labels

Post by luis »

PB FASM labels in the past were generated from their PB name adding a l_ in front of it, while now they include the name of the procedure as well and a double "l" for the local labels, so they tend to be a KM long (a Mile for not Europeans) and the label you are forced to use in the JMPs does not match at all with the labels they are linked to.

Example:

Code: Select all

EnableASM

Procedure.i GiveMeTheBiggerOne (a, b)
 MOV eax, a 
 MOV ecx, b
 CMP eax, ecx 
 
 JG ll_givemethebiggerone_skip  ; you need to write this ...

;JG skip ; this would obviously be better

 MOV eax, ecx 
 
 skip: ; ... when you want to jump here
 
 ProcedureReturn
EndProcedure


Procedure.i GiveMeTheBiggerOne (a, b)
 MOV eax, a
 MOV ecx, b
 CMP eax, ecx
 
 !JG gmtbo_skip  ; or you can do this, bypassing EnableASM just for this

 MOV eax, ecx
 
 !gmtbo_skip: ; same here
 
 ProcedureReturn
EndProcedure

I think PB should consider all the references to labels made by instructions not using the "!" passthrough as PB labels and expand them accordingly when generating the FASM source, while leaving the labels referenced by "!" instructions as they are.

So labels inside inline asm would work as it is now, and inside EnableAsm would work like they work in BASIC (you use the high level label name and the code generated defines and call the actual low level asm label).
"Have you tried turning it off and on again ?"
A little PureBasic review