2010-01-11

(mis)use of Programmers Notepad (PN2) as BASCOM IDE (Part 2: Tools)

(This post was updated on 23. august 09, dismiss anything older!!)

As I wrote in part 1 this part is a little tricky because BASCOMP.EXE was made by deep thought :)

First of yll you need the following batch scipt, download it here: dowload it from here.
You can put it to the bascom installation folder (recommended) or to any other folder you like.

Now you must decide if you want to define an environment variable called BASCOM_HOME or not. If you do so, my batchfile only needs one parameter: the basic source file.


If you do not define it, you must supply the complete path (with filename) of BASCOMP.EXE as first parameter and the source file as second parameter.

Next open PN2 (which already should do proper syntax coloring :) ) and open the menu "TOOLS/OPTIONS".

First I show you the tool setup if you have defined BASCOM_HOME:
Select the "Bascom Basic" scheme, click "Add", and fill the tool properties - don't do a typo, look careful, the double quotes are important!
You may decide to define a shortcut too, e.g. F7 or whatever.

Before hitting OK switch to console I/O tab, select "look for custom pattern" and enter file : %f : %l in the box (there are single spaces between the dots and args), exaclty like this:

Now the tool definition without the environment variable. Browse to the pn2compile.cmd to fill the command, copy the full patch of bascomp.exe including filename and enclosed in double quotes to the parameter field, append a space, and then enter "%d%f" (again with double quotes). The console I/O settings are identical.


Now give it a try: load one of your bascom sources, click "TOOLS/COMPILE" and see what happens. On my system it looks like this (of course our focus is the output portion below the source code. If there is nothing hit F8 or use menu "View/Output" to switch it on):


On my system the error parsing works fine, if there are errors, clicking on them in the output (even if it was not opened before. I argue that it nredirects PN2 to open the file and jump to the proper lineevertheless needs to be part of the project).

That said, I'd like you to test and comment this, and maybe improve it and share it back with me. Look forwar to the next part :)

2009-08-21

(mis)use of Programmers Notepad (PN2) as BASCOM IDE (Part 1: Scheme)

After some years now time came to do a bigger project with Bascom. It was required to split the source into multiple files, which is in general not a big problem (but a smaller one! those issues of using a c-style scheme of programming with a header file for each code file may be discussed on another article).
As you might know the Bascom IDE is not that comfortable if you have more files to handle as there is space on the tab bar. Therefore I gave PN2 a testdrive as I know it's quite capable of handling multiple files and also has some support for project management.

Some investigation of how PN2 does syntax colouring showed: a scheme file needs to be written.

The originally supplied scheme for vbscript was my inspiration as it nearly fitted for my purposes.

After pasting in all the bascom keywords and changing styles and colors (I like much colour ;) the result was close to my wish.

Still a little problem remains with some directives (see the difference with $regfile and $crystal) but apart from that I started working with it and had fun :)

The remaining issues of syntax coloring can only be resolved by writing a specific lexer but I feel that is not really needed as the misused vb-lexer works well enough.


You can download my scheme file - feel free to use and edit it. Simply put it into the scheme folder below your PN2 installation folder.

If you got something forward please share it and or leave a comment.

This was the first step of misusing PN2 for Bascom purposes. Hope it may be of use for somebody.

There is a second and maybe third part to come about "integrating the bascom compiler" and ""integrate the programmers to PN2". The second story turned out to be more complex as it should be because the bascom command line compiler is somehow tricky and dumb ... (some motivation needed to make it round) ;)