Skip to content

Instantly share code, notes, and snippets.

@circlePulse
circlePulse / x86_64_on_apple_silicon.md
Last active September 8, 2025 09:06
Running x86_64 Assembly on Apple Silicon Machines

Running x86_64 Assembly on Apple Silicon Machines

By Omar Hboubati

Introduction

This is a tutorial for running x86_64 on a Mac with Apple Silicon. These instructions work for me on a MacBook Pro M1 with Visual Studio Code, but there's no guarantee they will work on every machine. What we're doing is converting a .asm file to an x86_64 machine code file on our machine using nasm and x86_64-elf-gcc. Then, we copy that file to a Docker Ubuntu container, where we run the file.

Installations

Docker

@kongtomorrow
kongtomorrow / gist:e95bea13162ca0e29d4b
Last active August 31, 2022 16:20
Y combinator in Swift!
/* The Y combinator in Swift!
For a discussion of what the heck this is all about, see http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html
The nifty thing is that it allows us to implement recursion without the ability for a function to refer to itself from within its own definition.
Note how we manage a recursive definition of factorial without any function referring to its own name.
Thanks to @eridius for help with the SelfToUnderlying<T> type.
*/