Write a program in 68K assembly code that adds an odd parity to each ASCII character. Your code must satisfy the following specifications:
1. Define the following 64 characters in the SRC address.SRC:DC.B 'Computing and Software Systems, University of Washington Bothell'
2. Define the 64-byte space.DST:DC.B 64
3. Read each of the 64 characters, (i.e., each byte) into D0, check the number of 1s in it, set 1 to the MSB with "ORI.B #$80, D0" to create an odd parity, and save it to the 64-byte space defined above.
4. You need to use ROL.B to count the number 1s in D0. Check with SCS.B if a carry occurs. For this purpose use D1.
5. Use D0 - D4 as well as A0 - A1 registers as follows:
D0: reads the next character from SRC.
D1: checks with "SCS.B D1" if a carry was generated
D2: counts the number of 1s of the character D0 has.
D3: counts down from 64 to 0, (i.e., used for a loop to read the 64 characters).
D4: counts down from 8 to 0, (i.e., used for a loop to examine the lowest 8 bits in D0).
A0: points to the next character to read into D0
A1: points to the next space to write the character (with/without a parity) from D0
6. You also need to use "LSR.B #1, D2" to check if the number of 1s in D2 is even.
ORG $1000
START: ; first instruction of program
MOVEA #SRC, A0 ; A0: points to the next charcater to read into D0
MOVEA #DST, A1 ; A1: points to the space to write D0's content
; ADD YOUR ODD PARITY GENERATION CODE HERE
* Put program code here
SIMHALT ; halt simulator
* Put variables and constants here
SRC:
DC.B 'Computing and Software Systems, University of Washington Bothell' ;64 bytes
DST:
DS.B 64
END START ; last line of source
Solution:
ORG $8000
DATA EQU $9000
RESULT EQU $9002
CLR.B D1 ;D1 calculates parity
MOVE.W DATA,D0 ;D0 holds data
MOVE.W #16,D2 ;D2 counts 16 bit
LOOP LSR.W #1,D0 ;shift low bit into carry
BCC ZERO ;if bit is zero, go on
NOT.B D1 ;bit is 1, change parity
ZERO SUB.W #1,D2 ;decrement count
BNE LOOP ;loop until count is zero
MOVE.B D1,RESULT ;store parity in RESULT
TRAP #14 ;return to MON68K
END
Write a program in 68K assembly code that adds an odd parity to each ASCII character....
Task: if the character read in is a '.' (dot), ',' (comma), '?' (question mark), '-' (dash), or a "'" (single quote), then it is replaced by a ' ' (space) character unless these characters appear inside a double quotation-mark enclosed substring; and, if the character is not a '.' (dot), '.' (comma), '?' (question mark), '-' (dash), or a "'" (single quote), then it is always output as-is. You program must process all input from standard input (i.e., std::cin)...
C program: Write a program that assigns and counts the number of each alphabetic character in the Declaration of Independence and sorts the counts from the most used to the least used character. Consider upper and lower case letters the same. The frequency of each character should be accumulated in an array. USE POINTERS to increment counts for each letter, sort your array, and display the results. Output should consist of two columns: (1) each letter 'a'-'z' and (2) the...
MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and print a simple checksum for each string. Make your string long enough to hold 50 characters. Don't forget to leave space for the null byte. Our checksum algorithm will produce a value which you can print with the syscall for printing a character. Stop reading strings when the user enters ".". The syscall to read a string (sycall code 8) adds a newline to...
Write the assembly code that will transform a squared image into a negative print. (HARD-CODED OUTPUT WILL RESULT IN ZERO.) That is, every pixel whose unsigned value is 0 should change to 255, 1 should change to 254, 2 should change to 253, ... 255 should change to 0. $a0 contains the address of the input buffer, $a1 contains the address of the output buffer address, and $a2 contains the image dimension. Look at the below image for your reference:...
Create a program that performs the following operations: Prompt for and accept a string of up to 80 characters from the user. • The memory buffer for this string is created by: buffer: .space 80 # create space for string input • The syscall to place input into the buffer looks like: li $v0, 8 # code for syscall read_string la $a0, buffer # tell syscall where the buffer is li $a1, 80 # tell syscall how big the buffer...
Create a program that performs the following operations: 1. Prompt for and accept a string of up to 80 characters from the user. • The memory buffer for this string is created by: buffer: .space 80 #create space for string input The syscall to place input into the buffer looks like: li $v0,8 # code for syscall read_string la $a0, buffer #tell syscall where the buffer is li $a1, 80 # tell syscall how big the buffer is syscall 2....
Write a program that uses a recursive function to determine whether a string is a character-unit palindrome. Moreover, the options for doing case sensitive comparisons and not ignoring spaces are indicated with flags. For example "A nut for a jar of tuna" is a palindrome if spaces are ignored and not otherwise. "Step on no pets" is a palindrome whether spaces are ignored or not, but is not a palindrome if it is case sensitive. Background Palindromes are character sequences...
The goal is to create a code for implementing a Columns game using pygame Your program will read its input via the Python shell (i.e., using the built-in input() function), printing no prompts to a user with no extraneous output other than precisely what is specified below. The intent here is not to write a user-friendly user interface; what you're actually doing is building a tool for testing your game mechanics, which we'll then be using to automatically test them....
Need this in C
The starter code is long, if you know how to do it in other way
please do.
Do the best you can please.
Here's
the starter code:
//
-----------------------------------------------------------------------
// monsterdb.c
//
-----------------------------------------------------------------------
#include
#include
#include
//
-----------------------------------------------------------------------
// Some defines
#define NAME_MAX 64
#define BUFFER_MAX 256
//
-----------------------------------------------------------------------
// Structs
typedef struct
{
char name[NAME_MAX];
int hp;
int attackPower;
int armor;
} Character;
typedef struct
{
int size;
Character *list;
} CharacterContainer;
//
-----------------------------------------------------------------------
//...