Page 3 of 44

Re: gtBASIC

Posted: 30 May 2020, 09:40
by walter
That video put a smile on my face :-)

Re: gtBASIC

Posted: 31 May 2020, 02:50
by at67
walter wrote: 30 May 2020, 09:40 That video put a smile on my face :-)
:)

Re: gtBASIC

Posted: 06 Jun 2020, 08:25
by at67
Ver 0.9.9B, (Beta)

- Added 'BCDADD', 'BCDSUB' and 'BCDINT' to the BASIC compiler; these commands provide basic arithmetic for unpacked BCD, (one digit per byte), of any length, (until you run out of RAM). Great for scores and high score tables.
- Added an overlap option to sprites, this allows sprites to be drawn with widths that are NOT a multiple of six. The artist is required to allow for the overlap when generating sprite images.
- Added the 'POLYR' keyword, this is a relative coord system version of 'POLY' that allows for offsets and symmetry flipping in the X and Y directions. Great for generating symmetrical and instanced levels that require vector graphics.
- Added byte arrays to the BASIC compiler, they work exactly the same way as normal 16 bit integer arrays except that their syntax requires a '%' in the DIM statement; e.g. DIM test%(10). Note the '%' is ONLY required in the DIM statement and is not used again.
- Added fast boolean conditionals to the expression handler, you can now create code like this 'IF &(a) THEN blah'. This generates a branch that tests for equality to zero without requiring a call to a relational operator handler. Brackets around the expression are ALWAYS required when using this optimisation, (0 = false, !0 = true). The BEQ is subject to the same limitation that all other BRA's are subject to, namely they cannot cross 256 byte page boundaries; the validator will inform you if page crossings occur.
- Added optimised GOSUB's using the following syntax, 'GOSUB &label', this optimisation foregoes that 'PUSH' preamble within the called subroutine; used for leaf subroutines, vertical blank handlers, ASM subroutines, etc. When using this, you MUST use 'RET' and NOT 'RETURN' when exiting your subroutine.
- Added the 'FOREVER' keyword to 'REPEAT', this is another way of creating a 'GOTO' loop, but without the requirement of a label.
- Added optimisation sequences for byte arrays.
- Added _maxNumSprites_ pragma so that >48 sprites can be used on 32K RAM systems, this MUST be set to the exact number of sprites you have defined, whether instanced or not. (It defines the size of the sprite dictionary and allows it to be pre-allocated before contiguous sections of RAM larger than 96 bytes are no longer available).
- Array size parsing was limited to literals, it has now been upgraded to allow full constant expressions, e.g. 'DIM test(NUM_ENTRIES*2 - 1)'.
- Fixed nested 'IF ENDIF' pairs, 'ENDIF' label lists are now assigned per 'IF ENDIF' pair, rather than as a global list, (nasty bug).
- Fixed a rare bug in the pragma parser.
- Fixed two array optimisation sequences that were not being activated correctly.

Re: gtBASIC

Posted: 22 Jun 2020, 10:59
by at67
Ver 1.0.0B, (Beta)

- Added an address offset option to the Assembler's 'DB and 'DW' commands, the offset is calculated as N * sizeof(TYPE); e.g. 'DB(4) 0 1 2 3 4' will increment the address by 4 bytes for each defined byte. 'DW(4) 0 1 2 3 4' would increment the address by 8 bytes for each defined word, useful for creating interlaced data, (see PucMon for an example).
- Added a simple audio wave editor for the inbuilt audio channels, allows more complex sound effects to be created, (see PucMon for an example); saves in a trivial 64 byte binary format '.gtwav'.
- Added the 'WAVE' option to 'LOAD', e.g. 'LOAD WAVE, <filename>, <optional address>, <optional offset>'
- Added 'CALL' 'PROC' and 'ENDPROC', these allow for procedures to be defined that can accept parameters and local variables.
  • Recursion will NOT work.
  • Total number of parameters PLUS local variables is limited to 8.
  • Calling different procedures within a procedure MAY work, as long as the called procedure does not use any local/param slots that the callee procedure is using; see PucMon for examples.
  • Gosub within PROCS will work correctly.
- Added 'LOCAL' for the defining of local variables within procedures; see PucMon for examples.
- Added the '_tempVarSize_' pragma, this allows you to choose how large the temporary expression area is, (defaults to 8 bytes).
- Added 'MIN()', 'MAX()' and 'CLAMP()' functions.
- Added 'BCDCPY' for copying a source BCD numeric to a destination BCD numeric, both MUST be the same size.
- Added the 'VARS' option to 'INIT', e.g. 'INIT VARS <optional start var address>', this will zero all user global variables starting at the optional start var and ending at the end of user var space.
- Added extra emulator commands/keys for the image and audio editors, (CTRL + I and CTRL + A); the image editor is unfinished.
- Added the printing of thunk and total thunk size stats to the compiler output.
- Refactored the Keywords: module into separate Operators:, Functions:, Keywords: and Pragmas: modules.
- Added the 'MUSIC_NOTE' system variable to the 'GET' command; e.g. 'GET("MUSIC_NOTE", <note>)' which does a ROM lookup and converts a standard 8 octave midi note byte, (0 <-> 127), into a Gigatron specific audio frequency value, (which can then be used with the 'SOUND' command); see PucMon for many examples.
- Added the 'MUSIC' option to the 'PLAY' command, this uses note commands/data in the exact same format as the 'PLAY MIDI' command, but plays the stream modally rather than in the background; see PucMon for an example.
- Added the Menu: and Dialog modules, which are simple UI code blocks designed to be used by various parts of the emulator, (editors, terminal, etc).
- Changed the allocation of runtime memory to prioritise larger runtime subroutines over smaller ones, this gives the runtime a better chance of being loaded successfully as RAM size gets smaller and more fragmented.
- Refactored test code out of the main modules into it's own specific Test: module.
- Fixed Terminal mode so that it is more consistent when toggling with other system modules.
- Rearranged zero page variables, minimum stack size is guaranteed to be 16 bytes, (but may be larger depending on your expression temporary var usage). This allows for a minimum guaranteed gosub/call nested depth of 8, INCLUDING the runtime!

Re: gtBASIC

Posted: 25 Jun 2020, 07:35
by jurkstas
Hi at67,

This is awesome. Thank you.

Is there an include/import/copy directive for gtbas code modules?

Re: gtBASIC

Posted: 25 Jun 2020, 08:20
by at67
jurkstas wrote: 25 Jun 2020, 07:35 Is there an include/import/copy directive for gtbas code modules?
There is for the assembler but not for the compiler yet, it should be in for the next version; but no promises :)

Re: gtBASIC

Posted: 25 Jun 2020, 08:50
by jurkstas
at67 wrote: 25 Jun 2020, 08:20
jurkstas wrote: 25 Jun 2020, 07:35 Is there an include/import/copy directive for gtbas code modules?
There is for the assembler but not for the compiler yet, it should be in for the next version; but no promises :)
Thanks. Then copy/paste it is :)

Re: gtBASIC

Posted: 27 Jun 2020, 22:20
by RetroCode
There is some truly impressive work (going on) here, and it's a fascinating read (although I'll need to study hard to understand it all)

Guess I'll need to upgrade the RAM at some point... and definitely I'm going to have to work on getting a loader working.

Re: gtBASIC

Posted: 28 Jun 2020, 08:11
by at67
Ver 1.0.1B, (Beta)

- Added rect clear to 'CLS', e.g. 'CLS <address>, <width>, <height>'
- Added [Comms]:Enable to loader_config.ini, this toggle enables/disables communications to a suitably configured Arduino connected to real Gigatron hardware.
- Fixed the 'LSL' and '<<' commands not emitting correct instructions in some cases.
- Fixed 'CLS <address>', address was not being parsed correctly.
- Fixed 'CLS INIT', INIT was not being parsed correctly.
- Refactored the Loader module's opening and closing of COM ports to a global scope rather than locally around each section of comms traffic. This was causing BabelFish to resend version info each time the comms port was opened.
- Refactored the Loader module's error handling for COM ports; the result is less comms timeouts and erroneous behaviours for misconfigured or non functioning COM ports.
- Optimised 'CLS <address>, <width>, <height>' for ROMv1.
- Added void casts for Linux/Mac gcc.

I am planning on adding the following to Ver 1.0.2B
- FUNC and ENDFUNC: will work the same way as PROC and ENDPROC but return a result.
- MODULE: will recursively include gbas code modules in place.
- TYPE ENDTYPE AS: will allow for collections of different types, (i.e. struct), all members will be addresses apart from ints which will be by value.
- I've started a Space Invaders clone and will post a video once I have something decent to show.

Re: gtBASIC

Posted: 02 Sep 2020, 13:00
by Jalecko
I'm quite new to using compilers, but after reading the readme i typed in cmd

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