Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Counting Occurrences in ARM Assembly Objective: Write an ARM assembly program to count the occurrences of bytes from data 2 within data 1 . Utilize
Counting Occurrences in ARM Assembly
Objective:
Write an ARM assembly program to count the occurrences of bytes from data within data
Utilize the provided base addresses for datax X and datax X
Requirements:
Data Initialization:
data
data
Declare two arrays, data and data with the provided values.
Use the base addresses x for data and x for data
Counting Occurrences:
Use the base addresses of data and data to store the data.
Count the occurrences of each byte from data within data totally.
Store the total number of occurrences in X register.
Code :
MOVZ X #x LSL #
MOVK X #x LSL #
MOVZ X #x LSL #
MOVK X #x LSL #
MOVZ X #
MOVZ X #
MOVZ X #
MOVZ X #
MOVZ X #
MOVZ X #
MOVZ X #
storevaluesdata:
STURB XX
ADDI X X #
SUBI X X #
ADDI X X #
CBNZ X storevaluesdata
SUBI X X #
storevaluesdata:
STURB XX
ADDI X X #
SUBI X X #
SUBI X X #
ADDI X X #
STURB XX
ADDI X X #
ADDI X X #
CBNZ X storevaluesdata
CBNZ X storevaluesdata
SUBI X X #
loop:
LDURB XX
ADDI X X #
occurrancy:
LDURB XX
ADDI X X #
SUB X X X
CBNZ X jump
ADDI X X #
jump:
SUBI X X #
CBNZ X occurrancy
MOVZ X #x LSL
MOVZ X #
SUBI X X #
CBNZ X loop
Please make my code workable and work in legv simulator
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started