Author Topic: How do I begin coding in BCX Basic?  (Read 4407 times)

djsb

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
How do I begin coding in BCX Basic?
« on: May 30, 2020, 02:15:43 AM »
Hi,
I have used BCX in the past and I'm pleased that it appears to have been resurrected. However, I use BCX Devsuite which is no longer available in an up to date version. So I have a few questions.
1/ Can I use an old version of BCX Devsuite if I update it myself with a recent version of Pelles C and the BCX executable? How do I do this?
2/ Assuming that have the latest version of BCX in C:\BCX and PellesC in C:\Program Files\PellesC\Bin and that this directory has been added to my PATH how do I create both Console and GUI executables in 32 and 64 bit versions using a batch file in Windows 10? I usually use Notepad ++ as my preferred editor but I'm willing to use another editor if this will work well with BCX and it's batch files or command line operations.
3/ Where can I find a zipped up archive of all the demo/example files (both GUI and console based) for BCX Basic. I have had a look around and can't find anything all in one place. I'm willing to try a few of the old examples if there is a need to test them out.
I hope that you can answer my beginners questions. Thanks.
« Last Edit: May 30, 2020, 02:22:36 AM by djsb »

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #1 on: May 30, 2020, 09:12:27 AM »
Hi David and welcome back!

I've never been a user of DevSuite but I seem to recall that the packager of that toolset (Ryan Putzai) integrated a 32-bit version of Pelles C in it.  That might cause you some problems because Pelles C (version 9) is now a 64-bit compiler that can generate 32-bit and 64-bit executables.

I would try installing DevSuite first, if you haven't already done so, then examine where the Pelles C folder is placed.  Next, delete that Pelles C folder and install the new version of Pelles C in that same path location.  If you try to simply overwrite the existing Pelles' files instead of deleting the old version of Pelles, you will likely create problems for yourself.

Updating the BCX translator in Devsuite should be a matter of replacing the version of the BCX executable that came bundled in DevSuite with the latest version of BCX (7.4.6) which can be downloaded here:

https://bcxbasiccoders.com/archives/YahooGroups/Bcx_Files_New/

You might also want to update the BCX Help file that comes with DevSuite with a newer version:

https://bcxbasiccoders.com/smf/index.php?topic=162.0

The full BCX install with all the console, gui, and dll demos and other tools is available here:

https://bcxbasiccoders.com/bcx_install.zip

If you install that, I suggest you keep its installation folder separate from DevSuite.  That will
make it easier and less confusing to copy or move select files from the BCX installation folder
to the DevSuite folder, should you need to do so.

We're a small bunch of dinosaurs here and it's not always easy to tell if anyone is paying attention
but someone will almost certainly chime in to help.   

We'll do our best to help you get up and running again.

Best Regards,
Kevin Diggins
-MrBcx-

djsb

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #2 on: May 30, 2020, 10:27:59 AM »
Thanks, Kevin,
I'll give what you suggest a try.
If I wanted to try BCX without BCX Devsuite are there any sample batch files or commands that I can invoke from an IDE such as Notepad++ or simply the command prompt of Windows 10 (I'm using 64 bit version of Windows 10). PellesC does respond with a list of command switches when I enter POCC at the prompt so that a start. I'll do a search of the forum anyway and see what I can find. Thanks for your help so far.

David.

djsb

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #3 on: May 30, 2020, 10:44:13 AM »
Hi,
I've just installed BCX now, so I should have enough to get me started. I'll start with the JFE editor as I'm familiar with it from before. I'll pop back here if I have any problems. Thanks.

David.

djsb

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #4 on: May 30, 2020, 11:24:08 AM »
I've just had a look at JFE editor and if I remember correctly there used to be macro buttons that allowed for the converting of the basic file to C and then the invoking of PelesC. I would much prefer to use Notepad ++ instead of JFE as Notepad ++ is updated regularly.

https://notepad-plus-plus.org/downloads/

It has a plugin called NppExec which can be set up to send command line arguments to a command prompt.

I'm willing to give Notepad++ a try with Bcx if I can get some help with the command syntax required to just get Bcx working with PellesC at a command prompt WITHOUT NPP++ to start with. Thanks.

David.





MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #6 on: May 30, 2020, 01:06:41 PM »
 David,

Attached are the batch files I use for compiling console, gui, and dll files with Pelles C.

I'm including a resource file that I use to improve visual appearance without a lot of fuss. 
It is optional and can be removed from the batch files, if you find it not to your liking.

PC32 and PC64 are for compiling console mode apps
PW32 and PW64 are for compiling GUI apps
PD32 and PD64 are for compiling DLL files

You will most likely need to tweak paths to fit your setup but that should be pretty easy.


djsb

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #7 on: May 30, 2020, 01:20:04 PM »
Thanks, Kevin

If I get BCX and PellesC to work OK with Notepad++ I'll post what I've got working here. I've also read through this post

https://bcxbasiccoders.com/smf/index.php?topic=160.0

And I've also downloaded MainBatch.bat and CM.BAS so I can learn a bit more.
Thanks for your help.

David.

Robert

  • Hero Member
  • *****
  • Posts: 1142
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #8 on: May 30, 2020, 03:09:19 PM »
David,

Attached are the batch files I use for compiling console, gui, and dll files with Pelles C.

I'm including a resource file that I use to improve visual appearance without a lot of fuss. 
It is optional and can be removed from the batch files, if you find it not to your liking.

PC32 and PC64 are for compiling console mode apps
PW32 and PW64 are for compiling GUI apps
PD32 and PD64 are for compiling DLL files

You will most likely need to tweak paths to fit your setup but that should be pretty easy.

MrBCX:

Here, for your perusal,  is your PC64.bat modified to extract the Pelles C root folder location from the registry. Note that the hardwired "c:\pellesc" calls that were in PC64.bat have been changed to use %PellesCDir%

Code: [Select]
:******************************************
:This batch file was edited by Kevin Diggins 2020/05/30 18:06:41 U.T.C.
:******************************************
:******************************************
:This batch file was edited by Robert Wishlaw 2020/05/30 20:45:00 U.T.C.
:******************************************

@ECHO off
IF NOT EXIST %1.c GOTO Usage
for /f "tokens=2*" %%a in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Pelle Orinius\PellesC\Directories" /v PathDirs 2^>^&1^|find "REG_"') do @set fn=%%b
SET  PellesCDir=%fn%\..
SET  PATH=%PellesCDir%\Bin;%PATH%\;
SET  INCLUDE=%PellesCDir%\Include;%PellesCDir%\Include\Win;%INCLUDE%
SET  LIB=%PellesCDir%\Lib;%PellesCDir%\Lib\Win64;%LIB%

SET  PoccOPTS=/Go /Gn /W1 /Gd /Ze /Zx /Tx64-coff /D_WIN32_WINNT=0x501  /std:c17
SET  PolinkOPTS= -release -machine:x64 /subsystem:console,5.01 /STACK:10485760               
SET  PolinkLIBS=kernel32.lib advapi32.lib delayimp.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib ole32.lib oleaut32.lib
SET  DPIFILE=c:\bat\dpiawareness.res 

ECHO Pelles C is compiling (%1) as a 64-bit Console app
call %PellesCDir%\bin\pocc   %PoccOPTS%    %1.c
call %PellesCDir%\bin\polink %PolinkLIBS%  %PolinkOPTS% %DPIFILE%  %1.obj %2 %3 %4 %5 %6 %7 %8 %9
ECHO Completed ...
GOTO done


:Usage
ECHO **************************************************************
ECHO  For building 64-bit Console files using Pelles C Compiler
ECHO  Usage:   PC64   "C" FileName  [Optional Linker Files: 2-9]
ECHO  Example: PC64    MyGuiApp      MyIcons.res   MyManifest.res
ECHO **************************************************************
:done

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
Re: How do I begin coding in BCX Basic?
« Reply #9 on: May 30, 2020, 06:40:29 PM »
Quote from: Robert
for /f "tokens=2*" %%a in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Pelle Orinius\PellesC\Directories" /v PathDirs 2^>^&1^|find "REG_"') do @set fn=%%b

... belongs in a Rube Goldberg Contest