It is currently Thu Sep 19, 2019 5:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How can I use a constant in assembler?
PostPosted: Sun Jul 07, 2019 2:31 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 451
How can I use the content #myValue instead of the value 8 in this example?

Code:
#myValue = 8

!add edx, 8


Top
 Profile  
Reply with quote  
 Post subject: Re: How can I use a constant in assembler?
PostPosted: Sun Jul 07, 2019 2:51 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1905
Location: Germany
Constants are replaced at compile time from pb-code to asm-code.
Thus these constants are not stored as named constants in the asm-code.

Update with asm constants
Code:
#myValue = 8

Procedure foo()
  EnableASM
  XOr rax,rax
  add rax, #myValue
  ProcedureReturn
  DisableASM
EndProcedure

! myValue equ 16

Procedure foo2()
  !xor rax,rax
  !add rax, myValue
  ProcedureReturn
EndProcedure

Debug foo()
Debug foo2()

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye