问题
I am trying to run a sample Sparc assembly language , but I am not even sure where to start. I tried vim macro
or m4 example.m
but I dont know where and how to compile it. I searched the internet, read articles, but none of them mentioned how to start coding.
for example, I would like to type this assembly language :
.global main
main: save %sp, -96, %sp
mov PROMPT, %o0
call writeChar
nop
call readInt
what commend should I use to compile and run ? (using Linux)
回答1:
You don't "compile" assembly code, you "assemble" it! That said, your compiler driver can probably do it. A common filename extension for assembly source code is .s
, so maybe something like:
cc -o example example.s
Then, if it worked, you'll have an executable named example
to run, test, and debug.
来源:https://stackoverflow.com/questions/14651855/sparc-assembly-language