简体   繁体   中英

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

Under linux the standard assembler is as . If you want to use assembler sources inside ac or c++ environment you can give the compiler eg 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. :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM