CS501 Assignment Solution
CS501 Assignment Solution
Assignment Solution:
Student Name: AZKA ASIF
Student ID: BC210202844
section.data
fine_amount db 1500
section .text
global_start
start:
: Part Task A
mov eax, [account balance] : Move the account balance from memory to
EAX register (3000 cents)
mov ebx, [fine_amount] register (1500 cents) ; Move the fine amount from memory to EBX
sub eax, ebx (final balance: 3500 cents) ; Subtract fine amount in EBX from balance in
EAX
Part Task B
Convert final balance In EAX to a string and print (specifics vary by OS; example shown for
Linux)
For simplicity, this program assumes an output mechanism will display the final balance
Explanation of Code
1. Define the Data Section (section.data):
account_balance db 3000: This line stores the initial account balance as 3000 cents (equivalent to
$30.00) In a data section.
fine_amount db 1500: This line stores the fine or deduction amount as 1500 cents (equivalent to
$15.00).