This UNIX tutorial may be of some assistance.
You will have to familiarize yourself with several common UNIX tools for this assignment. The first of these is tar, a utility originally devised to create tape archives for the purpose of backing files up onto computer tapes.
While tar is still used to create tape backups of filesystems, it has become far more common to use tar to group files and/or directories together into a single entity, typically called a "tar-ball". (So common is the use of tar that it has been verbed in computer science terminology: We speak of "tarring" files, or files that have been "tarred up".) Tar syntax is somewhat arcane, as tar came into existence before modern standards for command-line options.
This untars the files into your working directory, in a subdirectory called pi3Playground/. For more information on tar, please see the UNIX man pages.
Edit the file main.S to write your program. Your work must be compiled on a machine with the proper tools, such as the Systems Lab machines. In order to compile your program, use the command "make". In order to run your program, use the command "arm-console". At any time, you can shutdown the remote console system by hitting Ctrl-Space, followed by the letter 'q', for 'quit'.
Few rules govern the format of assembly language programs. Make an effort to keep your programs readable and well-documented; sometimes partial credit may be given if we can tell what you were trying to do, even if it doesn't quite make it.
The ARM Playground (or Pi3 Playground) kernel includes several useful functions for input and output in these earliest assignments, as outlined in the README.txt file. The first is getnum. When executing the getnum function, (with the assembly code " bl getnum",) the user is prompted with a question mark, and a simple integer will be read into register r0. The printnum function will output a base-10 representation of the contents of register r0. The divide function takes a dividend in r0 and a divisor in r1; upon return, the integer quotient is stored in r0 and any remainder in r1.
In keeping with the standard ARM calling convention, registers r0 through r3 may have their values changed by any function call, as they are volatile.
The arm-console command transfers your compiled kernel onto an available
Raspberry Pi 3 board. After running the command, if all goes well, you should
see the message "kexecing new kernel..". This is the kernel transfer procedure. If you
do not see this message, it means the backend machine is not functioning properly. Luckily,
you can specify a different backend by adding it as a parameter to the arm-console command.
First, note the name of the bad backend machine so you can avoid it ('auton' in the example below'):
$ arm-console
spawn xinu-console -c rpi3
connection 'auton', class 'rpi3', host 'morbius.mscsnet.mu.edu'
...
Next, run xinu-status -c rpi3 to print a list of Pi3-class boards (one of these are chosen for you when running arm-console without parameters). Pick one from the list, and then
run arm-console <name-of-backend>.
If all goes well, you should see a "Hello Xinu World" message after "kexecing new kernel..".
Write an assembler program that reads in integers from the user until a zero is entered. Print the total, the average (total divided by number of items, truncated to an integer), the highest integer seen, and the lowest integer seen.
Example:
? 3
? 4
? 5
? 0
12
4
5
3
You may assume that overflow and underflow do NOT occur.
Write an assembler program that reads two positive integers, x and y, and prints x to the y power. Your program should continue asking for integers until it has gotten two positive, nonzero numbers.
Example:
? 2
? 30
1073741824
You may assume that overflow and underflow do NOT occur.
Write an assembler program that reads a positive integer representing a
pound-force per square inch (Psi) value, and prints the value measured in kilopascals (kPa).
For simplicity, assume 1000 Psi = 6895 kPa.
Example:
? 124
854
You may assume that overflow and underflow do NOT occur.