https://github.com/atcold/asm-apple-aarch64-playground
Assembly programs for macOS on Apple Silicon
https://github.com/atcold/asm-apple-aarch64-playground
Last synced: 10 months ago
JSON representation
Assembly programs for macOS on Apple Silicon
- Host: GitHub
- URL: https://github.com/atcold/asm-apple-aarch64-playground
- Owner: Atcold
- Created: 2025-05-05T15:07:18.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-05-17T19:00:12.000Z (11 months ago)
- Last Synced: 2025-05-17T20:18:31.860Z (11 months ago)
- Language: Assembly
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Apple AArch64 playground
A collection of minimal assembly programs for macOS on Apple Silicon (AArch64).
This repository is meant for experimentation, learning, and low-level exploration of the Apple ARM64 architecture.
## 🧰 Requirements
- macOS (Apple Silicon)
- `clang` (Apple LLVM)
- Optional: `lldb` for debugging
## 📂 Structure
Each `.s` file is a standalone assembly program, assembled and linked with `clang`.
```
src/
├── hello.c # print "Hello" to screen
├── mul.c # print multiplication output to screen
├── minimal.s # return to the OS the multiplication of two numbers
annotation/
├── mul_commented.s # clean up compiled `mul.c`
```
## 🛠️ Building
You can compile with:
```sh
clang -S hello.c
```
You can assemble and run with:
```sh
clang -o hello hello.s
./hello
```
You can compile an x86_64 version (runs under Rosetta) with:
```
clang -arch x86_64 -S -o hello_x86_64.s hello.c
```
To assemble an x86_64 version type:
```sh
clang -arch x86_64 -o hello_x86_64 hello_x86_64.s
./hello_x86_64
```
## 📚 References
- [Apple ARM64 ABI Documentation](https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms)
- [ARMv8 AArch64/ARM64 Full Beginner's Assembly Tutorial](https://mariokartwii.com/armv8/)