Assignment 2: MIPS virus

Due: 5:00pm, Tue 5 Feb. Value: 30 pts. Submit to Moodle.

This assignment uses MARS for simulating the MIPS architecture. On the laboratory computers, you can start MARS using the “mars” command from the terminal. For other computers, you can download it here [Link]; this version differs from the one available on the official MARS Web site, as the official version has a shortcoming preventing this assignment from being feasible.

Your assignment is to write a MIPS assembly language program that duplicates and invokes itself — i.e., a virus. That is, while the program you write is loaded into memory starting at 0x400000; but as executed, it should copy the program found starting from 0x400000 (i.e., itself) into memory starting from 0x400100. It should then jump to 0x400100 to execute the copied program, which would then duplicate the code starting from 0x400100 into memory into 0x400200, which when invoked will duplicate itself into 0x400300, and so on.