What Do These Assembly Instructions Do with $30 in Register d0?

  • Thread starter chelsea9947
  • Start date
In summary, "check this" in a scientific context means to review or examine something for accuracy and validity. It is important for someone to check scientific work as it serves as a form of quality control and helps to ensure accuracy and credibility. Ideally, someone with knowledge and expertise in the specific field of study should be the one to check scientific work. To effectively check scientific work, the individual should have a thorough understanding of the methods and techniques used, carefully review the data and results, and critically analyze the conclusions drawn. If errors or discrepancies are found during the checking process, the person should communicate their findings to the original author and discuss potential solutions.
  • #1
chelsea9947
8
0

Homework Statement



If the content of d0 is $30 state in words what each of the following numbered instructions will do when placed immediately after the test instruction below
tst d0

Homework Equations



a) bne fred
b) beq fred
c) bpl fred
d) bmi fred

The Attempt at a Solution



a) bne fred = [go to label fred] [if d0] [not equal to $30]
b) beq fred = [go to label fred] [if d0] [equal to $30]
c) bpl fred = [go to label fred] [if d0] [ plus $30]
d) bmi fred = [go to label fred] [if d0] [minus $30]

example

TST or tst direct against zero instruction.

This is really the same as compare with zero

tst <effective address>

it subtracts 0 from a copy of the location specified and sets the condition flags accordingly.
If the value to be tested is positive then +N –0 = +N or if negative –N –0= -N or if 0 then 0-0 =0

tst d0 is d0 equal to 0, greater than zero or less than zero

beq joe = [go to label joe] [if d0] [equal to 0]
bgt dan= [go to label dan] [if d0] [greater than 0]
blt ben= [go to label ben] [if d0] [less than 0]iam confused can someone help

If the content of d0 is $30 state in words what each of the following numbered instruction pairs will do.

a. cmpi #$30,d0
beq dan

b. cmp.l unknown,d0
bne dan

c. cmp.w d1,d0
bgt dan
 
Physics news on Phys.org
  • #2
chelsea9947 said:

Homework Statement



If the content of d0 is $30 state in words what each of the following numbered instructions will do when placed immediately after the test instruction below
tst d0


Homework Equations



a) bne fred
b) beq fred
c) bpl fred
d) bmi fred


The Attempt at a Solution



a) bne fred = [go to label fred] [if d0] [not equal to $30]
b) beq fred = [go to label fred] [if d0] [equal to $30]
c) bpl fred = [go to label fred] [if d0] [ plus $30]
d) bmi fred = [go to label fred] [if d0] [minus $30]
These are not right. I'm a little rusty on Motorola 68000 assembly (which is what I think you are using), so I assume these instructions are inspecting the contents of the D0 register.
bne <label> - means branch to <label> if d0 is not equal to zero.
beq <label> - means branch to <label> if d0 is equal to zero.
bpl <label> - means branch to <label> if d0 is positive (plus).
bmi <label> - means branch to <label> if d0 is negative (minus).
chelsea9947 said:
example

TST or tst direct against zero instruction.

This is really the same as compare with zero

tst <effective address>

it subtracts 0 from a copy of the location specified and sets the condition flags accordingly.
If the value to be tested is positive then +N –0 = +N or if negative –N –0= -N or if 0 then 0-0 =0

tst d0 is d0 equal to 0, greater than zero or less than zero

beq joe = [go to label joe] [if d0] [equal to 0]
bgt dan= [go to label dan] [if d0] [greater than 0]
blt ben= [go to label ben] [if d0] [less than 0]
These all look fine to me.
chelsea9947 said:
iam confused can someone help

If the content of d0 is $30 state in words what each of the following numbered instruction pairs will do.

a. cmpi #$30,d0
beq dan

b. cmp.l unknown,d0
bne dan

c. cmp.w d1,d0
bgt dan

These compare instructions subtract the first operand from the second and set the N and Z flags as appropriate. For a, D0 - #$30 = what? Does control branch to label dan?
For b, you don't know what value is in unknown, but whatever value is in this location, it is either >= $30 or < $30.
For c, you don't know what is in D1, but you can say what will happen depending on what value is in that register.
 
  • #3


d. cmpa.l d0,a0
bne dana. This instruction pair will compare the value in d0 to the hex value $30. If they are equal, it will go to the label "dan". Otherwise, it will continue to the next instruction.

b. This instruction pair will compare the value in d0 to the value stored in the unknown location. If they are not equal, it will go to the label "dan". Otherwise, it will continue to the next instruction.

c. This instruction pair will compare the value in d0 to the value in d1. If the value in d0 is greater than the value in d1, it will go to the label "dan". Otherwise, it will continue to the next instruction.

d. This instruction pair will compare the value in d0 to the value in a0. If they are not equal, it will go to the label "dan". Otherwise, it will continue to the next instruction.
 

FAQ: What Do These Assembly Instructions Do with $30 in Register d0?

1. What does "check this" mean in a scientific context?

"Check this" in a scientific context typically means to review or examine something, such as data, results, or a hypothesis, for accuracy and validity.

2. Why is it important for someone to check scientific work?

Having someone else check scientific work serves as a form of quality control and helps to ensure accuracy and credibility of the work being presented. It also allows for potential errors or biases to be identified and corrected.

3. Who should be the one to check scientific work?

Ideally, someone with knowledge and expertise in the specific field of study should be the one to check scientific work. This can be a peer, colleague, or mentor.

4. How can someone effectively check scientific work?

To effectively check scientific work, the individual should have a thorough understanding of the methods and techniques used, carefully review the data and results, and critically analyze the conclusions drawn. They should also be open-minded and willing to consider alternative explanations or interpretations.

5. What should be done if errors or discrepancies are found during the checking process?

If errors or discrepancies are found during the checking process, the person should communicate their findings to the original author and discuss potential solutions. This could involve additional research, re-analyzing data, or making revisions to the work.

Similar threads

Replies
2
Views
2K
Replies
3
Views
2K
Replies
4
Views
6K
Replies
1
Views
7K
Replies
1
Views
12K
Replies
4
Views
17K
Replies
3
Views
4K
Replies
5
Views
2K
Replies
6
Views
4K
Back
Top