News:

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

The Art of Assembly, Listing 2-7

Started by LogicRules, July 09, 2007, 05:57:21 PM

Previous topic - Next topic

LogicRules

I'm a noob at assembly and with RadAsm 1.97 as well. In my attempts to follow the The Art of Assembly (CHM) I ran into an apparent typo error, on line 16, as shown below.

1.   Listing 2-7: Unsigned I/O
2.   program UnsExample;
3.   #include( "stdlib.hhf" )

4.   static
5.   UnsValue:    uns16;

6.   begin UnsExample;

7.   stdout.put( "Enter an integer between 32,768 and 65,535: " );
8.   stdin.getu16();
9.   mov( ax, UnsValue );
10.   stdout.put

11.   (
12.   "You entered ",
13.   UnsValue,
14.   ". If you treat this as a signed integer, it is "
15.   );
               
16.   stdout.put.geti16( UnsValue );

17.   stdout.newln();

18.   end UnsExample;
-------------------------------------------------------------------------
D:\RadASM2211\hla\Projects\UnsExample>hla unsexample
Error in file "UnsExample.hla" at line 19 [errid:107619/hlaparse.c]:
syntax error, unexpected '.', expecting '('.
Near: << . >>

Error in file "UnsExample.hla" at line 19 [errid:61530/hlaparse.bsn]:
Expected ':', encountered '('
(Possible undefined ID 'geti16').
Near: << ( >>

UnsExample.hla [78]:
error: undefined symbol.
-------------------------------------------------------------------------

If I change line 16 to: stdout.put( ax, UnsValue );
I get:
•   Enter an integer between 32,768 and 65,535: 1024
•   You entered 1024. If you treat this as a signed integer, it is 04001024

If I change line 16 to: stdout.put( UnsValue );
I get:
•   Enter an integer between 32,768 and 65,535: 1024
•   You entered 1024. If you treat this as a signed integer, it is 1024

It is difficult enough learning this stuff without runnig into errors right at the start. In most instances I find the book extremely enlightening but errors throw off the ability to concentrate.
I can only assume that my corrections to the code were the intentions of the author.
Am I correct in this assumption?  :eek
Thank you


Sevag.K

I don't think they are intentional errors, however the online versions of AoA are no longer maintained/updated.  Such errors are more rare in the published version of AoA.

That shouldn't cause too much trouble since there are these forums to sort out any problems you encounter.