Index: common/words/abort-string.asm
===================================================================
--- common/words/abort-string.asm	(revision 2446)
+++ common/words/abort-string.asm	(working copy)
@@ -1,3 +1,7 @@
+; ( i*x x1 -- | i*x ) (R: j*y -- | j*y ) (C: "ccc<quote>" -- )
+; Exceptions
+; check flag. If true display the parsed text and throw exception -2 
+
 ;C ABORT"  i*x 0  -- i*x   R: j*x -- j*x  x1=0
 ;C         i*x x1 --       R: j*x --      x1<>0
 ;   POSTPONE IS" POSTPONE ?ABORT ; IMMEDIATE
@@ -16,7 +20,7 @@
 .if cpu_avr8==1
 VE_ABORTQUOTE:
     .dw $0006
-    .db "abort",'"'
+    .db "abort", $22
     .dw VE_HEAD
     .set VE_HEAD = VE_ABORTQUOTE
 XT_ABORTQUOTE:
Index: common/words/abs.asm
===================================================================
--- common/words/abs.asm	(revision 2446)
+++ common/words/abs.asm	(working copy)
@@ -1,3 +1,6 @@
+; ( n1 -- u1 ) 
+; Arithmetics
+; get the absolute value
 ;C ABS     n1 -- +n2     absolute value
 ;   DUP ?NEGATE ;
 
Index: common/words/accept.asm
===================================================================
--- common/words/accept.asm	(revision 2446)
+++ common/words/accept.asm	(working copy)
@@ -1,3 +1,6 @@
+; ( addr +n1 -- +n2 ) 
+; System
+; receive a string of at most n1 characters at addr until n2 characters are reveived or cr/lf detected.
 
 .if cpu_msp430==1
     HEADER(XT_ACCEPT,6,"accept",DOCOLON)
Index: common/words/pick.asm
===================================================================
--- common/words/pick.asm	(revision 2446)
+++ common/words/pick.asm	(working copy)
@@ -1,3 +1,6 @@
+; ( xu ... x1 x0 u -- xu ... x1 x0 xu ) 
+; Stack
+; access the stack as an array and fetch the u-th element as new TOS
 
 .if cpu_msp430==1
     HEADER(XT_PICK,4,"pick",DOCOLON)
Index: common/words/q-abort.asm
===================================================================
--- common/words/q-abort.asm	(revision 2446)
+++ common/words/q-abort.asm	(working copy)
@@ -1,3 +1,7 @@
+; ( f c-addr u --  ) 
+; Exceptions
+; abort & print msg
+
 ;Z ?ABORT   f c-addr u --      abort & print msg
 ;   ROT IF ITYPE ABORT THEN 2DROP ;
 
Index: common/words/q-dnegate.asm
===================================================================
--- common/words/q-dnegate.asm	(revision 2446)
+++ common/words/q-dnegate.asm	(working copy)
@@ -1,3 +1,7 @@
+; ( d1 n -- d2 ) 
+; Logic
+; negate d1 if n negative
+
 ;Z ?DNEGATE  d1 n -- d2   negate d1 if n negative
 ;   0< IF DNEGATE THEN ;       ...a common factor
 
Index: common/words/q-negate.asm
===================================================================
--- common/words/q-negate.asm	(revision 2446)
+++ common/words/q-negate.asm	(working copy)
@@ -1,3 +1,7 @@
+; ( n1 n2 -- n3 ) 
+; Logic
+; negate n1 if n2 negative
+
 ;Z ?NEGATE  n1 n2 -- n3  negate n1 if n2 negative
 ;   0< IF NEGATE THEN ;        ...a common factor
 
Index: common/words/ud-star.asm
===================================================================
--- common/words/ud-star.asm	(revision 2446)
+++ common/words/ud-star.asm	(working copy)
@@ -1,3 +1,6 @@
+; ( ud1 d2 -- ud3) 
+; Arithmetics
+; multiply unsigned and double cells to unsigned double cell
 
 .if cpu_msp430==1
     HEADER(XT_UDSTAR,3,"ud*",DOCOLON)
Index: doc/Makefile
===================================================================
--- doc/Makefile	(revision 2446)
+++ doc/Makefile	(working copy)
@@ -35,6 +35,12 @@
 sitemap:
 	./rst2sitemap | gzip -9 > build/htdocs/TG/sitemap-TG.xml.gz
 
+onlyepub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) \
+           -D master_doc=book    \
+	   -D release=$(VERSION) \
+           $(SOURCEDIR) $(BUILDDIR)/books/epub
+
 books:
 	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) \
            -D master_doc=book    \
Index: tools/make-refcard-rst
===================================================================
--- tools/make-refcard-rst	(revision 2446)
+++ tools/make-refcard-rst	(working copy)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 use strict;
 
+# local hashes
 my %XT;
 my %VOC;
 my %ASM;
@@ -10,125 +11,141 @@
 my %RSTACK;
 my %CSTACK;
 my %CATEGORY;
+my %TYPEOF;
 
-my $version="5.1";
+my $version="6.9";
 
-my $texdir="../doc/TG/source/TG";
-my $asmdir="../core/words";
+my $texdir="../doc/source/TG";
 
+# my $asmdir="../common/words";
+# my $devasmdir="../avr8/words";
+my $asmdir="../tempwords/words";
+
 sub readASM {
-    my ($filename) = @_;
-    open(ASM, $filename) or die ("$filename: $!\n");
-    my @ASM = <ASM>;
-    close(ASM);
-    my $ASM = "";
-    my ($lbl, $state, $voc, $xt, $dstack, $rstack, $cstack, $category);
-    my ($prevline1, $prevline2, $prevline3, $description) = ("","","", "");
-    foreach my $line (@ASM) {
-	chomp($line);
-	next if $line=~/\.if/;
-	$line =~ s/_VE_HEAD/VE_HEAD/;
-	$ASM .= $line;
-	if($line=~/^VE_(.*):/) {
-	    # start a new definition
-	    $ASM = "";
-	    $lbl = "XT_$1";
-	    $state = "new_header_found";
-	    $voc   = "(unnamed)";
-	    $category = "unclassified";
-	    $dstack = "( -- )";
-	    $dstack = "($1)" if $prevline3=~/\([S]?:?([^\)]+)/;
-	    $rstack = "";
-	    $rstack = "(R: $1)" if $prevline3=~/R:\s+([^)]+)\)/;
-	    $cstack = "";
-	    $cstack = "(C: $1)" if $prevline3=~/C:\s+([^)]+)\)/;
-            $description = $1 if $prevline1=~/^;(.*)/;
-	    if( $prevline2=~/;(.+)$/) {
-	        $category = $1;
-	    }
-#	    print "***\n$prevline3\n$prevline2\n$prevline1\n$line\n***\n";
-#	    print "$prevline3 : $category\n";
-#	    die;
-	    next;
-	}
-	if($line=~/^;VE_(.*):/) {
-	    # start a new definition
-	    $ASM = "";
-	    $lbl = "XT_$1";
-	    $state = "new_header_found";
-	    $voc   = "(hidden)";
-	    $dstack = $prevline3;
-	    $dstack = "( -- )";
-	    $dstack = "($1)" if $prevline3=~/\([S]?:?([^\)]+)/;
-	    $rstack = "";
-	    $rstack = "R($1)" if $prevline3=~/R:\s+(.+)\)/;
-	    $cstack = "";
-	    $cstack = "(C: $1)" if $prevline3=~/C:\s+(.+)\)/;
-            $description = $1 if $prevline1=~/^;(.*)/;
-	    if( $prevline2=~/;(.+)$/) {
-	        $category = $1;
-	    }
-	    $category = "internal/hidden";
-	    next;
-	}
-	if($state =~ /new_header_found/ && $line=~/.dw\s*(.*)/) {
-	    $state = "new_voc_header";
-	    next;
-	}
-	if ($state =~ /new_voc_header/ && $line=~/.db\s*(.*)/) {
-	    my @voc = split/,/, $1;
-	    my $i=0;
-	    $voc = "";
-	    foreach my $v (@voc) {
-		# next if $i++ == 0;
-		print "[$v]";		
-		$voc .= chr(hex($1)) if $v=~/\$([\da-fA-F]+)/;
-		$voc .= $1 if $v=~/"(\S+)"/;
-	    }
-	    $state = "vocabulary entry found";
-	    next;
-	}
-	if($line=~/^XT_(.*)/){
-	    $state = "xt_found";
-	    next;
-	}
-	if($state=~/xt_found/ && $line=~/.dw\s+(\w+)/) {
-	    $xt = $1;
-	    $state = "header_complete";
-	    next;
-	}
-	if($state =~ /header_complete/) {
-	    $DSTACK{$lbl} = $dstack;
-	    $RSTACK{$lbl} = $rstack;
-	    $CSTACK{$lbl} = $cstack;
-	    
-	    $XT{$lbl} = $xt;
-	    $VOC{$lbl} = $voc;
-            $DESCRIPTION{$lbl} = $description;
-	    push @{$CATEGORY{$category}}, $lbl;
-	    $state = "parsing_body";
-	    next;
-	}
-        $prevline3 = $prevline2;
-        $prevline2 = $prevline1;
-        $prevline1 = $line;
+  my ($filename) = @_;
+  open(ASM, $filename) or die ("$filename: $!\n");
+  my @ASM = <ASM>;
+  close(ASM);
+  my $ASM = "";
+  my ($lbl, $state, $voc, $xt, $dstack, $rstack, $cstack, $category, $typeof);
+  my ($line1, $line2, $line3, $description) = ("","","", "");
+    
+  # Added to try and remove the prevline issues
+  # before fixing correctly.
+  $line1 = $ASM[0]; # stack--effects
+  $line2 = $ASM[1]; # category
+  $line3 = $ASM[2]; # description
+    
+  # From this point on all prevline vars are now:
+  # prevline3 is now $line1
+  # prevline2 is now $line2
+  # prevline1 is now $line3
+  # This change is just to clarify that the first three
+  # lines have to be the info we are looking for. It was
+  # how it worked before but more loosly bound.
+    
+  foreach my $line (@ASM) {
+    chomp($line);
+    # 
+    next if $line=~/\.if/;
+    $line =~ s/_VE_HEAD/VE_HEAD/;
+    $ASM .= $line;
 
-	if($state =~ /parsing_body/) {
-	    $ASM{$lbl} = $ASM if $ASM=~/\w/;
-	}
+    if($line=~/^VE_(.*):/) {
+      # start a new definition
+      $ASM = "";
+      $lbl = "XT_$1";
+      $state = "new_header_found";
+      $voc   = "(unnamed)";
+      $category = "unclassified";
+      $dstack = "( -- )";
+      $dstack = "($1)" if $line1=~/\([S]?:?([^\)]+)/;
+      $rstack = "";
+      $rstack = "(R: $1)" if $line1=~/R:\s+([^)]+)\)/;
+      $cstack = "";
+      $cstack = "(C: $1)" if $line1=~/C:\s+([^)]+)\)/;
+      $description = $1 if $line3=~/^;(.*)/;
+      if( $line2=~/;(.+)$/) {
+        $category = $1;
+      }
+      next;
     }
+    
+    if($line=~/^;VE_(.*):/) {
+      # start a new definition
+      $ASM = "";
+      $lbl = "XT_$1";
+      $state = "new_header_found";
+      $voc   = "(hidden)";
+      $dstack = $line1;
+      $dstack = "( -- )";
+      $dstack = "($1)" if $line1=~/\([S]?:?([^\)]+)/;
+      $rstack = "";
+      $rstack = "R($1)" if $line1=~/R:\s+(.+)\)/;
+      $cstack = "";
+      $cstack = "(C: $1)" if $line1=~/C:\s+(.+)\)/;
+      $description = $1 if $line3=~/^;(.*)/;
+      if( $line2=~/;(.+)$/) {
+        $category = $1;
+      }
+      $category = "internal/hidden";
+      next;
+    }
+    if($state =~ /new_header_found/ && $line=~/.dw\s*(.*)/) {
+      $state = "new_voc_header";
+      next;
+    }
+    if ($state =~ /new_voc_header/ && $line=~/.db\s*(.*)/) {
+      my @voc = split/,/, $1;
+      my $i=0;
+      $voc = "";
+      foreach my $v (@voc) {
+        # next if $i++ == 0;
+        print "[$v]";		
+        $voc .= chr(hex($1)) if $v=~/\$([\da-fA-F]+)/;
+        $voc .= $1 if $v=~/"(\S+)"/;
+      }
+      $state = "vocabulary entry found";
+      next;
+    }
+    if($line=~/^XT_(.*)/){
+      $state = "xt_found";
+      next;
+    }
+    if($state=~/xt_found/ && $line=~/.dw\s+(\w+)/) {
+      $xt = $1;
+      $state = "header_complete";
+      next;
+    }
+    if($state =~ /header_complete/) {
+      $DSTACK{$lbl} = $dstack;
+      $RSTACK{$lbl} = $rstack;
+      $CSTACK{$lbl} = $cstack;
+
+      $XT{$lbl} = $xt;
+      $VOC{$lbl} = $voc;
+      $DESCRIPTION{$lbl} = $description;
+      push @{$CATEGORY{$category}}, $lbl;
+      $state = "parsing_body";
+      next;
+    }
+
+    if($state =~ /parsing_body/) {
+      $ASM{$lbl} = $ASM if $ASM=~/\w/;
+    }
+  }
 }
 
 sub _head {
-    my ($title) = @_;
-    my ($r);
-    open(I, "refcard-head.rst") or die "refcard header not found";
-    while(<I>) {
-      s/\*VERSION\*/$version/g;
-      $r .= $_
-    }
-    close(I);
-    return $r;
+  my ($title) = @_;
+  my ($r);
+  open(I, "refcard-head.rst") or die "refcard header not found";
+  while(<I>) {
+    s/\*VERSION\*/$version/g;
+    $r .= $_
+  }
+  close(I);
+  return $r;
 }
 
 sub _foot {
@@ -135,60 +152,62 @@
 }
 
 sub printLaTeX {
-    my ($title) = @_;
-    open(LATEX, ">$texdir/refcard.rst") or die "$!\n";;
-    print LATEX _head($title);
-    foreach my $category (sort keys %CATEGORY) {
+  my ($title) = @_;
+  open(LATEX, ">$texdir/refcard.rst") or die "$!\n";;
+  print LATEX _head($title);
+  foreach my $category (sort keys %CATEGORY) {
     next if $category=~/^\s*$/;
     next if $category=~/internal/;
 
-	print "$category\n";
-	my $cattxt = $category;
-	$cattxt =~s/\s+(.*)/$1/;
-	print LATEX "\n$cattxt\n". "-" x length($cattxt) . "\n\n";
-	foreach my $lbl (sort @{$CATEGORY{$category}}) {
-	    my $xt  = $XT{$lbl};
-	    my $voc = $VOC{$lbl};
-	    my $shortlbl = substr($lbl, 3);
-	    my $descr = $DESCRIPTION{$lbl};
-	    
-	    my $dstack = $DSTACK{$lbl};
-	    my $rstack = $RSTACK{$lbl};
-	    my $cstack = $CSTACK{$lbl};
-	    my $verbdelim = "|";
-	    $verbdelim = "/" if $dstack=~/$verbdelim/;
-	    # print LATEX ".. _ $lbl:\n";
-	    #$voc =~ s/\\/\\textbackslash/g;
-	    #$voc =~ s/\#/\\#/g;
-	    # $voc =~ s/]/{]}/g;
-	    ##voc =~ s/\[/{[}/g;
-	    $voc =~ s/\$/\\\$/g;
-	    #$voc =~ s/_/\\_/g;
-	    $voc =~ s/"/''/g; # '"
-	    #$voc =~ s/\+/\\\+/g;
-	    #$voc =~ s/-/\\-/g;
-	    #$voc =~ s/\*/\\\*/g;
-	    $voc =~ s/\\/\\\\/g;
-	    #$descr =~ s/_/\\_/g;
-	    print LATEX "* :command:`$voc`\n";
-	    print LATEX "  $dstack\n";
-	    print LATEX "  $rstack\n" unless $rstack =~ /^\s*$/;
-	    print LATEX "  $cstack\n" unless $cstack =~ /^\s*$/;
-	    print LATEX " $descr\n\n";
-	
-	  }
-	print LATEX "\n\n";
+    print "$category\n";
+    my $cattxt = $category;
+    $cattxt =~s/\s+(.*)/$1/;
+    print LATEX "\n$cattxt\n". "-" x length($cattxt) . "\n\n";
+    foreach my $lbl (sort @{$CATEGORY{$category}}) {
+      my $xt  = $XT{$lbl};
+      my $voc = $VOC{$lbl};
+      my $shortlbl = substr($lbl, 3);
+      my $descr = $DESCRIPTION{$lbl};
+
+      my $dstack = $DSTACK{$lbl};
+      my $rstack = $RSTACK{$lbl};
+      my $cstack = $CSTACK{$lbl};
+      my $verbdelim = "|";
+      $verbdelim = "/" if $dstack=~/$verbdelim/;
+      # print LATEX ".. _ $lbl:\n";
+      #$voc =~ s/\\/\\textbackslash/g;
+      #$voc =~ s/\#/\\#/g;
+      # $voc =~ s/]/{]}/g;
+      ##voc =~ s/\[/{[}/g;
+      $voc =~ s/\$/\\\$/g;
+      #$voc =~ s/_/\\_/g;
+      $voc =~ s/"/''/g; # '"
+      #$voc =~ s/\+/\\\+/g;
+      #$voc =~ s/-/\\-/g;
+      #$voc =~ s/\*/\\\*/g;
+      $voc =~ s/\\/\\\\/g;
+      #$descr =~ s/_/\\_/g;
+      print LATEX "* :command:`$voc`\n";
+      print LATEX "  $dstack\n";
+      print LATEX "  $rstack\n" unless $rstack =~ /^\s*$/;
+      print LATEX "  $cstack\n" unless $cstack =~ /^\s*$/;
+      print LATEX " $descr\n\n";
+
     }
-    print LATEX _foot();
+    print LATEX "\n\n";
+  }
+  print LATEX _foot();
 }
 
 opendir(CWD, $asmdir);
 foreach (reverse sort readdir(CWD)) {
-        next unless -f "$asmdir/$_";
-        next unless /(.*).asm$/;
-        my $basename = "$asmdir/$_";
-        readASM($basename);
+  next unless -f "$asmdir/$_";
+  next unless /(.*).asm$/;
+  my $basename = "$asmdir/$_";
+  print "$basename\n";
+  readASM($basename);
 }
+
 print "\n";
 printLaTeX($version);
 print "\n";
