# Run TIC80 on GS

**URL:** <https://forum.clockworkpi.com/t/run-tic80-on-gs/1121>\
**Category:** Developers\
**Tags:** tic80, gameshell\
**Created:** [August 1, 2018, 8:41am UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121 "2018-08-01T08:41:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![guu](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@guu](https://forum.clockworkpi.com/u/guu)\
**Post date:** [August 1, 2018, 8:41am UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/1 "2018-08-01T08:41:54Z")

</div>

A little edit to run [TIC80](https://github.com/nesbox/TIC-80) 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](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/e36adf2a8a0d27958190d9b43d3b62638267a713.png)

## demo p3d

 ![demo_p3d](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/8756b93fe8008126ff2bbd78e6799f065fd2c834.png)

 ![demo_p3d_2](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/cd70e91165f76d2690a0ea1e0b15a51026ebbd86.png)

 ![demo_tetris](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/95b76b9242bbbc1dc32bae41d836008487b26d01.png)

## demo benchmark:

 ![demo_benchmark_1](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/232713cf68844d1e659d2f93005df700b57f66cb.png) ![demo_benchmark_4](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/b012d90fd907adaef08f9b52b950951f77ae90b9.png) ![demo_benchmark_2](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/1704e8dc87e570fee9d47d04ef84e66044da6f66.png) ![demo_benchmark_3](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/fe83e0240dbfb73699276d34c34fd7d8e82bfbac.png) ![demo_benchmark_5](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/66e59cae4dd7458ab387d4a10f81a7d3692e9196.png)

## code editor

 ![code_editor](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/1X/95ef2b12caae5c0a915e9c9934bbae917113ab8a.png)

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

---

<div class="post-metadata">

**Author:** ![macario](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/macario/32/14564_2.png) [@macario](https://forum.clockworkpi.com/u/macario)\
**Post date:** [August 1, 2018, 9:35am UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/2 "2018-08-01T09:35:25Z")

</div>

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**

```auto
#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:**

```auto
#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.

---

<div class="post-metadata">

**Author:** ![guu](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@guu](https://forum.clockworkpi.com/u/guu)\
**Post date:** [August 1, 2018, 10:30am UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/3 "2018-08-01T10:30:53Z")

</div>

great , I am gonna test again  
🙂

---

<div class="post-metadata">

**Author:** ![guu](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@guu](https://forum.clockworkpi.com/u/guu)\
**Post date:** [August 1, 2018, 11:41am UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/4 "2018-08-01T11:41:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![macario](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/macario/32/14564_2.png) [@macario](https://forum.clockworkpi.com/u/macario)\
**Post date:** [August 1, 2018, 12:28pm UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/5 "2018-08-01T12:28:48Z")

</div>

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_):

```auto
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.

---

<div class="post-metadata">

**Author:** ![guu](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@guu](https://forum.clockworkpi.com/u/guu)\
**Post date:** [February 26, 2019, 4:13pm UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/6 "2019-02-26T16:13:12Z")

</div>

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](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/4/449af242bb09190fa92de874f44ff441534421d2.png)

![tic80_2](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/f/f64653025216a172f32309bf83d5d54f17fda02b.png)

![tic80_3](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/d/d880c89370a2dcbf4953b4b14e6a378514333576.png)

![tic80_4](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/5/510bdbf9887b1f123be7cccb7142881afe78e23b.png)

it works well with lima driver

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

> **[cuu/TIC-80](https://github.com/cuu/TIC-80/releases/tag/gameshellv0.2)**
>
> TIC-80 is a fantasy computer for making, playing and sharing tiny games. - cuu/TIC-80

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

---

<div class="post-metadata">

**Author:** ![SpringHack](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/springhack/32/1777_2.png) [@SpringHack](https://forum.clockworkpi.com/u/SpringHack)\
**Post date:** [February 26, 2019, 5:32pm UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/7 "2019-02-26T17:32:19Z")

</div>

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](https://github.com/springhack/tic-80)

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

---

<div class="post-metadata">

**Author:** ![guu](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@guu](https://forum.clockworkpi.com/u/guu)\
**Post date:** [February 27, 2019, 1:16am UTC](https://forum.clockworkpi.com/t/run-tic80-on-gs/1121/8 "2019-02-27T01:16:36Z")

</div>

and it will be fullscreen?
