0% found this document useful (0 votes)
91 views12 pages

Assembly Beta ISA Introduction

The document provides information about practicing assembly language exercises using the Beta instruction set architecture, including 20 practice problems covering topics like array manipulation, arithmetic operations, sorting, and prime numbers. It also provides 5 programming projects on sorting algorithms like bubble sort and selection sort to practice writing assembly language programs. Tutorial videos are linked to demonstrate the BSim simulator tool for testing assembly code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views12 pages

Assembly Beta ISA Introduction

The document provides information about practicing assembly language exercises using the Beta instruction set architecture, including 20 practice problems covering topics like array manipulation, arithmetic operations, sorting, and prime numbers. It also provides 5 programming projects on sorting algorithms like bubble sort and selection sort to practice writing assembly language programs. Tutorial videos are linked to demonstrate the BSim simulator tool for testing assembly code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

CEA201

ASSEMBLY
LANGUAGE
MASSACHUSETTS INSTITUTE OF TECHNOLOGY
BETA Instruction Set Architecture
Online simulator
BSim Sandbox:
http://computationstructures.org/exercises/sandbox
es/bsim.html

--> Click: Open BSim in a new window to open editor


and simulation.
Reference material:
Appendix_β Documentation.pdf

https://www.youtube.com/playlist?list=PL_5qWES7xEtCt5z3Fi4rKh71xBKSXzNzv
Tutorial :
Giới thiệu phần mềm BSIM: https://youtu.be/FYT38vagylg
Exam 1: https://youtu.be/NVfPtZpZh6M (Bài cơ bản)
Exam 2: https://youtu.be/AepuJT7Fsmc (symbol, label, mảng)
Exam 3: https://youtu.be/IBmPbye9QLQ (vẽ flowchat, đổi giá trị có điều kiện)
Exam 4: https://youtu.be/l3_n73GFV0g (xđ 3 giá trị có phải 3 cạnh tam giác ko)
Exam 5: https://youtu.be/39CRGA5nwHg (tìm min của 3 ô nhớ)
Exam 6: https://youtu.be/FmneWSSbTlI (tìm ước số chung lớn nhất)
Exam 7: https://youtu.be/j5U9ck1bB40 (tính tổng chuỗi số)
Exam 1: ALUC Instructions
For the Beta instruction sequence .include "beta.uasm"
shown below, indicate the 32-bit two's
ADDC(R31,0x11,R1)
complement values of the specified
registers after the sequence has been SUBC(R1,-1,R2)
executed by the Beta. The effect of the DIVC(R2,3,R8)
instructions is cummulative, later HALT()
instructions use the values stored by
earlier instructions.

Answer:

Value left in R1?

Value left in R2?

Value left in R8?


Exam 2: ALU Instructions

For the Beta instruction sequence .include "beta.uasm"


shown beside, indicate the 32-bit
ADD(r31, r31, r0)
two's complement values of the
specified registers after the CMPEQ(r0, r31, r1)
sequence has been executed by ADD(r1, r1, r2)
the Beta.  MUL(r2, r2, r3)
HALT()

Answer:

Value left in R0?

Value left in R1?

Value left in R2?

Value left in R3?


Practice assembly language exercises

For all exams, you should make use of the Beta documentation and you
can use the Bsim (Beta simulator) to verify the exams.

Note: For complicated assignments, use flowchat or pseodocode.


1. Interchange two contents from a[1] and a[3].
2. Write a program to do the calculation: a[0]=a[1]+a[2]
3. Divide a[0] by a[1], the integer part stored in a[2], the remaining part stored in
a[3].
4. a[0] store the value of minutes. Convert the number of minutes to hour and
store in a[1] and store the remaining one in a[2]. (For example: a[0] = 125, then a[1]
= 2 and a[2] = 5).
5. a[0] store the value of hours. Convert the number of hours to week and store in
a[1] and store the remaining days in a[2] and the remaining hours in a[3]. (For
example: a[0] = 497 then a[1] = 2, a[2] = 6 and a[3]=17.

6. If a[1] > a[3], then interchange.


7. Find the minimum value of a[0], a[1] and a[2], the result is stored in a[3].
8. Find the maximum value of a[0], a[1] and a[2], the result is stored in a[3].
9. Check if a[0], a[1] and a[2] are the lengths of the triangle. If it is true, store 1 to
a[3], otherwise store 0.
10. Sort a[0], a[1] and a[2] in ascending order.
11. Sort a[0], a[1] and a[2] in descending order.
13. Calculate the sum s = 1 + 2 + ... + a[0] and store it to register r0.
14. Calculate the total number of array elements from a[0] to a[9] and
store it to a[10].
15. Find the largest number of array elements from a[0] to a[9] and
store it to a[10].
16. Find the largest common divisor of a[0] and a[1] and store it to a[2].
17. Find the smallest common multiple of a[0] and a[1] and store it to
a[2].
18. Determine if a[0] is prime number or not. If yes, write 1 to a[1],
otherwise write 0.
19. Find the smallest prime number that is greater than a[0], the result
is stored in a[1]. (For example, a[0]=8 then a[1]=11).
20. Determine if a[0] is a square number or not. If yes, write 1 to a[1],
otherwise write 0.
Project - Design Problem: Bubble
sort
Write 5 programs using the Assemby language to perform the
following tasks:
Program 1: Write a program to swap two array elements A[5] and A[6]
in Assembly language.
Program 2: Write a program to swap two array elements A[i] and
A[i+1] in Assembly language.
Program 3: Write a program to swap two array elements A[i] and
A[i+1] if A[i]>A[i+1] in Assembly language. (increasing order)
Program 4: Write a program to sort a data array in increasing order
using the "bubble_sort" algorithm.
Program5: Write a program to sort a data array in program 4 using the
“selection sort” algorithm.

You might also like