.file 1 ""
.section .mdebug.abi32
.previous
.nan legacy
.module fp=32
.module nooddspreg
.abicalls
.text
.align 2
.globl bubble_sort
.set nomips16
.set nomicromips
.ent bubble_sort
.type bubble_sort, @function
bubble_sort:
.frame $fp,32,$31 # vars= 16, regs= 1/0, args= 0, gp= 8
.mask 0x40000000,-4
.fmask 0x00000000,0
.set noreorder
.set nomacro
addiu $sp,$sp,-32
sw $fp,28($sp)
move $fp,$sp
sw $4,32($fp)
sw $5,36($fp)
movz $31,$31,$0
sw $0,8($fp)
sw $0,12($fp)
sw $0,8($fp)
b $L2
nop
$L6:
sw $0,12($fp)
b $L3
nop
$L5:
lw $2,12($fp)
nop
sll $2,$2,2
lw $3,32($fp)
nop
addu $2,$3,$2
lw $3,0($2)
lw $2,12($fp)
nop
addiu $2,$2,1
sll $2,$2,2
lw $4,32($fp)
nop
addu $2,$4,$2
lw $2,0($2)
nop
slt $2,$2,$3
beq $2,$0,$L4
nop
lw $2,12($fp)
nop
sll $2,$2,2
lw $3,32($fp)
nop
addu $2,$3,$2
lw $2,0($2)
nop
sw $2,16($fp)
lw $2,12($fp)
nop
sll $2,$2,2
lw $3,32($fp)
nop
addu $2,$3,$2
lw $3,12($fp)
nop
addiu $3,$3,1
sll $3,$3,2
lw $4,32($fp)
nop
addu $3,$4,$3
lw $3,0($3)
nop
sw $3,0($2)
lw $2,12($fp)
nop
addiu $2,$2,1
sll $2,$2,2
lw $3,32($fp)
nop
addu $2,$3,$2
lw $3,16($fp)
nop
sw $3,0($2)
$L4:
lw $2,12($fp)
nop
addiu $2,$2,1
sw $2,12($fp)
$L3:
lw $3,36($fp)
lw $2,8($fp)
nop
subu $2,$3,$2
addiu $3,$2,-1
lw $2,12($fp)
nop
slt $2,$2,$3
bne $2,$0,$L5
nop
lw $2,8($fp)
nop
addiu $2,$2,1
sw $2,8($fp)
$L2:
lw $3,8($fp)
lw $2,36($fp)
nop
slt $2,$3,$2
bne $2,$0,$L6
nop
nop
move $sp,$fp
lw $fp,28($sp)
addiu $sp,$sp,32
j $31
nop
.set macro
.set reorder
.end bubble_sort
.size bubble_sort, .-bubble_sort
.rdata
.align 2
$LC0:
.ascii "Enter number of elements in the array:\000"
.align 2
$LC1:
.ascii "%d\000"
.align 2
$LC2:
.ascii "Enter %d integers\012\000"
.align 2
$LC3:
.ascii "Printing the sorted array:\000"
.align 2
$LC4:
.ascii "%d\012\000"
.text
.align 2
.globl main
.set nomips16
.set nomicromips
.ent main
.type main, @function
main:
.frame $fp,440,$31 # vars= 408, regs= 2/0, args= 16, gp= 8
.mask 0xc0000000,-4
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set nomacro
addiu $sp,$sp,-440
sw $31,436($sp)
sw $fp,432($sp)
move $fp,$sp
.cprestore 16
movz $31,$31,$0
lw $2,%got($LC0)($28)
nop
addiu $4,$2,%lo($LC0)
lw $2,%call16(puts)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,puts
1: jalr $25
nop
lw $28,16($fp)
addiu $2,$fp,428
move $5,$2
lw $2,%got($LC1)($28)
nop
addiu $4,$2,%lo($LC1)
lw $2,%call16(__isoc99_scanf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,__isoc99_scanf
1: jalr $25
nop
lw $28,16($fp)
lw $2,428($fp)
nop
move $5,$2
lw $2,%got($LC2)($28)
nop
addiu $4,$2,%lo($LC2)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
sw $0,24($fp)
b $L8
nop
$L9:
addiu $3,$fp,28
lw $2,24($fp)
nop
sll $2,$2,2
addu $2,$3,$2
move $5,$2
lw $2,%got($LC1)($28)
nop
addiu $4,$2,%lo($LC1)
lw $2,%call16(__isoc99_scanf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,__isoc99_scanf
1: jalr $25
nop
lw $28,16($fp)
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,24($fp)
$L8:
lw $2,428($fp)
lw $3,24($fp)
nop
slt $2,$3,$2
bne $2,$0,$L9
nop
lw $3,428($fp)
addiu $2,$fp,28
move $5,$3
move $4,$2
lw $2,%got(bubble_sort)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,bubble_sort
1: jalr $25
nop
lw $28,16($fp)
nop
lw $2,%got($LC3)($28)
nop
addiu $4,$2,%lo($LC3)
lw $2,%call16(puts)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,puts
1: jalr $25
nop
lw $28,16($fp)
sw $0,24($fp)
b $L10
nop
$L11:
lw $2,24($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $2,4($2)
nop
move $5,$2
lw $2,%got($LC4)($28)
nop
addiu $4,$2,%lo($LC4)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,24($fp)
$L10:
lw $2,428($fp)
lw $3,24($fp)
nop
slt $2,$3,$2
bne $2,$0,$L11
nop
move $2,$0
move $sp,$fp
lw $31,436($sp)
lw $fp,432($sp)
addiu $sp,$sp,440
j $31
nop
.set macro
.set reorder
.end main
.size main, .-main
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609"
IN ARM7TDMI Problem 2 ARM Assembly Programming; Splitting Array an - Write an ARM assembly program...
Write a program in ARM assembly language that copies each element of array A to consecutive fourth elements of array B, i.e., A[0] to B[0], A[1] to B[3], A[2] to B[7], etc. The array A is 12 elements long, and each element is a number that is 32 bits (1 word) wide. Assume the base address of array A is in register R2, and the base address of array B is in R3.
Programming Problem: SUMMING ARRAY ELEMENTS - Use Assembly Language x86 (MASM) Write an assembly code calculates the sum of all array elements. Save the sum in the EAX register. ------------------------------------------------------------------------------- This is my code so far: INCLUDE Irvine32.inc N=10 .data array SDWORD N DUP(0,1,2,3,4,5,6,7,8,9) j DWORD ? k DWORD ? .code main PROC ; not complete exit main ENDP END main
Arm Assembly Programming : Total of 3 assembly files using VisUAL arm emulator ( save as .S file) 1. Write a program to solve the below expression: Z= (a << 2) | (c & 15) 2. Write a program that adds the 32-bit two’s complement representations of −149 and 5 . Place the result in register r7. Submit your code with the resulting value in register r7 commented. 3. Write a program to mask first 9 bits of a...
Write an ARM assembly language program to collect the correct amount of road toll tax from a vehicle. If the vehicle is a motorbike then the correct road toll tax should be 2, otherwise the road toll tax should be 5. The vehicle type is given to you, so you don’t have to guess. Assume that someone has already put the vehicle type value in register R0. Therefore, R0 contains a value, 0 or some other value. If the value...
C- PROGRAMMING PROJECT #4 Design and Write a C program to calculate an average of an array of numbers and produce the following output: 1. Your first and last name 2. Course Number 3. C Project Number 4. All the numbers in the array 5. The sum of all the numbers in the array 6. The count of all the numbers in the array 7. The average of all the numbers in the array Double-space after lines 3, 4, 5,...
Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized with the following strings: “Einstein”, “Newton”, “Copernicus”, and “Kepler”. 2. Assume names in an Integer array with 20 elements. Write a pseudocode algorithm a For Loop that displays each element of the array. 3. Assume the arrays numberArray1 and numberArray2 each have 100 elements. Write a pseudocode algorithm that copies the values in numberArray1 to numberArray2 . 4. Write a pseudocode algorithm for a...
1- Write a MIPS assembly program to initialize register Ss0 to 8, register Ssl to 12, regis- ter Ss2 to 5, and register Ss3 to 2. Then, store register Ss0 in the first element of an array, register Ssl in the second element of the array, register Ss2 in the third element of the ar- ray, and register Ss3 in the fourth element of the array. Then, sort the elements of the ar- ray using the selection sort algorithm, and...
Assembly for x86 please.
Thank you
COSC 2325.S01 Program Nine Problem: Write an assembly procedure to sort the following array into numerical order and print the resulting array 5.8.6.3.4.1,0,9.2.7
COSC 2325.S01 Program Nine Problem: Write an assembly procedure to sort the following array into numerical order and print the resulting array 5.8.6.3.4.1,0,9.2.7
- Write a program that performs several operations on an array of positive ints. The program should prompt the user for the size of the array (validate the size) and dynamically allocate it. Allow the user to enter the values, do not accept negative values in the array. - Your program should then define the functions described below, call them in order, and display the results of each operation: a) reverse: This function accepts a pointer to an int array...
Complete this task4.s ARM assembly code to produce an assembly
program that: • Waits for the user to enter two integers (this part
is already coded in). • Places the first integer at r5, and the
second integer at r6 (this part is already coded in). • (This is
what you need to code in) Adds the two integers together. If the
result is between 0 and 9 (including 0 and 9) the program should
print the result. If not,...