Hello everyone, I have to do an Intel x86-based assembly language programming now. How do I do this on Xcode?

My school is learning intel 8086 microprocessor, so I need to use Intel x86-based assembly language syntax, but Xcode is based on ARM, there is a conflict between the two, how should I use the Intel x86 assembly syntax on Xcode?

Replies

Your post sparked my interest, seeing as I last wrote x86 code almost 35 years ago.


As I undestand it (and briefly tested), you can write assembler for x86 in Xcode by:


  1. Create a Mac OS Command Line Tool project (Command line probably easier to manage than Cocoa App) and specify Objective C (simplifies the calling and testing of your assembler);
  2. Use Xcode File->New->File to add a MacOS Assembly File (scroll down tothe "Other" section);
  3. Select your Assembly File in the project navigator, which brings up the editor;
  4. Start writing your assembler code, noting that Xcode only provides error messages when you Build the "app".


There are examples on the web for how to call assembly functions from Objective C.


The default syntax (in Xcode 10.2 anyway) is AT&T, which is different from Windows implementations (Intel syntax). The Apple implementation is described at https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/Assembler/030-Assembly_Language_Statements/asm_language.html#//apple_ref/doc/uid/TP30000822-TPXREF101


Best wishes,


Michaela