Re: [stella] help! distella -> dasm case sensitivity (fwd)

Subject: Re: [stella] help! distella -> dasm case sensitivity (fwd)
From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx>
Date: Wed, 1 May 2002 09:53:05 -0700 (PDT)
On Wed, 1 May 2002, Chris Wilkson wrote:
> Though I really would like to turn off case sensitivity in DASM.  Any way to
> do that?  It would really help speed up testing for the new TIA....

It is fairly simple to hack the DASM source to behave
the way you want it to.

The patch below modifies two functions;  the symbol table
is now hashed in a case insensitive manner, and the symbol
table lookup tries an caseless compare when an exact match
fails.

The patch below is against DASM 2.15

--Adam Wozniak

===BEGIN SCRIPT ===============================
Script started on Wed May  1 08:52:28 2002
[adam dasm]$ cat test.asm
   processor 6502

   seg.u code
   org 0

      nop
      bne   skip
      nop
Skip  nop
      nop

   seg.u data
   org 100

   seg.u bss
   org 200

[adam dasm]$ dasm/bin/dasm test.asm
DASM V2.15, (c)Copyright 1988-2002 Matthew Dillon, All Rights Reserved
Error: source is not resolvable.
re-run with verbose option 2 or higher to determine problem

[adam dasm]$ dasm-caseless/bin/dasm test.asm
DASM V2.15, (c)Copyright 1988-2002 Matthew Dillon, All Rights Reserved

[adam dasm]$ exit

Script done on Wed May  1 08:52:57 2002
===END SCRIPT==================================

===BEGIN PATCH ================================
diff -urbBN dasm/src/asm.h dasm-caseless/src/asm.h
--- dasm/src/asm.h	Sat Jan  2 22:59:46 1999
+++ dasm-caseless/src/asm.h	Wed May  1 08:38:36 2002
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 #define Prototype extern
 
diff -urbBN dasm/src/symbols.c dasm-caseless/src/symbols.c
--- dasm/src/symbols.c	Sat Jan  2 22:59:46 1999
+++ dasm-caseless/src/symbols.c	Wed May  1 08:38:20 2002
@@ -74,6 +74,13 @@
 	if (sym->namelen == len && bcmp(sym->name, str, len) == 0)
 	    break;
     }
+    if (!sym)
+    {
+        for (sym = SHash[h1]; sym; sym = sym->next) {
+	    if (sym->namelen == len && strncasecmp(sym->name, str, len) == 0)
+	        break;
+        }
+    }
     return(sym);
 }
 
@@ -118,7 +125,7 @@
     register uword result = 0;
 
     while (len--)
-	result = (result << 2) ^ *str++;
+	result = (result << 2) ^ tolower(*str++);
     return(result & SHASHAND);
 }
 
===END PATCH ==================================


-- 
This is  n ?nrcu?cemert for thc transcendental r?n? The train now standirg
leavc? for higher ?l?nes. Due tc a derai|rent, thcre vill be no other train.
Sc wry rot h?? cn this cre? 

adam@xxxxxxxxxxxxxxxx        http://cuddlepuddle.org/~adam/pgp.txt

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread