PureBasic Forum
http://forums.purebasic.com/english/

RunProgram() exmaple in ASM Linux.
http://forums.purebasic.com/english/viewtopic.php?f=15&t=2770
Page 1 of 1

Author:  BackupUser [ Sat Dec 28, 2002 9:36 pm ]
Post subject: 

Restored from previous forum. Originally posted by pbdep.


Hi,

Because it seems PB v3.30 does have RunProgram defined but is
not executed you could workout with the following example I
mixed it in 2 minutes.. Im lazy :) but its usefull. If you want the
Arguments and Environment settings You have to point them out
to and Array and end with a Null-byte. Hope its usefull. Pbdep.


;------------------------------------------------------
; execute program
;------------------------------------------------------
; You can extent by passing Environment and Arguments
; for returned errors see also /errno.h
;------------------------------------------------------
Procedure NewRunProgram(fname$)

FILENAME.s = FNAME$+chr(0)
ENVP.s = chr(0)
ARGV.s = chr(0)
RESULT = 0

MOV EAX,11 ; execve
MOV EBX,FILENAME ; filename
MOV ECX,ARGV ; arguments
MOV EDX,ENVP ; environment
INT 0X80 ; syscall
MOV RESULT,EAX ; result, if errors

ProcedureReturn RESULT
EndProcedure

printn (str( NewRunprogram("./file") ))


;------------------------------------------------------

Author:  BackupUser [ Sat Dec 28, 2002 10:58 pm ]
Post subject: 

Restored from previous forum. Originally posted by fred.

FILENAME.s = FNAME$+chr(0)

just for your info, all string in pb are null terminated. Nice snippet anyway :).

Fred - AlphaSND

Author:  BackupUser [ Sat Dec 28, 2002 11:11 pm ]
Post subject: 

Restored from previous forum. Originally posted by pbdep.

Quote:
Originally posted by fred

FILENAME.s = FNAME$+chr(0)

just for your info, all string in pb are null terminated. Nice snippet anyway :).

Fred - AlphaSND



Heee i did not know that :wink: I thought only the ones
with PokeS ..

Thanks for the tip !

Norman.

Author:  BackupUser [ Sun Dec 29, 2002 7:23 am ]
Post subject: 

Restored from previous forum. Originally posted by boop64.

Thanks for the info pbdep ^_^!
I knew it could be done it's just I didn't know how to do it in asm.


Boop64

Author:  BackupUser [ Sun Dec 29, 2002 8:09 am ]
Post subject: 

Restored from previous forum. Originally posted by Rings.

Let the good old times roll...

i see heavy INT Calls next time.....

i just should read some api- and system decriptions..


Its a long way to the top if you wanna .....CodeGuru

Author:  BackupUser [ Sun Dec 29, 2002 7:26 pm ]
Post subject: 

Restored from previous forum. Originally posted by Danilo.

Rings:
http://www.int80h.org/
http://www.int80h.org/bsdasm/
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
http://www.janw.easynet.be/eng.html
http://www.linuxassembly.org/
http://linuxassembly.org/linasm.html
http://www.lxhp.in-berlin.de/lhpf8.html
http://www.winehq.com/

cya,
...Danilo

(registered PureBasic user)

Author:  BackupUser [ Mon Dec 30, 2002 9:07 pm ]
Post subject: 

Restored from previous forum. Originally posted by pbdep.


Woow I can tell you, I did a lot of programming on the 6502 and 8086
in my early IceAges :wink: for some years, but It took me 3 hours to understand how linux handels Assembly, coding the NewRunprogram() was
done in 2 minutes but befor I had the clue on linux :wink: hahaha..
Thats the trouble with those higher languages dies day, you dont have
to bother anymore about whats beneath it...
Well i learned form reading my Eyesout the last few days that the
32/64-bits are pritty changed compared to the 16 bits I used to do in
Asm coding... okay the basic are the same but i cant find my way in
the registers anymore :wink:...

For those who are intrested in more Mind failuers :wink: Have a look
at -> http://www.muppetlabs.com/~breadbox/bf/

That for sure will turn you upsidedown :wink:

Funny world... And the above all happens in 15 years :wink:

Have a nice day...

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