PROGRAMMING ASSIGNMENT:
Write a fully-commented program for the HC12 board, including appropriate directives and labels for memory operands and constants. The program should do the following:
• The program should start execution at address $2000.
• Use directives to create an array of N=20 unsigned 8-bit decimal values: 15,20,14,13,17,9,10,5,18,7,19,8,1,3,4,11,2,6,12,16 stored in contiguous memory at locations start at $1000.
• Sort given numbers in a descending order.
• Store sorted numbers at memory locations starting from $1000. *assembly programming language*
section .text
global _start ;must be declared for linker (ld)
Begin:
mov ax, data
mov ds, ax
mov es, ax
mov bx, OFFSET N
mov cx, 20
mov dx, cx
L1:
mov si, 0
mov ax, si
inc ax
mov di, ax
mov dx, cx
L2:
mov al, [bx][si]
cmp al, [bx][di]
jg L4
L3:
inc si
inc di
dec dx
cmp dx, 00
je L1
jg L2
L4:
mov al, [bx][si]
mov ah, [bx][di]
mov [bx][si], ah
mov [bx][di], al
inc si
inc di
dec dx
cmp dx, 00
je L1
jg L2
Exit:
mov ax, 1000
int 21h
_start: ;tells linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
N times 20 DW
15,20,14,13,17,9,10,5,18,7,19,8,1,3,4,11,2,6,12,16
PROGRAMMING ASSIGNMENT: Write a fully-commented program for the HC12 board, including appropriate directives and labels for...
C++ programming language Write a program that asks the user for a file name. The file contains a series of scores(integers), each written on a separate line. The program should read the contents of the file into an array and then display the following content: 1) The scores in rows of 10 scores and in sorted in descending order. 2) The lowest score in the array 3) The highest score in the array 4) The total number of scores in...
C programming Strictly - Write a program to sort an array of integers via arrays of pointers to those integers as shown in the figure. Problem 1 (68 points): Write a program to sort an array of integers via arrays of pointers to those integers as shown in the figure. The code should contain the following functions: 1)to randomly generate an array of integer numbers; 2) to allocate memory and build the arrays of pointers as shown in the figure...
Please answer using assembly language Easy68k ONLY. I. Write a program called Sorted Primes to a. Find out the prime numbers in a method from the following list (15, 16, 17, 23, 2, 32, 3, 31, 13, 19, 12, 9) and push/store them in a stack and then PRINT. (15 points) b. Sort those prime numbers passed by reference (using PEA) to a second method that you found out from the above list in descending order and then PRINT. (20...
Write a program in MIPS assembly language that implements the DESCENDING bubble sort algorithm to sort a variable-sized array of signed 32-bit integers (words)that are read from the console. Be reminded that in a descending sort, the integers are sorted from the largest to the smallest. A “special value” 99999 will beused to signify the end of the input sequence. This value is not to be considered part of the input data set. However, any value greater than 99999 that...
Write a computer program that prompts the user for one number, n for the number of items in the array to sort, and create and sort 1000 different arrays of this size timing the run to get an average time to sort an array of this size. Then do the following: Initiate a variable running_time to 0 Create a for loop that iterates 1000 times. In the body of the loop, Create an array of n random integers (Make sure...
Write a PIC18Fxx2 assembly program that takes the variable A and save into B in inverted the 110010102, then the program finishes with B 010100112-The 1. bit order. For example, if A variable A shall preserve the original value at the end of the program execution. The program shall be implemented using any of the loop and shift techniques discussed in class. 2. Write a PIC18Fxx2 assembly program that makes the calculus of the first eigth (8) terms of the...
Can someone please help me with this problem? We are using CodeWarrior to write this program in assembly language. The array sample contains eight 8-bit signed binary numbers (integers) as shown below. Write a program which stores the negative numbers in the array nelements, computes the sum of the positive numbens to be stored in the variable psum and stores the number of the positive numbers in the variable pnumber. Note that a zero is ther positive nor negative. Your...
This assignment is designed to introduce you to using memory, input/output syscalls and if statements a. Open the text editor and type in the following. Then save your work as “assign3.asm”. Note that there are 3 words of memory indicated that start at the address 0x10010000. Do not use labels in the data segment. .data .word 0 .word 0 .word 0 .globl main .text main: b. Add the following zero terminated ascii strings (.asciiz) to the data segment right above...
1. Write a program in Assembly language using MIPS instruction set that reads two integer numbers from the user named as start and end number and finds out all the prime numbers between start and end (including start and end). Your program should do the validation of both the numbers as follows: i. start number must be smaller or equal to the end number. ii. Both numbers must be positive. iii. The maximum value for the end number is 10000...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....