I remembered that AppleCommander supports converting between tokenized Applesoft BASIC and a text representation but not exactly how to accomplish it.
Fumbling my way through, with AppleCommander 1.8.0 on macOS Monterey, I did this:
- In the main window, click Create… in the toolbar and use the Create Disk Wizard to make a new DOS disk.
- In the disk window, click Import… in the toolbar and in the Import Wizard choose a text file that contains an Applesoft BASIC program.
- Its type was autodetected as binary (B) but since I wanted AppleCommander to convert it to tokenized Applesoft BASIC I selected it, chose Edit…, and changed the Filetype menu from B to A and clicked OK.
- After clicking Finish, the file was added to the disk image.
Because there were no warnings or errors I believed this had done what I wanted, but instead what I think happened is that the file's data was copied byte for byte to the disk image and the file's type was simply set to A without its contents having actually been converted to that format. This seems confirmed by the fact that the file on the disk image is the same size as the original; if it had been tokenized it should be smaller.
One reason why I thought these steps were correct is that there is a "RAW binary?" checkbox in the File Import Settings window. I assumed that checking this box would copy the data verbatim. Since I did not check this box, I assumed a conversion would take place.
Then, selecting the file in the listing, I clicked View in the toolbar, which caused AppleCommander to quit; this is what was in the terminal:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 61 out of bounds for length 61
at com.webcodepro.applecommander.util.ApplesoftTokenizer.getNextToken(ApplesoftTokenizer.java:129)
at com.webcodepro.applecommander.ui.swt.filteradapter.ApplesoftFilterAdapter.createStyledText(ApplesoftFilterAdapter.java:74)
at com.webcodepro.applecommander.ui.swt.filteradapter.ApplesoftFilterAdapter.display(ApplesoftFilterAdapter.java:47)
at com.webcodepro.applecommander.ui.swt.FileViewerWindow.open(FileViewerWindow.java:168)
at com.webcodepro.applecommander.ui.swt.DiskExplorerTab.viewFile(DiskExplorerTab.java:1631)
at com.webcodepro.applecommander.ui.swt.DiskExplorerTab$52.widgetSelected(DiskExplorerTab.java:1379)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4565)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1522)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1545)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1530)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4351)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3927)
at com.webcodepro.applecommander.ui.swt.SwtAppleCommander.launch(SwtAppleCommander.java:118)
at com.webcodepro.applecommander.ui.swt.SwtAppleCommander.launch(SwtAppleCommander.java:86)
at com.webcodepro.applecommander.ui.swt.SwtAppleCommander.main(SwtAppleCommander.java:71)
... 8 more
So I think the bug is just that the Applesoft BASIC viewer expects an Applesoft BASIC file to be completely valid. Some error checking should be added so that if for example invalid tokens are encountered an error message is displayed and the program can continue normally rather than exiting abnormally.
I remembered that AppleCommander supports converting between tokenized Applesoft BASIC and a text representation but not exactly how to accomplish it.
Fumbling my way through, with AppleCommander 1.8.0 on macOS Monterey, I did this:
Because there were no warnings or errors I believed this had done what I wanted, but instead what I think happened is that the file's data was copied byte for byte to the disk image and the file's type was simply set to A without its contents having actually been converted to that format. This seems confirmed by the fact that the file on the disk image is the same size as the original; if it had been tokenized it should be smaller.
One reason why I thought these steps were correct is that there is a "RAW binary?" checkbox in the File Import Settings window. I assumed that checking this box would copy the data verbatim. Since I did not check this box, I assumed a conversion would take place.
Then, selecting the file in the listing, I clicked View in the toolbar, which caused AppleCommander to quit; this is what was in the terminal:
So I think the bug is just that the Applesoft BASIC viewer expects an Applesoft BASIC file to be completely valid. Some error checking should be added so that if for example invalid tokens are encountered an error message is displayed and the program can continue normally rather than exiting abnormally.