ASM Output

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
DoubleDutch
Addict
Addict
Posts: 3179
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

ASM Output

Post by DoubleDutch »

It would be useful to have an option in the IDE of generate the ASM file (rather tha having to go to DOS and run the compiler directly with the option).
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Derek
Addict
Addict
Posts: 2357
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

2nd. Good idea.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

I agree.
The IDE could load the generated ASM file into a new tab.

Best regards

Wolf
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Here's a tool which you can add to the PB IDE. (Windows only!)

Compile to "commentedASM.exe" :

Code: Select all

file$=ProgramParameter(0)
dir$ = GetPathPart(file$)

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)
  If Compiler  
    dir$+"PureBasic.asm"
    RunProgram("notepad.exe", dir$,"")
  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.
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3179
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Vey nice, does the Job - It would be good to have it built-in though. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Franky
Enthusiast
Enthusiast
Posts: 213
Joined: Sat Apr 26, 2003 2:58 pm

Post by Franky »

I agree. Good Idea :)
Give Up everything but trying!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

+1
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

+1
Good programmers don't comment their code. It was hard to write, should be hard to read.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Agree
Dare2 cut down to size
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

+1
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

+1 *thumbs up!*
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Psychophanta
Addict
Addict
Posts: 4672
Joined: Wed Jun 11, 2003 9:33 pm
Location: Spa, relaxing and thinking, and learning...
Contact:

Post by Psychophanta »

1up
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
hellhound66
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Feb 21, 2006 12:37 pm

Post by hellhound66 »

Removed.
Last edited by hellhound66 on Wed Mar 19, 2008 11:33 pm, edited 1 time in total.
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Better commentedASM

Post by Peyman »

Better commentedASM I use Scintilla.
Compile to "commentedASM.exe" :

Code: Select all

;******************************************************
;   Program:          CommenntedASM
;   Author:           Peyman
;   Date:             February 23, 2008
;   Target OS:        Windows All
;   Target Compiler:  PureBasic 4.0 +
;   License:          Freeware
;
;******************************************************


file$=ProgramParameter(0)
dir$ = GetPathPart(file$)

 ;{ Enumeration
Enumeration
#Window    = 0
#Scintilla = 1
#MinWidth  = 400
#MinHeight = 300
#MaxWidth  = 800
#MaxHeight = 600
EndEnumeration
;}

 ;{ KeyWord
Keyword.s = "aaa aad aam aas adc add and call cbw clc cld cli cmc cmp cmps cmpsb cmpsw cwd daa das dec div esc hlt idiv imul in inc int into iret ja jae jb jbe jc jcxz je jg jge jl jle jmp jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns jnz jo jp jpe jpo js jz lahf lds lea les lods lodsb lodsw loop loope loopew loopne loopnew loopnz loopnzw loopw loopz loopzw mov movs movsb movsw mul neg nop not or out pop popf push pushf rcl rcr ret retf retn rol ror sahf sal sar sbb scas scasb scasw shl shr stc std sti stos stosb stosw sub test wait xchg xlat xlatb xor bound enter ins insb insw leave outs outsb outsw popa pusha pushw arpl lar lsl sgdt sidt sldt smsw str verr verw clts lgdt lidt lldt lmsw ltr bsf bsr bt btc btr bts cdq cmpsd cwde insd iretd iretdf  iretf jecxz lfs lgs lodsd loopd  looped  loopned  loopnzd  loopzd  lss movsd movsx movzx outsd popad popfd pushad pushd  pushfd scasd seta setae setb setbe setc sete setg setge setl setle setna setnae setnb setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets setz shld shrd stosd bswap cmpxchg invd  invlpg  wbinvd  xadd lock rep repe repne repnz repz cflush cpuid emms femms cmovo cmovno cmovb cmovc cmovnae cmovae cmovnb cmovnc cmove cmovz cmovne cmovnz cmovbe cmovna cmova cmovnbe cmovs cmovns cmovp cmovpe cmovnp cmovpo cmovl cmovnge cmovge cmovnl cmovle cmovng cmovg cmovnle cmpxchg486 cmpxchg8b  loadall loadall286 ibts icebp int1 int3 int01 int03 iretw popaw popfw pushaw pushfw rdmsr rdpmc rdshr rdtsc rsdc rsldt rsm rsts salc smi smint smintold svdc svldt svts syscall sysenter sysexit sysret ud0 ud1 ud2 umov xbts wrmsr wrshr"
Keyword2.s = "f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcom fcomp fcompp fdecstp fdisi fdiv fdivp fdivr fdivrp feni ffree fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub fisubr fld fld1 fldcw fldenv fldenvw fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnsavew fnstcw fnstenv fnstenvw fnstsw fpatan fprem fptan frndint frstor frstorw fsave fsavew fscale fsqrt fst fstcw fstenv fstenvw fstp fstsw fsub fsubp fsubr fsubrp ftst fwait fxam fxch fxtract fyl2x fyl2xp1 fsetpm fcos fldenvd fnsaved fnstenvd fprem1 frstord fsaved fsin fsincos fstenvd fucom fucomp fucompp fcomi fcomip ffreep fcmovb fcmove fcmovbe fcmovu fcmovnb fcmovne fcmovnbe fcmovnu"
Keyword3.s = "ah al ax bh bl bp bx ch cl cr0 cr2 cr3 cr4 cs cx dh di dl dr0 dr1 dr2 dr3 dr6 dr7 ds dx eax ebp ebx ecx edi edx es esi esp fs gs si sp ss st tr3 tr4 tr5 tr6 tr7 st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7"
Keyword4.s = ".186 .286 .286c .286p .287 .386 .386c .386p .387 .486 .486p .8086 .8087 .alpha .break .code .const .continue .cref .data .data?  .dosseg .else .elseif .endif .endw .err .err1 .err2 .errb .errdef .errdif .errdifi .erre .erridn .erridni .errnb .errndef .errnz .exit .fardata .fardata? .if .lall .lfcond .list .listall .listif .listmacro .listmacroall  .model .no87 .nocref .nolist .nolistif .nolistmacro .radix .repeat .sall .seq .sfcond .stack .startup .tfcond .type .until .untilcxz .while .xall .xcref .xlist alias align assume catstr comm comment db dd df dosseg dq dt dup dw echo else elseif elseif1 elseif2 elseifb elseifdef elseifdif elseifdifi elseife elseifidn elseifidni elseifnb elseifndef end endif endm endp ends eq equ even exitm extern externdef extrn for forc ge goto group gt high highword if if1 if2 ifb ifdef ifdif ifdifi ife  ifidn ifidni ifnb ifndef include includelib instr invoke irp irpc label le length lengthof local low lowword lroffset lt macro mask mod .msfloat name ne offset opattr option org %out page popcontext proc proto ptr public purge pushcontext record repeat rept seg segment short size sizeof sizestr struc struct substr subtitle subttl textequ this title type typedef union while width db dw dd dq dt resb resw resd resq rest incbin equ times %define %idefine %xdefine %xidefine %undef %assign %iassign %strlen %substr %macro %imacro %endmacro %rotate .nolist %if %elif %else %endif %ifdef %ifndef %elifdef %elifndef %ifmacro %ifnmacro %elifmacro %elifnmacro %ifctk %ifnctk %elifctk %elifnctk %ifidn %ifnidn %elifidn %elifnidn %ifidni %ifnidni %elifidni %elifnidni %ifid %ifnid %elifid %elifnid %ifstr %ifnstr %elifstr %elifnstr %ifnum %ifnnum %elifnum %elifnnum %error %rep %endrep %exitrep %include %push %pop %repl struct endstruc istruc at iend align alignb %arg %stacksize %local %line bits use16 use32 section absolute extern global common cpu org section group import export"
Keyword5.s = "$ ? @b @f addr basic byte c carry? dword far far16 fortran fword near near16 overflow? parity? pascal qword  real4  real8 real10 sbyte sdword sign? stdcall sword syscall tbyte vararg word zero? flat near32 far32 abs all assumes at casemap common compact cpu dotname emulator epilogue error export expr16 expr32 farstack flat forceframe huge language large listing ljmp loadds m510 medium memory nearstack nodotname noemulator nokeyword noljmp nom510 none nonunique nooldmacros nooldstructs noreadonly noscoped nosignextend nothing notpublic oldmacros oldstructs os_dos para private prologue radix readonly req scoped setif2 smallstack tiny use16 use32 uses a16 a32 o16 o32 byte word dword nosplit $ $$ seq wrt flat large small .text .data .bss near far %0 %1 %2 %3 %4 %5 %6 %7 %8 %9"
Keyword6.s = "addpd addps addsd addss andpd andps andnpd andnps cmpeqpd cmpltpd cmplepd cmpunordpd cmpnepd cmpnltpd cmpnlepd cmpordpd cmpeqps cmpltps cmpleps cmpunordps cmpneps cmpnltps cmpnleps cmpordps cmpeqsd cmpltsd cmplesd cmpunordsd cmpnesd cmpnltsd cmpnlesd cmpordsd cmpeqss cmpltss cmpless cmpunordss cmpness cmpnltss cmpnless cmpordss comisd comiss cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi cvtss2sd cvtss2si cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi cvttsd2si cvttss2si divpd divps divsd divss fxrstor fxsave ldmxscr lfence mfence maskmovdqu maskmovdq maxpd maxps paxsd maxss minpd minps minsd minss movapd movaps movdq2q movdqa movdqu movhlps movhpd movhps movd movq movlhps movlpd movlps movmskpd movmskps movntdq movnti movntpd movntps movntq movq2dq movsd movss movupd movups mulpd mulps mulsd mulss orpd orps packssdw packsswb packuswb paddb paddsb paddw paddsw paddd paddsiw paddq paddusb paddusw pand pandn pause paveb pavgb pavgw pavgusb pdistib pextrw pcmpeqb pcmpeqw pcmpeqd pcmpgtb pcmpgtw pcmpgtd pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pmachriw pmaddwd pmagw pmaxsw pmaxub pminsw pminub pmovmskb pmulhrwc pmulhriw pmulhrwa pmulhuw pmulhw pmullw pmuludq pmvzb pmvnzb pmvlzb pmvgezb pfnacc pfpnacc por prefetch prefetchw prefetchnta prefetcht0 prefetcht1 prefetcht2 pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pf2iw pinsrw psadbw pshufd pshufhw pshuflw pshufw psllw pslld psllq pslldq psraw psrad psrlw psrld psrlq psrldq psubb psubw psubd psubq psubsb psubsw psubusb psubusw psubsiw pswapd punpckhbw punpckhwd punpckhdq punpckhqdq punpcklbw punpcklwd punpckldq punpcklqdq pxor rcpps rcpss rsqrtps rsqrtss sfence shufpd shufps sqrtpd sqrtps sqrtsd sqrtss stmxcsr subpd subps subsd subss ucomisd ucomiss unpckhpd unpckhps unpcklpd unpcklps xorpd xorps"
;}

Procedure.l Scintilla(hsci.l, p1.l, p2.l=0, p3.l=0)
  ProcedureReturn ScintillaSendMessage(hsci,p1,p2,p3)
EndProcedure

ProcedureDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)
  If *scinotify\nmhdr\code = #SCN_MODIFIED

       LenghofLines =  Len(StrU(Scintilla(#Scintilla, #SCI_GETLINECOUNT), #Long))
   
       Scintilla(#Scintilla, #SCI_SETMARGINWIDTHN, 0, 37+(LenghofLines-3)*10)
 
 
  EndIf

 
EndProcedure

Procedure WindowCallback(WindowID, Message, wParam, lParam)
  ReturnValue = #PB_ProcessPureBasicEvents
 
    If Message = #WM_MOVE
   
   
    ElseIf Message = #WM_GETMINMAXINFO
   
        *pMinMax.MINMAXINFO = lParam
        *pMinMax\ptMinTrackSize\x=#MinWidth
        *pMinMax\ptMinTrackSize\y=#MinHeight
        *pMinMax\ptMaxTrackSize\x=#MaxWidth
        *pMinMax\ptMaxTrackSize\y=#MaxHeight
        ReturnValue = 0


    ElseIf Message = #WM_SIZE

       
        ResizeGadget(#Scintilla,0,0,WindowWidth(#Window),WindowHeight(#Window))
   
    EndIf
       
   
    ProcedureReturn  ReturnValue

EndProcedure

Procedure LoadFile(filename.s)
    If filename <> ""
        file.l = ReadFile(#PB_Any, filename)
        If file <> 0
            len.l = Lof(file)
            *mem = AllocateMemory(len)
            If *mem
                ReadData(file, *mem, len)
                Scintilla(#Scintilla, #SCI_SETTEXT, 0, *mem)
                FreeMemory(*mem)
            EndIf
            CloseFile(file)
        EndIf
       
      LenghofLines =  Len(StrU(Scintilla(#Scintilla, #SCI_GETLINECOUNT), #Long))
   
      Scintilla(#Scintilla, #SCI_SETMARGINWIDTHN, 0, 37+(LenghofLines-3)*10)
     
    EndIf
EndProcedure

OpenWindow(#Window, 130, 50, 655, 445, "CommenntedASM By Peyman", #PB_Window_SizeGadget|#PB_Window_SystemMenu)

SetWindowCallback(@WindowCallback())

CreateGadgetList(WindowID(#Window))

InitScintillaStaticFull()

GetClientRect_(WindowID(#Window), rect.RECT)

ScintillaGadget(#Scintilla, 0, 0, rect\right, rect\bottom, @ScintillaCallBack())



; Delete Tab Key For Tab in Scintilla
RemoveKeyboardShortcut(#Window, #PB_Shortcut_Tab)
RemoveKeyboardShortcut(#Window, #PB_Shortcut_Tab | #PB_Shortcut_Shift)

; Other
Scintilla(#Scintilla, #SCI_SETINDENT, 2)


; Font And Size
Scintilla(#Scintilla, #SCI_STYLESETFONT, #STYLE_DEFAULT, @"Courier New")
Scintilla(#Scintilla, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 10)
Scintilla(#Scintilla, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER)
Scintilla(#Scintilla, #SCI_SETMARGINWIDTHN, 0, 50)
Scintilla(#Scintilla, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER)
Scintilla(#Scintilla, #SCI_SETMARGINMASKN, 2, #SC_MASK_FOLDERS)
Scintilla(#Scintilla, #SCI_SETMARGINWIDTHN, 0, 37)
Scintilla(#Scintilla, #SCI_SETMARGINWIDTHN, 1, 1)
Scintilla(#Scintilla, #SCI_SETMARGINWIDTHN, 2, 18)
Scintilla(#Scintilla, #SCI_SETMARGINSENSITIVEN, 2, #True)

; Choose folding icons
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDEROPEN, #SC_MARK_BOXMINUS)
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDER, #SC_MARK_BOXPLUS)
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDERSUB, #SC_MARK_VLINE)
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDERTAIL, #SC_MARK_LCORNER)
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDEREND, #SC_MARK_BOXPLUSCONNECTED)
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDEROPENMID, #SC_MARK_BOXMINUSCONNECTED)
Scintilla(#Scintilla, #SCI_MARKERDEFINE, #SC_MARKNUM_FOLDERMIDTAIL, #SC_MARK_TCORNER)


; Choose folding icon colours
Scintilla(#Scintilla, #SCI_MARKERSETFORE, #SC_MARKNUM_FOLDEROPEN, RGB(236, 233, 216))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDEROPEN, RGB(128, 128, 128))
Scintilla(#Scintilla, #SCI_MARKERSETFORE, #SC_MARKNUM_FOLDER, RGB(236, 233, 216))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDER, RGB(128, 128, 128))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDERSUB, RGB(128, 128, 128))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDERTAIL, RGB(128, 128, 128))
Scintilla(#Scintilla, #SCI_MARKERSETFORE, #SC_MARKNUM_FOLDEREND, RGB(236, 233, 216))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDEREND, RGB(128, 128, 128))
Scintilla(#Scintilla, #SCI_MARKERSETFORE, #SC_MARKNUM_FOLDEROPENMID, RGB(236, 233, 216))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDEROPENMID, RGB(128, 128, 128))
Scintilla(#Scintilla, #SCI_MARKERSETBACK, #SC_MARKNUM_FOLDERMIDTAIL, RGB(128, 128, 128))

;lex setup
Scintilla(#Scintilla, #SCI_SETLEXER, #SCLEX_ASM, 0)
Scintilla(#Scintilla, #SCI_SETSTYLEBITS, 5, 0)
Scintilla(#Scintilla,#SCI_STYLESETFORE, #STYLE_DEFAULT, RGB(0,0,0));
Scintilla(#Scintilla,#SCI_STYLESETBACK, #STYLE_DEFAULT, RGB(255,255,255));
Scintilla(#Scintilla,#SCI_STYLECLEARALL);

; Set caret line colour
Scintilla(#Scintilla, #SCI_SETCARETLINEBACK, 16771304)
Scintilla(#Scintilla, #SCI_SETCARETLINEVISIBLE, #True)



; Set styles for custom lexer
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_DEFAULT, 0)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_COMMENT, 32768)
Scintilla(#Scintilla, #SCI_STYLESETFONT, #SCE_ASM_COMMENT, @"Comic Sans MS")
Scintilla(#Scintilla, #SCI_STYLESETSIZE, #SCE_ASM_COMMENT, 8)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_NUMBER, 33023)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_STRING, 8421504)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_OPERATOR, 8388608)
Scintilla(#Scintilla, #SCI_STYLESETBOLD, #SCE_ASM_OPERATOR, #True)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_IDENTIFIER, 0)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_CPUINSTRUCTION, 16711680)
Scintilla(#Scintilla, #SCI_STYLESETBOLD, #SCE_ASM_CPUINSTRUCTION, #True)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_MATHINSTRUCTION, 12615680)
Scintilla(#Scintilla, #SCI_STYLESETBOLD, #SCE_ASM_MATHINSTRUCTION, #True)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_REGISTER, 16744576)
Scintilla(#Scintilla, #SCI_STYLESETBACK, #SCE_ASM_REGISTER, 13434879)
Scintilla(#Scintilla, #SCI_STYLESETBOLD, #SCE_ASM_REGISTER, #True)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_DIRECTIVE, 16744448)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_DIRECTIVEOPERAND, 8388608)
Scintilla(#Scintilla, #SCI_STYLESETBOLD, #SCE_ASM_DIRECTIVEOPERAND, #True)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_COMMENTBLOCK, 32768)
Scintilla(#Scintilla, #SCI_STYLESETFONT, #SCE_ASM_COMMENTBLOCK, @"Comic Sans MS")
Scintilla(#Scintilla, #SCI_STYLESETSIZE, #SCE_ASM_COMMENTBLOCK, 8)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_CHARACTER, 32896)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_STRINGEOL, 8421504)
Scintilla(#Scintilla, #SCI_STYLESETFORE, #SCE_ASM_EXTINSTRUCTION, 16512)
Scintilla(#Scintilla, #SCI_STYLESETBOLD, #SCE_ASM_EXTINSTRUCTION, #True)


; Color Of Selection
Scintilla(#Scintilla, #SCI_SETSELBACK, #True, RGB(49, 106, 197))
Scintilla(#Scintilla, #SCI_SETSELFORE, #True, RGB(255, 255, 255))


; Code Wraper
;Scintilla(#Scintilla, #SCI_SETWRAPMODE, #SC_WRAP_WORD, 0)
;Scintilla(#Scintilla, #SCI_SETWRAPVISUALFLAGS, #SC_WRAPVISUALFLAG_START | #SC_WRAPVISUALFLAG_END, 0)


; Keyword
Scintilla(#Scintilla, #SCI_SETKEYWORDS, 0, @Keyword)  ; Set KeyWord 1
Scintilla(#Scintilla, #SCI_SETKEYWORDS, 1, @Keyword2) ; Set KeyWord 2
Scintilla(#Scintilla, #SCI_SETKEYWORDS, 2, @Keyword3) ; Set KeyWord 3
Scintilla(#Scintilla, #SCI_SETKEYWORDS, 3, @Keyword4) ; Set KeyWord 4
Scintilla(#Scintilla, #SCI_SETKEYWORDS, 4, @Keyword5) ; Set KeyWord 5
Scintilla(#Scintilla, #SCI_SETKEYWORDS, 5, @Keyword6) ; Set KeyWord 6


SetFocus_(GadgetID(#Scintilla))


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)
  If Compiler
    dir$+"PureBasic.asm"
    LoadFile(dir$)
  EndIf
EndIf


Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow 
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 'Wait until tool quits' checkbox.)

NOtice : I use Gonzal Lib (ScintillaStatic) Download It then Compile This.

Enjoy It. 8)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Better commentedASM

Post by PB »

I've been using this successfully for months. Not originally my code, but
I shortened it to the following form. Just select it from the Tools menu
when a source is present and voila! :)

Code: Select all

; Compile to an executable and add to the PureBasic 'Tools' Menu.
; Set 'Arguments' in the 'Tools' menu to "%TEMPFILE" (include the ").

pb$=#PB_Compiler_Home
RunProgram(pb$+"Compilers\PBCompiler.exe",Chr(34)+ProgramParameter()+Chr(34)+" /COMMENTED",pb$+"Compilers\",1|2)
RunProgram("Notepad.exe",Chr(34)+pb$+"Compilers\PureBasic.asm"+Chr(34),pb$)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply