Hmmm... Second Edition, you say? I have not read any of Jeff Duntemann's books. I have looked at the code which is available on line. In my humble opinion, there are a couple of errors - translating from the Masm syntax of the first edition to the Nasm syntax of the second edition. This may not apply to the code in the book, but take a look at it and see if it improves the formatting, etc.
Only in .: beg2dif.txt
diff -u orig/eat3.asm ./eat3.asm
--- orig/eat3.asm Sun Dec 12 14:18:02 1999
+++ ./eat3.asm Mon Jan 28 19:41:28 2002
@@ -110,7 +110,7 @@
ClrScr:
mov CX,0 ; Upper left corner of full screen
- mov DX,LRXY ; Load lower-right XY coordinates into DX
+ mov DX,[LRXY] ; Load lower-right XY coordinates into DX
ClrWin:
mov AL,0 ; 0 specifies clear entire region
ScrlWin:
diff -u orig/eat5.asm ./eat5.asm
--- orig/eat5.asm Sun Dec 12 14:25:04 1999
+++ ./eat5.asm Mon Jan 28 21:09:18 2002
@@ -15,7 +15,7 @@
[SECTION .text] ; Section containing code
-%include "BOOK\MYLIB.MAC" ; Load in screen control macro library
+%include "MYLIB.MAC" ; Load in screen control macro library
START: ; This is where program execution begins:
diff -u orig/info.asm ./info.asm
--- orig/info.asm Sun Dec 12 14:29:22 1999
+++ ./info.asm Mon Jan 28 20:44:00 2002
@@ -21,7 +21,7 @@
START: ; This is where program execution begins:
call VidCheck ; Initialize all video information variables
- Clear VidSegment,ClearAtom,VidBufSize ; Clear the screen
+ Clear VidOrigin,ClearAtom,VidBufSize ; Clear the screen
; Here we display the name of the program and its author:
Writeln IDString,LIDString ; Display the program name
@@ -274,8 +274,8 @@
; system and are initialized by the VidCheck procedure:
;---------------------------------------------------------------
DispType DB 0 ; Code for display adapter type
-VidSegment DW 0B000H ; Segment of installed display buffer
VidOrigin DW 0 ; Offset for FAR pointer to refresh buffer
+VidSegment DW 0B000H ; Segment of installed display buffer
VisibleX DB 80 ; Number of columns on screen
VisibleY DB 25 ; Number of lines on screen
VidBufSize DW 4000 ; Default to 25 X 80 X 2 (char & attribute)
diff -u orig/mylib.mac ./mylib.mac
--- orig/mylib.mac Mon Sep 20 12:04:08 1999
+++ ./mylib.mac Mon Jan 28 20:58:40 2002
@@ -32,8 +32,8 @@
;---------------------------------------------------------------
%macro Clear 3 ;VidAddress,ClearAtom,BufLength
les DI,[%1] ; Load ES and DI from FAR pointer
- mov AX,%2 ; Load AX with word to blast into memory
- mov CX,%3 ; Load CX with length of buffer in bytes
+ mov AX,[%2] ; Load AX with word to blast into memory
+ mov CX,[%3] ; Load CX with length of buffer in bytes
shr CX,1 ; Divide size of buffer by 2 for word count
cld ; Set direction flag so we blast up-memory
rep stosw ; Blast away!
Only in .: orig
As you see, even the professionals can have trouble with syntax translations. Not that you can't translate your Gas example to Nasm, but you'll confuse yourself less if you just use Gas for it...
Best,
Frank