All right, if I could have your attention, we've had two talks on embedded systems, and now
we're going to have a talk about Rust Boy, afraid of Rico.
Hello, hello to everyone.
We have a warm welcome, thank you.
Thank you.
I want to talk to you about Rust Boy.
It's an idea to make a game for the Game Boy.
First, to enter in the talk, I want to tell you my story.
I always love the Game Boy.
This is my Game Boy from my childhood, and I think that is the best consult that I have.
This is me when I play the Game Boy.
As you can see, there is something wrong, because in the 90s, my parents didn't take
a fourth of me play Game Boy, so I generated with the chat, the GPT, and it's something,
I think.
I grew up, and I always passionate about the tech and the programming, I am a developer
of a stuck developer, and in the recent years, I enter in a developer loop, something
like boring life, we have a problem, find the problem, replicate the problem, search for
the problem, ask to find the solution, try the solution, it's a loop, it's a boring loop,
the last year, I came here in fourth of them, and I reach a tutorial, I fell in love with
a tutorial here, one in this room about Rust and Ratatoui and Tui, and another one about
talking about the making games for Game Boy in the modern time.
So, before we go ahead, I want to talk about the hardware of the Game Boy, this is all the
Game Boy that an Nintendo ever product, and the interesting only for the Game Boy, not the
Nintendo DSLine, and there is some names in the Lichteratoui we found, so GP for the first
Game Boy, GP also for the second Game Boy, the Game Boy pocket, it's a little bit smaller,
and Game Boy call or is called the ZBC, and Game Boy Advance is G-G-J-B-A, okay.
There is a community, a big community for the developing games of Game Boy,
and it's in this site, GBDev.io, and there is a lot of documentation about Game Boy about
the hardware, about the function, about all the information, about Game Boy, today is in here.
The Game Boy, the Game Boy work, the most common instruction for the Game Boy is about writing
a RAM, there is some section of the RAM to do things, so we have the first to choose section,
that is a ROM in the cartridge, in the cartridge, and there is a video RAM you put here,
some bits, and he printed the screen of the Game Boy, and the work here RAM from the variables
and values and process stuff. There is also section to check if input is pressed or less, okay.
And the Game Boy, and Game Boy color is very similar, the main difference is about the color,
so the CPU is the same, change some things in the color management, and of course the screen
that is the Game Boy color, a box color. I want to talk about a little bit about the CPU,
the CPU didn't have a name or a brand, it's a custom CPU,
of 10 is called the Z80 CPU modified, but some researchers tell us that it's a sharp SM83,
okay. It's important because Rust don't compile for SM83. How to make games today?
Obviously, of course, in asthma, in asthma, it's an assembler very similar to Z80,
sharp make this architecture, of course, to simplify the life of the programmers.
And there is a project called the RGBDS, that is an assembler, a linker, and also
fixer, and there are also software to utilities to make a Game Boy game.
There is a cross platform, they have kit for the Game Boy, that you can program in C and asthma,
and the most interesting, either to program Game Boy games. Today, maybe it's a GB Studio,
that is something like an enzyme, something like god or unity, you can do games, you can make games
with this without code. It's an accord, and the small script that you have to don't for a game,
it's only virtual, visual block programming, okay. It's based on the GBDK, so you can also
script in C or in assembly, and it's the, I think the most interesting right now.
And Rust, as I said, Rust don't compile for this processor, so start what we have in Rust,
in these two wars, not Rust and Game Boy. We have a lot of emulators, a lot of project in Rust,
in WebAssembly, in educational proposed emulation project, a lot of, we have two or more
crates to make games for GBA, Game Boy Advance instead, they have an armor processor, so Rust,
it's a support it in the tire 3, if you know the compilation, the platform support,
and so there is, there are some crates, GBA, and GBA is the most important to make games with
for Game Boy Advance. There is also a few projects by this LFN, it's our username,
that try to bake games with Rust. It's a workaround, so it's start from Rust, compiling LLA
BOM here, and then in C, and then in Piling C, Zeta H assembly, then get the object code in GBA,
Zeta 80, and then with a linker, make a wrong GBA, GBA. And there are other from the same user,
Green Lift, Zeta 80, that do the same things, it's a workaround to obtain the compiling code.
And we are Rust Boy, we have only one processor, SM83, so the idea is there, why not to make
a compiler for this processor, Rust Compiler, it's a big idea, it's a big goal, and maybe
there is, it will not, Rust Compiler is something similar, like GD script for Godot,
similar to Python, it's a big idea, and to do that, I start with a Proof of Concept to see
how hard they are, so the low level, I take the working base of the making Game Boy games,
so GBDS, and assembly, I write the code over that, so I do the Rust Boy, it's a three-level
library, and the low level GBAsman create the assembly, and that RGDBS assembly link,
create the wrong, and then we go up the middle level, and the idle level to
try to reach a code that it's a, I level language, okay, I start to develop in Rust Boy,
making some reverse engineering from this game, this game it's, I found the tutorial to do this,
so I take the code in assembly, and do some reverse engineering, to check if there is
some sections, some logical section in assembly, and I show you this section that I found,
there is some instruction that is at the start of the file, and it's the same for all the games,
so I call in it's, I need it's section, okay, at the end of the file there is a section that is
a declaration of variables, there is a section about tiles and tile map, tiles are a small tile
of code, it's a it for it bit, it's for the graphics, it's the base graphic of the Game Boy,
there is one for all the game, okay, tile and when I put a tile in the ram, it gives me ID, okay,
with this ID I can draw the background, and I have obtained a tile map, okay, this down,
this bottom is the tile map, is the ID about the tiles that I'm certain, okay, so there is a section
where is tiles and tile map, there are in the code, there is a section that this tile map and tiles
are copied in the ram, from the ROM of the character at the ram, there is a section about function,
and there is the main section that is main loop, every game is in every, I think in giant,
it's a main in loop, and in this main in loop, we are the game's logic, okay,
a true important game's logic is about input, so check if I press some buttons, and the movement
of the object, so the dynamic part of the games, we have the left, the right, check left, check
if I press left button, the game is an arcanoid clone, so we have the paddle, okay, that move
left and right, and then the bolt that move randomly, okay, so we have, so we have this section,
okay, from this section I try to start to build the library, the low level is Gbiasm, it's,
it's, it formalizes some concepts, it formalizes some concepts, like extraction and operators,
it's one to one with assembly, so in the future we can change not to generate an assembly,
but to generate maybe binary, okay, and it, it creates an array with destruction, and then
I'll tend it to generate the assembly, okay, if we watch the code again, okay, it's written
in Rust, so yeah, the goal is, okay, and it's one to one with assembly, okay, the second level,
try to, to step up, okay, the middle level, okay, and I do these things, a chunk system, so I want to
write a chunk of code in every part of my file or in another file, so I, I use this, so I put
this instruction in the function section, put this function in the may look, put, okay, and I do tile
map a tile utility, okay, because it's a lot of code, a lot of bit, a lot of something,
a low level, not a tile level, a sprite manager to manage all the objects, sprite are the
movement object in the game, and there is a niche, and I need a lot of them to have an
if statement, so I want to make my if that translate in assembly, okay, the if logic,
this is the code, it's a little bit clear, it's a little bit compact, I don't know, I use
the asmodot chunk to set the chunk where I want to write the code after, okay, so I, okay, tiles,
add the tiles, it's a utility, that add the tiles, the tiles, I, I transform it in a ray, okay,
the main copy is not free structure, it's only one, okay, every utility is every function, that I wrote
a return of that instruction, okay, so you can put whatever you want,
this is the first attempt of the ifs, it's a mess, I don't like it, but see this code,
I think that I do a better job in the second try, okay, and now we are at the active level,
restboy, so I want to formalize some concept, I want to do better if statement,
then it's a instruction, must be written in automatic way, I don't want to think about the
initial structure, it's a instruction, there are some functions that can be considered right
built-in, something like memcopy or the input check, and I want, I do, I did more managers,
so manager for tiles, manager for input, I formalize some concept and I do the manager,
and the goal is to add every reference to memory address, when we could, we don't care about
more or less memory, so I try to do this things, and the code is a little bit clear,
okay, this is always some break-up, so we have cost-on, we have tiles, it's more friendly,
GB dot tiles dot at the background, okay, add the tile map, the paddle, the sprite for the
paddle, the sprite for the ball, they need initial position, okay, there is also the variable
section, function, some function to check, is volatile as to check if the ball bounce or not,
and they if it's a little bit more readable, okay, if you see, okay, it's okay, it's all the code,
okay, I do this code and I want to for today do a demo with my rest boy, so I do a demo,
and I show it to you, okay, oh no, where is it, okay, it's a stupid demo, but it's a
video.
Is Britain is the last boy, so, okay, they code this as volatile, it's here, this is the
the animator, a sort of animator, and this is the control, the check input and start change
animation and so on.
What's next to the first thing is the factor record. It's a proof of concept. I build
steps, so there is a lot of code that we can try it.
There is also something that I miss, for example, the sound manager or other things.
My reverse engineering is do only in the Ambrick example, so only these things works
and there are a lot of to implement.
Instead, that lot of level for me, the future, it's to replace the assembler and
RGBDS and make the assembler linker for obvious, I think.
And the rest boy, I think it's it's already because it's one to one with
instructions, so with the assembler instructions, so we can change it.
I don't know the string in binary, I think.
I hope.
And that I'll at level maybe it's the rust parser, so
a rust compiler, so a parser and build an abstract.
I don't know if you know about compilers.
Build the compiler complete.
Rust parser, so you can write rust and it is rust boy translate to the
gameboy.
And the biggest dream is to put the rust boy in GBStudio or
another custom enzyme, so you have an enzyme completed to
management, the graphic, the sound, something like
god or something like Unity or GBStudio, maybe.
GBStudio is a project open source project, so maybe we can add
things, I don't know.
And thanks for attention.
Thank you.
So first of all, thank you.
So, first off, I got that correct, it's basically more like how you would write a
rust, so you run the rust code and that generates you the
actual chemistry.
And then second question, but maybe I know the answer already, and
that you just don't know how to.
Have you thought about doing it just as like an LVM back in, so
it's just a normal rust target that you can just compile to,
or is there any reason that doesn't work with the gameboy?
No, there isn't a rust, there isn't a target for the LVM.
From rust to direct, from rust to from rust to from
from rust to the gameboy, there isn't.
Maybe.
That couldn't be or just because there isn't.
They could be, because they rust,
support the platform, there isn't this CPU.
And maybe we can do something with LVM,
but we have to explore.
There is the project that I link at the before, explore this way.
And it's a very interesting project,
the rust, the GPN, the Kringna ZET.
Any more questions?
I don't know.
Why do you want to skip the assembly parts?
What? Why do you want to skip the assembly parts,
and write directly the compiler?
Why skip the assembly part? I don't know,
because from when I was from 10 years,
I like the compiler science, I don't know,
and it's interesting for me,
and to build, to see how to,
the assembler work, link at work,
but, so it's just for fun.
Any more questions?
Thank you very much.
Thank you.