Madduck
Madduck

Reputation: 19

How to compile and run assembly code in linux

I am quite new to assembly and Linux as a whole. I found on gitHub a space invader program written in Assembly. But I tried compiling and running it, but have no clue how.

I first thought I could use gcc -o name name.s and that didnt work.

Like I said I am completely new to usuing linux and I would greatly appreciate it if someone could explain to me how to compile this and get it running.

Here's the link : https://github.com/timotei/Space-Invaders-Clone/blob/master/spacein.asm

Upvotes: 0

Views: 10778

Answers (1)

Klaus
Klaus

Reputation: 25663

Under linux the standard assembler is as. If you want to use assembler sources inside a c or c++ environment you can give the compiler e.g. gcc a hint with -xassembler or xassembler-with-cpp if you want to use the C-preprocessor. Normally gcc also accepts assembler sources if the name of the file ends with standard file name like *.s or *.S.

There is already another question here which handles dos assembler: Taking an Assembly Course, Stuck in DOS!

And maybe you find some other discussions helpful: https://www.winehq.org/pipermail/wine-users/2007-November/028174.html

But I have no idea why someone wants to start with assembler on x86 at all if you are not a os programmer or kernel hacker. :-)

Upvotes: 1

Related Questions