News:

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

Invisible Error

Started by Codec, April 29, 2009, 07:57:08 PM

Previous topic - Next topic

Codec

Well, there seems to be something wrong with this code.  I copied the AoA example's syntax exactly to create a similar program of my own.  I even put the original program through HIDE and it did run.  HIDE's main problem seems to be with the variable declaration, and line 17 (the first call to stdout.put())


program AddSub;

   #includeonce ("stdlib.hhf")
   #includeonce ("hide/hidelib.hhf")
   #includeonce ("macros/macros.hhf")
   #includeonce ("macros/extensions.hhf")

   ?@nodisplay := true;
   ?@noalignstack := true;

static

   int:  int8 := -10;

begin AddSub;

stdout.put("Value of integer: ", int, nl);
mov(0, al);
sub(int, al);
mov(al, int);
stdout.put(nl,"Value of integer: ",int,nl);
mov(5,al);
add(al, int);
stdout.put(nl,"Value of integer: ",int,nl);


   
end AddSub;



This looks like it should run.  If I can make these mistakes now, I'll be finished when I'm writing large programs.  If anybody can see the problem, do tell.

Thanks,
-Codec

fearless

line 17:
stdout.put("Value of integer: ", int, nl);

but on the other lines below you have:
stdout.put(nl,"Value of integer: ",int,nl);

so i assume you have missed the nl parameter part at the start of the function:  stdout.put(nl,"Value of integer: ",int,nl);
ƒearless

Codec

Nope.  Look at the way it's written.  The first stdout.put() call writes to the first line in the console window.  Later calls to stdout.put() have a trailing nl, but the later calls also carry an nl at the beginning, so I have two lines between each output.

-Codec

Sevag.K

Works fine on the latest HIDE except for the "int" variable name, which is a reserved HLA word.

This is a part of the error HLA gives:

syntax error, unexpected intTkn.
Near: << int >>

Later errors fall into the stdout.put functions because it doesn't know what to do with "int"

Rename the variable name to fix the error.