| |||
Home > Using the Assembler > Using stdin to input source code to the assembler |
Instead of creating a file for your source code, you can use stdin
to
pipe output from another program into armasm
or
to input source code directly on the command line. This is useful
if you want to test a short piece of code without having to create
a file for it.
To use stdin
to pipe output from another
program into armasm
, invoke the program and the assembler
using the pipe character (|). Use the minus character (-
)
as the source filename to instruct the assembler to take input from stdin
.
You must specify the output filename using the -o option.
You can specify the command line options you want to use. For example
to pipe output from fromelf:
fromelf --disassemble input.o | armasm -o output.o -
To use stdin
to input source code directly
on the command line:
Invoke the assembler with the command
line options you want to use. Use the minus character (-
)
as the source filename to instruct the assembler to take input from stdin
.
You must specify the output filename using the -o option.
For example:
armasm --bigend -o output.o -
Enter your input. For example:
AREA ARMex, CODE, READONLY ; Name this block of code ARMex ENTRY ; Mark first instruction to execute start MOV r0, #10 ; Set up parameters MOV r1, #3 ADD r0, r0, r1 ; r0 = r0 + r1 stop MOV r0, #0x18 ; angel_SWIreason_ReportException LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit SVC #0x123456 ; ARM semihosting (formerly SWI) END ; Mark end of file
Terminate your input by entering:
Ctrl-Z
then Return
on
Microsoft Windows systems
Ctrl-D
on Unix-based operating
systems.
The source code from stdin
is stored in
an internal cache that can hold up to 8 MB. You can increase this
cache size using the --maxcache command line
option.
Introducing the ARM Compiler toolchain:
Introducing the ARM Compiler toolchain:
Assembler Reference: