How to use assembly language in Xcode

26 Views Asked by At

I have the below program written and tried to compile/build it in XCODE (Version 10.1 (10B61)), but failed.

.386
.model flat
.code

start   PROC
        mov eax,213
        add eax,432

        rel
start   endp
end     start

This code was extracted from a study video on assembly language and I believe XCODE is capable of handling.

However, I'm presented with the following errors,

error: unexpected token at start of statement .386 ^

error: unknown directive .model flat ^

error: unknown directive .code .code ^

error: invalid instruction mnemonic 'start' start PROC ^

error: unknown use of instruction mnemonic without a size suffix mov eax,213 ^

error: unknown use of instruction mnemonic without a size suffix add eax,432 ^

error: invalid instruction mnemonic 'rel' rel ^

error: invalid instruction mnemonic 'start' start endp ^

error: invalid instruction mnemonic 'end' end start

Can someone kindly suggest any solutions, please. By the way, I'm a novice to programming as well and this is the first time I have used XCODE.

Regards Thusitha

0

There are 0 best solutions below