Changed around line 1
+ // Hello World in ARM64 Assembly for macOS (Apple Silicon)
+ // Assemble with: as -o hello.o hello.s
+ // Link with: ld -o hello hello.o -lSystem -syslibroot `xcrun --sdk macosx --show-sdk-path`
+
+ .global _main // Declare the entry point as global (required for linking)
+ .align 2 // Align the code to a 4-byte boundary (2^2 = 4 bytes)
+
+ _main: // Program entry point
+ // Write "Hello, World!\n" to stdout
+ mov x0, #1 // Move 1 into x0 (x0 holds file descriptor: 1 = stdout)
+ adr x1, hello // Load address of 'hello' string into x1 (x1 holds pointer to message)
+ mov x2, #14 // Move 14 into x2 (x2 holds length of the string)
+ mov x16, #4 // Move 4 into x16 (x16 holds syscall number: 4 = write)
+ svc #0x80 // Supervisor call to invoke the syscall (write to stdout)
+
+ // Exit the program
+ mov x0, #0 // Move 0 into x0 (x0 holds return code: 0 = success)
+ mov x16, #1 // Move 1 into x16 (x16 holds syscall number: 1 = exit)
+ svc #0x80 // Supervisor call to invoke the syscall (exit program)
+
+ hello: // Label for the string data
+ .ascii "Hello, World!\n" // Define the string "Hello, World!" with newline