30th of April 2021 Porting GS BASIC – to PiTrex (9)

Ok. Yes.

I will not say again, that I did not do anything wrong… (I probably will though).

PiTrex GS BASIC is looking good today! For now I think everything is working. I should probably not look again at it – so I won’t find any more faults.

I guess I spent about 20 hours to locate the things I fixed today. While it was stressfull in those 20 hours, it is nice to be able to say “done it!”.

Mainly there were three “hidden features” (euphemism for wrong doings).

1) The Large Vectors 1

For optimization I removed the parameter „eliminateTrailingMove“  For some (unkown) reason this completely threw the „ToVectrexCoordinates()“ function of balance.  For now I have put it in again – and everything works.
But the vectrexInterface library uses absolute coordinates everywhere – so in the long run I’ll return to that and will optimze it (in a non fatal way). At the moment GS BASIC holds positioning in absolut values. When transporting them to the vectrex, above function (amongst other things) converts the coordinates to relative coordinates. AFTER that I intercept and do not output to Vectrex but to my vectrexInterface library – where again I convert them to absolut coordinates.

Naturally in the long run – this is stupid and a waste of resources. But for now I just want it to work. I know where the risks and features are hidden now and I will return and optimize at a later date!

2) The displaced „sprites“ in Startrek

This is due to the fact, the original Vectrex32 positions with scale and move on the vectrex. It uses the original functions and thus the “original” scale and strength. E.g. using a scale of 10 and a strength of 100 and go to position 1000.
The scale and the strength can mathematically not be calculated like that. Within my library I use a correction factor. I had not used the correction factor with the  BASIC. Once I implemented that – the sprites were positioned Ok.

3) The Large Vectors 2

In VX Tron – the movement speed is calculated in relation to the GetTicks() from the BASIC. I had not looked up which value that returned, but just returned my own „Ticks“. But my Tick count was nearly 1000 times as high as the “original” (1Mhz timer) – I have now read up on the GetTicks() function (960 ticks per second) and after that corrected my GetTicks() function… VxTron works :-).

With this I close this “blog” feature … BASIC is running. What is left will be done without to much blogging.


A few random thoughts/information:

Following functions do not make sense in PiTrex environment – and are thus not implemented. (they are callable, but return “0” and give out a one time message, that they are not supported):

 static ErrorCode Upgrade()
 static ErrorCode Downgrade()
 static ErrorCode PatchCode()
 static ErrorCode Poke()
 static ErrorCode PokeW()
 static ErrorCode JSR()
 static ErrorCode CodeSprite()
 static ErrorCode GetFlashChecksum()
 static ErrorCode GetCompiledSpriteCount()
 static ErrorCode DumpMemory()
 static ErrorCode DumpDisk()
 static ErrorCode DumpDPRAM()
 static ErrorCode DumpDPRAMMirror()
 static ErrorCode DumpMem()
 static ErrorCode DumpFlashErrors()

 static ErrorCode Peek()

The last function (Peek()) can be used to determine whether the BASIC is running on a PiTrex. If you peek at an address that you KNOW is non zero the peek() returns 0 nonetheless – than the BASIC is running on a PiTrex :-).


Following functions are on my immediate todo list:
(they are callable and return no error – but do nothing!)

static ErrorCode Explosion()
static ErrorCode MusicIsPlaying()
static ErrorCode Play()
static ErrorCode Music()
static ErrorCode BreakOnControlC()

I want to add three function (groups) to the BASIC:

  • playYM()
  • playSample()
  • playSFX()

Which would greatly reduce the overhead VxTron does to play more elaborate sounds than the “normal” Vectrex.


I have not talked with Bob about the next steps, so following questions can not be answered yet:

  • when will GS Basic be available to the PiTrex users?
  • will the source code be made available?

What I can say is: Bob will not support GS BASIC on the PiTrex. This is a goody grown on my “land” and I don’t want to cause Bob any more trouble or want him to spend his free time with a port he did not do himself.


Tagged on: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.