Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It is an assembly language problem. PROGRAM 2: X Table Write a program to produc

ID: 645362 • Letter: I

Question

It is an assembly language problem.

PROGRAM 2: X Table
Write a program to produce a number table as described here. This table should be built from a single integer value provided by the user. The program will display a square 4x4 of various numbers, starting with the value provided by the user. The entered number should appear in an X like pattern across the table. Filling the rest of the square, each successive filler number printed will be one less than the filler number previously printed.

For example, the following output should be produced when the user inputs the starting value 15:

Gimme a starting value: 15
15 14 13 15
12 15 15 11
10 15 15 9
15 8 7 15

And here is the output that would be produced when the user inputs the starting value 10:

Gimme a starting value: 10
10 9 8 10
7 10 10 6   
5 10 10 4   
10 3 2 10

HINT: Don't worry too much about getting all the spacing beautifully correct. I'll be scoring the numbers printed, not the beauty of your table.

And here is what my code is

program gimmenum;
#include("stdlib.hhf");
static
i: int16 :=0;
j: int16 :=0;
val: int16 :=0;
temp: int16 :=0;
t: int16 :=0;

begin gimmenum;
stdout.put("Gimme a starting value: ");
stdin.get(val);
mov(val,temp);
sub(1,temp);
for(mov(0, i); i < 4; add(1, i)) do
for(mov(0, j); j < 4; add(1, j)) do
mov(3, t);
sub(j, t);
if(i = j || i = t) then
stdout.put(val, "");
else
stdout.put(temp, "");
sub(1, temp);
endif;
endfor;
stdout.put("", pl);
endfor;
end gimmenum;

Can someone help me to figure out why this can not run correctly?It is said there are syntax error in line 6 and 12 which are ":", "valTkn" and ")"

Explanation / Answer

Hope it may helps you...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote