This is a repository for lab work in CMSC 131 (Machine-Level Programming) with NASM. Paul Carter's book is used extensively as a reference. It contains a guide
on how to set up a local environment for writing assembly programs in NASM. To follow along with the contents of this repository, it is advised to have a copy of the book.
- Declare two variables
jack
andjill
to store an integer each. - Prompt the user to input the value of
jack
and store it in thejack
variable. - Prompt the user to input the value of
jill
and store it in thejill
variable. - Print the initial values of
jack
andjill
to identify their values. - Swap the values of the variables
jack
andjill
. - Print the updated values of the variables
jack
andjill
.
- Solve for an
integer
using basic opcodes. - The first two digits add up to 8.
- The difference of the second and fifth digits is equal to the fourth digit.
- The middle digit is the quotient when the product of the first and last digits is divided by 6.
- Identify whether a
year
is a leap year. - The user should input an integer that represents the
year
. - Use control structures such as
cmp
andjmp
to accomplish the task.
- Identify the Least Common Multiple (LCM) of two integers.
- The user should input the two integers.
- Use control structures such as
cmp
andjmp
to accomplish the task.
- Implement right-shift and left-shift operations using native opcodes.
- The user should input an integer to be
shifted
and another integer to denote thenumber of places to shift
.
- Implement bitwise
OR
,AND
, andXOR
operations. - The user should input two integers to be operated on.
- Calculate the
factorial
of an integer. - The user should input the integer.
- Use
call
andret
in accomplishing the task.
- Take the program you wrote in
Lab 6
and implement it as a multi-module program. - Create a module named
factorial.asm
that contains the subprogramsget_int
andfactorial
. - Another file
main.asm
should consist of the external subprogramsget_int
andfactorial
.
- Print out a
multiplication table
from1 up to N
. N
should be an integer input taken from the user.- A module named
mult.asm
should exist that interfaces withmain.c
.
- Print out the
Fibonacci series
up to theKth
number. K
should be an integer input from the user.- A module named
fibo.asm
should interface withmain.c
. - The program
main.c
should call a subprogramfibonacci
fromfibo.asm
that solves for the Fibonacci numbers.
- Attempt to
sort
the values in anarray
. - A program named
sortArray.asm
should sort the values in an array from user input. sortArray.asm
should interface witharray1c.c
.- The sorting algorithm is
abstracted
, which means that you may implement whatever sorting algorithm you prefer.
- Find the the
modal character(s)
in astring
and theirfrequency
. - The
string
should be from a user input. Spaces
should not be included as characters.- Assume that the user input is a
string
inASCII
character encoding. - You may use whatever algorithm you prefer.