|
Example Page |
Additional examples provided for CS310A MAL program to calculate N-factorial (with an if-then-else template; a while template; and decimal input/output using syscalls) A MAL program to calculate N-factorial (with an if-then-else template; a while template; and hexadecimal input/output using syscalls)
MAL Assembly Language Examples from Goodman/Miller textbook:MAL Assembly Language Examples from University of Oregon:
- A simple program to average 3 integers (fig 2.1)
- A program to demonstrate if-then-else statement (fig 2.2)
- A program to demonstrate compound conditional (fig 2.3)
- Another program to demonstrate compound conditional (fig 2.4)
- A program to calculate baseexponent using a while loop (fig 2.5)
- A program to calculate baseexponent using a for loop (fig 2.6)
- A program to read a string of characters until 'Z' is encountered (fig 2.7)
- A program that sums the first n positive integers (fig 2.9). This program uses syscall to read/print integers.
- A program to print an integer using putc (fig 7.8)
- A program that calculates the sum of 2 vectors (section 9.7)
- A program that calculates the greatest common divisor of two positive integers (section 9.7 revised)