New games for the Gigatron

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

New games for the Gigatron

Post by Hans61 »

After it somehow with the software (games) does not really go on I tried to make something myself.
First I thought of something time uncritical. So I tried myself in a Sokoban for the Gigatron.
I still have many questions about the basic compiler, I list them below. It is not finished yet but it should be good to try it, I add the files.
I tested it on the emulator and on real hardware. The arrow keys move the player, Start (Del) restarts the level and A (PageUp) changes to the next level.
The As said it is not finished yet. It is still missing undo moves. Goto level would be perhaps also not bad. The 32k version has 81 levels, the 64k version 90.

Here first what I have so far:
gtsokoban_v1.gt1
(11.27 KiB) Downloaded 182 times
gtsokoban64k_v1.gt1
(12.69 KiB) Downloaded 148 times
sokoban-src.zip
(34.12 KiB) Downloaded 162 times

To program with the Basic compiler. I fished my way through the forum as best I could and looked at the examples. A command reference with the possible options would help me.
Here are my questions/comments:
1. bug?
What stopped me a bit was the bug, if you insert a comment on the line of a lab/mark, then the program is translated without errors, but when you get to the point the program does a restart. I mean in the form:
if a>b then goto lable
...
lable: ' this comment leads to a restart
...
2. there are possibilities for conditional compilation.
it would be useful for debugging or for 32k and 64k versions in one file

About the game code itself, it's not very perfect I still don't understand the compiler enough. Shift functions I didn't find right away, I did it with division and multiplication, that might be slower?
With arrays, due to the compression of the levels they are of different length. In a two dimensional array, I give away memory because of this, since I have to go by the largest.
Because of this I don't get all levels in the 32k version. Since I have as first byte the number of following bytes in the level I could hail me also well by a one-dimensional array.
Are there any restrictions on the length of one-dimensional arrays?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: New games for the Gigatron

Post by at67 »

Hans61 wrote: 23 May 2021, 21:51 The As said it is not finished yet. It is still missing undo moves. Goto level would be perhaps also not bad. The 32k version has 81 levels, the 64k version 90.
It looks great so far.
Hans61 wrote: 23 May 2021, 21:51 To program with the Basic compiler. I fished my way through the forum as best I could and looked at the examples. A command reference with the possible options would help me.
I'm finishing a new ROM, providing documentation for it, adding new ROM features to both the assembler and the compiler and trying to finish the compiler's documentation as well...all while working 5 days a week. I get back from work and I am exhausted unfortunately, I end up sleeping most of the weekend as well.

For now you're just going to have to sift through the many tutorials and examples.
Hans61 wrote: 23 May 2021, 21:51 Here are my questions/comments:
1. bug?
What stopped me a bit was the bug, if you insert a comment on the line of a lab/mark, then the program is translated without errors, but when you get to the point the program does a restart. I mean in the form:
if a>b then goto lable
...
lable: ' this comment leads to a restart
This is a bug, thanks for reporting it, a fix for it will be in the next release, (whenever that is).
Hans61 wrote: 23 May 2021, 21:51 2. there are possibilities for conditional compilation.
it would be useful for debugging or for 32k and 64k versions in one file
The assembler supports a rudimentary pre-processor, (%include, %if, %else, %endif), the compiler only supports the MODULE command, (same functionality as include), more work in this area for the compiler is on the TODO list.
Hans61 wrote: 23 May 2021, 21:51 About the game code itself, it's not very perfect I still don't understand the compiler enough. Shift functions I didn't find right away, I did it with division and multiplication, that might be slower?
Multiply, divide. mod are a few hundred times slower than LSL, LSR, ASR, AND, etc.
Hans61 wrote: 23 May 2021, 21:51 Are there any restrictions on the length of one-dimensional arrays?
Yes, the largest non fragmented section of memory is your limitation; i.e. in a 32K system if you intelligently design your memory map, you can get a little more that 1k of memory for a 1dimensional array. In a 64k RAM system you can get a full 32KBytes.

Use the pragma _runtimeStart_ &hFFFF to specify the runtime to begin at the top of a 64K memory map, or probably better in your case _arraysStart_ &hFFFF to force arrays to begin at the top of a 64K Memory map. This will produce a valid 64K .gt1 file, (that should be named with 64K in it's name for clarity).

P.S. It's OK to use multiply, divide, floating point and even transcendentals in CONST assignments and in bracketed expressions that include NO variables, the compiler will automatically evaluate the complex expression and return a 16bit signed result, (obviously your expression has to fit within this range to return a meaningful result).
walter
Site Admin
Posts: 160
Joined: 13 May 2018, 08:00

Re: New games for the Gigatron

Post by walter »

Nice to see new games emerging on the Gigatron! Marcel and I hoped the Giagtron would be mature enough to get a bit of a software ecosystem around it. That it also spawns a lot of ideas about Gigatron-like other systems is nice as well, of course, but I don't see them as a Gigatron, but as a separate DIY kit hobby project, just like the Gigatron.

The BASIC interpreter was would get people involved, and we now also have the BASIC compiler which is wonderful for less experienced people to start adding to that software ecosystem. So thanks Hans61 for creating the Sokuban port.

I just played a bit, but it got hard quick :) While in level 10, I discovered a little cheat: by combining two directions, e.g. up+right, you can pass blocks you shouldn't be able to pass.
delpozzo
Posts: 38
Joined: 03 Jun 2020, 18:47

Re: New games for the Gigatron

Post by delpozzo »

Great work Hans61! I was able to load this on my Gigatron and it played very nicely. I was also able to replicate the diagonal cheat that Walter mentioned :lol:

I'm not sure if this is useful for you, but I developed VideoPoker and FishTank in gtBASIC in case you were looking for any additional examples. The source code for both are available under my username in Contrib: https://github.com/kervinck/gigatron-ro ... b/delpozzo
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: New games for the Gigatron

Post by Hans61 »

at67 wrote: 24 May 2021, 09:25 I'm finishing a new ROM, providing documentation for it, adding new ROM features to both the assembler and the compiler and trying to finish the compiler's documentation as well...all while working 5 days a week. I get back from work and I am exhausted unfortunately, I end up sleeping most of the weekend as well.
I can understand that. I also have a 5 day work week and a large family that takes its toll. (4 kids, 5 grandkids) Thanks for the compiler. It is a great achievement. I am glad someone is working on the native code and ROM. I couldn't. It really brings the Gigatron to life or keeps it alive.
walter wrote: 24 May 2021, 11:14 I just played a bit, but it got hard quick :) While in level 10, I discovered a little cheat: by combining two directions, e.g. up+right, you can pass blocks you shouldn't be able to pass.
Thanks for pointing this out. I didn't notice this in the emulator when using the keyboard. On real hardware with the gamepad, I already had the impression that I could move the player diagonally as well. I didn't take into account that multiple keys can be pressed at the same time. I will still investigate this and fix it.
I think of these old time non-critical games it is not hard to make some more. I still have a few in mind that I used to like to play as well. I am an electronics engineer and programmer. As a designer I am very bad. You could maybe make some things more visually appealing.

Idea:
I would like it if a software, a game, could also store data (hitlists, own levels) or reload (levels). I can't get a thought out of my head. I think we all have hardware. I would simulate, emulate a floppy disk. I think the Gigatron could provide the CP/M BIOS functions and the PluggyReloaden could do all the management of those on an SD card. So manage a floppy as one file. The disk functions of the CP/M BIOS are select disk, set track number, set sector number, set dma address, read disk, write disk. select disk I would somehow abuse to select the file, set track number, set sector number is trivial, set dma address I would ignore and read disk, write disk are again trivial.
It would be useful in implementing CP/M and games could use it. With Apple][ the games also managed their own disks. And because the disk is only for the game, it doesn't have to follow any format or rules. I think you could also reduce the sector size to 64 bytes to keep the buffer small.

I hope the automatic translation is somewhat understandable. Sorry.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: New games for the Gigatron

Post by at67 »

Hans61 wrote: 24 May 2021, 19:10 I would like it if a software, a game, could also store data (hitlists, own levels) or reload (levels). I can't get a thought out of my head. I think we all have hardware. I would simulate, emulate a floppy disk. I think the Gigatron could provide the CP/M BIOS functions and the PluggyReloaden could do all the management of those on an SD card. So manage a floppy as one file. The disk functions of the CP/M BIOS are select disk, set track number, set sector
I have already written IO routines for the Pluggy Reloaded SD Card, but they haven't been fully translated into the compiler's BASIC command set yet. I'm also planning on writing IO calls for Marcel's/lb3361's expansion card as well.

The File/Folder access will be extremely simple and work in a similar way to C's fopen() mechanism, there will be no low level implementation or simulation of old school media like floppy or tape.
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: New games for the Gigatron

Post by Hans61 »

Here is my next version of gtSokoban
History of the program development (can be skipped)
The bug that you can jump diagonally is fixed. I also found some bad bugs. So I have not considered that a box can stand already to level start on the goal. What led from level 15 to the fact that there are more boxes than targets. Which leads to no end.
To implement this game code I removed the player from the compression and replaced it with a box on the target. Since the player can only exist once, I pass the x and y coordinates of the player before the level data. I also pass the number of the level. So in the 32k version the correct number of the level is shown, if I have to skip levels in the data for memory reasons. So level 10 is not included in the 32k version. The game then immediately jumps from 9 to 11.
I also experimented with storing the level data in a one dimensional array. This saves 30% of memory, because the padding to a constant length is omitted. Unfortunately it only works in the 64k version, where it doesn't really matter.
The original version 40 years ago also had a built-in level editor, so there are still countless user levels on the internet that I could add. But I think the existing ones should be enough for a while.
The current version:
Operation:
The arrow keys on the keyboard or gamepad move the player.
The key + or B on the gamepad change to the next level.
The key - or A on the gamepad switch to the previous level, for level 1 to the last one in the game.
The n/N or Start button on the gamepad restarts the current level.
The r/R or Select key on the gamepad will undo the last move made. Up to 50 moves can be undone.

gtsokoban is the current 32k version, it contains 75 levels gtsokoban64k and gtsokoban64k1d are the 64k versions they only differ internally in the storage of the level data 2 dimentionales/ 1 dimentionales array (30% less memory for the level data), both contain 90 levels.
gtsokoban.gt1
(12.07 KiB) Downloaded 142 times
gtsokoban64k.gt1
(14.26 KiB) Downloaded 124 times
gtsokoban64k1d.gt1
(11.61 KiB) Downloaded 130 times
gtsokoban-src.zip
(123.31 KiB) Downloaded 132 times
The game should be ready for now. The only thing missing is some sound, but I'm not a sound person. Let's see if I still want to do that. Please report bugs and change requests.
I also made a list of old games, which I thought of and which are possible on the graphics of the Gigatron. So there will follow some more. I just can't promise how fast.
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: New games for the Gigatron

Post by Hans61 »

gtSokoban the third
So I still found some mistakes. The level 20 was not the original level and it was not solvable. I have corrected the levels. I also noticed that in the original game the box at the finish is displayed in a different color. This is very useful for levels where there are already boxes at the start of the level. I also added a direct selection of a level, via the g|G key.
The 64k version contains all 90 original levels. The 32k version still has 66 levels. I lost 9 levels (a 96 bytes = 864 bytes) by "relatively" little new code. I do not understand the Basic Compiler yet for a long time. I approach with small steps.
I then get an error when linking: "Memory::getNextCodeAddress() : Couldn't find free code pace in RAM od size 9 bytes". I think it lacks enough contiguous memory, but I don't know.
Here are the current versions. I have played the game up to level 28. So far everything is ok.
gtsokoban-src.zip
(89.01 KiB) Downloaded 128 times
gtsokoban64k.gt1
(15.17 KiB) Downloaded 146 times
gtsokoban.gt1
(12.11 KiB) Downloaded 134 times
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: New games for the Gigatron

Post by at67 »

I've added your GT1 files to the GT1 repository at: https://www.dropbox.com/sh/4bbys2afg9y6 ... tlBza?dl=0
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: New games for the Gigatron

Post by Hans61 »

Thank you is a great honor for me.
I must once again submit an update. I have noticed that the level 50 has an error and does not correspond to the original. It is now corrected. My wife has now played the game to level 88. There should be no more errors now. To make it easier for me, I had imported the levels from an open source source with a small Python script.
gtsokoban.gt1
(12.11 KiB) Downloaded 158 times
gtsokoban64k.gt1
(15.17 KiB) Downloaded 141 times
gtsokoban-src.zip
(89.03 KiB) Downloaded 155 times
Post Reply