Make your way through x86-64 assembly language • The Register
Ruby and Internet Japanese developer Aaron Patterson released a REPL for the 64-bit x86 assembly language, allowing interactive coding in the lowest-level language of all.
REPL stands for “read-evaluate-print loop”, and REPLs were first seen in Lisp development environments such as Lisp Machines. They allow incremental development: programmers can write code on the fly, enter expressions or blocks of code, have them evaluated – executed – immediately, and print the results. This was viable because of the way Lisp blurred the lines between interpreted and compiled languages; nowadays, they are a standard feature of most scripting languages.
Patterson has previously offered groundbreaking enhancements to developer productivity, such as an analog terminal bell and performance-enhancing firmware for the Stack Overflow keyboard. It only has the Ctrl, C, and V keys for super easy copy and paste, but Patterson’s firmware does away with the tedious need to stay in control.
We suspect that the REPL assembler originated from Patterson’s work on his own compiler just in time for Ruby, TenderJIT. He does such things for his day job. And like TenderJIT, the main focus of AsmREPL is educational.
Patterson explained, “I wrote it because I never remember what
test the instruction does to flag zero. Every time I use the instruction I have to search for the documents. Searching for documents is good, but running code in a REPL helps me remember things better. “
AsmREPL works by assembling code in a shared buffer using Patterson’s own Fisk, an x86-64 assembler written in Ruby, then using Unix
ptrace system call to monitor what the code is doing. Windows users will need to use WSL.
It’s not quite the same as a machine code monitor, as loved by early 8-bit coding pioneers, but it looks like a fun tool if you’re learning to write device drivers. or other very low level codes. ®