'process flags:
%CREATE_NEW_CONSOLE 0x00000010
%CREATE_NO_WINDOW 0x08000000
'etc
'
function Exec(string c, int wait=0, flags=0) as int
===================================================
STARTUPINFO infs
PROCESS_INFORMATION infp
CreateProcess null,c,0,0,0,flags,0,0,@infs,@infp
if wait
WaitForMultipleObjects 1,@infp.hthread,1,-1
end if
GetExitCodeProcess(infp.hProcess,@function)
CloseHandle infp.hProcess
CloseHandle infp.hThread
return 0
end function
function QuExec(string c,d,f, int wait=0,flags=0) as int
========================================================
return Exec(qu+c+qu+" "+d+" "+qu+f+qu, wait,flags)
end function
function DOS(string s, int wait=0,flags=0)
==========================================
string c
if s then
c="cmd.exe /c "+s
else
c="cmd.exe"
end if
Exec c, wait,flags
end function
' multiplication of two values
'
Declare Function MessageBox Lib "user32.dll" alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
' 1) '- multiply go asm ------------------- //
'
byte val1
byte val2
int result ''resd 1
val1=4
val2=6 '
mov eax,val1
mov eax,val2 ''multiply eax by ebx "
mul val1 'ebx
mov result,eax
'print "the result of val1*val2 is " + str(result) '24
zstring tit[] = " PowerBASIC"
string msg[] = " hello my powerbasic friends " + str(result)
push 2 ' 0
addr eax,tit
push eax
addr eax,msg
push eax
addr eax,result
push 0
call MessageBox
mov eax, msg
' multiplication of two values
'
Declare Function MessageBox Lib "user32.dll" alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
zstring tit[] = " PowerBASIC"
zstring msg[] = " hello my powerbasic friends"
byte val1
byte val2
int result ''resd 1
val1=4
val2=6 '
' 1) '- multiply go asm ------------------- //
'
mov eax,val1
mov eax,val2 ''multiply eax by ebx "
mul val1 'ebx
mov result,eax
'- multiply go asm ------------------- //
'
' 2) how I can add the result of "mov result,eax" to the Call MessageBox ?
'------------ messagebox go ---------- //
'32bit asm
push 2 ' 0 '2
addr eax,tit
push eax
addr eax,msg
push eax
push 0
call MessageBox ' here should be the result of multiply mov result,eax
'------------ messagebox go ---------- //
print "the result of val1*val2 is " + str(result) '24
string cancellaPdf ="cmd.exe /c del "+pdf
if FileExists(pdf)=1 then exechide(cancellaPdf,1)
String riga=prodir + " -out pdf -ratio -resize 1200 -overwrite -c 5 -q "+qualita+" -o " +qu+pdf+qu+ " " +qu+f+qu
[font=Verdana, Arial, Helvetica, sans-serif]int valu=exechide(riga,1) [/font]
' Set the Watchdog to 20 Seconds
%SetWatchdog 20
' After using the Watchdog, switch it off
%ClrWatchdog
'-----------------------------------------------------------
' Dictate
'-----------------------------------------------------------
:But_Dictate
%SetWatchdog 20
GSB.HiColor
GSB.Dictate
GSB.LoButton
%ClrWatchdog
RET.
'-----------------------------------------------------------
' Dictate
'-----------------------------------------------------------
:But_Dictate
%SetWatchdog 2
GSB.HiColor
GSB.Dictate
GSB.LoButton
%ClrWatchdog
RET.
'**********************************************
' PRR./PRE./PRV. - Watchdog
' This script demonstrates a simple watchdog timer
' using the $$TIM variable to monitor the main script.
'
' Usage:
' - Set $$TIM to a non-zero value to start the watchdog.
' - The watchdog monitors the elapsed time.
' - If $$TIM is zero, the watchdog is off.
' - If the elapsed time exceeds $$TIM, an action is taken.
'**********************************************
:Watchdog_Start
MOD.New|Watchdog
' Variables Initialization
VAR.$$MWH=#cbw#
' Default State is off
VAR.$$TIM=0
'-----------------------------------------------------------
' Parallel Robot Routine
PRR.0
MOD.Enter|Watchdog
' Print robot information
'PRT.I am (Parallel-)Robot-Nr. #pri#.
'PRT.I am Son #pri# of $$MWH.
:Loop
PRT.Watchloop A
' Wait for timer value to be set
WFV.$$TIM|3
JIZ.$$TIM|off
' Record the start datetime
$$STA=#dtime#
' Main watchdog loop
:WatchdogLoop
PRT.Watchloop B: $$TIM
' Pause for a short period
PAU.1
' Calculate the elapsed time
CAL.$$CUT=(#dtime#-$$STA)
PRT.Test: $$CUT>$$TIM
' Check if the elapsed time exceeds the timer value
IVV.$$CUT>$$TIM
' Print the elapsed time and the timer value
PRT.Watchdog-Timeout: $$CUT>$$TIM
' Get and execute the command
GDF.hp|$$MWH|$$PID
CPR.$$PID
EIF.
' Check if the timer is reset to zero (watchdog off)
JIZ.$$TIM|off
' Repeat the watchdog loop
JMP.WatchdogLoop
' Off condition handling
:off
' Pause for 1 second
PAU.1
' Jump back to the beginning of the loop
JMP.Loop
END.
' Set return value for the main program
PRE.$$WDG|0
MOD.Copy to Last|$$WDG
'-----------------------------------------------------------
MOD.Return
RET.
: %SetWatchdog 1
MOD.Enter|Watchdog
VIN.$$TIM=§§§01
PRV.$$WDG|$$TIM
MOD.Return
END%
: %ClrWatchdog
MOD.Enter|Watchdog
VIN.$$TIM=0
PRV.$$WDG|$$TIM
MOD.Return
END%
Page created in 0.087 seconds with 11 queries.