Cygwin --- "Linux-like" environment for windows
IMPORANT 1: We will test your assignment under this environment.
IMPORANT 2: Make sure that the binutils and gcc packages are included
in your installation (if you download Cygwin these packages are not included by default).
MinGW --- Minimalist GNU for windows
Note that these manuals use the Intel syntax whereas we are using GAS (AT&T)
syntax.
Differences between the two are listed here and
also summarized below.
| AT&T | Intel | |
| Order of operands | op a,b means b = a op b (second operand is destination) |
op a, b means a = a op b(first operand is destination) |
| Memory addressing | disp(base, offset, scale) |
[base + offset*scale + disp] |
| Size of memory operands | instruction suffixes (b,w,l) (e.g., movb, movw, movl) |
operand prefixes (e.g., byte ptr, word ptr, dword ptr) |
| Registers | %eax, %ebx, etc. |
eax, ebx, etc. |
| Constants | $4, $foo, etc |
4, foo, etc |
| Intel® Architecture Software Developer's Manual, Volume 1: Basic Architecture | (most relevant) |
| Intel® Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual | (also relelvant) |
| Intel® Architecture Software Developer's Manual, Volume 3: System Programming Guide | (less relevant) |
| Intel Architecture Optimizations Manual | (finished everything else, huh?) |
Intel Instruction Summary (taken from NASM manual, Intel Syntax)
Linux Assembly (useful for wintel users as well)
Programming From the Group Up Book (PDF)
Note that these programs are optimized, and your generated code will look more cumbersome.
hello.ic,
hello.s
fib.ic,
fib.s
objects.ic,
objects.s
T12_example.s
arithmetic.seax register (not on stack) eax, ecx, edx ebx, esi, edi, ebp, espIn Windows under the Cygwin environment, the assembling and linking commands for an
assembly file "file.s" are:
as -o file.o file.s
ld -o file.exe file.o /lib/crt0.o libic.a -lcygwin -lkernel32
The library file libic.a for
Windows/Cygwin is a collection of .o files bundled together,
containing the code for all of the library functions defined in the language
specification, along with run-time support for garbage collection.
The library is also available for Linux: libic-linux.a.
The assembling and linking commands for "file.s" in Linux
are:
as -o file.o file.s
ld -o file file.o /usr/lib/crt1.o /usr/lib/crti.o libic-linux.a -lc /usr/lib/crtn.o -dynamic /lib/ld-linux.so.2
compile hello