-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BabelFish is lacking a terminal command for loading the saved BASIC program #104
Comments
The scenario where this occurs is when we use a connected laptop/PC to type in a BASIC program into TinyBASIC using a terminal program and command 'T' for terminal mode. In this mode we can then SAVE the program into the Arduino. The Arduino has a bit more EEPROM storage after all. From that moment, the normal function keys don't get transferred to the Gigatron. There is a hardware solution: hookup a PS/2 keyboard to the Arduino. The function keys will be recognised in the same way as in Pluggy McPlugface's ATtiny85. But perhaps we should echo back the program being SAVEd over USB as well. But then we can also just copy-paste it from the terminal window. Of course it has always been possible to use "sendFile.py Blahblah.gtb" from the connected laptop/PC: sendFile.py recognises the GTB extension. It will start TinyBASIC on the Gigatron and then transfer the program from your file system. Taking a helicopter view: with the steady progress on SDC/MMC card reading in issue #107, untethered file loading should become the standard method of loading files. [Although it remains to be seen if we soon grow the ability to SAVE to SDC/MMC from Tiny BASIC...] It's better to close this issue without solving now. |
First, typing SAVE in 'T-mode won't work, because BabelFish isn't listening to data in that mode. But the workaround is to use the dot command on the Cmd? prompt:
From the help message:
This keeps BabelFish in the mode where it recognises incoming data from the Gigatron. Now, loading back is indeed an omission. So I just extended the 'P'-command to work in a similar way as in Pluggy McPlugface: the last slot number is for the BASIC program. Which is the last slot number depends on the microcontroller. For example, on the Arduino Micro the slot configuration looks as follows: :PROGMEM slots: And so the 'P' command now accepts '7' as argument. This is also now explicitly mentioned in the help text:
As you can see, I added a reminded that '.SAVE' should be used, not 'SAVE' in terminal mode. |
1. Give MSBASIC much more time to process a program typed back from EEPROM MS BASIC can be detected because it sends the CR LF sequence instead of LF. In that case, the delay time before sending the next line depends on it's length. This gives MS BASIC a time proportional to the length for tokenizing. Also, we now give a longer delay when we expect there's an linewrap (that is: every 26th character on the line). Tested ok with this test program in default video mode 1: 10 INPUT"HOW MANY DIGITS";N 20 T=TIME 30 L=INT(10*N/3)+1:DIM A(L) 40 Z$="000000":T$="999999" 50 FOR I=1TOL:A(I)=2:NEXT 60 M=0:P=0 70 FOR J=1TON:Q=0:K=2*L+1 80 FOR I=L TO 1 STEP -1 90 K=K-2:X=10*A(I)+Q*I 100 Q=INT(X/K):A(I)=X-Q*K 110 NEXT 120 Y=INT(Q/10):A(1)=Q-10*Y:Q=Y 130 IF Q=9 THEN M=M+1:GOTO170 140 IF Q>9 THEN PRINT CHR$(49+P);LEFT$(Z$,M);:GOTO170 150 PRINT CHR$(48+P);LEFT$(T$,M); 160 P=Q:M=0 170 NEXT 180 PRINT CHR$(48+P):PRINT (TIME-T)/59.98 2. Allow 'P'-command to write back from the EEPROM slot as well. This solves issue #104 (BabelFish is lacking a terminal command for loading the saved BASIC program) 3. Fix compile warnings about falling through (one was an actual bug) 4. Update comments, add warning that Arduino Nano doesn't currently work well with ROMv4.
Integrated with this commit: |
It should be possible to use any function from a hooked up laptop. However, for loading a saved BASIC program back, it needs a PS/2 keyboard to recognise the different type of load request...
The text was updated successfully, but these errors were encountered: