Monotron - making a 80s style computer with s $20 dev kit
This is a modal window.
Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.
Formale Metadaten
Titel |
| |
Alternativer Titel |
| |
Serientitel | ||
Anzahl der Teile | 15 | |
Autor | ||
Lizenz | CC-Namensnennung 3.0 Unported: Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen. | |
Identifikatoren | 10.5446/52162 (DOI) | |
Herausgeber | ||
Erscheinungsjahr | ||
Sprache |
Inhaltliche Metadaten
Fachgebiet | ||
Genre | ||
Abstract |
|
2
3
4
6
10
13
14
15
00:00
ComputerReelle ZahlProjektive EbeneTwitter <Softwareplattform>MomentenproblemQuick-SortPhysikalisches SystemMultiplikationsoperatorJSONXMLVorlesung/Konferenz
00:30
ProgrammiergerätGebäude <Mathematik>ROM <Informatik>Physikalisches SystemSystemprogrammierungYouTubeLastNebenbedingungProgrammierungFächer <Mathematik>NetzbetriebssystemRuhmasseDatenverarbeitungssystemGruppenoperationBootenMultiplikationsoperatorQuick-SortHardwareNeuroinformatikNichtlinearer OperatorHydrostatischer AntriebYouTubeMetropolitan area networkBroadcastingverfahrenDifferenteSpieltheoriePlotterPhysikalisches SystemHalbleiterspeicherProgrammiergerätInteraktives FernsehenProjektive EbeneMaschinencodeNebenbedingungBitDatenverwaltungComputeranimation
03:24
Konvexe HülleNebenbedingungPeripheres GerätStatisches RAMEigentliche AbbildungInterface <Schaltung>Cheat <Computerspiel>MultiplikationsoperatorDatenverarbeitungssystemStatisches RAMBitNotebook-ComputerFlash-SpeicherDivergente ReiheSichtenkonzeptCoprozessorPunktLastSystemplattformRohdatenDemo <Programm>HardwareWhiteboardBefehlsprozessorEigentliche AbbildungInterface <Schaltung>Demoszene <Programmierung>TouchscreenPhysikalisches SystemARM <Computerarchitektur>MikrocontrollerEinsComputeranimation
05:03
Statisches RAMTouchscreenBus <Informatik>Open SourceNeuroinformatikWhiteboardTreiber <Programm>Güte der AnpassungBitmap-GraphikFlash-SpeicherProgrammiergerätUmsetzung <Informatik>Serielle SchnittstelleVideokonferenzProgrammierungGraphfärbungGraphiktablettOffene MengeComputeranimation
06:58
SpeicherverwaltungSingle Sign-OnPeripheres GerätMehrkernprozessorNeuroinformatikSerielle SchnittstelleWhiteboardEinfache GenauigkeitMikrocontrollerQuick-SortVariableHalbleiterspeicherSynchronisierungPeripheres GerätParallele SchnittstellePhysikalisches SystemLoopZahlenbereichBus <Informatik>DatenverarbeitungssystemPixelFlussdiagramm
07:57
MaschinencodeKonvexe HülleEingebettetes SystemGeradeAnalogrechnerGreen-FunktionSynchronisierungVertikaleRahmenproblemDiffusorWellenwiderstand <Strömungsmechanik>Spannungsmessung <Mechanik>BeamerSerielle SchnittstelleGeradeRahmenproblemBefehlsprozessorPixelMinimumAnalogrechnerPhysikalisches SystemFunktion <Mathematik>ZahlenbereichHardwareElektronische PublikationMechanismus-Design-TheorieBitLaufzeitfehlerVirtuelle MaschineGamecontrollerFunktionalBus <Informatik>Lesen <Datenverarbeitung>Algebraisch abgeschlossener KörperObjekt <Kategorie>DatenfeldFitnessfunktionAbzählenKonfiguration <Informatik>AuswahlaxiomLeistung <Physik>EinsGanze ZahlSchreiben <Datenverarbeitung>SoftwareentwicklerVerschiebungsoperatorQuick-SortAbstraktionsebeneTreiber <Programm>VideokonferenzBootenMobiles EndgerätFeldrechnerSnake <Bildverarbeitung>IntegriergerätFestplattenrekorderCompilerThumbnailBetafunktionSoftwareSoftwaretestProgrammfehlerMixed RealityGraphfärbungMaschinencodeSelbstrepräsentationTouchscreenPunktSynchronisierungSichtenkonzeptLastQuellcodeRechter WinkelWort <Informatik>TypentheorieEinfache GenauigkeitEin-AusgabeAdressraumFrequenzFlächeninhaltDeskriptive StatistikXMLComputeranimation
14:05
PixelFunktion <Mathematik>BefehlsprozessorZellularer AutomatStereometrieMinimumVideokonferenzGeradeInterrupt <Informatik>ZählenSynchronisierungAttributierte GrammatikDreiecksfreier GraphBitOrtsoperatorDatensatzGraphfärbungDatensichtgerätTouchscreenInnerer PunktBitmap-GraphikMathematikPunktKurvenanpassungZweiMultiplikationsoperatorGlobale OptimierungPortscannerKoroutineGerichteter GraphOrdnung <Mathematik>Inverser LimesPhysikalisches SystemSynchronisierungPixelGeradeVideokonferenzNeuroinformatikStatisches RAMZellularer AutomatHalbleiterspeicherInterrupt <Informatik>MaschinencodeWeb SiteDifferenteBildgebendes VerfahrenNP-hartes ProblemSoftwareKonstanteAttributierte GrammatikStandardabweichungATMStereometrieBildschirmfensterRandverteilungPeripheres GerätFehlermeldungDiagrammPhysikalische TheoriePrimzahlzerlegungEchtzeitsystemFontBootenAuflösung <Mathematik>BitrateFitnessfunktionZahlenbereichSerielle SchnittstellePolarkoordinatenGanze ZahlZustandsdichteQuick-SortVererbungshierarchieWhiteboardComputeranimation
20:14
Konvexe HülleFunktion <Mathematik>Attributierte GrammatikFibonacci-FolgeSpeicherabzugKommensurabilitätChi-Quadrat-VerteilungEindringerkennungGeradeRechenwerkJust-in-Time-CompilerMini-DiscSCI <Informatik>Weg <Topologie>MultiplikationsoperatorSchnelltasteDemo <Programm>Treiber <Programm>Spannweite <Stochastik>Kartesische KoordinatenMenütechnikVideokonferenzZeichenvorratSummengleichungPhysikalisches SystemHilfesystemp-BlockARM <Computerarchitektur>Interrupt <Informatik>FeldrechnerTabelleAdressraumZahlenbereichOrdnung <Mathematik>SystemzusammenbruchSpeicherabzugHalbleiterspeicherMaschinencodeQuick-SortWeb-SeitePhysikalischer EffektSystemaufrufMaßerweiterungInhalt <Mathematik>XMLComputeranimationProgramm/Quellcode
21:59
TouchscreenAssemblerEchtzeitsystemNichtlinearer OperatorWeb-SeiteQuick-SortATMGraphfärbungGreen-FunktionMultiplikationsoperatorFreewarePhasenumwandlungComputeranimation
23:10
Chi-Quadrat-VerteilungMinkowski-MetrikQuick-SortSpieltheorieDelisches ProblemProdukt <Mathematik>Physikalischer EffektPhysikalisches SystemDatensichtgerätSoftwareComputerspielNeuroinformatikATMComputeranimation
23:43
HIP <Kommunikationsprotokoll>Hill-DifferentialgleichungAnalogrechnerTexteditorFontGraphfärbungDienst <Informatik>ATMMaschinenschreibenVideokonferenzTopologieQuick-SortDigitale Photographie
24:40
Dateiformatp-BlockGamecontrollerInternetworkingMaschinencodeFontPixelZahlenbereichLeistung <Physik>JSON
25:42
Twitter <Softwareplattform>BitClientMultiplikationsoperatorInternetworkingWeb-SeitePhysikalisches SystemInformationBefehlsprozessorPackprogrammHydrostatikPhysikalischer EffektProgramm/QuellcodeJSONXML
26:11
BefehlsprozessorHalbleiterspeicherZellularer AutomatGeradeBitmap-GraphikMultiplikationsoperatorVideokonferenzGüte der AnpassungTouchscreenComputeranimation
26:52
HochdruckEmulatorPunktWort <Informatik>Virtuelle MaschineWhiteboardSnake <Bildverarbeitung>SpieltheorieDifferenteMaschinencodeBefehlsprozessorInterrupt <Informatik>TUNIS <Programm>Formation <Mathematik>ProgrammierungMultiplikationsoperatorDemo <Programm>ARM <Computerarchitektur>MenütechnikSerielle SchnittstelleInterpretiererWellenlehreTabellePhysikalischer EffektComputervirusRechter WinkelSystem FJSON
30:48
JSONXML
Transkript: Englisch(automatisch erzeugt)
00:08
Thank you very much. Yes, my name is Jonathan. I'm the JPster on GitHub. I'm the real JPster on Twitter because someone got there before me. And I'm going to talk about a project that I've been spending quite a lot of my spare time on.
00:23
This sort of crazy idea I had to recreate the 80s. The world is terrible at the moment. So let's just pretend it's 1983 and everything will get better, right? So I'm an embedded systems programmer. I work in Cambridge, England. I mainly program in C. I've tried some C++. Not a massive fan of C++. There's some positive bits, but
00:43
when I came across Rust, I was like, this is incredible. Rust fixes all the things I hate about programming, and I just completely fell in love with it. You know, all those great things. The documentation system, the build system, the package manager, dependency management, memory safety, and it works in embedded systems like an operating system in it.
01:05
Brilliant. Love it. And I got into that and I got roped into the embedded working group. So we hang out on GitHub, github.com slash Rust-embedded. And there you can see all the things we're trying to do to make Rust on embedded work better.
01:24
When we started at this 18 months ago Rust on embedded was okay, but it was not where it needed to be. And we were working really hard to try and make it smoother and easier. So I like retro computing. As I said, you know, I'd like to hark back to this time when computers were simple.
01:42
If it goes wrong, you turn it off, you turn it on again, it boots in half a second flat, and you know, then you're up and running again. I like programming bare-metal systems. I like getting down and sort of reaching out and touching the hardware. I love that when I was a kid we had BBC computers in England and they had motors and lights plugged in and you could do something on the computer and then something
02:05
immediate happened. The light came on, the thing started spinning, and I love that interactivity. And I loved the idea that you don't need an operating system and all this stuff. You can just simple, you write some code, it does a thing. I also spend an awful lot of my time watching YouTube.
02:24
I realized that I don't watch broadcast TV anymore. It finally arrived in the 21st century. So nostalgia nerd, 8-bit guy with his t-shirt, retro man cave, lazy game reviews, all brilliant, you should check them out. And so this project,
02:41
I wanted to set myself a challenge. I wanted to do something that I don't think had been done before, certainly something that I hadn't done before, and I wanted to know how much can you get from very little? I'm a firm believer in, I think it was Stephen Fry, said that there is beauty to be found in constraints. It's the difference between landscape gardening, 300 acres of park, and a small urban
03:04
backyard plot. That can be incredibly beautiful because it is constrained, because you are limited in what you can do in those few square yards. It's the same with writing a haiku versus writing, you know, prose, writing a novel. There is beauty to be found in what you can extract
03:21
from the very little. That's how I feel about embedded systems. So what have I done with my time? So I wanted to make a system, it was a bit like these computers from the 1980s, I wanted it to be super cheap, don't have a lot of money, just wanted to use some bits I had lying around. I wanted to do it in Rust.
03:41
Pretty much means I had to use a processor from ARM, one of their Cortex-M series microcontrollers, because they have the best support in Rust. They're not the only ones. There are some other platforms that are getting support as well, but Cortex-M is kind of where it's at. I wanted it to be kind of basic. I wanted it to be constrained so I could challenge myself to see what I could get out of it.
04:03
And I didn't want, I didn't want the problem to come solved. I didn't want to just get a system, turn it on, load the demo code, and go, no, I'm done. That's, there's no fun in that. I wanted, I wanted, you know, a raw bag of bits that I had to put together and do something with.
04:21
So the first board I looked at was this one from SD Micro, the F7 Discovery. It's a great board. The megabyte of flash. To some of you that might sound pretty constrained compared to your, you know, terabyte laptop. For me, it sounds like it's quite a lot, really. 340K SRAM sounds like loads, from my point of view.
04:40
216 megahertz. Again, depends on your point of view. I think that's pretty fast, actually. 32-bit embedded CPU. But this thing's got a proper LCD interface, and if we're going to try and connect to a TV or a monitor to do some graphics, having hardware support to drive a monitor or screen, ah, come on. Where's the fun in that? And it's even, it's even got audio and ethernet and everything.
05:03
This is what it looks like. It comes with a screen. You turn it on and it does that. That is problem-solved. There's no fun in this. So I went, so I went for a different board. The Texas Instruments Stellaris launchpad. It used to be known as Stellaris. Um, that was a brand TI had bought. They've scrapped that branding and relabeled it the Tiva C launchpad.
05:26
Tiva C launchpads and Stellaris launchpads are basically the same, but some minor tweaks. So I already had a couple of these boards. I've done some drivers for them. I've written a couple of crates. They're on crates.io. So if you get one of these boards, there's good support. You can use the drivers I've used to get you going.
05:43
256K flash. 32K of SRAM. Now there, now that's a challenge. That is, that is not really enough SRAM to store a whole bitmap. Never mind a color bitmap. So you'll see how we solve that one. It's Cortex-M4F. 80 megahertz.
06:01
Um, you know, not too fast, not too shabby. Only got a, got a few peripherals, but, but most importantly, there's no VGA support in the chip. No graphic support and no external bus. So there's no way of just dropping down like a video chip like we did in the, in the 1980s. Gonna have to do this. I have to do this different way. This is what the, uh, this is what the board looks like.
06:20
These are super cute because you get this chip, which is the one you're allowed to program. This is another copy of pretty much the same chip. Comes pre-programmed by TI. And that's your JTAG programmer and USB serial converter. So you just plug this into your USB on the computer. You can run an open source program called OpenOCD. You can flash the board. You can get serial comms in and out.
06:41
So there's nothing else you need to buy to use this board. Buy the board, plug it in. You can program it. You can use it. You can do that in Rust. You get a couple of buttons and a, this is a red, green, blue LED. So you can, um, you can blink an LED and that's, that's like embedded hello world. If you can make an LED turn on and off, you're all good. So,
07:01
this is what the chip looks like internally. The way, um, these boards work, these microcontrollers work, they're a lot like a whole computer from the 1980s, but shrunk down to a single piece of silicon. So there is a processor core that can read the instructions and do the maths and move the variables around in memory. There is some memory, some RAM, some ROM, and there's a whole bunch of peripherals in the, um, these simple computers.
07:25
These would have been separate chips all connected on some kind of bus, the sort of eight or sixteen parallel wires you see snaking across the circuit board. But here they're all baked in. We've got some timers. We've got some synchronous serial, um, uh, devices which help us push out pixels.
07:40
We've got a serial port and it runs at 66 or 80 megahertz. That's quite important because the, the clock loop system on this is fixed and it will either run at 80 or 66. It won't do 72 or 70 or any number in between. It's literally 80 or 66. So how do you get started doing embedded Rust? Well, you need to drive the hardware
08:02
and in C that means you need a bunch of numbers you take from the data sheet. Kind of tedious. Um, we have a mechanism in Rust where we can auto-generate the code to access the chip. The chip manufacturer provides an XML file. Not all of them do. Some do. Um, but it basically describes the registers. It says there is a serial port here.
08:23
The serial port has a register at this address. Those 32 bits are split into these 8 bits mean this, these 4 bits mean that, these 12 bits mean this. And if that, you have that machine description, you can auto-generate this code and here we are saying in the runtime clock control register we are on the, um, the AHB bus enable register and we're going to modify that register
08:46
and then this modify function takes a closure. And so, you know, it's embedded Rust, but I can still use closures. That works perfectly well. This closure takes a read and a write and I'm going to use the write object to set the, um, IOP enable bit.
09:00
Now that might look like nonsense, but if you read the data sheet, these words, IOP, AEN and AHB, ENR, they all line up with the data sheet. So if you've got the data sheet open, the code you write makes sense compared to what you're reading. And it's impossible to get this wrong. You can't accidentally set the wrong bit because you mistyped a 6 for a 7
09:21
like you can when you do this in C. Um, you can't accidentally write a 16-bit value to an 8-bit field. It just won't let you. It says, nope, that doesn't fit. If, um, if you've got a field which is an enumeration and there's like three choices and the fourth option is invalid, well, you can only give it the three valid ones and you can't give it the invalid one.
09:42
So there's loads of power in this and then when it compiles, this disappears and becomes a single register write. So it's as efficient as doing the hand optimized C where you've written out all the literal integers and done all the bit shifting. Um, but, you know, if you've got a data sheet and you understand the chip, this I think is easier to understand what's going on.
10:03
So, um, if you, uh, if you listen to the new Rustation podcast, you know they do. Crates you should know. Here are my crates you should know for embedded development. SVD to Rust and the crates that are generated from that. Have a look on crates.io and you'll see crates for various different embedded chips. That's your sort of low-level, um, access to your chip.
10:23
We then have an embedded HAL, a hardware abstraction layer. We're trying to find ways of saying this is a serial port. You can read data. You can write data. Now, I don't care if you've got a TI serial port or an STMicro serial port or an NXP serial port.
10:41
We'll try and write drivers that make all of these serial ports look the same and then we have some code portability. So we have these HAL crates that dress up the chip to look standard, make them all look similar so we can write some portable code. And then for Cortex-M there's a couple of crates that help you get the chip booted. Um, can be a little bit fiddly, but it's great because Jorge's done some great work and you just extern those crates
11:04
and your chip will start up and you can do interrupt vectors. For most of this year, I've had to use nightly Rust. it's a little bit like gambling. I go Rust up update, you roll the dice. Snake eyes, sorry, sucks to be you. Thumb V7's broken again.
11:22
Um, we are going to be on stable embedded Rust by the end of the year. We've got a couple of blocking issues. So to go with that, we are also writing three separate books. One is an introduction to embedded systems.
11:41
One is an introduction to embedded Rust and one is all of the deep weird compiler voodoo required to make embedded systems work. You can find them all on our GitHub. We love pull requests. We love reviews. So please check out the books and help us out with that. Um, but yeah by 2018 release you will be able to do embedded software on your Cortex-M
12:02
using 2018 syntax if you wish, um, and using the stable compiler, which I think is super excited. I've done a bunch of tests on beta. If you're not testing on beta, please test on beta. Let's find all these bugs before we before we go stable. So video, what I want to do is connect this to a monitor. Um, how do we connect things to a monitor? Well, VGA is the simple way to do it. HDMI is like insanely complicated.
12:27
Uh, VGA video is an analog system with three colors, red, green, and blue. And the colors you see are some mix of red, green, and blue. Um, this is a representation of a line. So if you imagine a, um, a laser pointer or your the
12:42
the cathode ray in your CRT, it starts on the left side of the screen and it swings across drawing pixels in a line and then it flies back to the left and comes over again and it's swinging back left and right. And as it swings across there's a bit where it's kind of off screen. That's this synchronization period. And then where you've got the red, green, and blue lumps, that's the that's the portion where the picture is.
13:05
so you have these lines and then lines make up a frame. And again, some of the frames are invisible. They're off the top of the screen or off the bottom depending on your point of view. And some of them are on the screen. And that turns out to be really useful because while the beam is going across the screen in the visible portion, my CPU is going to be pretty busy doing pixels.
13:25
But while the the beam is off the bottom of the screen in this invisible area, well, I've got no pixels to draw so my CPU can go and do something else. Um, I should mention VGA is an analog system. You are supposed to have analog operational amplifiers and a 75 ohm source impedance.
13:43
Turns out that's completely optional. You can just, you can, you can just connect an HDMI splitter and hop hog video recorder into a projector using three resistors on a 3.3 volt TTL output. And hey, you will probably get a picture or a fire, but you know, we are going to have a great afternoon.
14:06
Um, so this system is, the VGA is all about timing. If the timing falls apart, if you do not do things when the monitor is expecting you to do them, it says out of sync. I have a lot of experience with monitors saying out of sync. And that means the timing was not
14:25
as expected and the picture stopped. Um, if you're slightly in sync, what you get is a wobbly picture or a fuzzy picture or a picture where all the colors are all smeared out. If you go to tiny vga.com, it's a brilliant website. Um, you can see the timings required
14:41
for a whole bunch of stiff, uh, different standard video modes as used on IBM PCs. For example, the basic video mode from windows 3.1, uh, the standard VGA mode, 640 by 480 pixels, 640 across 480 lines, 60 Hertz. You need to emit a new pixel at 25.175
15:01
megahertz. That is exactly how often the pixels need to come out. Otherwise it's not going to work a little margin for error. Um, you remember my chip is clocked to 80 or 66. That is not, that is not an integer factor. Um, well, with the, the, the bios mode,
15:20
so text mode, when you boot your computer, not actually a VGA resolution resolution, it's 720 by 400. The sort of the classic dos 80 by 25 text mode, uh, 28.322 megahertz. Nope, Nope. That's, uh, that's not going to work either. Um, super VGA, the next step up 800 by 600 pixels at 60 Hertz 40.000 megahertz is the pixel clock rates. And yes, that is
15:49
exactly half of 80. So I think we have a winner. The problem is 800 pixels by 600 pixels is a lot of pixels. And I haven't got enough SRAM to store all those. If you take 800 by 600,
16:04
multiply them and have one bit per pixel doesn't fit in RAM. How are we going to fix this? So the first thing we do, we cheat. If you, if you half the pixel rate from 40 to 20 megahertz, you get yourself a 400 by 600 display. It's a little bit smaller. You can just about squeeze
16:23
it in. It's also less CPU required because each pixel is twice the size. Um, we split the screen into text cells. So like characters in a, in a dos screen, um, eight by 16 pixels for each cell. Um, and then what you can do is you can put the characters in memory, and then you can convert the characters to bitmaps in real time. As the scan line is running
16:46
across the screen, the pixels on screen are not stored in memory. At any point, only the characters are stored and the characters are converted, like rendered with the font. Fortunately, I'm not using true type fonts. It's just a basic bitmap font rendering Bezier curves. And then we put a little bit of a border on 12 pixels and eight,
17:07
and it just makes things a bit simpler. Gives the monitor something to lock onto. If you're doing homemade VGA and you've just got a little image in the middle of the screen, it's kind of hard for the monitor to know where the edges are. So the board is actually a bit of a trick to help the monitor line up. So how are we going to do this in software? Well,
17:24
we need to do it in interrupts. So an interrupt is, uh, your code is running, an interrupt occurs and your CPU switches and does something else. It turns out it's actually a, um, a non constant amount of time elapses between the interrupt and your code starting to run,
17:43
which gives you wobbly video because the start of your scan lines then don't all line up. But we have a timer. And when the timer goes off, we start our routine. And the way this works, I use the SPI, the synchronous serial peripheral, and it's got a FIFO in it. It's a bit like a bathtub. When the first timer fires, the far left of this diagram, I start
18:02
generating the pixels that need to be displayed on screen by looking up the characters and rendering them. And I start filling the bathtub. And then when the second timer fires precisely here, I pull the plug out the bath and it starts draining and the pixels are displayed across the screen. And then in theory, if I'm filling the bath sufficiently fast,
18:23
it will never be empty at any point. If it goes empty, there is a black line in the screen. Um, that's happened a lot. And then I'm doing, doing as much work as I can. So ideally the bath just, just runs out just at the end of the, of the scan line. And it all works. So this is the fundamental number. I have 32 clock cycles
18:44
for every character on screen. A character is eight bits across. That's a byte. 32 clock cycles. To go into the text RAM, find the character, the letter A. Look up A in the font. There's 256 entries in the font. Find out which bits I need for a letter A at that position in the A.
19:02
There are 16 rows in each character. I then have to go and if I'm doing attributes like underline or bold or maybe colors, I've got to hold, do a whole bunch of maths, work out what I'm doing there and then get those pixels chucked into the SBI peripheral.
19:21
32 cycles for each byte, 48, 50 bytes across the screen. Uh, there's 37,000 lines per second. And it has to do that every single time. Any one of those goes wrong. It's not going to work. I have, um, it's worth saying I have had some fun with the optimizer recently.
19:40
Um, I was, I was in a situation where I was editing some code and I'd rebuild it and my scan line routines would not run fast enough and my monitor wouldn't sync. I edited some completely unrelated code and built it again. And the optimizer did things in a slightly different order and my picture was fine. And I'd edit something else and then it would all fall apart again.
20:00
Um, it was incredibly frustrating. I think I managed to take some maths out of the loop and pre-compute some stuff. And I think we'll, we've got a solid picture. Um, but I'm kind of pushing the limits as to, as to what you can do, um, in Rust. So enough talking demo time. So get my Bluetooth keyboard to work. I may just have to use,
20:33
So there's a, there's a built in menu system and this is Rust. So it's all divided, divided into crates. There's a crate that does the video driver. There's a crate for the application.
20:41
This menu system is a crate. It's on my GitHub. It's called menu and it allows you to plug in static commands and it generates the help text and you can, you can go in and do stuff. So we can, um, we can do a dump. So this will show you the contents of memory. So if you want to see what, um, an arm interrupt vector table looks like, this is an arm interrupt
21:01
vector table. It's at address naught. All of these numbers here are in little endian. So the bytes are basically in the wrong order, but this is 0 0 0 0 0 7 8 D. These are all the crash interrupt vector cause I'm not using these interrupts. So if someone calls them, that's bad and it crashes. Um, but some of these are different numbers. Um, and one of
21:21
these will be the video, um, the video rendering routine and so on. Um, I've got a couple of demos to show you. So a couple of these demos are baked into ROM. Um, we can show you what the font looks like before I stay in range of my Bluetooth keyboard. Alphabet. So this is the MS-DOS code page 850. Felt like it was a balance between
21:46
extended characters and sort of some of these graphical blocks. Um, I could have done 4 3 7 for you Americans, but you took all the accented characters out and just had more block characters cause who needs international characters? Um, the code page 850 is a,
22:02
is a sort of a nice, a nice thing. So we've got this text mode and as I said, these are being rendered in real time as the beam goes across the screen. There is a significant amount of processing happen to make this picture appear. Um, the color for example is interesting. There are three SPI devices, one for red, one for green, one for blue.
22:22
If you start them in the obvious way, start red, start green, start blue. They don't start at the same time. One of them has to start before the other. And that means on screen, the red, the green and the blue don't line up. If you draw a white thing, it has a red edge and a yellow edge and then it's white and then it's purple and then it's
22:41
blue because none of them are in phase. Um, the trick it turns out is some inline assembler and a lot of no ops. You actually, you actually start red two bites early and then do a bunch of no ops and then you start green one bite early and then do a bunch of no ops and then start blue and they remain in phase across the screen. That took about two months
23:06
to work out. You're welcome. I'll let you have that one for free. So sort of things you can do on this system. You could play space invaders. I've got a text based display, got some double height text. You know, I could write this game if I wanted. You could do Pac-Man, you know, it's not, not great cause I haven't got a Pac-Man
23:22
graphic, you know, but that will work. MS-DOS productivity software, you know, people run their lives on this kind of thing. That's fine. That would work. You know, you could, you could run your life on a, on a computer you'd, you'd made yourself.
23:41
Um, you could do artwork, um, kind of, kind of blocky cause we're in, we're in text mode. This, I, I have no artistic merit. I'm, I'm happy to admit that. I was using an ASCII art editor called Rex paint drawing things. I'd drawn landscapes and trees and houses, sort of stuff my four year old can manage. And the only thing I could think to draw was
24:02
a picture of the ASCII art editor. So this is a photo of the ASCII art editor I drew in an ASCII art editor. Um, but you get the idea. You can select your colors and you can, you can paste the characters from the font. All right. So I have no artistic merit. So I got in touch with, um, a renowned, um, eight bit artist. His name is Horsenberger. Um,
24:22
and he did the art for teletext. If you remember that, that video, that, um, tech service you could get on your analog TV told you the weather and the news. Um, when you care, it's very popular and there was a lot of artwork on there and Horsenberger done a lot of this artwork and he's done us a special teletext artwork for Rust Fest.
24:48
So there is a, there is pixel Ferris. Technically Ferris is not made of pixels. He's made of sixles. Um, teletext is this weird thing. What we've done here is we've switched the font. I've now loaded a different font into the system and you've got, um,
25:05
six individual pixels or sixles within a block. There's two and then three. And then each of these is actually a character, but it has a different number of the little blocks turned on two to the power six is 64. So I've got 64 block characters, which let me do this,
25:21
but he sent it to me in teletext format. He gave me a thousand bytes of data and I had to go and get the teletext specs and understand all the, all the control codes. Um, so this is actually a thousand bytes of genuine teletext data baked into the ROM. And I decode it at runtime and convert all the control codes and map all the stuff around, which made me realize I can just go to the internet and download teletext data.
25:44
This, this is a genuine page from 1983 that someone accidentally captured on their VHS recorder and has since digitized and uploaded to the internet, to the teletext archive. Seriously, this is genuine teletext information from 1983. Um, I think the system is fine. I could
26:02
use it. Imagine a Twitter client that looked like that. You will be absolutely fine. Um, and just to demonstrate, cause these have all been a bit static. There is, uh, there is some extra CPU time. How about graphics? You know, I see some ooze. What we've done here is we've used 17 kilobytes of video memory to do a black and white
26:24
bitmap and we've overlaid that bitmap on top of the text background. So these are all text cells. And then instead of rendering font, I'm, I'm pulling the graphics from the bitmap and then
26:40
basically attaching it at a different scan line on the screen. So I don't have to move anything in memory to slide it around because I'm not sure the chip's that fast. Um, but yeah, this is basically a cheap, but it looks kind of good. And you know, there's enough CPU time to do that, to do the flame animation. So, so far, this is all kind of similar to what
27:02
we had at Rust Fest Paris, but with the Telesect stuff. But I understand that's not going to be enough for you people and you would like to see something new and something different. So how would you like to see, um, I haven't got a lot of time to pick one of these. How would you like to see a program written in C compiled for ARM, injected over the serial
27:24
port and then executed from RAM? If I, if I get out of the demo menu, cause I can't do it while in the demo menu. So there we go. There is a C program that has been injected over the serial port and into RAM. And then that runs just fine, but okay, that's all right.
27:47
How about, how about some more interesting C programs? How about a copy of Dr. Dobbs, tiny basic originally for the 68,000. So welcome to a, welcome to a basic interpreter. So I can say 10 print. Hello. 20 go to 10 run. Yeah. Yeah. Woo. Right. So let's,
28:15
let's go back in here. Let's exit out of that. I can tell you're a tough crowd and you're
28:23
tiny basic is only an integer basic and there's no floating point support. So wouldn't it be better if we used a proper basic, a Microsoft basic, how would you like to see Microsoft enhanced basic for the 6502 running in a 6502 emulator? That is, that is genuinely
28:43
Microsoft code for the, um, so for something like the outer, I can't remember which machine this is from, but this is genuinely Microsoft basic. Um, and the reason we can tell it's different is because all the, all the words have to be in capitals.
29:02
So there we go. It's not, not as fast, but that is a 6502 CPU emulator. So I've got one last demo. I have to, I have to reboot the boards to get out of that. Cause all this basic stuff is fine and people normally use basic to write games. So how about a copy of snake and a copy of snake? You know, it's all right. I've got my
29:22
Atari 2600 joystick, but, but what you really need is some, is some background music. So how about a three channel wave table synthesizer that executes at 37 kilohertz at the end of the scan light interrupt. So I don't know how well that's coming out on the, uh, on the
29:44
microphone, but there is a three channel synthesizer running and then we can, uh, yeah, if we grab the microphone, we might be able to, so I, I, I don't know if I mentioned,
30:02
but I have no artistic merit. This is the most annoying tune I've ever heard. And I have, I have heard it a lot. So, um, so that's the end of my talk. So what I'd like you to do now is watch me have a little game of snake whoop and cheer every time I get an apple. And then when I eventually crash into the wall, you may all go into wild, rapturous applause. Are you ready? Here we go. Yeah,
30:26
come on. Oh, it's tricky. No, I missed it. No, no, come on.