Page 1 of 1

Commented ASM

Posted: Wed Jul 04, 2018 10:16 am
by wilbert
How can I make this work on MacOS ?
I know I've used it in the past, when the compiler etc. were not yet moved inside the PureBasic app but now everything is inside the PureBasic app I can't seem to get it working. :?

Re: Commented ASM

Posted: Thu Jul 05, 2018 10:31 pm
by Shardik
The following is working for me on MacOS 10.13.4 'High Sierra' with PB 5.62 x64. I have taken srod's original example code and modified it for MacOS:

Code: Select all

; http://www.purebasic.fr/english/viewtopic.php?f=12&t=30864&start=0
; srod

; Modifications for MacOS by Shardik:
; -----------------------------------
; - Backslashes changed to slashes
; - " /commented" changed to " -c"
; - "\Compilers\pbcompiler" changed to "Compilers/pbcompiler"  
; - RunProgram("notepad.exe, dir$,"") changed to RunProgram("Open", dir$, "")

file$=ProgramParameter(0)
dir$ = GetPathPart(file$)
DeleteFile(dir$+"PureBasic.asm")

If file$ And FileSize(file$)>0
  Compiler = RunProgram(#PB_Compiler_Home+"Compilers/pbcompiler",
    Chr(34) + file$ + Chr(34) + " -c", dir$,
    #PB_Program_Hide | #PB_Program_Wait)
  dir$+"PureBasic.asm"
  If Compiler And FileSize(dir$)>=0
    RunProgram("Open", dir$, "")
  Else
    MessageRequester("Error!",
      "There was an error creating the assembly code file.")
  EndIf
EndIf
- I compiled it to /Volumes/DATEN/Displayx64AsmCode.app
- I opened Tools > Configure Tools... and filled in the form as in the following image. Unfortunately the shown path is truncated in the Edit Tool Settings and is the following in full length:
/Volumes/DATEN/Displayx64AsmCode.app/Contents/MacOS/Displayx64AsmCode

Image

- Afterwards the new tool entry looked like this:

Image

- It may further be necessary to assign an editor like TextEdit to purebasic.asm so that purebasic.asm is automatically opened in TextEdit!

Re: Commented ASM

Posted: Thu Jul 05, 2018 10:39 pm
by mk-soft
Command line:
/{path to purebasic}/PureBasic.app/Contents/Resources/compilers/pbcompiler
Arguments:
-c "%FILE"
Arguments (thread safe):
-c -t "%FILE"
Arguments DyLib:
-c -dl "%file"
Arguments Dylib (thread safe):
-c -t -dl "%file"
Tip
The compiler don't like space character into the path to PureBasic.app for create DyLib´s

Re: Commented ASM

Posted: Fri Jul 06, 2018 4:49 am
by wilbert
Thanks a lot Shardik and mk-soft.
Both solutions are working fine :)