Label as argument for Procedure ???

Just starting out? Need help? Post your questions and find answers here.
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Label as argument for Procedure ???

Post by Ralf »

Is there any way, to parse a labeladress to a procedure like following "not working" example :?:

Code: Select all

; ---- Label as argument in Procedure? ----

Procedure LabelTest(?LabelAdress)
  Restore ?LabelAdress
  Read text.s
  Debug text.s
EndProcedure


LabelTest(?label2)
End


DataSection
  label1:
    Data.s "Text from Label 1"
  label2: 
    Data.s "Text from Label 2"
  label3: 
    Data.s "Text from Label 3"
EndDataSection
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

Code: Select all

; ---- Label as argument in Procedure? ---- 

Procedure LabelTest(LabelAdress.l)
! MOV    eax,[esp]
! MOV    dword [PB_DataPointer],eax
  Read text.s 
  Debug text.s 
EndProcedure 


LabelTest(?label2) 
End 


DataSection 
  label1: 
    Data.s "Text from Label 1" 
  label2: 
    Data.s "Text from Label 2" 
  label3: 
    Data.s "Text from Label 3" 
EndDataSection 
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

very cool jack! many thanks! *GREAT* :D

Your example with strings and modifing to read vals works fine! But in my example i get everytime "invalied memory adress" message... (does not work) - now i am trying to check where the problem is...

possible the labeladress is doublelong?
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

why does this doesnt work.. inline asm enabled..

Code: Select all

Procedure WhatsWrong(LabelAdress.l)
  
  ! MOV    eax,[esp]
  ! MOV    dword [PB_DataPointer],eax

  Read Value.w
  Debug Value.w
  
EndProcedure 


WhatsWrong(label1)


DataSection
label1:
  Data.w 4096                       ; anzahl 

EndDataSection
sec
Enthusiast
Enthusiast
Posts: 792
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

Post by sec »

you're missing ? , it would be WhatsWrong(?label1)
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

sec wrote:you're missing ? , it would be WhatsWrong(?label1)
oh my god :wink:
i havent noticed that while searching for the bug... thanks
Post Reply