Run TIC80 on GS

A little edit to run TIC80 on GS

version : git clone ,with short hash dbb762d

src/system.c
line 15

#define STUDIO_UI_SCALE 1

include/tic80.h
start line 32:

#define TIC80_WIDTH 320
#define TIC80_HEIGHT 240
#define TIC80_FULLWIDTH 336
#define TIC80_FULLHEIGHT 248

src/tic.h
start line 54

#define TIC_VRAM_SIZE (38*1024) //38k
#define TIC_RAM_SIZE (146*1024) // 146k

src/tic.c
line 77

STATIC_ASSERT(tic_map, sizeof(tic_map) < 1024*76);

now compile tic80 as document says

here is some screenshots run tests, some of them look not well because of resulotion changed, tic80 res is 240x136

demo fire

demo_fire

demo p3d

demo_p3d

demo_p3d_2

demo_tetris

demo benchmark:

demo_benchmark_1 demo_benchmark_4 demo_benchmark_2 demo_benchmark_3 demo_benchmark_5

code editor

code_editor

the performance is good
I think just change the resolution in code of game may fit GS as well

3 Likes

Great that you have got TIC80 to run in native resolution @guu, it is a great platform. It says much to the credit of @nesbox that the code is so configurable.

However there are some portions of the code that rely on the framebuffer width being a power of two (e.g. src/tic.c:80) and that could explain the background tiling issues you are seeing in the Tetris demo.

In order to address this you will need to increase TIC80_FULLWIDTH_BITS:

include/tic80.h:32

#define TIC80_WIDTH 320
#define TIC80_HEIGHT 240
#define TIC80_FULLWIDTH_BITS 9
#define TIC80_FULLWIDTH (1 << TIC80_FULLWIDTH_BITS)
#define TIC80_FULLHEIGHT 256

and then the memory sizes need updating:

src/tic.h:54:

#define TIC_VRAM_SIZE (64*1024) //38k
#define TIC_RAM_SIZE (128*1024) // 128k

So now we have TIC128, not TIC80. Games which rely on the memory map will not work but those using API functions instead of PEEK / POKE / MEMSET / MEMCPY should do.

BTW, I don’t understand with the tile map structure (tic_map) changes in size. Also I haven’t been able to try any of this as I am yet to receive my GS.

great , I am gonna test again
:slight_smile:

1 Like

tic_map is an array of u8[ TIC80_WIDTH * TIC80_HEIGHT]

so 128k is not enough for TIC_RAM_SIZE

with TIC80_FULLWIDTH_BITS 9

I changed TIC_RAM_SIZE to be 176*1024 ,176k,it compiled
but tetris still the same

well, maybe I need to change the code of tetris

1 Like

I see; since I saw u8[ TIC80_MAP_WIDTH * TIC80_MAP_HEIGHT] I thought it was the size of the tilesheet, but actually it is the size of the framebuffer rounded to tile sizes. Then we have to account twice for the increment in size (once for vram, once for map):

typedef union
{
	struct
	{
		tic_vram vram;
		tic_tiles tiles;
		tic_tiles sprites;
		tic_map map;
		tic80_input input;
		u8 unknown[16];
		tic_sound_register registers[TIC_SOUND_CHANNELS];
		tic_sfx sfx;
		tic_music music;
		tic_music_pos music_pos;
	};

	u8 data[TIC_RAM_SIZE];
} tic_ram;

Thus 80 - 16 + 64 - 16 + 64 should do, which is the same 176K which you have got.

After more digging now

I made a variant of tic80 ,fullscreen,stretched to fit gameshell screen as big as it can

menu key to exit

tic80_1

tic80_2

tic80_3

tic80_4

it works well with lima driver

If someone is interested, you can download the deb to install it, depending on libgtk-3-0

then put *.tic files to ~/games/TIC-80

But games run as resolution in 240x136, that’s weird, so I change the uiscale params.

Here is my change: https://github.com/springhack/tic-80

Just run tic-80 like: DISPLAY=:0 ./tic80 -uiscale 1.25

and it will be fullscreen?