| 1 |
|
| 2 |
================================================ |
| 3 |
Collection of random patches from around the net |
| 4 |
================================================ |
| 5 |
|
| 6 |
This is a random collection of patches for DASM I ran across |
| 7 |
over time; some of these may be included in future releases, |
| 8 |
others will probably never make it in. But it's good to have |
| 9 |
them in one place. I use a *very* long line one "-" between |
| 10 |
each one, hopefully that'll work out okay. :-) |
| 11 |
|
| 12 |
------------------------------------------------------------------------------- |
| 13 |
FROM: http://biglist.com/lists/stella/archives/200205/msg00008.html |
| 14 |
------------------------------------------------------------------------------- |
| 15 |
|
| 16 |
Subject: Re: [stella] help! distella -> dasm case sensitivity (fwd) |
| 17 |
From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx> |
| 18 |
Date: Wed, 1 May 2002 09:53:05 -0700 (PDT) |
| 19 |
On Wed, 1 May 2002, Chris Wilkson wrote: |
| 20 |
> Though I really would like to turn off case sensitivity in DASM. Any way to |
| 21 |
> do that? It would really help speed up testing for the new TIA.... |
| 22 |
|
| 23 |
It is fairly simple to hack the DASM source to behave |
| 24 |
the way you want it to. |
| 25 |
|
| 26 |
The patch below modifies two functions; the symbol table |
| 27 |
is now hashed in a case insensitive manner, and the symbol |
| 28 |
table lookup tries an caseless compare when an exact match |
| 29 |
fails. |
| 30 |
|
| 31 |
The patch below is against DASM 2.15 |
| 32 |
|
| 33 |
--Adam Wozniak |
| 34 |
|
| 35 |
===BEGIN SCRIPT =============================== |
| 36 |
Script started on Wed May 1 08:52:28 2002 |
| 37 |
[adam dasm]$ cat test.asm |
| 38 |
processor 6502 |
| 39 |
|
| 40 |
seg.u code |
| 41 |
org 0 |
| 42 |
|
| 43 |
nop |
| 44 |
bne skip |
| 45 |
nop |
| 46 |
Skip nop |
| 47 |
nop |
| 48 |
|
| 49 |
seg.u data |
| 50 |
org 100 |
| 51 |
|
| 52 |
seg.u bss |
| 53 |
org 200 |
| 54 |
|
| 55 |
[adam dasm]$ dasm/bin/dasm test.asm |
| 56 |
DASM V2.15, (c)Copyright 1988-2002 Matthew Dillon, All Rights Reserved |
| 57 |
Error: source is not resolvable. |
| 58 |
re-run with verbose option 2 or higher to determine problem |
| 59 |
|
| 60 |
[adam dasm]$ dasm-caseless/bin/dasm test.asm |
| 61 |
DASM V2.15, (c)Copyright 1988-2002 Matthew Dillon, All Rights Reserved |
| 62 |
|
| 63 |
[adam dasm]$ exit |
| 64 |
|
| 65 |
Script done on Wed May 1 08:52:57 2002 |
| 66 |
===END SCRIPT================================== |
| 67 |
|
| 68 |
===BEGIN PATCH ================================ |
| 69 |
diff -urbBN dasm/src/asm.h dasm-caseless/src/asm.h |
| 70 |
--- dasm/src/asm.h Sat Jan 2 22:59:46 1999 |
| 71 |
+++ dasm-caseless/src/asm.h Wed May 1 08:38:36 2002 |
| 72 |
@@ -10,6 +10,7 @@ |
| 73 |
#include <stdio.h> |
| 74 |
#include <stdlib.h> |
| 75 |
#include <string.h> |
| 76 |
+#include <ctype.h> |
| 77 |
|
| 78 |
#define Prototype extern |
| 79 |
|
| 80 |
diff -urbBN dasm/src/symbols.c dasm-caseless/src/symbols.c |
| 81 |
--- dasm/src/symbols.c Sat Jan 2 22:59:46 1999 |
| 82 |
+++ dasm-caseless/src/symbols.c Wed May 1 08:38:20 2002 |
| 83 |
@@ -74,6 +74,13 @@ |
| 84 |
if (sym->namelen == len && bcmp(sym->name, str, len) == 0) |
| 85 |
break; |
| 86 |
} |
| 87 |
+ if (!sym) |
| 88 |
+ { |
| 89 |
+ for (sym = SHash[h1]; sym; sym = sym->next) { |
| 90 |
+ if (sym->namelen == len && strncasecmp(sym->name, str, len) == 0) |
| 91 |
+ break; |
| 92 |
+ } |
| 93 |
+ } |
| 94 |
return(sym); |
| 95 |
} |
| 96 |
|
| 97 |
@@ -118,7 +125,7 @@ |
| 98 |
register uword result = 0; |
| 99 |
|
| 100 |
while (len--) |
| 101 |
- result = (result << 2) ^ *str++; |
| 102 |
+ result = (result << 2) ^ tolower(*str++); |
| 103 |
return(result & SHASHAND); |
| 104 |
} |
| 105 |
|
| 106 |
===END PATCH ================================== |
| 107 |
|
| 108 |
|
| 109 |
-- |
| 110 |
This is n ?nrcu?cemert for thc transcendental r?n? The train now standirg |
| 111 |
leavc? for higher ?l?nes. Due tc a derai|rent, thcre vill be no other train. |
| 112 |
Sc wry rot h?? cn this cre? |
| 113 |
|
| 114 |
adam@xxxxxxxxxxxxxxxx http://cuddlepuddle.org/~adam/pgp.txt |
| 115 |
|
| 116 |
------------------------------------------------------------------------------- |
| 117 |
FROM: forwarded by Andrew Davie |
| 118 |
------------------------------------------------------------------------------- |
| 119 |
|
| 120 |
-----Original Message----- |
| 121 |
From: Ben Combee [mailto:[email protected]] On Behalf Of Ben Combee |
| 122 |
Sent: Thursday, February 28, 2008 8:56 AM |
| 123 |
To: [email protected] |
| 124 |
Subject: Bitmap format patch for DASM |
| 125 |
|
| 126 |
Hi, Andrew... I just started up a 2600 project of my own, and I've done |
| 127 |
a few local modifications to the DASM source -- most are to make it |
| 128 |
compile without warnings in CodeWarrior for Windows, but I also added a |
| 129 |
new integer representation inspired by some of the disassemblies I've |
| 130 |
seen. I call it bitmap format, and instead of a leading %, you use a |
| 131 |
leading | followed by dots and Xs. A trailing | is allowed, but not |
| 132 |
required. Here's an example. |
| 133 |
|
| 134 |
PfDataStart |
| 135 |
.byte |..XXX...| |
| 136 |
.byte |....X...| |
| 137 |
.byte |X..XX..X| |
| 138 |
.byte |.XX..XXX| |
| 139 |
.byte |.XX..XXX| |
| 140 |
.byte |X..XX..X| |
| 141 |
.byte |....X...| |
| 142 |
.byte |..XXX...| |
| 143 |
PfDataEnd |
| 144 |
|
| 145 |
I find it easier to visualize the bitmaps in the code using this format, |
| 146 |
as 0's and 1's aren't that distinctive. |
| 147 |
|
| 148 |
Here's the code change made to exp.c. I added this new function just |
| 149 |
before pushbin(): |
| 150 |
|
| 151 |
char *pushbitmap(char *str) |
| 152 |
{ |
| 153 |
long val = 0; |
| 154 |
while (*str == '.' || *str == 'X') { |
| 155 |
val = (val << 1) | (*str == 'X'); |
| 156 |
++str; |
| 157 |
} |
| 158 |
if (*str == '|') { |
| 159 |
++str; |
| 160 |
} |
| 161 |
stackarg(val, 0, NULL); |
| 162 |
return str; |
| 163 |
} |
| 164 |
|
| 165 |
Then I modified the case statement around line 314: |
| 166 |
|
| 167 |
|
| 168 |
case '|': /* 13: | 11: || */ |
| 169 |
|
| 170 |
if (str[1] == '.' || str[1] == 'X') |
| 171 |
{ |
| 172 |
str = pushbitmap(str+1); |
| 173 |
} |
| 174 |
else if (str[1] == '|') |
| 175 |
{ |
| 176 |
doop((opfunc_t)op_oror, 11); |
| 177 |
str += 2; |
| 178 |
} |
| 179 |
else |
| 180 |
{ |
| 181 |
doop((opfunc_t)op_or, 13); |
| 182 |
++str; |
| 183 |
} |
| 184 |
break; |
| 185 |
|
| 186 |
|
| 187 |
I'd be glad to send the other changes, but they're mostly just adding |
| 188 |
"static" in front of local functions and cleaning up some loops that |
| 189 |
used a ";" to do nothing into using "{ }" instead (it tells the compiler |
| 190 |
that you intended on the empty action rather than just using a semicolon |
| 191 |
accidentally by habit. |
| 192 |
|
| 193 |
I'm looking forward to Boulder Dash and I'm also enjoying your old |
| 194 |
tutorial series on Atari Age. Thanks! |
| 195 |
|
| 196 |
------------------------------------------------------------------------------- |
| 197 |
TODO: Find more patches... :-) |
| 198 |
------------------------------------------------------------------------------- |
| 199 |
|