Here is the description of my project:
write a program to produce an "addition table." This table should input two small int8 values from the user. It should verify that the input is correct(i.e., handle the ex.ConversionError and ex.ValueOutOfRange exceptions) and is postitive. The second input value must be greater than the first input value. The program will display a row of values specified. Finally, it will print a matrix of sums.
The following is the expected output for the user inputs 15 & 18.
add 15 16 17 18
15 30 31 32 33
17 32 33 34 35
18 33 34 35 36
Okay and here is what Me and my friend have got so far:

program testBadInput5;

#include( "stdlib.hhf" )

static

input: int8;
input2: int8;
colSize: int8;
i: int8;
GoodInput: boolean := false;
i16: int16;

//line 15
begin testBadInput5;


repeat

mov( false, GoodInput );
try

//Gets 2 Values to use to make addition table

stdout.put( "Enter two digits, the first one being LESS than the second one: " );
stdin.get( input, input2 );
mov(input, AL);
stdout.put( "The two input values are: ", input, " ", input2, nl nl );
//30

// If statement to make sure the first Value is not larger than the second one.

if( AL > input2 ) then

stdout.put("Your first number was larger than the second,",
" please have the first number smaller than the second." nl nl );

mov( false, GoodInput );

else
stdout.put("You entered the number correctly." nl nl );
mov( true, GoodInput );

endif;

//47
exception( ex.ValueOutOfRange )

stdout.put( "The value was too large, reenter." nl, nl );

exception( ex.ConversionError )

stdout.put( "The input contained illegal characters, reenter." nl, nl );


endtry;

until( GoodInput = true ); // repeats until there is a good, qualified input that can be used
//60

stdout.put( "The numbers are: ", input, " " , input2, nl );


mov( input2 , AH ); //move input2 into 8 bit register AH
sub( input , AH ); //subtract input - AH(input2) to get the amount of colums needed
add( 1, AH );
mov( AH , colSize ); //moves AH into variable colSize

stdout.put( "The colSize is ", colSize, nl nl );
//70
mov( input2, BL);
add( 1, BL );
While( input < BL ) do

if( colSize = 0 ) then

stdout.put("ColSize = ", colSize );

//mov( 0, colSize );

endif;

stdout.put( input:5 );
add( 1, input );
sub( 1, colSize );
stdout.newln();

endwhile;

// in comments so we can test program

//mov( 96, i32 );
//mov( 0, ColCnt );

// while( colSize > 0 ) do

// if( ColCnt = 8 ) then

// stdout.newln();
// mov( 0, ColCnt );

// endif;
// stdout.puti32Size( i32, 5, ' ' );
// sub( 1, i32 );
// add( 1, ColCnt );

// endwhile;
// stdout.newln();


end testBadInput5;

Having some trouble with displaying any help would be much appreciated

Edited 6 Years Ago by xerreck: n/a

forgot to put my output when ran:

Enter two digits, the first on being LESS than the second on: 5 8
The two input values are:5 8

You entered the number correctly

The numbers are: 5 8
The colSize is 4
5
6
7
8

okay so I figured out I am going to need a loop inside a loop for this to work and here is a basic idea of what I am trying to do but not in assembly code

for i = low; i <= high i ++
	print low
	for j =al; j<= al + high J ++
	print J
	
	print nl

I now just need help getting it into assembly code? Thanks

Thanks for everyone's help... I guess.. I figured it out anyways... This site wasn't any real help. oh well.

This article has been dead for over six months. Start a new discussion instead.