Welcome to the GW Basic! Multi-Tool

by Michael C Palmer

This document can be accessed by clicking Help from the menu

Read more or click HERE to start the App


The following GUI tools are available


File Lister

List Modifier

SFXR Helper

Sprite Sheet Builder


The following Console tools are available

Binary Calculator

Binary Flag Helper

Key Scanner

Radian Converter

RegEx Tester

Sub Scanner


Known Problems

Getting Started

Use the Jump Menu at the top of the screen to open one of the GUI tools, or to open the text menu from which you may select one of the console tools. The File List and List Modify tools present some powerful features that remain unavailable with most of the file managers and text editors for Android. They may prove quitevuseful to programmers and power users who are picky about their file names and directory structure.


Some of the tools, such as the SFXR and Sprite Sheet tools, are specialized, while others are generally useful. The lists generated by them are interoperable and can be easily saved to and loaded from files or the clipboard.

Possible uses

Create a list of files and folders, with or without subfolders included

Filter file lists using literal strings, patterns, or regular expressions

Remove duplicates from a list and reorder the results

Modify lists using tokens or RegEx find and replace

Batch rename files using tokens, RegEx, and/or numbering

Create aligned rows or columns from multiple images, useful for sprite sheets

Generate scripts for quickly updating sprite sheets when an image is changed

Rename and organize sound effects generated by the free SFXR app

Copy long lists into the clipboard one line at a time, useful for searching for a list of items or completing a TODO list

Generate source code for retrieving binary flag lists and values

Generate a list of degree conversions or of named keycode values

Shuffle the contents of a list or a text file

Add numbers to a list or text file

File Lister

This tool is designed to create lists of files and folders. Many options are available to customize the list, with even more features available if you open the generated list in separate the List Modify tool.

Browsing

Files and folders will appear in a list at the bottom of the screen, with each folder proceeded by a forward slash. Tap a folder to enter that directory. Above the list is a drop down box that displays the current directory. If you tap it a new list will pop up showing every folder down to root. Tap one to change to that folder. Alternatively, you may use the back button beside it.

Filtering

An edit box at the top of the screen allows you to enter text for filtering the list. Beneath it are many options to specify how the file list should be filtered. The first bar is used to toggle between include and exclude mode, and to choose case sensitivity. The second bar offers three options for literal text matching, as well as pattern matching, regular expressions, and manual mode. Manual mode allows you to remove individual files and folders by tapping them. The third bar has no effect filtering.

Tap the Filter button to filter the list using the filter entered into the text box above it. Tapping it again will further filter the list using any new text typed there. Tap revert to refresh the file list if you make a mistake.

View

The third bar beneath the Filter box changes the view, with options such as showing paths and hiding folders. Once you have the view set the way you like it, you may use the Save button to save the list to a file or the Clip button to copy it into the clipboard. The Append check box allows you to add multiple lists to a file or to the clipboard by appending them one at a time.

Tap the Subfolders button to include all of the files and folders contained in the subfolders located within the current directory.

File Management

The listed files can be copied or moved into another folder, deleted from the current folder, or renamed using pattern matching, RegEx, tokens, and/or numbers. Use the buttons located beneath the file list to access these features.

If you tap Rename a dialog box will appear informing you that the List Modify tool will be opened with the current file list loaded into it. Use the list modifier to alter the file names and then tap the Rename button in that tool to rename them. The rename feature requires that the lines in the file list and the lines in the modified list match, so any feature in the List Modify tool that removes, adds, or reorders a line in its list will disable renaming. You will have to reenter the File List tool and start again.

List Modifier

General

The List Modifier tool is divide into five parts. At the top are buttons to load and save files. The other parts are hidden to save space and must be opened by tapping their title bar. The titles are self explanatory and include Filter, Add and Replace, Tokenize, and List View.

Loading a List

Lists can be loaded from many sources by using the Load drop down box at the top of the screen. Sources include the clipboard, a text file, or a list that has been generated by one of the other tools. You may load from any text file on your SD card by choosing File. A separate page will open and allow you to navigate your folders and choose the file that you wish to open.

Two temporary lists may also be saved to and loaded from, much like the clipboard, but they are not accessible by other programs unless you save them first.

Saving a list

Lists may be saved to most of the same sources that they can be loaded from. Use the Save button to save your current list.

Revert and Undo

The Revert button will revert the list to the contents of whatever source it was loaded from, if possible. It cannot revert a list that was generated from multiple sources using the Append option. Undo will undo the most recent change. It will only undo mass changes, such as Filter, Add, or Replace. It will not undo changes made to an individual list item by using Edit, Sort, or Remove.

Filtering

Multiple filters may be applied to the list. Add one by typing it into the edit box and then tapping Add. Remove one by tapping it in the drop down box accessible by first tapping Remove. Choosing Remove from the top of the remove drop down box clears the entire list of filters.

Options

The options for filtering, from left to right, are to include matches, to exclude matches, and to enable case insensitive matching(otherwise upper and lower case letters will not match). The second bar has three options for literal matches, including to match only the text at the start of an item, to match text anywhere in an item, or to match only the text at the end of an item. The last two options are to enable pattern matching using the # and * symbols, or to enable regular expression matching.

Priority

The priority options select how a list is effected by the filters. Include Mode will not filter out an item unless it is specifically excluded by a filter, and even if it is, the item will still be included if it also matches an include filter. Exclude Mode will filter out an item that is not specifically included by a filter, and even if a filter does include an item, it will still be filtered out it if it also matches an exclude filter. Last Mode gives priority to a match located further down the list.

Loading and Saving

Tapping Add while the filter text box is empty will add every line from the clipboard as a new filter. Each filter will use the current filter options. You may export all of the filters into the current list by selecting the Filters option from the Load menu available at the top of the screen. Using these two features allows you to include or exclude items in one list only if they are also included in a second list.

Add and Replace

Adding Text

Text can be added to the left or to the right of every item in the list with one simple click. The Find text box should be empty and either the Left or the Right option must be selected. Type the text that you wish to add into the Replace text box and then tap Add. The text will be added to the left or to the right of very item in the list.

Replacing Text

Several options are available for searching text in the list and replacing it with whatever text that you type into the Replace text box. Left, middle, and right will perform a literal search, replacing specific text with the text of your choice, such as replacing all occurrences of the word dog with the word bulldog, for example. Pattern matching allow you to search with the common ? and * characters. Full RegEx searches are also available.

Tap the A=a button to enable case insensitive searching. Otherwise, Multi-Tool is case sensitive by default.

The search results will be replaced by the literal text string typed into the replace box. Using the $ character to replace the text with text from the RegEx search results is not yet supported. I cannot figure out how to provide this vital function using the available BASIC! commands.

Numbering

Lists can be numbered by using the Add feature with either +# or +## typed into the replace box. Use +## to add a number with enough leading zeroes so that each number will have the same amount of digits, depending on how many items are in the list. Therefore 01 will be the number for the first item in a list with eighty items, and 001 will be the first number if there are 999 items in the list.

Item 1: Hello

Item 2: Hi

Option: Right

Replace Box: “ there +#”

Results:

Hello there 1

Hi there 2

Tokenize

The tokenize feature will split each item in the list into tokens using a delimiter and produce its output with the tokens in any order you wish. The delimiter can be a literal string, such as “ - “, or it could be a pattern or a regular expression. Enter the desired separator into the Delimiter text box on the left side and the desired output into the right side. The characters +#, when followed by any number, will be replaced by a token from each item in the list. All other characters will be appear exactly as entered.

List Item: “Rush – Subdivisions”

Delimiter: “ - “

Output Text: “+#2 is a great song by +#1”

Results: “Subdivisions is a great song by Rush”

List View

The largest and most important element of the List View is the list itself, where the items will be displayed. Although the display truncates very large lists down to only 200 entries, the remaining items will still be processed.

Many buttons populate the top of the list view. Their purpose follows.

Add: Displays a dialog box to add a new entry to the bottom of the list.

Sort: Sorts the list into alphabetical order.

Reverse: Reverses the order of items in the list without sorting them.

Shuffle: Rearranges the list into a random order.

Remove Duplicates: Removes duplicates from the list, retaining only the first occurrence.

Clip Lines: Copies the first list item into the clipboard and displays a dialog box allowing you to cycle through the remaining items. This is useful for pasting text into another app one line at a time, such as when performing searches, or for completing a TODO list.

Edit Mode: When this option is enabled a dialog box will appear and allow you to edit a list item by tapping it.

Order Mode: When this option is enabled you may reorder a list item by first tapping it, then tapping the new location where you wish it to move to.

Remove Mode: When this option is enabled you may remove list items by tapping them.

Rename: This button is located beneath the list view and can be used to rename a group of files that was previously processed by the File List tool. More details can be found in that section.

SFXR Sound Tool

SFXR is an open source, multi-platform app available for Android. It produces retro, arcade-style sound effects useful for developing retro-style games, or for providing place holder sounds until better, permanent sound effects can be obtained. Unfortunately, the SFXR app saves all of its sound files into the SFXR folder with date-stamped file names, without providing its users any option to choose the output directory or to provide more descriptive titles.

Basics

The GW Basic! Multi-Tool steps in where SFXR leaves off. When opened, a list of all the sounds in the SFXR folder will appear. One touch playback is offered, as well as easy access to the rename, copy, and move functions. In addition, it the Set Output Folder button at the bottom of the screen will set the current directory as the destination for any rename, copy, or move operations.

Setting and Swapping the Output Folder

The the most effective method for using the SFXR tool is to browse to the project folder where you wish to save your sounds and then tap the folder navigation drop down box. Select the Output Folder option and the current directory will become the output directory, while simultaneously, the file list will jump back to the previous output directory, which unless you changed it, should still be the SFXR folder itself. Therefore you will see all of your sounds and be able to play and rename them.

Renaming Sounds

In the SFXR tool the rename function acts as a move command. If you rename “SFXR-2017-08-XXX” to boom1, for instance, it will be renamed and moved to the output directory at the same time. This is usually a convenient and efficient behavior, but you may wish to sample and rename the newly generated sounds while the output folder is still set to SFXR, then change the output folder so that you can copy them there instead of moving them.



Sprite Sheet Tool

This tool combines multiple image files into a single columns or row within a larger file. This is useful for producing characters or animations for use in game design, and may have other uses as well. Multiple image lists can be saved into a single file, with each one defining its own output image so that they can all be generated by a single click after one or more of the individual images has been changed. JPG and PNG images are supported.

File View

A pair of buttons switches between File View and List View. In File View, a list of folders, image files, and scripts will appear at the bottom of the screen. Clicking on a folder will update the list to show the folder contents. Just like in the File List tool, the drop down box above the file view will open a list of folders that allows you to navigate back to the root directory.

Thumbnails appear for image files, which when tapped, will add the image to the current list. Unless you deactivate the Filter check box, the image will disappear from file view when it's added. There is also a Hide button, which allows you to remove images that you do not wish to use and make it easier to find the ones that you do.

Clicking on a script file will load the image lists defined inside of it and automatically switch to List View.

List View

When in List View, the file list will display only the images contained in the current image list, and it will display them in the order that they will appear in the output image. Instead of listing folders to navigate to, the drop down box above the list is used to switch between the various image lists in the current file.

By default, tapping an image while in list view will remove it from the current list. If you switch from Remove to Reorder mode, you may change the order of the images in the list. First tap the image that you wish to move, then tap the position where you wish it to move to.

List and File Buttons

There are four buttons at the top of the Sprite Sheet screen. The first first one will clear the images from the current list. The second one will save the current list into memory and create a new empty one. The old list will be named by the text entered in the Output File text box located beneath it. The new one will appear as “New” in the drop down box below that.

The next two buttons are for saving and loading an image script file, which will use the BMS extension (bitmap script). Each script file can include any number of image lists.

Output Image

A text box and four mode buttons are available to configure the output image for each list. Enter the desired file name for the output image into the text box. The .png extension will be assumed if no extension is given.

By default, the images in an script file are linked to by their path. Enabling Copy or Move mode will copy or move the linked images to the current directory and save the script without any paths. Therefore the script will still work if the folder is moved with the images and the script file still inside of it. Also, if the script file is moved into a different folder with identically named images, it will generate an output image using them. This could be useful for theming, such as seen with the various block styles in Abyss.

Horizontal or Vertical Mode

The individual images in an image list will appear within a horizontal row inside the output image unless the Vertical option is enabled. A grid can be created by first creating a series of image rows and then creating a list of them in vertical mode.

Build

The output image will be generated when the Build button is tapped. If the file already exists then it will be replaced without warning. The screen will turn blank momentarily while Basic! changes into graphics mode in order to gain access to the bitmap commands used to generate the image.

Console Tools

Binary Calculator

The binary calculator is a console mode calculator that might be helpful to individuals who are trying to better understand boolean algebra, or for more advanced programmers who need to make quick conversions between number systems. All values will be printed to the screen in binary, hex, and decimal formats.

The commands in the calculator are all single characters and must be entered in a specific order. The onscreen guide should provide adequate reference for most users. All operations except for the memory store function will alter the value that is currently in memory. Standard usage is as follows.

=1011 (set 1011 into memory)

:00001011 : [Bh, 11d] (output showing the value in memory

+1 (add 1 to the current value)

:00001100 : [Ch, 12d]

A1001 (logical operation 1100 AND 1001)

:00001000 : [8h, 8d]

Basic Functions

Note: x represents any number of digits that precede or follow the function command.

=x: enter binary number x into memory for further calculation. The equal sign may be omitted in most situations.

Ax: perform a logical AND operation between the number in memory and x.

Nx: perform a NOT AND operation between the number in memory and x.

Rx: perform an OR operation between the number in memory and x.

=T: perform a NOT operation to invert the value in memory.

fxT: perform function f with the inverted value of x.

Xx: perform an XOR operation between the number in memory and x.

<x: Shift the value in memory x binary places to the left.

>x: Shift the value in memory x binary places to the right.

(+-*/)x: add, subtract, multiply, or divide the value in memory by x

Memory Functions

Sx: store the value in memory into storage cell x, where x is a number between 1 and 9

Cx: Recall the value previously stored into memory cell x and place it in memory.

fCx: perform function f with the value previously stored into memory cell x.

=1111

:00001111 : [Fh, 15d]

S2 (store 1111 into memory cell 2)

"00001111 : [Fh, 15d]

=1010

:00001010 : [Ah, 10d]

AC2 (recall 1111 from memory cell 2 and perform the AND operation)

:recalling 1111

:00001010 : [Ah, 10d]

Conversion Functions

fDx: perform function f with the decimal value x (=D10, AD12.5, ext). Decimal values will be truncated into binary integers.

fHx: perform function f with the hexadecimal value x(=H1A, AH2F, ext)"

Binary Flag Helper

This tool is designed to help define binary flag sets and create variables that use them. It will generate source code that defines an array containing a description of each binary flag, and a function that will print the description of each flag that is set in a particular variable.

The first thing that the tool will ask is for you to name the set of binary flags. The name will be used for the array created to describe the meaning of each bit in the binary values that use them. Next it will ask you to describe the meaning of each bit in the set.

Set Name: GunInfo

Bit 1: needs ammo

Bit 2: uses battery

Bit 3: fires ballistic

Bit 4: fires beam

Bit 5: hurts target

Bit 6: destroys target


After the binary flag set is defined the tool will help you to create values that use it. A menu will appear, allowing you to set each bit by tapping its description. A '>' symbol will appear before each value that will be set in the variable. Press BACK or tap outside of the menu once you have finished.

The tool will then ask if you wish to define another set of binary flags. Enter its name or leave it blank if you have finished. The generated source code will appear in the console window and be copied into the clipboard. You may use the List Modify tool to modify or save it into a text file.

Key Scanner

This tool will print the value returned by inkey$ for any key or button that you press. It will also ask you to enter a description for the value and save into the clipboard a list containing all of your key presses.

Radian Converter

For programmers, who like me, cannot think in radians, this tool will allow you to enter angles in degrees and retrieve a list of their radian equivalents for easy insertion into your source code.

RegEx Tester

This tool allows a regular expression to be entered and tested against a series of console inputs. To enter a regular expression, precede it with the letter p. To test the expression, enter any text preceded by the = sign.

p[a-z]*

=apple

matched

=2 pears

no match

Scan Subs

This tool will open a menu listing all of the files in you RFO Basic! source folder. Select a file to scan and a list of all of its subroutines and functions will be generated, appearing both in a single line of comma separated values and again on individual lines. The number of lines in the file will also appear, not including any blanks or full line comments. The information will be copied into the clipboard.

Known Problems

Some buttons do not align properly due to problems with GW-Lib or my understanding of it.

The SaMe, UPPER, and lower buttons for Add and Replace in the List Modify tool do not function and will not until I discover how to retrieve the text from a RegEx match instead of just using it as a delimiter.

The console screen does not always scroll properly when using an onscreen keyboard.

The list view in the List Modify tool sometimes displays improperly. Specific issues include: all lines will be preceded by sequential numbers if the first line begins with the # character. Words in parentheses may appear in a right aligned bubble. If text pasted from the clipboard has multiple spaces or certain symbols at the left side of the lines then the entire list might fail to display. The data will still be processed correctly, despite its improper appearance. This occurs because of the special characters that format list views in GW-Lib. I will attempt to add unformatted list views to the library in the near future.