Skip to content
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

Closed
kervinck opened this issue Sep 7, 2019 · 3 comments
Closed

Comments

@kervinck
Copy link
Owner

kervinck commented Sep 7, 2019

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...

@kervinck
Copy link
Owner Author

kervinck commented Sep 24, 2019

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.

@kervinck kervinck changed the title BabelFish is lacking a terminal command for loading saved BASIC program BabelFish is lacking a terminal command for loading the saved BASIC program Sep 24, 2019
@kervinck kervinck reopened this Nov 7, 2019
@kervinck
Copy link
Owner Author

kervinck commented Nov 7, 2019

@monsonite

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:

Cmd?
.SAVE

From the help message:

: .<text> Send text line as ASCII keystrokes

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:
: P0) BASIC
: P1) WozMon
: P2) Terminal
: P3) Blinky
: P4) Lines demo [at67]
: P5) Game of Life demo [at67]
: P6) Starfield demo [at67]
: P7) -SAVED-

And so the 'P' command now accepts '7' as argument. This is also now explicitly mentioned in the help text:

:Commands are
: V        Show configuration
: H        Show this help
: R        Reset Gigatron
: L        Start Loader
: M        Show key mapping or menu in Loader screen
: P[<n>]   Transfer object file from PROGMEM slot <n>
: P7       Type saved EEPROM data back into Gigatron
:          [Hint: Use '.SAVE' for saving, not 'T'-mode!]
: U        Transfer object file from USB
: .<text>  Send text line as ASCII keystrokes
: C        Toggle echo mode (default off)
: T        Enter terminal mode
: W/A/S/D  Up/left/down/right arrow
: Z/X      A/B button
: Q/E      Select/start button

As you can see, I added a reminded that '.SAVE' should be used, not 'SAVE' in terminal mode.

kervinck added a commit that referenced this issue Nov 7, 2019
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.
@kervinck
Copy link
Owner Author

kervinck commented Nov 7, 2019

Integrated with this commit:
9cfbbe4

@kervinck kervinck closed this as completed Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant