NASM · 8086 · real DOSBox, in the browser
The trick for working out the weekday of any date in your head — implemented in 723 lines of NASM, and running on this site inside a real DOS machine. No install, no DOSBox setup, no server.
╔══════════════════════════════════════════════════╗ ║ ║ ║ Welcome To Doomsday Date Machine ║ ║ ║ ║ Choose any date using the Doomsday Algorithm ║ ║ This Machine will tell you the Day of the Week ║ ║ ║ ╚══════════════════════════════════════════════════╝
C:\> doomsday.com
Opens the program with its source on the left and a live DOS machine on the right. Click the screen and type a date.
The finished program. Source read-only on the left, a full-size DOS screen on the right, and a debug panel underneath showing what NASM said and how long it took. It assembles the moment the page loads.
Write your own →The same toolchain as a scratchpad. Type 8086 assembly, press Run, and NASM assembles it inside DOS exactly as it would on a real machine — errors, line numbers and all.
Every year has a weekday — its doomsday — that a set of easy dates all fall on: 4/4, 6/6, 8/8, 10/10, 12/12, and the last day of February. Work out that one weekday for the year and any date is a short hop from the nearest anchor. It is designed to be done in your head; doing it in 8086 assembly means doing the division yourself.
The same algorithm was implemented in C++ first. That version, and a longer explanation of the arithmetic, live in the Doomsday project. This repository is the third implementation.
Real DOSBox, compiled to WebAssembly, with real NASM installed inside it.
Your source is written into the emulated filesystem as
prog.asm, assembled with nasm -f bin, and the
resulting .COM is executed. Nothing is sent anywhere; there
is no backend.
requestAnimationFrame, so a backgrounded tab stops the
machine dead. It looks exactly like a hang, and it isn't one..COM programs: start with org 100hint 21h, AH=09h ($-terminated) or AH=02hAH=0Ah, a single character with AH=01hAX=4C00h.MODEL, and a label is already its address