Rivet is a toy RISC-V emulator I made as an excuse to learn Zig. As of now, it implements the RV64GC architecture, with an interpreted core written in Zig. The core has access to a few virtual devices through MMIO, including a serial port, real-time clock, hard drive, and ethernet adapter. This is enough to boot and run Linux! Usage The CLI requires exactly one file argument: either an ELF or a…
In the previous blog post , we made a RV64GC emulator that can pass all the architecture tests. Which is very cool in and of itself, but being able to run tests doesn’t necessarily mean we can run actual software. And in this case, we are v e r y very far away from being able to run something like Linux on this thing, so let’s start making progress towards that. What you might have realised with…
Most of you reading this would be familiar with the SI prefixes. They’re those things that you put in front of unit names to make them bigger and smaller. 1 km = 1000 m, 1 MPa = 1 000 000 Pa, etc. They’re super easy to use. So why don’t we use them in computer science? First, a quiz Ok, that’s half a lie. We do use them in computer science. But we also don’t use them. And we sometimes get confused…
Rivet is a RV64GC emulator that I made because bpaul told me to. (They’re making one too, check it out here ). As an excuse to learn Zig , it’s a really good project! I put Zig’s extremely capable comptime metaprogramming, and its variable-width integers to good use, and it helps that it can catch memory errors, and also seamlessly interoperate with C code. For those who don’t know, RISC-V is a…
I discovered, after posting my previous blog post , that my Atom feed had a few issues with it. First, that it wasn’t actually compliant with the spec (I’ve now fixed that). Second, that images don’t render properly in the timeline (I’ve fixed that too). Third, and most drastic, that it doesn’t actually update (depending on your reader). It wasn’t until a few weeks later, when the article finally…
This was originally formatted as an accidental lightning talk for UQ Cyber Squad, but I figured hey since I already have the script I might as well upload it to my blog as well. I’ve adjusted it somewhat to fit the new medium, but otherwise, enjoy! Zig is an in-development systems programming language that markets itself as “a general-purpose programming language and toolchain for maintaining…
I went to CrikeyCon IX last Saturday, and it was a great time! Lots of interesting talks, workshops, and lockpicking, and also a CTF (Capture-The-Flag) competition that ran for the whole day. I only attempted two challenges during the day (I was there more for the talks), but my team altogether managed to raise 1880 points, putting us in 4th place! It’s WASM time! (200 points) I inherited this…
For day 5, we have to pass our input through 7 partial maps. However, these are no ordinary maps, these are range maps . I think it’s finally time for me to show my true colours and use Rust for this one. The first thing I’m going to do is cheat use the tools made available to me by my choice of language . By which I mean, pull in an external dependency Rust Source ```cargo [ dependencies ]…
Introduction My family’s chocolate cake recipe of choice has for a long time been Donna Hay’s “Basic Chocolate Cake” recipe, from her Simple Essentials Chocolate recipe book. It’s very easy to make, and the recipe itself is very resilient to error (for example, the cake worked even when we forgot to add baking powder), earning it the nickname “Donna Hay’s Never Fail Chocolate Cake”. Fiona Weir…
Day 1 was a bit of a curveball, as far as Day 1’s go. That’s not to say it was particularly difficult, though; it’s just a “parse the string and sum the numbers” game. With that said, let’s get into it! Part 1 Part 1 is simple enough; we can just grab all the digits out of the string using a list comprehension: Python Source import sys for line in sys . stdin : part1_digits = [ int ( c ) for c in…
This December I, like so many other programmers, will be competing in Eric Wastl’s Advent Of Code . Or, maybe “competing” is a strong word: I’m not going for leaderboard times, I’m just in it for the code. My solutions (and a star chart) will go up on my sourcehut repo . Also in that repo is my input-fetching and solution-executing script, which allows me to write multiple solutions per day in…
My first blog post, Hello World and Linker Scripts describes the details behind a "Hello, world!" binary program and the process of creating this program using a language that is just “brainfuck with system calls”. For fun, I also wrote for my 404 page a sysfk program that prints 404 to standard output. But sysfk isn’t the only project I’ve made that I could have fun with in a 404 page. Why…
Runscript is a tool I made when I came across a project (I beileve it was an operating system) that required multiple commands to be executed to effectively run the app. I wanted to be able to run the command run and have it run my project, no matter what project it was. Solutions to this problem already exist: make has .PHONY targets, or if you don’t like the idea of using a build tool to run…
I kinda wanted to do something with polystrip , my graphics library, so I thought why not do everything at once? Making a Shadertoy clone gives me a nice excuse to do a number of things, including: Registering a subdomain https://shader.mrcat.au/ Learning how to make a Webassembly project with Rust Tricking myself into working on polystrip even though motivation is very low at the…
I wanted to make something substantial with my graphics library, polystrip . This page gives a technical overview of the project, but if you want to read an explanation of some of the tech behind it (or, more accurately, a long spiel about how cool the Nix package manager is that just happens to contain this project’s development process), you can check that out here Technical overview Polystrip…
polystrip is a graphics library I’m writing to essentially experiment with API design and see how much I can abuse Rust’s type system to do cool things. One of those cool things can be seen in the design of the render graph, and specifically in the construction of render graph nodes. A very simple example Let’s create a simple shader toy in polystrip. (Or rather, a slightly gutted version of…
Polystrip is an experimental graphics library that tries to be a simple but powerful layer on top of wgpu . It achieves this by directly using wgpu types in the public API, but allowing more expressive ways of utilising them. Automatic pipeline construction Polystrip can automatically generate wgpu::RenderPipelineDescriptor s and wgpu::ComputePipelineDescriptor s by reading the shader module…
shared_slab is a small data structure library that I created for polystrip . It is similar to the already existing slab library and others, except for a key API difference. This library was created to solve an odd lifetime problem: when the primary way you want to manipulate data is with shared references, how can you store that data in a collection? This library’s main selling-point is the…
I’ve been thinking about brainfuck , and it is a very limited programming language. Yes, it’s Turing Complete , so it is capable of doing any possible computation (given enough time and memory, of course), but what does that mean to me as an application developer? Its only method of interacting with the host system is through stdin/stdout— not very flexible. While in theory you could put a…