CLR C
MOVE R1,08 %%LENGTH OF BYTE
MOVE R2,00 %% INITIAL COUNT OF NUMBER OF 1'S
MOV R3,given byte %% GIVEN BYTE
UP:ROR R5 %% ROTATE RIGHT -
BCC SKIP %% CHECK CARRY TO CLEAR
INC R2 %% INCREASE THE COUNT
SKIP: BNE R1,UP %%LOOP COUNT EQUALS TO R1
MOVE A2,R2 %% STORE THE VALUE OF R2 IN A2
RTS %% RETURN FROM SUBROUTINE
Problem 2: Write a subroutine which counts the number of O's in the highest Byte in register D5 a...
e. te the complete assembler directive to achieve the followings: Write the complete directive Action Declare byte memory variable VAR1 and initialize it to hex 7A Declare 16-bit memory variable VAR1 and initialize it to hex 7A6D Declare array ARRAY1 which contains 100 bytes Set the assembler to begin at address hex 2000 HCS12 branch instructions: h. Action Write the corresponding instruction Branch if Greater Than or Cqual Branch if Greater Than Branch if Less Than or Equal Branch if...
Please answer 2.6.1
2.6 The table below shows 32-bit values of an array stored in memory Address Data 24 38 2 4 32 36 40 2.6.1 [5] <COD §§22, 2.3-For the memory locations in the table above, write C code to sort the data from lowest to highest, placing the lowest value in the smallest memory location shown in the figure. Assume that the data shown represents the C variable called Array, which is an array of type int, and...
2. Write an 80x86 assembly language program that reads byte size signed integers from memory and counts the number of zeros. Store this count in memory. End when you get a negative number. (20pts) For example: nums DB 4, 0, 0, 12, 6, 8, 0, 4, -1 count DB 0 after executing the procedure count should be 3 count DB 3.
Write a program in assembly language that loads register R2 with the word in memory location which is 10 bytes above the address in R0; and loads register R3 with the word in memory location which is 10 bytes below the address in R1. Your program must compare the two numbers in R2 and R3. If number in R2 is less than or equal to the number in R3 it must add the two numbers and save the result in...
# ECE 445 Computer Organization # Homework 3, problem 9 # Write a MIPS assembly language program to count the number of positive values in an array of integers. # The array of integers and the array length are provided in the .data section below. # After running your code, the variable count (in memory) should contain the number of positive values in the array Insert your name here > Insert the date here > # Author: # Date: .text...
Problem 1 Write a find subroutine that can locate a specified 8-bit quantity in a null-terminated string 8-bit quantities. (Remember that null terminated means "it ends with zero"). The subroutine is passed two parameters. The pointer to the array is passed in array X, the value to be found is passed in ACCA. The function should return the index of the first occurrence of the value in ACCB, or -1 (0xFF) if the value is not found. a) Write the...
Write a function decompressed(count_tuples)
that takes a list of counts of '0's and '1's as defined above and
returns the expanded (un-compressed) string. You may assume that
the first value of count_tuples has a count that is
greater than or equal to zero and all other counts are greater than
zero.
Comments to show how to figure this out would be greatly
appreciated
A data file in which particular characters often occur multiple times in a row can be compressed...
Problem 4 (15pts): (a) (5pts) Consider the following MIPS memory with data shown in hex, which are located in memory from address 0 through 15. Show the result of the MIPS instruction "lw Ss0,4(Sa0)" for machines in little-endian byte orders, where Sa0 4. Address Contents Address Contents 9b lb 2 4 6 10 b4 c5 12 13 14 15 3d 5f 70 7 8f (b) (10pts)Assume we have the following time, performance and architecture parameters in the specified units Ec-...
Problem 4 (15pts): (a) (5pts) Consider the following MIPS memory with data shown in hex, which are located in memory from address 0 through 15. Show the result of the MIPS instruction "lw Ss0,4(Sa0)" for machines in little-endian byte orders, where Sa0 4. Address Contents Address Contents 9b lb 2 4 6 10 b4 c5 12 13 14 15 3d 5f 70 7 8f (b) (10pts)Assume we have the following time, performance and architecture parameters in the specified units Ec-...
Write an ARM assembly language subroutine (named nfibo) to calculate and return the n-th Fibonacci number. Fibonacci numbers (or a Fibonacci sequence) are a series of numbers with a property that the next number in the series is a sum of previous two numbers. Starting the series from 0, 1 as the first two numbers we have 0, 1, (0 + 1) = 1, (1 + 1) = 2, (1 + 2) = 3, (2 + 3) = 5, (3...