GER

Editing Sharp basic programs on the PC

ENG
Editing Sharp basic programs on the PC
  • Introduction
    The PC-1350/PC-1360 require line numbers for basic programs. Those aren't optimal for editing or reorganizing of the basic program why the PC-1360 offers a renumber function.
    By using labels (text within quotation marks) instead of line numbers introduces new problems. First of all you still need a renumber (not available on the PC-1350) if you need to insert more lines between two existing lines than therer are free line numners. Second and for me even more relevant: the execution time of the programs drops as the PC-1350/PC-1360 doesn't hold a list of labels and line nubers. So for efery jump the Sharp has to search the basic program for the line number with the required label.
     
    My solution is to edit the basic programs on the PC without line numbers and convert the text back to a basic program with line numbers only to run it on the PC-1350/PC-1360.
    For this I wrote two scripts that convert a basic program with line numbers into one using special jumpmarks and one to do the exact difference.
    So I can edit the program on the PC with any text editor withou caring about line numbers.
     
    Both scripts search for target line numbers directly behind the following basic commands
    GOTO, GOSUB, THEN, RESTORE, ARUN, AUTORUN
    Targte can be single numbers or a comma separated list:
    GOTO 120
    ON I GOSUB 100, 200, 300
     
    Importend to note is that the scripts don't work with calculated line numbers. So a
    GOTO V*5
    isn't allowed but will not generate an error in the script.
     
    The scripts are written as Visual Basic.NET functions. To use them on the command line they are wrapped into Powershell-scripts.
     
  • Convert a basic program with line numbers to one with jumpmarks
    For the conversion the basic program must be given as ASCII-text. Conversion from a binary file to ASCII can be done with the Pocket Tools (see data transfer between PC/MAC and Sharp PC-1350 / PC-1360 ).
     
    The script <convertBasicLineNrToLabel.ps1> converts a basic program with line numbers into one with jumpmarks.
     
    The program
     
    90 REM This is a test
    100 PRINT "Hello ";
    110 GOTO 100

     
    will be converted to
     
    REM This is a test
    :_L100
    PRINT "Hello ";
    GOTO _L100

     
    The script is started from command line by:
    powershell "C:\sharp\convertBasicLineNrToLabel.ps1" -Infile "C:\sharp\test.bas" -Outfile "C:\sharp\test_renumbered.bas"
     
  • Editing of the basic program with jumpmarks on the PC
    The converted program can be editoed with every ASCII text editor (e.g. Notepad++) on the PC.
    Instead of line numbers as targets for jumps or RESTORE you must use a jumpmark.
     
    A jumpmark always is defined as a single element in the sourcecode.. It must start with a colon (":"), followed by a combination of letters, numbers or underscores. Uppercase and lowercase are ignored and treated as the same jumpmark.
     
    Wehn using a jumpmark the name is given without the colon.
     
    Please note that it's up to you not to use basic commands or numbers as jumpmarks.
     
  • Convert a basic program with jumpmarks to one with line numbers
    The script <convertBasicLabelToLineNr.ps1> converts a basic program with jumpmarks into one with line numbers.
     
    The program
     
    REM This is a test
    :_L100
    PRINT "Hello ";
    GOTO _L100

     
    will be converted to
     
    100: REM This is a test
    110: PRINT "Hello ";
    120: GOTO 110

     
    The following parameters can be set at the beginning of the script:
    # 1. line number (1. Zeilennummer)
    $FirstLineNr = 100
    # distance between line numbers (Abstand der Zeilennummern)
    $StepLineNr = 10
    # output the program with ($true) or without ($false) colon behind the line number
    #   (Ausgabe der Zeilennummern mit ($true) oder ohne ($false) Doppelpunkt)
    $AddColonToLineNr = $true

    The script is started from command line by:
    powershell "C:\sharp\convertBasicLabelToLineNr.ps1" -Infile "C:\sharp\test.bas" -Outfile "C:\sharp\test_with_linenr.bas"
     
  • Usage of the scripts for renumber
    If you prefer to edit the basic program with line numbers you can use both script after eachother to renumber your basic program.
     
  • Using within Notepad++
    The scripts can directly be called from Notepad++
    The configuration is described within the <02_integration_notepad++.txt> (sorry, Geman only, Google probably will translate it for you).
     
Download scripts for conversion
Basic line number <-> jumpmarks renumber_basic-v1.0.zip  

back to staring page Sharp


Copyright: All images and text shown on this page are ©1999/2026 Bernhard Schwall, copyright protected and meight not be used without permission of the author.
Author:  Bernhard Schwall letzte änderung: 01.01.2026