PureBasic Forum
https://www.purebasic.fr/english/

EnableASM and PureBasic labels
https://www.purebasic.fr/english/viewtopic.php?f=3&t=60362
Page 1 of 1

Author:  luis [ Mon Aug 25, 2014 11:25 am ]
Post subject:  EnableASM and PureBasic labels

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:
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).

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/