RSSAmplifier

Blog

magnushoff.com

Assorted stuff I've made

&RSS feed ↗27 posts

Latest posts

Id30

Id30 is an encoding scheme for identifiers I have designed for use in URLs, and implemented in Rust . It is also a good fit for single-use keys meant to be copied to another device, such as login codes sent via SMS or displayed on a TV screen. Id30 looks like the following: bpv3uq , zvaec2 , rfmbyz , jwygvk or even 000000 and zzzzzz . Example URLs could be:…

Asmtut

I have written six lessons in a tutorial on x86-64 assembly programming. The theme of the tutorial is the making of a snake game with the least amount of abstractions over the OS. The tutorial was originally posted on Google+, but has been reposted here after its demise.

Hexagonal train game

I'm dreaming of a train game inspired by OpenTTD , a game I have spent the typical "too many hours" playing. I obviously enjoy it a lot, but there are nevertheless some annoyances that would be nice to fix. So I have spent a lot of time designing a new game in my mind that fixes everything and is so much better. Maybe. The only way to know is to play the game, and that requires having the…

Writing dependency-free JavaScript

Lately, I have been working on a web application, pixu.rs 1 , that, while small, includes an interactive form with image uploading and multiple phases. This is exactly the kind of thing I tend to turn into a mess when I'm not using React, Redux and everything that comes with that ecosystem, but small enough that I hesitate to bring in the big guns. For pixu.rs, I have experimented with…

Site maintenance

Over the last weeks I have implemented various improvements to this site. I have been saving them for a single write-up, because I want to keep the volume of meta-posts low, lest this become another blog about blogging and how I would want to write more next year. First up is tags. Some blog posts get one or more tags, and I can now give you an overview of all my posts about doom , for example. I…

Kick the Bitbucket

On June 1, Atlassian will indiscriminately delete all Mercurial repositories from Bitbucket, becoming another Git-only site. In the beginning, Bitbucket exclusively supported Mercurial, so this change is unexpected to say the least. In addition to supporting Mercurial, the main distinguishing feature that kept me using Bitbucket was its generous offer of unlimited private repositories for free.…

Snygg

Edit the template file directly.

JPEG Orientation

When shooting a photograph in portrait orientation, cameras generally recognize the situation and are able to store the resulting image such that the top of the photo corresponds with the top of the scene. Yet somehow, portrait photos sometimes show up in the wrong orientation; the top of the image on screen suddenly corresponds to the top of the camera as it was when the photo was taken. The…

Actually getting started with Portable Native Client

This post was originally a featured article on the front page . I thought the technology looked fun and promising, and I wanted to keep up with it. It is clear, however, that the winner in this space is WASM, and PNaCl is just a failed experiment. While blog posts can go out of date and be kept for posterity, this is not what I want the fetaured articles on my front page to be like, so I relegated…

Asmtut 6: Live interaction

This was originally posted on Google+, which has now been shut down. It was helpfully converted to Markdown by Robert Jacobson after which I adjusted it for reposting here. I have dated it at its original posting date, but it was posted here on 2019-09-07. Since the last time, the nasm people have been able to fix the bugs I stumbled upon, and pushed them in a release . Anything newer than 2.10.6…

Asmtut 5: More snappy interaction

This was originally posted on Google+, which has now been shut down. It was helpfully converted to Markdown by Robert Jacobson after which I adjusted it for reposting here. I have dated it at its original posting date, but it was posted here on 2019-09-07. At this point, we are tired of the line-buffered interface. Let's make it more responsive! Step 11: Cleanup First, let's just clean…

Asmtut 4: Input

This was originally posted on Google+, which has now been shut down. It was helpfully converted to Markdown by Robert Jacobson after which I adjusted it for reposting here. I have dated it at its original posting date, but it was posted here on 2019-09-07. Let's start drawing and moving around a snake. Before we can ask the user where he wants to move the snake, we need to have a snake: Step…

Asmtut 3: Redundancies

This was originally posted on Google+, which has now been shut down. It was helpfully converted to Markdown by Robert Jacobson after which I adjusted it for reposting here. I have dated it at its original posting date, but it was posted here on 2019-09-07. This time we will automate stuff with the assembler. Step 6: String length In our Hello world-implementation, we used a tedious and error prone…

Asmtut 2: Hello world!

This was originally posted on Google+, which has now been shut down. It was helpfully converted to Markdown by Robert Jacobson after which I adjusted it for reposting here. I have dated it at its original posting date, but it was posted here on 2019-09-07. Aside: For your convenience, please use a Makefile . To assemble and link, simply execute make . # Please be aware that the indentation must be…

Asmtut 1: true

This was originally posted on Google+, which has now been shut down. It was helpfully converted to Markdown by Robert Jacobson after which I adjusted it for reposting here. I have dated it at its original posting date, but it was posted here on 2019-09-07. In an effort to educate the dunces Knut and Jon who apparently never programmed in assembly , I am going to post a step by step instruction on…

BSP rendering in Doom

I gave a talk on the Doom rendering engine at RevolverConf 2019.2 . It is a big topic, so I had to narrow down the scope. I chose to talk about the binary space partitioning (BSP) rendering algorithm. This was the core innovation in Doom which enabled it to run smoothly on ancient hardware and it is still an important algorithm in rendering engines. I want to do a write-up on it one day, but for…

Textures

Textures in Doom are a notch more complex than sprites : they are compositions of multiple sprites. There are also a couple of additional indirections, one which seems to make more sense than the other. The first indirection is the TEXTURE1 and TEXTURE2 lumps. While both flats and sprites are lumps in the wad file in their own right, textures are nested one level deeper. You have to read the…

Sprites

Sprites in Doom are stored in a custom format, tailor made for the rendering engine and in a sense even for the final output medium. It has taken me a while to implement support for this format in wad-gfx (formerly doom-gfx ), not because of any complexity in the format, but because I had a hard time figuring out how to most faithfully represent the source data in a normal contemporary image file…

Flats

Of the different image formats in Doom, flats are the simplest. Now, all images in Doom are flat, but flats are what they decided to call the textures that go on the floors and ceilings. I'll save the wall textures and sprites for another time. Flats have predefined dimensions of 64 by 64 pixels. With 8 bits per pixel and no compression or other fancy encoding, this works out to 4096 bytes,…

E1M1

I was gifted the Game Engine Black Book DOOM for Christmas, to my great pleasure. It will let me finally satisfy the curiosity that has been lingering in me since '93. And I suspect it is not entirely without some expectation that I get this book now, after having recreated the rendering engine from Wolfenstein 3D in a live-coding session at RevolverConf 2018.1 . My primary goal here is to…

WikiLinks

I've been working on Sausagewiki for a while now, but I have only recently discovered how best to enable prolific linking between articles. I have now made it possible to link to an article by just writing its title in square brackets inline in the text; I like [pie], I like [cake] . This is a bit of a lucky combination of an extension to Markdown and the way URLs are generated for articles…

Wwwwayland sucks

Wayland sucks. I'm sure that it's not Wayland that sucks, but running Ubuntu 18.04 with gnome-wayland is inferior to gnome-x11 in multiple surprising ways, and better in only a few. I've been using gnome-wayland now for about a month, since upgrading to Ubuntu 18.04 , and I'm about ready to switch back. The good: In Wayland, I am allowed to switch workspaces with a four-finger…

System(d) upgrade

I have recently updated a server of mine from Ubuntu 16.04 LTS to 18.04 LTS. As usual, it was a bumpy ride. The upgrade stopped half-way through with my system in a stupid state, and I had to figure out how to fix things so that apt would be able to continue the process. I don't understand why this keeps happening when the resolutions are so daft. This time it amounted to removing a good deal…

Blog!

I'm experimentally adding a blog to this site. In this post, I'll introduce the blog and discuss some specifics about how the blog and site in general is technically put together. I used to write a bit on Google+ , but it is neither a good blogging platform nor a good social platform, so I have given up on that. Writing blog posts on this site is technically superior, and I suspect I…

Mustachio: Pull streaming Mustache templating

Mustachio: Pull streaming Mustache templating

Solving Minesweeper

Minesweeper is a simple game with simple rules, yet some configurations yield interesting challenges. In this article, we will develop a Minesweeper solver of increasing refinement, and discuss how the game dynamics develop as we employ the increasingly advanced help. In the end, we will develop a new variant of the game which has more interesting gameplay. Local reasoning: Zero adjacent mines The…

PlainTalk: a simple network protocol syntax

PlainTalk: a simple network protocol syntax