| Autor |
Wiadomość |
krztracz ~user
Dołączył: 23 Lut 2010 Posty: 1
|
|
Hi guys,
I need Your help in the Assembler becouse I don't know anything about this program and I need get answers for this questions:
Question 1
Because the RAM is 1024 words the size of the operand in the instructions must be 10 bit. Is it possible to encode all instructions into 16 bit? Justify your answer by defining a binary opcode system for this instruction set.
Question 2
An assembler language must include instructions for shifting – both left and right. Define such operations in the same way as above. In case it is possible, extend your answer to question 1 to include these shift operations.
Question 3
Define a logical operation for exclusive or (xor). Write a fragment of assembler instructions that swap the content of REG and a word in memory. Can you do it such that the fragment is not using a temporary word?
Question 4
In this “machine” code and data are allocated in the same memory. It means that you could write some code that changes itself. How? Is this a good idea?
Question 5
Write programs in the above defined assembler language that
a) Read two numbers and output the sum of them
b) Read two numbers and output the greatest of them
c) Read two numbers and output them sorted.
d) Read a sequence of numbers (end with a zero) and output the sum of them
e) Read a sequence of numbers (end with a zero) and output the greatest of them
f) Read a number and out 1 if the number is a prime.
g) Read two numbers and output the greatest common divisor.
You may use labels and comments as illustrated in the following assembler program that is an answer to a) above.
Read x
Load x ; REG = x
Read x ; x = 2nd input
Add x ;
Store x
Write x
Exit
x:0
Thank You so much in advise
Regards
_________________ kris |
|
| Powrót do góry |
|
|
|
|
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach
|
MapaPowered by phpBB © 2001, 2005 phpBB Group
|
|