MingGW
MingGW is an environment for
program development under Windows.
Installation
- First download MSYS and execute. Install to C:\msys\1.0. In the postinstall,
reply as follows:
Do you wish to continue with the post install? [yn ] y
Do you have MinGW installed? [yn ] n
- Download
MinGW
and execute. Install to C:\MinGW.
- Using an editor e.g. wordpad create a file with the single line
"c:/mingw /mingw" and save to "C:\msys\1.0\etc\fstab"
First assembly language program
- From your windows start menu, select MinGW -> MSYS -> msys. This
will bring you to a command line shell from which you can type commands.
If you type "pwd", it will show you what directory you are in. In my
case, it returns "/home/phwl". This corresponds to the "C:\msys\1.0\home\phwl"
directory on Windows.
- Download
hello.s
and copy to the C:\msys\1.0\home\phwl directory. If you type "ls" in your msys
shell, you should see hello.s.
- Run the assembler by typing the command "as -o hello.o hello.s" and
link with "gcc -o hello.exe hello.o"
- Run your program by typing "hello". It should output "Hello world"
and return.
Exercise
- You will notice that in hello.s, the string "Hello world" has the
label LC0. In
hello1.s, the string has been "encrypted" by
incrementing each ascii character by 1. Modify this program so that
it decrements each character in LC0 before the "call _puts" statement
so it prints out "Hello world".