Page 1 of 2

Where to find gtBasic emulator

Posted: 05 Apr 2021, 18:22
by PhaustSceptique
Hi all,

is there an online gtBasic emulator ou compiled files of the emulator on windows ?

thanks,

Re: Where to find gtBasic emulator

Posted: 06 Apr 2021, 07:39
by at67
Are you after a pre-built version of the complete package, i.e. emulator, assembler/disassembler, debugger, compiler...or just the command line compiler/assembler?

It's generally much better, (and safer), to build it yourself on your own PC, (it's buildable under Windows, Linux, MacOS and RPiOS now).

If you're desperate I can build you a Windows executable, just specify if you want Win32 or x64...I provide no warranty or guarantee's that the executable is 100% virus free and safe to run on your machine though, (you have to risk it for the biscuit), so you are on your own if you choose this path.

Re: Where to find gtBasic emulator

Posted: 07 Apr 2021, 15:28
by PhaustSceptique
I'm looking for the emulator like the one already existing for the basic (https://gigatron.io/emu/)

But if there is no one online I'll try to build my own on W10.

If I fail I know where to find help ;D

Thanks !

Re: Where to find gtBasic emulator

Posted: 07 Apr 2021, 22:47
by at67
PhaustSceptique wrote: 07 Apr 2021, 15:28 I'm looking for the emulator like the one already existing for the basic (https://gigatron.io/emu/)
There is no online package for gtBASIC, it's a standalone application/executable built on Windows, Linux, MacOS or RPiOS.
PhaustSceptique wrote: 07 Apr 2021, 15:28 But if there is no one online I'll try to build my own on W10.

If I fail I know where to find help ;D

Thanks !
No worries, it's not too difficult to build yourself, if you have any problems we'll be able to solve them.

Re: Where to find gtBasic emulator

Posted: 08 Apr 2021, 12:24
by PhaustSceptique
I compiled successfuly on unbuntu !

But I have some issues :
- the keyboard does not respond correctly, I can move left/right/up/down but I can not validate. If I want to enter in a menu item I need to switch keyboard mode to PS2 where each key act as the validate button ;
- when I enter in BASIC, it is written tiny BASIC but I have syntax error on "const a = 0" and "dim toto(3) =0".

Am I wrong anywhere ?

Re: Where to find gtBasic emulator

Posted: 08 Apr 2021, 13:27
by at67
PhaustSceptique wrote: 08 Apr 2021, 12:24 I compiled successfuly on unbuntu !
Good job!
PhaustSceptique wrote: 08 Apr 2021, 12:24 But I have some issues :
- the keyboard does not respond correctly, I can move left/right/up/down but I can not validate. If I want to enter in a menu item I need to switch keyboard mode to PS2 where each key act as the validate button ;
Press CTRL + H to get an idea of the keyboard commands, when in native gigatron keyboard mode the following keys map to the controller buttons:

Code: Select all

Left         = A         ; left input for emulator/hardware depending on Mode
Right        = D         ; right input for emulator/hardware depending on Mode
Up           = W         ; up input for emulator/hardware depending on Mode
Down         = S         ; down input for emulator/hardware depending on Mode
Start        = SPACE     ; start input for emulator/hardware depending on Mode
Select       = Z         ; select input for emulator/hardware depending on Mode
A            = .         ; A input for emulator/hardware depending on Mode
B            = /         ; B input for emulator/hardware depending on Mode
You can change these keys in input_config.ini

When you switch to PS2 keyboard mode the keys become:

Code: Select all

      case 0xe075: button = buttonUp;     break; // [UpArrow]
      case 0xe06b: button = buttonLeft;   break; // [LeftArrow]
      case 0xe072: button = buttonDown;   break; // [DownArrow]
      case 0xe074: button = buttonRight;  break; // [RightArrow]
      case 0x66:                                 // [BackSpace]
      case 0xe071: if ((flags & ctrlFlags)       // [Delete]
                    && (flags & altFlags))
                     newAscii = CTRLALTDEL;      // [Ctrl-Alt-Del] becomes [Start]
                   else
                     button = buttonA;    break; // ASCII DEL is 127 is ~buttonA
      case 0xe069: button = buttonA;      break; // [End]
      case 0xe070:                               // [Insert]
      case 0xe06c: button = buttonB;      break; // [Home]
      case 0xe07a: button = buttonSelect; break; // [PageDown]
      case 0xe07d: button = buttonStart;  break; // [PageUp]
      case 0xe04a: newAscii = '/';        break; // [/] on numeric island
      case 0xe05a: newAscii = '\n';       break; // [Enter] on numeric island
Which are defined by the standard set in PS2.ino as part of BabelFish.ino, (i.e. you can't change these ones unless you edit the gtemuAT67 source code).
PhaustSceptique wrote: 08 Apr 2021, 12:24 - when I enter in BASIC, it is written tiny BASIC but I have syntax error on "const a = 0" and "dim toto(3) =0".

Am I wrong anywhere ?
The built in interpreted BASIC in the gigatron's ROM is TinyBASIC, which is a subset of most BASIC's. TinyBASIC's commands and features are defined here: https://gigatron.io/?page_id=1234

gtBASIC is a cross compiler/development system for the gigatron, i.e. you create your code on the PC in a text/code editor of your choosing and then either compile it at the command line or within gtemuAT67. You can test your code in the emulator or upload it to real hardware through one of the Arduino interfaces, (I recommend Norgate's Pluggy Reloaded found here: https://forum.gigatron.io/viewtopic.php?f=4&t=169).

Re: Where to find gtBasic emulator

Posted: 09 Apr 2021, 09:05
by PhaustSceptique
Thanks ! I guess it was included like the TinyBasic.

I tried to compile under Windows without big success as with Linux.

I've downloaded cmake and added it to the path.
I've downloaded sdl2 binary and sdl2 sources in separated directories.

But I don't know how to configure cmake to find libs, the "cmake ." complains "Could NOT find SDL2 (missing: SDL2_LIBRARY)".

Re: Where to find gtBasic emulator

Posted: 09 Apr 2021, 09:26
by at67
PhaustSceptique wrote: 09 Apr 2021, 09:05 Thanks ! I guess it was included like the TinyBasic.

I tried to compile under Windows without big success as with Linux.

I've downloaded cmake and added it to the path.
I've downloaded sdl2 binary and sdl2 sources in separated directories.

But I don't know how to configure cmake to find libs, the "cmake ." complains "Could NOT find SDL2 (missing: SDL2_LIBRARY)".
If CMake's FindSDL2.cmake script doesn't work by default, then you can manually set the include and lib variables within CMake, (using cmake_gui), something like this:

Code: Select all

SDL2
        SDL2_INCLUDE_DIR                D:/SDK/SDL/include
        SDL2_LIBRARY                    D:/SDK/SDL/lib/x64/SDL2main.lib;D:/SDK/SDL/lib/x64/SDL2.lib
Obviously you need to change the path's for your specific folder structure.

You can also set SDL2DIR as a Windows environment variable, exit and then re-run CMake, like this:

Code: Select all

SDL2DIR=D:\SDK\SDL
Once again you need to change the path to suit your specific requirements.

Re: Where to find gtBasic emulator

Posted: 09 Apr 2021, 13:20
by PhaustSceptique
OK, flawless victory ! plus or minus :D

To be able to compile and run I've had to :
  • Download and install cmake for windows and adding executable directory to the Windows path;
  • Download and install VC++;
  • Download the SDL Developpement library for VC++;
  • Set the SDL2DIR environnement variable to the path where I unzipped the SDL dev library;
  • Download the SDL runtime library;
  • Add the path to SDL runtime library to the windows path in order to be able to run gtemuAT67.exe;
  • Run cmake . in the at67 directory;
  • Open VC++ and load the generated gtemuAT67.sln (twice because it failed the first time);
  • Run Generate > Generate ALL BUILD;
  • Run manually the gtemuAT67.exe found in at67\Debug directory.
I have the same issue as the linux one : keys Start(SPACE), Select(Z), A(-) and B(/) do not work.
I noticed loadind gtBasic files is slow compared to linux where it is loaded near instantly.

But it works !!!!

Re: Where to find gtBasic emulator

Posted: 09 Apr 2021, 18:24
by at67
PhaustSceptique wrote: 09 Apr 2021, 13:20
  • Add the path to SDL runtime library to the windows path in order to be able to run gtemuAT67.exe;
You can also just copy the SDL2.dll file to the same folder as gtemuAT67.exe, that way you don't have to modify your Window's path, but either method is fine.
PhaustSceptique wrote: 09 Apr 2021, 13:20
  • Run manually the gtemuAT67.exe found in at67\Debug directory.
I noticed loadind gtBasic files is slow compared to linux where it is loaded near instantly.
Run the Release version instead of the Debug version, I use modern C++14 STL containers extensively in this project and Microsoft's compiler is wickedly slow when it comes to DEBUG versions of the STL containers.
PhaustSceptique wrote: 09 Apr 2021, 13:20 I have the same issue as the linux one : keys Start(SPACE), Select(Z), A(-) and B(/) do not work.
But it works !!!!
This doesn't make a lot of sense, are you using a localisation/keymap that could be at odds with my default choice? Try editing input_config.ini and adding your own keys. If the file input_config.ini doesn't exist, then create a new one in the same folder as gtemuAT67.exe and add the following to it's contents, (changing the keys to whatever you prefer).

Code: Select all


; Keys are editable in 'input_config.ini'
; If 'input_config.ini' is changed, then the emulator has to be restarted
; Text cursor and hex editing is controlled via the mouse
; Left Mouse Button to compile/execute current file in Browser on Emulator
; Right Mouse Button to compile/execute current file in Browser on Hardware

[Emulator]               ; case sensitive
MemoryMode   = CTRL+M    ; toggles between RAM, ROM0 and ROM1, (in Hex mode)
MemorySize   = CTRL+Z    ; toggles between 32K, 64K, and 128K RAM with SPI
Browse       = CTRL+B    ; file browser
RomType      = CTRL+R    ; ROM browser
HexMonitor   = CTRL+X    ; hex monitor
Disassembler = CTRL+D    ; disassembler, (vCPU or Native)
CpuMode      = CTRL+C    ; toggles between vCPU and Native
Terminal     = CTRL+T    ; basic serial terminal for talking to hardware
ImageEditor  = CTRL+I    ; basic image editor for editing graphic images
AudioEditor  = CTRL+A    ; basic audio editor for editing sample waveforms
ScanlineMode = CTRL+S    ; toggles scanline modes, Normal, VideoB and VideoBC
Reset        = CTRL+F1   ; emulator reset
Help         = CTRL+H    ; toggles help screen on and off
Quit         = CTRL+Q    ; instant quit

[Keyboard]               ; case sensitive
Mode         = CTRL+K    ; toggles between, Giga, PS2, HwGiga and HwPS2
Left         = A         ; left input for emulator/hardware depending on Mode
Right        = D         ; right input for emulator/hardware depending on Mode
Up           = W         ; up input for emulator/hardware depending on Mode
Down         = S         ; down input for emulator/hardware depending on Mode
Start        = SPACE     ; start input for emulator/hardware depending on Mode
Select       = Z         ; select input for emulator/hardware depending on Mode
A            = .         ; A input for emulator/hardware depending on Mode
B            = /         ; B input for emulator/hardware depending on Mode

[Hardware]               ; case sensitive
Reset        = CTRL+F2   ; resets hardware, (must have an Arduino interface)

[Debugger]               ; case sensitive
Debug        = CTRL+F6   ; toggles debugging mode, (can debug vCPU and Native)
RunToBrk     = CTRL+F7   ; run to breakpoint, does nada if no breakpoints exist
StepPC       = CTRL+F8   ; single steps debugger based on vPC or native PC
StepWatch    = CTRL+F9   ; single steps debugger based on a watched variable
                         ; default is videoY which changes once per scanline