viewing pb's asm output

Bare metal programming in PureBasic, for experienced users
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

viewing pb's asm output

Post by Tenaja »

How do you view pb's asm output so you can edit it, and then run it back through the assembler?

EDIT: Two different solutions for viewing the PureBasic assembly output code are given 5 posts down.
Last edited by Tenaja on Wed Nov 23, 2011 7:23 pm, edited 2 times in total.
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: viewing pb's asm output

Post by Shield »

Call the PB compiler manually using the /COMMENTED flag, modify the ASM file and call it again with the /REASM help.
There is a whole section in the help about this. :)

Although this feature seems cool it's not very useful because you'd have to change the ASM file every time...
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: viewing pb's asm output

Post by Tenaja »

Yup, you are right... unless you have a Tool that runs every time...

And thank you. I have found the Command Line Compiler page in the help file.
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: viewing pb's asm output

Post by Tenaja »

Is there no way to get the /COMMENTED asm file from within the IDE without creating a Tool?

Thanks again.
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: viewing pb's asm output

Post by luis »

I don't think so. At minimum you have to write a simple batch file or something like that.

You should find something searching on the forum.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: viewing pb's asm output

Post by Tenaja »

Got it. I will add it here, so it is in the Assembly forum. This is the source thread, showing both IDE and Batch File methods:
http://purebasic.fr/english/viewtopic.php?f=12&t=30864

I am using srod's with success. Trond's has a link to another.
srod wrote:just a simple tool which you may or may not find of some use. All it does is take the current source you have open in the PB IDE and generates the corresponding assembly code and loads it into notepad etc.

Compile to "commentedASM.exe" :

Code: Select all

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)+" /commented", dir$, #PB_Program_Hide|#PB_Program_Wait)
  dir$+"PureBasic.asm"
  If Compiler  And FileSize(dir$)>=0
    RunProgram("notepad.exe", dir$,"")
  Else
    MessageRequester("Error!", "There was an error creating the assembly code file.")
  EndIf
EndIf
Now add the commentedASM.exe tool to the IDE tools menu by selecting "Configure Tools".

(Make sure that you select the name of the commentedASM.exe (with full path) in the CommandLine option.
In the 'Arguments:' control enter "%TEMPFILE" with the quotes. Select the 'Run Hidden' checkbox.)

**EDIT : change the command RunProgram("notepad.exe", dir$,"") to simply RunProgram(dir$) if your system is set up to deal directly with .asm files etc.
Trond wrote:I won't say that I already made this (oups there I said it), because I'm not using it any more. Instead I use a bat file:

Code: Select all

@echo off
cd "c:\programfiler\purebasic 4\compilers"
pbcompiler %1 /COMMENTED
if errorlevel 1 goto wait
start PureBasic.asm
exit
:wait
pause
The advantage is that it pauses to show you the compilation error if any.
Post Reply