Page 2 of 2
Re: Copy PbConstant value in variable ASM [Resolved]
Posted: Sun May 27, 2012 10:37 am
by bosker
The data declared in asm - in the DB statement - is used in Purebasic.
Which when wrapping the statements in EnableASM/DisableASM blocks, it works.
No, it doesn't. You can't write a DB statement without the !. When you write a statement with a ! at the beginning, you can't use a PB #Const.
This is where I fail to see the problem...
Ok.
Re: Copy PbConstant value in variable ASM [Resolved]
Posted: Sun May 27, 2012 10:59 am
by Foz
bosker wrote:No, it doesn't. You can't write a DB statement without the !. When you write a statement with a ! at the beginning, you can't use a PB #Const.
And Comprehesion finally dawns on my rather slow mind - thank you

Re: Copy PbConstant value in variable ASM [Resolved]
Posted: Sun May 27, 2012 10:06 pm
by Kwai chang caine
For good understanding my problem, i have try to create a little code with the problem
Code: Select all
; In the begining of all my program, i have numerous PbConstant for create a style of "Identity card" for each different soft
#NameOfSoftware = "Kcc Soft"
#VersionOfSoftware = "v1.0"
#DateCreationOfSoftware = "12/10/2010"
#ReferenceOfSoftware = "1240"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
#AgainCharacteristicOfSoftware = "xxxxx"
; .........
; .........
; .........
; .........
; .........
; .........
!SizeOfDataSection = 1000 ; <==== Here thanks to the code of Breeze4me i can choose the size of the datasection, :-)
#SizeOfDataSection = 1000 ; But here i'm forced to create the same line for have the value for PB :-(
; My goal is to find a way for using the value of !SizeOfDataSection in #SizeOfDataSection for have just one line,
; because have To line can create error If the !SizeOfDataSection is different of #SizeOfDataSection
Restore my_data
For i = 1 To #SizeOfDataSection ; <== After at several time, i need to have the value of the DATA, and here IMPOSSIBLE TO USE ASM CONSTANT
Read.c TheData ; it's the reason why, i need have the ASM value in a PbConstant
Debug TheData
x + 1
Next
Debug "Number of data = " + Str(x)
DataSection
my_data:
!repeat SizeOfDataSection ; <== But here impossible to use the PBConstant :-((
CompilerIf #PB_Compiler_Unicode
!dw '*'
CompilerElse
!db '*'
CompilerEndIf
!end repeat
EndDataSection
@FOZ
I have try your tips, but no chance...REPEAT is also a PB command
Furthermore i can't use EnableASM/DisableASM in dataSection
Code: Select all
EnableASM
Repeat #SizeOfDataSection ; <== But here impossible to use the PBConstant :-((
DisableASM
Re: Copy PbConstant value in variable ASM [Resolved]
Posted: Mon May 28, 2012 10:44 am
by Foz
I think I understand what is going on now. KCC - you are trying to fight the PureBasic compiler:
- PureBasic keeps track of, and allows use of the ASM keywords - the keywords of the CPU.
- Repeat, If, While are *not* ASM keywords - they are keywords of the FASM compiler to help people who code in FASM; this is where the conflicts are arising.
Now this is entirely conjecture on my part, as I am not privy to the working of PureBasic, but this is how I'm guessing the ASM in PureBasic works:
- Inline ASM either through the IDE checkbox, commandline or EnableASM/DisableASM goes through the PB Compiler, which transforms the code into ASM recognisable output. This allows variables, constants and such like to be used with instructions like MOV, ADD, etc, but is completely incompatible with the FASM directives.
- The special ! pushes that line *directly* to FASM as it is written - nothing is changed, except for (and accessed completely differently) pointers and variables. Due to that, the FASM directives are within your grasp.
Now as it stands KCC, the ! method for declaring FASM constants is the only way you can manage what you are doing, because it's the pre-processors that you are having to talk to here - not the compilers.
What I think is needed is a Feature Request to add constants to the ! syntax so you can have one common constant that can be used in PB and passed through to the assembler directives.
Re: Copy PbConstant value in variable ASM [Resolved]
Posted: Tue May 29, 2012 11:11 am
by Kwai chang caine
What I think is needed is a Feature Request to add constants to the ! syntax so you can have one common constant that can be used in PB and passed through to the assembler directives.
So if i good understand..it's not tomorrow i can do what i want

I'm very surprising, that FRED want to do this style of request for only KCC

Because apparently, i'm again the one to need this function, because i'm the first who ask this question
I think I understand what is going on now. KCC - you are trying to fight the PureBasic compiler
Fight !!!! 
No no no...i come in peace....
I want to fight nobody...even the compiler

For KCC....everybody is kind in PB world...and KCC never fight the kind persons
So thanks to have tried to help KCC with his always impossible request

Have a good day