News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

AoA program

Started by Aiva, August 06, 2007, 01:41:56 PM

Previous topic - Next topic

Aiva

Hallo everyone, im new here and i came up with a little problem. x, y should be integer 16 bit values but compiler reports "type missmatch error" if i change data type to word everything works fine but i want to know why these doesnt work, obviously something is wrong and i cant find what, if you could, please point out mistake or give advise, i'd be grateful for your help.

here is the code:

program testGotoxy;

include("stdlib.hhf");

var
x:int16;
y:int16;

begin testGotoxy;

stdout.put
(
nl,
"HLA console.gotoxy() Test Routine", nl,
"---------------------------------", nl,
nl,
"This routine will clear the screen then demonstrate the use", nl,
"of the gotoxy routine to position the cursor at various", nl,
"points on the screen.",nl,
nl,
"Press the Enter key to continue:"
);

stdin.readLn();

console.cls();

console.gotoxy( 5, 10 );
stdout.put(" (5,10) ");

console.gotoxy( 10, 5 );
stdout.put( "(10,5)" );

mov( 20, x );

for( mov(0, y); y<20; inc(y)) do

  console.gotoxy(y, x);
  stdout.put( "(", x, ",", y, ")" );
  inc( x );

endfor;

end testGotoxy;

Randall Hyde

Quote from: Aiva on August 06, 2007, 01:41:56 PM
Hallo everyone, im new here and i came up with a little problem. x, y should be integer 16 bit values but compiler reports "type missmatch error" if i change data type to word everything works fine but i want to know why these doesnt work, obviously something is wrong and i cant find what, if you could, please point out mistake or give advise, i'd be grateful for your help.


The problem is that you're mixing library modules (not your fault, they changed behind your back).
The original console code (described in the electronic edition of AoA) has been deprecated. It used "word" types for the coordinate parameters. The newer, cross-platform version, of the stdlib console library uses uns32 values for coordinates.

You have two options:

1) Switch to the win32cons library module found in the HLA examples download (which matches the old material in the electronic edition of AoA), or
2) Use Uns32 types as your coordinate data types (see the console module description in the HLA Standard Library documentation).

hLater,
Randy Hyde