'How do I compile my 16 bit Mac assembly code?
So I'm trying to assemble this piece of 16bit assembly code on my Mac (Monterey):
global _main
section .text
_main:
mov ah, 0x0e
mov al, '!'
int 0x10
mov ah, 0x4c
int 0x21
I am using the NASM assembler, and have so far managed to get it assembled into a .com file using the following command:
nasm testing.asm -o test.com -f bin
However when trying to link this into an executable using LD with the following command:
ld -e _main -static -o test test.com -arch x86_64
it comes up with the error:
standing-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0xB4 0x0E 0xB0 0x21 0xCD 0x10 0xB7 0x0E 0xB5 0x0E 0xB6 0x0E 0xBE 0x0E 0x00 0xBF ) Undefined symbols for architecture x86_64: "_main", referenced from: -u command line option ld: symbol(s) not found for architecture x86_64 ```
Does anyone know how to fix this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
