KLO BBC Micro Utilities

I recently got round to repairing and re-capping the power supply in my BBC Micro Model B, which I bought 40 years ago. Of course I started grabbing various programs and data from it, transferring to my Windows PC as .dsd files, then using those with Beebem, and I bought a copy of BBC BASIC for Windows so that I could play with that too. I wanted some command line utilities to display the content of .dsd files, and decode BBC BASIC files along with "PRINT#"-type BBC data files, so I wrote them as console applications using the .NET framework. The utilities are:

They can all produce colour output, e.g. string, keywords and so forth are coloured differently, and can either produce plain text (which is only in colour if output is to a command prompt window, of course), bbcode, or HTML, optionally launching the browser for the latter. They take wildcards as input and can traverse down through folders. I realize that not everyone is comfortable downloading such things other than from "official" sites, but I've put a .zip file with the setup.exe and corresponding .MSI (see lower down). I am currently fiddling around to get them published on the Windows Store (where I recently published contour mapping app to familiarize myself with the process, but it is different, and IMHO fiddlier, for console apps) so if anyone would like to try them, I'd love to get feedback and suggestions.

Here's an example of .html output using the Sketch program from https://www.bbcbasic.co.uk/bbcwin/tutor...ndixe.html as input, saved on the PC in BBC Basic tokenized binary as Sketch.bbc.

C:\...\WelcomeDiskFiles> bbcbasictotext Sketch.bbc Sketch.html

BBCBasicToText found 1 file matching Sketch.bbc
Escape non-printable characters: True

BBCBasicToText: processing 1/1, C:\Users\...\BBCMicro\Sketch.bbc

BBCBasicToText Success: 1/1, C:\Users\Kara Ottewell\OneDrive\Documents\BBCMicro\Sketch.bbc, dialect WindowsOrSDLWithoutLineNumbers

Output: C:\Users\...\BBCMicro\Sketch.html

BBCBasicToText found and processed 1 file, ignored 0, excluded 0, produced results for 1
REM Sketch
 X%=10
 Y%=10
 REM Print X in starting place
 PRINT TAB(X%,Y%);"X"
 REPEAT
   Key%=GET
   REM Move cursor in direction after checking
   REM we're still in limits
   CASE Key% OF
     WHEN 139: IF Y% > 0 THEN Y%-=1
     WHEN 137: IF X% < 19 THEN X%+=1
     WHEN 138: IF Y% < 19 THEN Y%+=1
     WHEN 136: IF X% > 0 THEN X%-=1
   ENDCASE
   REM Print X in new position
   PRINT TAB(X%,Y%);"X"
 UNTIL FALSE
 END

 

It tries to change the indentation style automatically based on whether it is an Acorn format BASIC file, or BBC BASIC for Windows/SDL, but you can override via the /w or --windows-style-indent switches. I extracted the program using

C:\...\WelcomeDiskFiles\> bbcreaddiskimage Welcome.ssd --export=*welcome*

then used

C:\...\WelcomeDiskFiles\> bbcbasictotext 0_W.WELCOME *.bbcode /w

BBCBasicToText found 1 file matching 0_W.WELCOME
Escape non-printable charaters: True

BBCBasicToText: processing 1/1, C:\Users\...\BeebEm\DiscIms\WelcomeDiskFiles\0_W.WELCOME
BBCBasicToText Success: 1/1, C:\Users\...\BeebEm\DiscIms\WelcomeDiskFiles\0_W.WELCOME
Output: C:\...\WelcomeDiskFiles\0_W.WELCOME.bbcode

 

Which produced

BBCBasicToText: processing 1/1, C:\...\WelcomeDiskFiles\0_W.WELCOME
  10 REM New version of 'INTRO' from
  20 REM Welcome pack
  30 REM By John Coll & Andrew Gordon
  40 ON ERROR GOTO 630
  50 ENVELOPE 1,1,-RND(50),-RND(50),-RND(45),255,255,255,127,0,0,-127,127,0
  60 SOUND 1,1,255,255
  70 DIMCOM%11
  80 M0=650:M1=500:M2=708:M3=104:M4=288:M5=550:M6=720:M7=450:M8=5
  90 MODE5
 100 VDU5
 110 VDU23,255,255,255,255,255,255,255,255,255
 120 GCOL0,135
 130 CLG
 140 VDU18,0,129,24,128;128;1152;896;16,18,0,135,24,256;256;1024;768;16,26
 150 FORI%=M1 TO M2 STEP M3:PROCSWOOSH(M0):PROCLETTER:NEXT
 160 $COM%="DISC SYSTEM"
[Snip rest of "Welcome" BASIC program]
BBCBasicToText Success: 1/1, C:\...\WelcomeDiskFiles\0_W.WELCOME
Output: C:\...\WelcomeDiskFiles\0_W.WELCOME.bbcode

 

Indentation is applied to FOR, REPEAT, WHILE, and CASE, and it respects EXIT REPEAT etc. but you can turn it off with --noindent.

Because I am too lazy to type the full command names, I created some DOSKEY macros in a command file named cmdsetup.cmd

doskey brd="<path to exe>\BBCReadDiskImage.exe" $*
doskey btt="<path to exe>\BBCBasicToText.exe" $*
doskey bdt="%<path to exe>\BBCDataFileToText.exe" $*

and this runs in every new command window because I have added this to the registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"CompletionChar"=dword:00000009
"DefaultColor"=dword:00000000
"EnableExtensions"=dword:00000001
"PathCompletionChar"=dword:00000009
"AutoRun"="\"%OneDrive%\\<wherever>\\ cmdsetup.cmd\""

Latest Version

The most recent version, which you can open with zip, is v1.0.60 here BBC Micro Utilities v1.0.60.zip

I'm investigating the best way to get it published on Windows Store, but for now the .zip file is located on a Git web site, hence the signature in the .zip file. As always you should be cautious and do due diligence before downloading and running an installer. Please let me know what you think.