Question

SEARCH Hack Assembly Language Help Whenever I run my .asm file, I get a comparison failure at lin...

SEARCH Hack Assembly Language Help

Whenever I run my .asm file, I get a comparison failure at line 3. Please help me resolve this issue. Here is my .asm code, followed by Search.tst.

Search.asm:

1 // Searchs for given value
2
3 (loop)
4 @1
5 A=M
6 D=M
7 @0
8 D=D-M
9 @j1
10 D;JNE
11 @0
12 M=1
13 (j1)
14 @1
15 M=M-1
16 D=M-1
17 @j2
18 D;JEQ
19 @loop
20 0;JMP
21 (j2)
22 @0
23 M=0
24 (end)
25 @end
26 0;JMP
27

Search.tst:

load Search.asm,
output-file Search.out,
compare-to Search.cmp,
output-list RAM[0]%D2.6.2;

set RAM[0] 0,
set RAM[1] 4,
set RAM[2] 1,
set RAM[3] 1,
set RAM[4] 1,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 0,
set RAM[1] 4,
set RAM[2] 1,
set RAM[3] 1,
set RAM[4] 0,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 0,
set RAM[1] 4,
set RAM[2] 1,
set RAM[3] 1,
set RAM[4] 1,
set RAM[5] 0,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 5,
set RAM[1] 6,
set RAM[2] 5,
set RAM[3] 1,
set RAM[4] 5,
set RAM[5] 0,
set RAM[6] 10,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 5,
set RAM[1] 6,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 0,
set RAM[6] 10,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 2,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 0,
set RAM[6] 10,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 2,
set RAM[2] 8,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 0,
set RAM[6] 10,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 10,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 0,
set RAM[6] 10,
set RAM[7] 9,
set RAM[8] -20,
set RAM[9] -10,
set RAM[10] 0,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 10,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 8,
set RAM[6] 10,
set RAM[7] 9,
set RAM[8] -20,
set RAM[9] -10,
set RAM[10] 0,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 10,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 0,
set RAM[6] 10,
set RAM[7] 9,
set RAM[8] -20,
set RAM[9] -10,
set RAM[10] 8,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 10,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 5,
set RAM[6] 10,
set RAM[7] 9,
set RAM[8] -20,
set RAM[9] -10,
set RAM[10] 0,
set RAM[11] 8,
repeat 200 {
ticktock;
}
output;

set PC 0,
set RAM[0] 8,
set RAM[1] 10,
set RAM[2] 0,
set RAM[3] 1,
set RAM[4] -5,
set RAM[5] 5,
set RAM[6] 10,
set RAM[7] 9,
set RAM[8] -20,
set RAM[9] -10,
set RAM[10] 0,
set RAM[11] 7,
set RAM[12] 8,
repeat 200 {
ticktock;
}
output;

0 0
Add a comment Improve this question Transcribed image text
Answer #1
 xor cx,cx   ; cx-register is the counter, set to 0
loop1   nop         ; Whatever you wanna do goes here, should not change cx
        inc cx      ; Increment
        cmp cx,3    ; Compare cx to the limit
        jle loop1   ; Loop while less or equal

you can code be like it works.

Add a comment
Know the answer?
Add Answer to:
SEARCH Hack Assembly Language Help Whenever I run my .asm file, I get a comparison failure at lin...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I work for Redbull as an Account Sales Manager (ASM). There are 10 ASMs that work...

    I work for Redbull as an Account Sales Manager (ASM). There are 10 ASMs that work out of our warehouse. We start at 5 am Monday through Friday and for my problem, I chose to estimate the number of times each Account Sales Manager complete their route after 3 pm each day. The data set below shows the amount of times each ASM returned after 3 pm in 1 week. I chose a 90% confidence level for my population means....

  • I need help with this program. It is in Irvine MASM Assembly Language. You are to...

    I need help with this program. It is in Irvine MASM Assembly Language. You are to write a program to compute the results of a postfix expression. The expression has the format operand operand operator   where the operator can be +, -, *. You must use a stack to evaluate the expressions. (The system Stack will not work.) Print out the input expression and the results of the evaluation. Read the data from a file and output to a file....

  • Friends.. I need help figuring it out this exercise. I am not sure if my answer...

    Friends.. I need help figuring it out this exercise. I am not sure if my answer is right. Thank you all for helping!! 19) The U.S. Department of Health has suggested that a healthy total cholesterol measurement should be 200 mg/dl. She conducts a study from a sample of random, independent people and the results are shown. Hypothesis test results: : Mean of population HO: 200 HAN > 200 Mean Sample Mean Std. Err. DF T-Stat P-value 208.26 5.7516066 49...

  • The Hungarian algorithm: An example We consider an example where four jobs (J1, J2, J3, and...

    The Hungarian algorithm: An example We consider an example where four jobs (J1, J2, J3, and J4) need to be executed by four workers (W1, W2, W3, and W4), one job per worker. The matrix below shows the cost of assigning a certain worker to a certain job. The objective is to minimize the total cost of the assignment. J1 J2 J3 J4 W1 82 83 69 92 W2 77 37 49 92 W3 11 69 5 86 W4 8...

  • How to write assembly language for x86 and where do I put the code under as? please give me answe...

    how to write assembly language for x86 and where do I put the code under as? please give me answer as soon as possible. ZOOMt COSC 2325.S01 Kxtra Credit l'rogram Problem: Starting wilh the following C+program #includes iostream > using cspace sld; cxlem'C" long Average (long, long LD; void main long Arrayl Г 101-1, 2, 3. 4, 5, 6, 7, 8. 9. 103; long Aray2 111」 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; coul <'': "Average...

  • The Assign.xlsx file gives the assignment of workers to four groups. The suitability of each worker...

    The Assign.xlsx file gives the assignment of workers to four groups. The suitability of each worker for each group (on a scale from 0 to 10) is also given. Write a formula that gives the suitability of each worker for the group to which the worker is assigned. Suitability rating Group 1 Group 2 Group 3 Group 4 Assigned to Worker 1 2 3 4 4 1 9 8 6 8 1 2 10 0 5 6 3 3 5...

  • Assume that you will be given a *.txt file, which in the same format of RandSource.txt...

    Assume that you will be given a *.txt file, which in the same format of RandSource.txt (attached). The file has three numbers at each line. Numbers are separated with a space. All number are in the range of [0, 50]. The first two numbers indicate a range. The third one shows number of random numbers to be generated in the range of first two numbers. The range always given in first < second order. If not, raise an error. For...

  • please help me with what you can, my teacher didn’t explain this well enough and i...

    please help me with what you can, my teacher didn’t explain this well enough and i don’t ynderstand it. Tell whether the statement is true or false 1) 8 e(16, 24, 32,40,48) True B) False 2) (4, 10, 14) -(0,4,10,14) A) True B) False Insert"" or "d" in the blank to make the statement true. 3) 14, 6, 8) (3,4,5,6, 8) B) g 4) (0, 6) (4,6) A)s B) c A) c B) g Let A- (1, 3,5, Th: B-(5,...

  • I need help with number 6, 8 and 9. Use the HW8 script. Get a random...

    I need help with number 6, 8 and 9. Use the HW8 script. Get a random sample of n=29 from the data set. Print out the html output (after knitting). You need the output to receive credit. Make sure the set.seed code with your student ID is visible. Perform the calculations by hand for each question using the data generated with the HW8 script. You must show your work here or on a separate piece of paper. Circle the answer...

  • I NEED HELP WITH NUMBER 8 & 9 Get a random sample of n=29 from the...

    I NEED HELP WITH NUMBER 8 & 9 Get a random sample of n=29 from the data set. H0: ? = 15 H1: ? ≠ 15 x f 10 4 11 6 12 7 13 5 14 4 15 2 16 1 Sampling distribution (assuming the null is true): 4. What is the mean of the sampling distribution? (+1) mean= 15 5. What is standard error of the sampling distribution? (+1) Find it on the output. (+1) standard error= 1.63...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT