gtBASIC

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
at67
Posts: 201
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 » 02 Sep 2020, 14:25

Jalecko wrote:
02 Sep 2020, 13:00
cd C:\(the folder with the compiler)
gtbasic Cube.gbas

and then i got an error that the command was not included
I'm kinda stuck now what to do
Was the error that it couldn't find "gtbasic.exe" or that it it couldn't find "cube.gbas"?

Jalecko
Posts: 11
Joined: 23 Aug 2020, 10:47

Re: gtBASIC

Post by Jalecko » 02 Sep 2020, 18:27

When i write:

gtbasic Cube.gbas
it says:
'gtbasic' is not recognized as an internal or external command,
operable program or batch file.

and when i write

gtbasic.cpp Cube.gbas it opens notepad++

at67
Posts: 201
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 » 02 Sep 2020, 21:04

It sounds like gtbasic.exe hasn't been built, did you do the following?

Code: Select all

Building

    CMake 3.7 or higher is required for building, has been tested on Windows with Visual Studio and gcc/mingw32
    and also built and tested under Linux.
    A C++ compiler that supports modern STL, (Visual C++ 15 or higher, gcc, etc).
    Requires the latest version of SDL2 and it's appropriate include/library/shared files.
    For detailed instructions for Windows, Linux and macOS, see this thread in the Gigatron forum:
    https://forum.gigatron.io/viewtopic.php?p=368#p368

Windows

  Download and install cmake
  Download sdl2 development libraries https://www.libsdl.org/download-2.0.php
  Clone or download https://github.com/kervinck/gigatron-rom
  cd gigatron-rom\Contrib\at67
  cmake .

    Open gtemuAT67.sln into Visual Studio, compile and execute.
    Optional: if you want to be able to develop using SDL2 without having to configure the include and lib variables
    for each new project, then add an environment variable SDL2DIR pointing to the directory you installed SDL2 into.

Linux

  sudo apt-get -y install cmake libsdl2-dev
  git clone https://github.com/kervinck/gigatron-rom
  cd gigatron-rom/Contrib/at67
  cmake .
  make
  ./gtemuAT67
  
After you've built it you can then cd into Contrib\at67\tools\gtbasic and you will find the executable in there, (add Release or Debug for Windows, depending on which you built). If when running cmake you specify an out of source build directory, (e.g. d:\gigatron\buildx64), then you would find it in d:\gigatron\buildx64\tools\gtbasic

You can also compile and execute .gbas files, (and others such as .gasm, .gt1, .gcl, etc), directly in the emulator by left clicking on them in the emulator browser. If you right click on them and you have configured "loader_config.ini" correctly as well as setup an appropriate Arduino solution, then they will be directly uploaded to your Gigatron hardware.

Jalecko
Posts: 11
Joined: 23 Aug 2020, 10:47

Re: gtBASIC

Post by Jalecko » 28 Sep 2020, 20:34

so i finally managed to do some more but i got this error message

****************************************************************************************************
* Compiling file './Cube.gbas'
****************************************************************************************************
Compiler::initialiseMacros() : Failed to open file : './../runtime/macros.i'
Linker::loadInclude() : Failed to open file : 'math.i'

i also didn't manage to get gtemu to work
8>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
8>Project not selected to build for this solution configuration
========== Build: 7 succeeded, 0 failed, 0 up-to-date, 1 skipped ==========

at67
Posts: 201
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 » 29 Sep 2020, 13:30

Jalecko wrote:
28 Sep 2020, 20:34
Compiler::initialiseMacros() : Failed to open file : './../runtime/macros.i'
Linker::loadInclude() : Failed to open file : 'math.i'
This means the path to the runtime, (a bunch of *.i files), is not correct. By default it expects the *.i files to be in "..\runtime".

If they are not, then you can specify the path yourself, (either relative or absolute), like this, (these are just examples), find the "runtime" directory on your system and specify it in either a relative or an absolute way, as shown:

Code: Select all

1: gtbasic cube.gbas ..\..\runtime
2: gtbasic cube.gbas c:\blah\blah\runtime
Jalecko wrote:
28 Sep 2020, 20:34
i also didn't manage to get gtemu to work
8>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
8>Project not selected to build for this solution configuration
========== Build: 7 succeeded, 0 failed, 0 up-to-date, 1 skipped ==========
1: You are building the DEBUG version which will be horribly slow because of all the STL runtime checks, select Release and build that one.

2: You need to select the correct project as "Startup project", i.e. right click on gtemuAT67 in the left hand Solution Explorer Pane of Visual Studio and then find the "Set as Startup Project" in the menu list and left click. This will now select the gtemuAT67 project as the executable project. Then you can hit CTRL-F5 to execute.

3: You can also move the executable anywhere you like, as long as it can find the SDL2 DLL and *.ini config files, (if you have configured any).

Jalecko
Posts: 11
Joined: 23 Aug 2020, 10:47

Re: gtBASIC

Post by Jalecko » 01 Oct 2020, 19:24

Thank you I have finally managed to compile my first .GBAS file. Now i can finally look further into making my own sd card loader program

Jalecko
Posts: 11
Joined: 23 Aug 2020, 10:47

Re: gtBASIC

Post by Jalecko » 04 Oct 2020, 18:17

Ok so i'm spending some time with the compiler and looking at different GBAS files to get an insight of how everything works
but i have walked up to a pretty weird problem already

but everytime i compile this piece of code and try to run it on my gigatron it doesnt wanna work or my gigatron starts doing weird stuff

_runtimePath_ "\runtime"
_runtimeStart_ &h7FFF
_codeRomType_ ROMv4

cls
10 colour = rnd(0) AND 63)
11 set FG_COLOUR, colour
20 at rnd(160),rnd(120)
40 line rnd(320)-160,rnd(240)-120
50 goto 10

Is there perhaps a place with the documentation?

at67
Posts: 201
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 » 04 Oct 2020, 19:03

Jalecko wrote:
04 Oct 2020, 18:17
_runtimePath_ "\runtime"
_runtimeStart_ &h7FFF
_codeRomType_ ROMv4

cls
10 colour = rnd(0) AND 63)
11 set FG_COLOUR, colour
20 at rnd(160),rnd(120)
40 line rnd(320)-160,rnd(240)-120
50 goto 10
Line 10 should be giving you a syntax error because of the extra closing bracket at the end, if it isn't then you have found a parsing bug /sigh

Line 11 and 20 are fine.

Line 40 is incorrect, when you use the Line command with only 2 parameters it works exactly the same way as Marcel's implementation: i.e. the two parameters should be offsets, these offsets are added to the at command's parameters to get the final values for the Line command.

e.g.

Code: Select all

at 10, 10
line 1, 1
is the same as

Code: Select all

line 10, 10, 11, 11
Your usage of it is randomly overwriting non screen memory, a simpler, (and faster version), of what I think you are trying to do, would be:

Code: Select all

remove line 20
40 line rnd(160), rnd(120), rnd(160), rnd(120)
Jalecko wrote:
04 Oct 2020, 18:17
Is there perhaps a place with the documentation?
The documentation is still not done, I haven't been well so I have had to have a break unfortunately, I'll get back to it when I can.

delpozzo
Posts: 24
Joined: 03 Jun 2020, 18:47

Re: gtBASIC

Post by delpozzo » 08 Oct 2020, 20:08

at67 wrote:
04 Oct 2020, 19:03
The documentation is still not done, I haven't been well so I have had to have a break unfortunately, I'll get back to it when I can.
I'm really sorry to hear this at67, I hope all is well and wish you a speedy recovery.

Just wanted to let you know that I've been developing a video poker game for Gigatron in gtBASIC. I've had a blast working on the project and can't thank you enough for your compiler. I'm really enjoying gtBASIC!

Once the game gets closer to completion I'll start a new thread, but for now I'm keeping the progress up to date on my GitHub repo here: https://github.com/delpozzo/gigatron

at67
Posts: 201
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 » 09 Oct 2020, 04:42

delpozzo wrote:
08 Oct 2020, 20:08
Just wanted to let you know that I've been developing a video poker game for Gigatron in gtBASIC. I've had a blast working on the project and can't thank you enough for your compiler. I'm really enjoying gtBASIC!

Once the game gets closer to completion I'll start a new thread, but for now I'm keeping the progress up to date on my GitHub repo here: https://github.com/delpozzo/gigatron
That looks great!

I had a quick scan through your files and it made me quite emotional seeing all those thousands of hours brought to fruition through someone else's code :)

Post Reply