 OK, so my everyone. So if you want to say just for me to start this again, we're just going to have a little current table. And this is actually going to be a talk that's a bit aimed like that, because I don't really know what this talk is about. Like, I don't think. But the thing that it is about is, I think, quite neat and relevant to AgWare, and also very recent. Like, this all happened in the last couple of weeks. And like, the time we just talked a bit about that. So I want to talk about the Homeland 2, which is a computer. And I want to talk about some game that I made for the Homeland 2, why I made them, and why this might be interesting. So the Homeland 2 is a computer. So OK, so the story goes like this. In 1981, there were a pair of scholars back in Hungary who wanted to make a Hungarian version of the Homeland 2 computing plot. So they basically started building their own computer in their location. And the Homeland 1 was destroyed. Or like cannibalized. Like, they made it for the time. They didn't like it, and it was destroyed. Then they used the parts to build Homeland 2 in 1982. And this was an interesting machine in some sense. And also, but in other sense, it was also very similar to other machines of its time. So it's a Zenit-based home computer. OK, so does everybody know what a home computer is? Like, the category of, OK, so the home computer before PC is like in the late 70s, early 80s, home computer would be something that you would buy for home. And it could be a computer that's low cost, much, much lower cost than the other kinds of computers of the time. And it would come in usually becoming the form of a keyboard. So it's a keyboard with a computer, and you put it usually in the RTB. So you'd have to buy a separate screen. And usually it could boost to basic. Programming and using the machine was what I'm saying. So this was based on this same idea. It uses a ZEP CPU, which was a 8-bit CPU from ZIDO. It basically, you could say it's two Intel 8-bit like together, like the register files of two 8-bit and two together. And it had 8 kilobytes of RAM, 16 kilobytes of RAM, plus an extra 1-bit of RAM dedicated video RAM for this character-based graphics. And what is interesting, I think, this crowd is that other than the CPU and the memory, everything else was 7,400 series ICs, and a lot of them. So like the video signal was generally 7,400 series, the date. So because it had a set thing for storing, persistently storing data, that was not, everything was done with 7,400 series. The reason for that was cost saving. And also because there was this thing called COP on, that I don't think any material in Singapore would deliver it. But that was an export restriction treaty of the Western world or NATO countries. And I think it's even more than just NATO countries. And of course, because Hungary was part of the the other side of history, the wrong side of history. So high tech was not allowed to be exported to Hungary. So do we get anything with the simplest possible percent or the 3,400 series was reported? Okay, so then what I really like about the home lab here is how they ended up doing video. So like I said, it has no dedicated video graphics chip. So what they ended up, or video signal generator chip. So the CPU itself is basically bitmatching the file output. But if you think about the timing of the timing of the 4MHz Z8, it just doesn't work out. So what they do is instead of running a program that would retrieve data from video memory and then feedback that's output, the CPU jumps into the video memory. So CPU thinks that it's executing the contents of video memory. But the data bus is hacked so that the CPU sees knobs instead of the contents of the video memory. But there's a character wrong whose address lines are directly connected to the data bus of the video. So this way the CPU can as fast as it is possible for a CPU because the fastest way you can scan some area of memory is if you use the program counter instead of any other register because if you have any register that just loading the program to load the instruction that would implement your counter. It's already much slower. Whereas if you just execute the knob, then a side effect of executing anything is increasing the program counter. And what this means? Oh, and then, okay, just because the mouse, if you think about this, the mouse still doesn't work out. So the idea is that you read eight bits from the character wrong. It's sending the shift register, and that shift register is blocked fast enough to shift out the eight bits for the next eight bits. But that means that while the physical part of the screen is scanned by the CRT, all the CPU is doing is just racing the beam. So more than 80% CPU time is unusable for your programs. You can turn it off. That's not as understandable as that. Sinclair, did I say anything? Yeah, I don't understand anything. Not exactly the same, yes, not the same, but Sinclair was overwhelmingly pushing video out and then did everything else in the region of it. Yes, and of course, you can turn off video output and then you can... And it's very good, so like I said by the way. Yes, yes. Oh, I mean, this one you have to turn off for, because I will not just for timing purposes, but actually, but because the, basically the same address time, like so one of your address time from the video. Yeah, yes, but I mean, in practice, it doesn't really matter because you have to turn it off anyway because the cassette input is all done in software. So the timings are very important to measure how much time is passed between spikes of the... So like on the tape you have like this tiny... No, it's not what you usually get, but you said that only because you have the most patience. It's almost... Oh, yeah, that too, but yeah, yeah, yeah. Yeah, yeah. And so what is my involvement in this? I've never heard of this computer until a couple of months ago. I've never heard of this, no one really knows of this computer. So all that too, I think there was like maximum of 200 of them here, but like you keep four or no two that are the same. But that's exactly like half of them up here. Half of them was produced by a some agricultural, law and government company, whatever. And I think it's really fun that you're going to stop the time we read. They're not like just like that programs you can find for this, but one of them is a live-streamed optimizer. Like that's one of the main programs that we've ever done, that's going to be like a linear programming thing. You know, very, yeah. I mean, it's like good in the operations, we see a problem that everyone has seen in school, but it's actually you can practice for that. So I've heard of this bot and there's a Hungarian retro computing and retro gaming podcast and there they had an episode about this. That's why I heard of this. And what was interesting about it is that there was their guests who knew everything about this computer. They were saying, oh, I'd actually do to promote building software for this and to promote people knowing about it because it's such an important piece of Hungarian computing history. Because I think the first and the truly Hungarian main designs and build computer that they are announcing like the job on my computer site to announce the game development competition for this machine. And when I heard this episode it was just when I was like a week or a couple of days from going home anyway. So I had like a long week ahead of me. So, and I've never seen all that too. I've never done any assembly programming. I've never developed for this like the iPhone 65 which is like Ross kind of crazy than I am. So of course I don't talk about of course I'm gonna make a game for you, right? And then I think I had like one and a half months for the whole thing. So how do you do this, right? Like you have this computer, you never see it, you don't touch it because you don't find one and you don't just start working on one. So it is some emulation of it, right? Emulation situation was less than ideal. It actually the game development competition was so spurred improvement from that. But when I started to think into this there was no good emulator storage because some main had an emulator that was kind of working like you could do it to basic. But if you wanted to do anything that's like real time it just wouldn't make it wouldn't cut it because it didn't actually implement the video with that. So it was like running the CPU on its own and then rendering the video memory content on its own. But this whole thing about how the CPU after 15 or something percent of its time gets. Oh, and by the way, the horizontal third-wing trace not usable either. It's really just a perfect third-wing trace. So that was not implemented. And then there was a closed source windows on the emulator that was supposedly better. But I can't really tell if it's better or not. It is closed source windows on the emulator. So I ended up writing a single page web app emulator which was a lot of fun because there's not that much documentation for this machine. So a lot of it you have to kind of guess by looking at the original documentation. So you read the original 1982 documentation that has been titled someone's type writer. And then it has some like hand-drawn diagrams and stuff. But luckily you can find dumps of the wrong content. And then I tried to think that up and I got to the point where I started this video magic. But that was not re-documented. And then I figured out, what do I put on the database to make everything work? It's not as straightforward. It's not just not. Because you have to end the line somehow. So after the right amount of reading from this video around shadow area, you have to make sure that the next top code that the CPUs is actually one of the reset codes that the database allows you to jump to specific addresses one by each. So anyway, so then, yes, I wrote this. So obviously for the Z84, I think just use it all as a library. Then I re-drawn it in Idris too. I mean the whole web version because again, I'm that kind of crazy. And then you can imagine that this used up a lot of time and then of course the deadline started approaching. So okay, somebody hadn't really done any games yet. So how am I gonna write the games? Well, kind of as a parody of myself, I decided that I'm gonna use a test code DSL for the assembler. So this is like an example of something where you can see like the back rowing capability that you get for free by being the DSL. So here, so I don't know how widespread this is, but there's no other 24, there's the same code speed coding, which is like the fancy for unrolling use. Like if you want to do things really fast then you just, you know, make it. And this one it shows you how easy this speed coding if you have a, like a host landing. Because here, you know, I and J go over zero to three and then you just, I mean assembly code, basically 16 such a, I mean the 16 times and then the address calculation and all that is completely set. It's not the end of time during the assembly. And then you just end up with the 16 times for instructions, it's like big, and then during the other plan, the fastest way of actually trying things out was to just inject the memory of the tree and then just jump it, which is a big benefit of writing your own memory. There's few tricks like that. So what did I write? So I wanted to get like some handle on the machine. The first one I wrote was snake. Actually, first one I started writing the stepries, but then I said that someone had already done the stepries and they actually knew what they were doing, unlike me. So like, okay, well, they're making other steps that I'm going to make. So let's put that aside. So let's try something even simpler. So then I wrote snake. You can imagine how we did this. Oh, so this is all character graphics. I never implemented rest of graphics because like it's quite slow and also that one is even less documented. So, and yeah, character graphics. And then the second one was a 2048 game, you know, the one where you slide the files around. So it was like, everyone was 24K. So these ones were simple, right? Like each of them was like, less than 2K, the finished game. The first one was real-time, of course. And the reason that I went to 2048 for the second game was because I had an occasion to see a real Home Left 2. There was a Home Left 2 event. So I went there and there was the actual machine on the small TV. And there are the keyboard situations really bad. Like this foil-based keyboard and it's really unresponsive and slow. And this also explains why if you try to emulate it, you get input glitches because the firmware, of course, is made with the assumption that the foil is a cheat sheet. And so real-time is not, like it's very awkward to play real-time games. And there's nothing else. It's just the keyboard. You don't have joystick. You don't have, I don't know, D-pad, nothing. So that's why I went to 2048 because that is a third-day game. So yeah. But also, what you think you can't steer is that it's nicely smoothly animated. So when you slide it in a certain direction, the tiles don't go character by character instead of block by block. And it turned out that I couldn't make it fast enough if you finished, like to re-render everything in time. So I ended up doing double-buckering, which, of course, definitely made it even slower because you have to copy everything over into the big video memory location, but it avoided bickering. So that was one of the takeaways. Yeah. Double-buckering. No, no, no. Oh, no, no, no. No, I couldn't go. Oops. So this is one bit. So you have like eight bits. So you have 64 bits, or eight bytes for each character in the ROM. And you can't even change that. So the character satisfies. And then, yeah, it's like eight by eight, one bit. You mean, yeah, yeah. But you can see here that there are, it's not just letters. You can see here, like, you have this nice, rounded corner, right? That's a character. Like these ones, like these fancy double arrows, that's a character. Here, oh, okay, if I had to realize when I made this picture, you see like a card, so there's a card. So yes, there are lots of characters that are like cool for writing games like this, but yeah. Okay, and then, so what was like the big game that I made? And also why is it called adventure game? So I took this Hungarian text adventure game from 88 that was written for the Commodore 64. And I knew everything about this game because like ages ago, I was engineered this, I remade it for Android. I had the technology, I should remade this. And it's interesting part about this game, it is quite a modern design because the game script is stored in like the simple vital format. And most of the game is just the interpreter for these scripts. So instead of, which was here, like for example, this guy's previous game is the built-in Bayesian implement the actual game logic, but it's pretty elegant. It's all in memory, so you load the game once and the graphics and the text and everything is inside 64K. So we should write the new interpreter in for the Z80 for the same byte code, then we should be done, right? The problem is that like I said, it was written for the Commodore 64. So if you write the Z80 interpreter, then that takes care of the Commodore part but not the 64 part, because I've heard the 64 and Commodore 64 stands for 64 kilobytes. Of course, we have 16 kilobytes. So, and you might think that if you just throw away the graphics, which you have to do anyway, like so, yeah, then it's gonna be, it's gonna be because of course these days we're used to multimedia being the big thing that takes up all the disk space for the memory space. But turns out that even without the graphics, just the text messages and all the assets, that's still like 26 kilobytes. And then we haven't even done the interpreter yet, which came out to like one and a half K. So what did I end up doing? So, first of all, I used ZSKEEP from the, from you Pokemon for the text representation that allows you to store three characters in two bytes. And then the other, and basically in that, I'm speaking a bit with byte code for a moment, I was even getting it down to I think 20K, which is of course, like maybe 18 plus for the game itself, which of course this doesn't fit. So I ended up doing this thing, the game into two episodes. And that should, you know, you would think that, okay, well, even with the naive encoding, if it's like 36K, you split it in, now it's 13K, right, that's not how it works. First of all, because the game itself, it's like you go some, okay, so the game, does anyone care? Is anyone interested in what the game is about? Because, okay, so the game is like this guy in Uro, the future of Japan, is out to like bring water to the village and the rise of his family, sorry, in the entire village being like burned and raised, but he goes on a revenge, right? That's why he did the revenge. And so you eventually end up getting to China, and then you pray to be a better school master, and then you go back to Japan to keep the ass of the people, like warlords who trade with the village because they do not think like taxi or ransom or whatever. So, but the problem with this story is that it's like, okay, you start in your village, you go somewhere to get trained, and then you come back. So the locations of the game, you can't really like cut it into half, because the first half of the game is basically, you know, solving all the puzzles that are needed to get to China, to get to this country master, to get him to train you. But then you basically retrace your steps, and now you can keep the ass of all those NPCs who, but it's absolutely a clear cut. It is a clear cut, it's a clear cut. Exactly, so narratively, there's a clean cut, which is, okay, you get trained. Like that's the halfway point, even in the original game, if you just look at how long it takes, like how many commands, or how many percentage of scores you get, it's a very nice halfway point, and narratively satisfying, because episode one ends when you get trained. The problem is that, technically, because you go, like you kind of traverse the same terrain. So it's like the same room. So you don't get to throw away all the rules, if you just go there and not come back. And so there was quite some pruning needed to be done to, so basically turned out that, A, of course, there are parts of the Japanese setting that you can't get to before you can defeat some of these guys and you can only defeat them if you're on the train. So you can cut down parts of the mansion of the evil world war. And the other one was getting rid of this section. So this is like a map of all the games, right? So this one is like an annoying maze. I don't know if you guys have played any of these games. It's an amazing first stage of all these games, but they're really not fun, they're just there to make their time. And I think there was another one in the year. No, I think there's a man in the year. Anyway, so there was two mazes that we cut out. And then, so the results, I give you the screenshot of this, running on the phone, that too. And so finishing touches into the making sure that the walk works, make sure that the game version of the puzzles work. So I ended up writing yet another interpreter in Haskell just so I could play the game to make sure that it's winnable in this trimmed script, which was actually really useful too, because I found that there were two puzzles in the game that depends on the graphics. So of course those have to be changed a bit because you don't have graphics, you can't see the picture, you don't get the hint from the picture. And then I also came up with this idea that I could just pre-compute the word wrapping because every message is always printed starting at the first pattern. So you don't need to put any code into your interpreter to word wrap. You can just compute it ahead of time and then just put new lines. Yeah, you burn the new lines into the text that you're sorry, just replace some space with the new line. Show the word wrap becomes smaller. I've had it more than once. Sorry? Showing because the word wrap is smaller. But the new lines start for free because you replace some spaces with, like one space becomes one new line. It's kind of weird. Right? And also, like in this particular equation, you can see that this word ends of the last one and this word starts at the first. So here we were actually able to save a space. And this matter is because the final version had around 40 or less than 50 bytes of memory remaining. But you need that for the stack. So now this is a bit of an exaggeration because I could have saved another 256 bytes by not implementing saving, quick saving, quick loading. So there's like a memory saving and loading, but it's very nice to have because the game, it can be quite punishing in terms of like, it can be quite virtual. So I really wanted to include that side of it, right? That was always part of the calculation that we should have both the game state and the save game state in memory. Yeah, official results. So it came out fourth out of 13 entries. The first game, like the game that actually won was nice, like untouchable because like, I don't know who that guy is, but you know, they're looking at something like a graphical game that has like smooth scrolling. And like, oh, it's amazing. So there is absolutely no way to be in competition whilst that actually was made. Or yeah, I really prefer something to be there. But after the cut-offs for the official voting, revenge has been slowly creeping up and now it's at second place. I think what happened is that people have been playing in that scenario, actually, there's quite a lot of that. Like this is the long game, like how does this even fit into this machine? And then they're voting for it. So that's it. And then, yeah, I got a bunch of things. So Snake at home that playing 48 are already open source. The open source release of the revenge is coming soon and it's just filling up. But what's also nice about it is that it's not just a game. It also includes all the tools that you can use to manipulate the fight. So you can even make your own game the same as if you want it. And then I have a bunch of top posts about this for retrochalant, which is like this one month book writing thing where something and it just happened to be just in October and it's the contest and the new look of October. It's perfect times like double it. And yeah, and that's pretty much it. If anyone's been interested, I also have one very cool story about the last minute how I almost got screwed over in the very last minute by not being able to go try the game. Do we have time for that still there? I think it's neat. We're kind of running out of time. Yeah, okay. Talk to me after. Or next time. Next time. Actually, I mean, yeah. So yeah, okay, that's pretty much it. So it's a fun, it contains me. So it's a fun, it contains me. For a key, maybe a free. Yeah, okay. Okay. Okay.