WEBVTT

00:00.000 --> 00:13.640
All right, if I could have your attention, we've had two talks on embedded systems, and now

00:13.640 --> 00:20.040
we're going to have a talk about Rust Boy, afraid of Rico.

00:20.040 --> 00:23.760
Hello, hello to everyone.

00:23.760 --> 00:34.800
We have a warm welcome, thank you.

00:34.800 --> 00:35.800
Thank you.

00:35.800 --> 00:37.160
I want to talk to you about Rust Boy.

00:37.160 --> 00:43.320
It's an idea to make a game for the Game Boy.

00:43.320 --> 00:51.080
First, to enter in the talk, I want to tell you my story.

00:51.080 --> 00:53.480
I always love the Game Boy.

00:53.480 --> 01:05.240
This is my Game Boy from my childhood, and I think that is the best consult that I have.

01:05.240 --> 01:08.840
This is me when I play the Game Boy.

01:08.840 --> 01:14.080
As you can see, there is something wrong, because in the 90s, my parents didn't take

01:14.080 --> 01:21.800
a fourth of me play Game Boy, so I generated with the chat, the GPT, and it's something,

01:21.800 --> 01:23.800
I think.

01:23.800 --> 01:33.080
I grew up, and I always passionate about the tech and the programming, I am a developer

01:33.320 --> 01:41.480
of a stuck developer, and in the recent years, I enter in a developer loop, something

01:41.480 --> 01:49.160
like boring life, we have a problem, find the problem, replicate the problem, search for

01:49.160 --> 01:57.960
the problem, ask to find the solution, try the solution, it's a loop, it's a boring loop,

01:58.040 --> 02:05.960
the last year, I came here in fourth of them, and I reach a tutorial, I fell in love with

02:05.960 --> 02:15.960
a tutorial here, one in this room about Rust and Ratatoui and Tui, and another one about

02:15.960 --> 02:27.080
talking about the making games for Game Boy in the modern time.

02:27.160 --> 02:35.160
So, before we go ahead, I want to talk about the hardware of the Game Boy, this is all the

02:35.160 --> 02:43.880
Game Boy that an Nintendo ever product, and the interesting only for the Game Boy, not the

02:43.880 --> 02:54.200
Nintendo DSLine, and there is some names in the Lichteratoui we found, so GP for the first

02:54.280 --> 03:00.360
Game Boy, GP also for the second Game Boy, the Game Boy pocket, it's a little bit smaller,

03:00.360 --> 03:07.160
and Game Boy call or is called the ZBC, and Game Boy Advance is G-G-J-B-A, okay.

03:09.000 --> 03:16.200
There is a community, a big community for the developing games of Game Boy,

03:16.200 --> 03:23.640
and it's in this site, GBDev.io, and there is a lot of documentation about Game Boy about

03:23.720 --> 03:32.680
the hardware, about the function, about all the information, about Game Boy, today is in here.

03:35.240 --> 03:45.000
The Game Boy, the Game Boy work, the most common instruction for the Game Boy is about writing

03:45.080 --> 03:53.560
a RAM, there is some section of the RAM to do things, so we have the first to choose section,

03:54.200 --> 04:02.680
that is a ROM in the cartridge, in the cartridge, and there is a video RAM you put here,

04:02.680 --> 04:08.440
some bits, and he printed the screen of the Game Boy, and the work here RAM from the variables

04:08.520 --> 04:18.440
and values and process stuff. There is also section to check if input is pressed or less, okay.

04:20.200 --> 04:27.880
And the Game Boy, and Game Boy color is very similar, the main difference is about the color,

04:27.960 --> 04:38.920
so the CPU is the same, change some things in the color management, and of course the screen

04:38.920 --> 04:47.880
that is the Game Boy color, a box color. I want to talk about a little bit about the CPU,

04:48.760 --> 04:55.000
the CPU didn't have a name or a brand, it's a custom CPU,

04:57.000 --> 05:08.040
of 10 is called the Z80 CPU modified, but some researchers tell us that it's a sharp SM83,

05:08.760 --> 05:18.840
okay. It's important because Rust don't compile for SM83. How to make games today?

05:20.680 --> 05:28.840
Obviously, of course, in asthma, in asthma, it's an assembler very similar to Z80,

05:28.840 --> 05:36.280
sharp make this architecture, of course, to simplify the life of the programmers.

05:38.600 --> 05:47.000
And there is a project called the RGBDS, that is an assembler, a linker, and also

05:48.440 --> 05:55.880
fixer, and there are also software to utilities to make a Game Boy game.

05:58.040 --> 06:06.040
There is a cross platform, they have kit for the Game Boy, that you can program in C and asthma,

06:06.360 --> 06:15.720
and the most interesting, either to program Game Boy games. Today, maybe it's a GB Studio,

06:15.720 --> 06:24.920
that is something like an enzyme, something like god or unity, you can do games, you can make games

06:24.920 --> 06:32.520
with this without code. It's an accord, and the small script that you have to don't for a game,

06:33.480 --> 06:42.920
it's only virtual, visual block programming, okay. It's based on the GBDK, so you can also

06:43.720 --> 06:50.360
script in C or in assembly, and it's the, I think the most interesting right now.

06:51.560 --> 07:00.120
And Rust, as I said, Rust don't compile for this processor, so start what we have in Rust,

07:01.080 --> 07:08.520
in these two wars, not Rust and Game Boy. We have a lot of emulators, a lot of project in Rust,

07:08.520 --> 07:22.920
in WebAssembly, in educational proposed emulation project, a lot of, we have two or more

07:23.000 --> 07:30.360
crates to make games for GBA, Game Boy Advance instead, they have an armor processor, so Rust,

07:31.000 --> 07:37.960
it's a support it in the tire 3, if you know the compilation, the platform support,

07:38.680 --> 07:45.400
and so there is, there are some crates, GBA, and GBA is the most important to make games with

07:45.480 --> 07:53.640
for Game Boy Advance. There is also a few projects by this LFN, it's our username,

07:56.840 --> 08:06.760
that try to bake games with Rust. It's a workaround, so it's start from Rust, compiling LLA

08:06.760 --> 08:15.960
BOM here, and then in C, and then in Piling C, Zeta H assembly, then get the object code in GBA,

08:15.960 --> 08:27.320
Zeta 80, and then with a linker, make a wrong GBA, GBA. And there are other from the same user,

08:27.320 --> 08:35.160
Green Lift, Zeta 80, that do the same things, it's a workaround to obtain the compiling code.

08:37.720 --> 08:56.760
And we are Rust Boy, we have only one processor, SM83, so the idea is there, why not to make

08:56.840 --> 09:07.640
a compiler for this processor, Rust Compiler, it's a big idea, it's a big goal, and maybe

09:11.640 --> 09:23.320
there is, it will not, Rust Compiler is something similar, like GD script for Godot,

09:23.640 --> 09:34.840
similar to Python, it's a big idea, and to do that, I start with a Proof of Concept to see

09:36.120 --> 09:44.760
how hard they are, so the low level, I take the working base of the making Game Boy games,

09:44.840 --> 09:54.680
so GBDS, and assembly, I write the code over that, so I do the Rust Boy, it's a three-level

09:55.480 --> 10:03.720
library, and the low level GBAsman create the assembly, and that RGDBS assembly link,

10:03.720 --> 10:11.320
create the wrong, and then we go up the middle level, and the idle level to

10:12.280 --> 10:29.160
try to reach a code that it's a, I level language, okay, I start to develop in Rust Boy,

10:31.320 --> 10:38.040
making some reverse engineering from this game, this game it's, I found the tutorial to do this,

10:38.120 --> 10:46.120
so I take the code in assembly, and do some reverse engineering, to check if there is

10:46.120 --> 10:52.920
some sections, some logical section in assembly, and I show you this section that I found,

10:54.680 --> 11:01.480
there is some instruction that is at the start of the file, and it's the same for all the games,

11:01.480 --> 11:09.640
so I call in it's, I need it's section, okay, at the end of the file there is a section that is

11:09.640 --> 11:21.480
a declaration of variables, there is a section about tiles and tile map, tiles are a small tile

11:21.480 --> 11:29.960
of code, it's a it for it bit, it's for the graphics, it's the base graphic of the Game Boy,

11:30.040 --> 11:40.520
there is one for all the game, okay, tile and when I put a tile in the ram, it gives me ID, okay,

11:40.520 --> 11:50.280
with this ID I can draw the background, and I have obtained a tile map, okay, this down,

11:50.280 --> 11:57.560
this bottom is the tile map, is the ID about the tiles that I'm certain, okay, so there is a section

11:57.640 --> 12:09.160
where is tiles and tile map, there are in the code, there is a section that this tile map and tiles

12:09.160 --> 12:17.400
are copied in the ram, from the ROM of the character at the ram, there is a section about function,

12:17.400 --> 12:24.520
and there is the main section that is main loop, every game is in every, I think in giant,

12:24.600 --> 12:30.600
it's a main in loop, and in this main in loop, we are the game's logic, okay,

12:30.600 --> 12:38.760
a true important game's logic is about input, so check if I press some buttons, and the movement

12:38.760 --> 12:45.640
of the object, so the dynamic part of the games, we have the left, the right, check left, check

12:45.640 --> 12:54.440
if I press left button, the game is an arcanoid clone, so we have the paddle, okay, that move

12:54.520 --> 13:04.360
left and right, and then the bolt that move randomly, okay, so we have, so we have this section,

13:05.160 --> 13:12.520
okay, from this section I try to start to build the library, the low level is Gbiasm, it's,

13:13.480 --> 13:27.480
it's, it formalizes some concepts, it formalizes some concepts, like extraction and operators,

13:28.040 --> 13:35.080
it's one to one with assembly, so in the future we can change not to generate an assembly,

13:35.160 --> 13:46.920
but to generate maybe binary, okay, and it, it creates an array with destruction, and then

13:46.920 --> 13:57.240
I'll tend it to generate the assembly, okay, if we watch the code again, okay, it's written

13:57.240 --> 14:09.560
in Rust, so yeah, the goal is, okay, and it's one to one with assembly, okay, the second level,

14:09.560 --> 14:22.120
try to, to step up, okay, the middle level, okay, and I do these things, a chunk system, so I want to

14:22.440 --> 14:33.560
write a chunk of code in every part of my file or in another file, so I, I use this, so I put

14:33.560 --> 14:41.720
this instruction in the function section, put this function in the may look, put, okay, and I do tile

14:41.720 --> 14:51.080
map a tile utility, okay, because it's a lot of code, a lot of bit, a lot of something,

14:51.800 --> 14:58.680
a low level, not a tile level, a sprite manager to manage all the objects, sprite are the

14:58.680 --> 15:05.480
movement object in the game, and there is a niche, and I need a lot of them to have an

15:05.480 --> 15:15.480
if statement, so I want to make my if that translate in assembly, okay, the if logic,

15:15.560 --> 15:28.520
this is the code, it's a little bit clear, it's a little bit compact, I don't know, I use

15:28.520 --> 15:41.880
the asmodot chunk to set the chunk where I want to write the code after, okay, so I, okay, tiles,

15:41.960 --> 15:51.000
add the tiles, it's a utility, that add the tiles, the tiles, I, I transform it in a ray, okay,

15:52.200 --> 16:01.480
the main copy is not free structure, it's only one, okay, every utility is every function, that I wrote

16:02.360 --> 16:07.320
a return of that instruction, okay, so you can put whatever you want,

16:07.800 --> 16:18.200
this is the first attempt of the ifs, it's a mess, I don't like it, but see this code,

16:20.200 --> 16:32.600
I think that I do a better job in the second try, okay, and now we are at the active level,

16:32.600 --> 16:39.400
restboy, so I want to formalize some concept, I want to do better if statement,

16:40.920 --> 16:48.760
then it's a instruction, must be written in automatic way, I don't want to think about the

16:48.760 --> 16:55.720
initial structure, it's a instruction, there are some functions that can be considered right

16:55.720 --> 17:06.200
built-in, something like memcopy or the input check, and I want, I do, I did more managers,

17:06.200 --> 17:13.080
so manager for tiles, manager for input, I formalize some concept and I do the manager,

17:14.520 --> 17:25.160
and the goal is to add every reference to memory address, when we could, we don't care about

17:26.120 --> 17:33.800
more or less memory, so I try to do this things, and the code is a little bit clear,

17:34.680 --> 17:42.440
okay, this is always some break-up, so we have cost-on, we have tiles, it's more friendly,

17:42.440 --> 17:49.160
GB dot tiles dot at the background, okay, add the tile map, the paddle, the sprite for the

17:49.160 --> 18:00.120
paddle, the sprite for the ball, they need initial position, okay, there is also the variable

18:00.120 --> 18:07.800
section, function, some function to check, is volatile as to check if the ball bounce or not,

18:08.760 --> 18:21.160
and they if it's a little bit more readable, okay, if you see, okay, it's okay, it's all the code,

18:24.680 --> 18:33.080
okay, I do this code and I want to for today do a demo with my rest boy, so I do a demo,

18:33.240 --> 18:53.160
and I show it to you, okay, oh no, where is it, okay, it's a stupid demo, but it's a

18:53.320 --> 18:58.120
video.

18:59.320 --> 19:11.720
Is Britain is the last boy, so, okay, they code this as volatile, it's here, this is the

19:11.720 --> 19:23.720
the animator, a sort of animator, and this is the control, the check input and start change

19:23.720 --> 19:27.720
animation and so on.

19:27.720 --> 19:35.720
What's next to the first thing is the factor record. It's a proof of concept. I build

19:35.720 --> 19:43.720
steps, so there is a lot of code that we can try it.

19:43.720 --> 19:51.720
There is also something that I miss, for example, the sound manager or other things.

19:51.720 --> 19:59.720
My reverse engineering is do only in the Ambrick example, so only these things works

19:59.720 --> 20:05.720
and there are a lot of to implement.

20:05.720 --> 20:11.720
Instead, that lot of level for me, the future, it's to replace the assembler and

20:11.720 --> 20:19.720
RGBDS and make the assembler linker for obvious, I think.

20:19.720 --> 20:29.720
And the rest boy, I think it's it's already because it's one to one with

20:29.720 --> 20:33.720
instructions, so with the assembler instructions, so we can change it.

20:33.720 --> 20:37.720
I don't know the string in binary, I think.

20:37.720 --> 20:39.720
I hope.

20:39.720 --> 20:45.720
And that I'll at level maybe it's the rust parser, so

20:45.720 --> 20:51.720
a rust compiler, so a parser and build an abstract.

20:51.720 --> 20:55.720
I don't know if you know about compilers.

20:55.720 --> 20:59.720
Build the compiler complete.

20:59.720 --> 21:05.720
Rust parser, so you can write rust and it is rust boy translate to the

21:05.720 --> 21:07.720
gameboy.

21:07.720 --> 21:13.720
And the biggest dream is to put the rust boy in GBStudio or

21:13.720 --> 21:19.720
another custom enzyme, so you have an enzyme completed to

21:19.720 --> 21:23.720
management, the graphic, the sound, something like

21:23.720 --> 21:27.720
god or something like Unity or GBStudio, maybe.

21:27.720 --> 21:33.720
GBStudio is a project open source project, so maybe we can add

21:33.720 --> 21:35.720
things, I don't know.

21:35.720 --> 21:51.720
And thanks for attention.

21:51.720 --> 21:53.720
Thank you.

21:53.720 --> 21:57.720
So first of all, thank you.

21:57.720 --> 22:01.720
So, first off, I got that correct, it's basically more like how you would write a

22:01.720 --> 22:05.720
rust, so you run the rust code and that generates you the

22:05.720 --> 22:07.720
actual chemistry.

22:07.720 --> 22:09.720
And then second question, but maybe I know the answer already, and

22:09.720 --> 22:11.720
that you just don't know how to.

22:11.720 --> 22:15.720
Have you thought about doing it just as like an LVM back in, so

22:15.720 --> 22:19.720
it's just a normal rust target that you can just compile to,

22:19.720 --> 22:23.720
or is there any reason that doesn't work with the gameboy?

22:23.720 --> 22:29.720
No, there isn't a rust, there isn't a target for the LVM.

22:29.720 --> 22:37.720
From rust to direct, from rust to from rust to from

22:37.720 --> 22:43.720
from rust to the gameboy, there isn't.

22:43.720 --> 22:45.720
Maybe.

22:45.720 --> 22:47.720
That couldn't be or just because there isn't.

22:47.720 --> 22:51.720
They could be, because they rust,

22:51.720 --> 22:57.720
support the platform, there isn't this CPU.

22:57.720 --> 23:01.720
And maybe we can do something with LVM,

23:01.720 --> 23:05.720
but we have to explore.

23:05.720 --> 23:09.720
There is the project that I link at the before, explore this way.

23:09.720 --> 23:13.720
And it's a very interesting project,

23:13.720 --> 23:17.720
the rust, the GPN, the Kringna ZET.

23:17.720 --> 23:21.720
Any more questions?

23:21.720 --> 23:23.720
I don't know.

23:29.720 --> 23:33.720
Why do you want to skip the assembly parts?

23:33.720 --> 23:37.720
What? Why do you want to skip the assembly parts,

23:37.720 --> 23:41.720
and write directly the compiler?

23:41.720 --> 23:45.720
Why skip the assembly part? I don't know,

23:45.720 --> 23:53.720
because from when I was from 10 years,

23:53.720 --> 23:59.720
I like the compiler science, I don't know,

23:59.720 --> 24:03.720
and it's interesting for me,

24:03.720 --> 24:09.720
and to build, to see how to,

24:09.720 --> 24:13.720
the assembler work, link at work,

24:13.720 --> 24:17.720
but, so it's just for fun.

24:21.720 --> 24:23.720
Any more questions?

24:23.720 --> 24:25.720
Thank you very much.

24:25.720 --> 24:27.720
Thank you.

