Subject: Re: [stella] BLINT: Branch, Conditional Lint From: "Mark Graybill" <saundby@xxxxxxxxxxxx> Date: Thu, 17 Oct 2002 00:08:44 -0700 |
This is cool. I didn't comment because I haven't been reading the posts, I just got around to skimming them tonight before hitting the sack. We can use more tools of this sort. I seem to recall there were some tools once of this variety for general 6502 development, but offhand I don't recall how platform-dependent they were or whether they were part of larger development packages of propietary tools (it's late, I'm tired, and that was almost 20 years ago now for me.) It seems like there were some pretty good tools for catching some of the gotchas of the 6502s, though. I'll have to get Perl on this system and try it out against my code when I'm more awake tomorrow (the system I use for 2600 development isn't used for any other development, so it doesn't have Perl. The others have _all_ got it, of course.) I put a few things into the FAQ that are actual information today, though I don't have any code snippets to go with them yet. I'll probably do a little work on the FAQ tomorrow while taking breaks from my real work, and post the latest at some point. I've added descriptions of the playfield and background, with a few technical details (register locations, bit patterns for the playfield, etc.), and done a general discussion of putting graphical objects onscreen. I also started on a description of what a kernel is, and how it's structured, but didn't get it finished before other things called me away. (Yawn) When it gets late and I get tired like this my brain starts coming up with hairbrained ideas on its own based on what happens to be nearby. My eyes fell on a couple of stepper motors laying next to my monitor here and it occurred to me to wonder whether anyone's used the 2600 as a robot controller yet. The image of a 2600 console with a pair of arms emanating from a cart popped into my head. Sheesh, I better get to sleep before I start drawing a schematic or something... Later, all! -Mark G. ----- Original Message ----- From: <KirkIsrael@xxxxxxxxxxxxx> To: <stella@xxxxxxxxxxx> Sent: Wednesday, October 16, 2002 7:15 PM Subject: [stella] BLINT: Branch, Conditional Lint > > Hey Gang... > I was ever-so-slightly bummed that my idea about a "Lint" > that could inspect a DASM list file and find any conditional > branches over page boundaries didn't generate much further > talk...I figure either people aren't *that* troubled by the > core issue, or maybe people don't really take interest in > stuff 'til it's past the vaporware stage... > > So I put on my Perl hat, and made the script I'm > including below. I also made an exe version, available at > http://alienbill.com/vgames/blint.zip > > Running it with no arguments brings up the following info: > BLINT: Tool for Atari VCS ASM by Kirk Israel <kisrael.com> > find conditional branches that cross page boundaries > Usage: > blint ASMFILE > (must have DASM in current directory) > blint -l LISTFILE > (file generated by -lLISTFILE argument to DASM) > > So if you put it in the same directory as DASM, it'll > run DASM for you, or you can generate the list file > yourself and run it against that. It prints up any lines > that are suspect. > > So I'm still open for suggestions, like I think there might > be some other boundary conditions that I could check for... > *IF* someone with a deeper knowledge of 6507 code can suggest > what to look for... > If people think it'd be useful, I could even try to adapt > it so people could always invoke DASM through this script, > so it would always keep an eye out for these issues. Or maybe > I should just keep it for when people are having weird problems... > > -------------snip-here----------------- > #!/usr/bin/perl > > > if(! defined($ARGV[0])){ > print<<__EOQ__; > BLINT: Tool for Atari VCS ASM by Kirk Israel <kisrael@xxxxxxxxxxxxx> > find conditional branches that cross page boundaries > Usage: > blint ASMFILE > (must have DASM in current directory) > blint -l LISTFILE > (file generated by -lLISTFILE argument to DASM) > __EOQ__ > } else { > > > if($ARGV[0] eq "-l") { > $rundasm = 0; > $filename = $ARGV[1]; > } else { > $rundasm = 1; > $timestamp = time; > $filename = substr($timestamp, 0,$length - 3).".".substr($timestamp, $length - 3); > print "running dasm $ARGV[0] -f3\n"; > print "-----------------\n"; > print `dasm $ARGV[0] -f3 -l$filename \n`; > print "-----------------\n"; > } > > > > open(READ, "< $filename") || die "Can't Open $filename $!"; > > > #prepopulate hash, keys are hex code > #for conditional branches, value is mnemonic > > %branches = ( > "10"=>"BPL", > "30"=>"BMI", > "50"=>"BVC", > "70"=>"BVS", > "90"=>"BCC", > "B0"=>"BCS", > "D0"=>"BNE", > "F0"=>"BEQ" > ); > > > > > > $bgwhite = "CCFFCC"; > $bgblue = "#CCCCFF"; > > while($nextline = <READ>){ > chomp $nextline; > > ($linenum,$memloc,$hexcommand,$label,$nuthin,$command,$target,@rest) = split(/\t/,$nextline); > > if($memloc ne $oldmemloc){ > > > if($color eq $bgwhite){ > $color = $bgblue; > } else { > $color = $bgwhite; > } > $oldmemloc = $memloc; > > } > > > > $linenum =~ s/^\s+//; > if(!($linenum =~ /\D/ )){ > if($memloc ne "????"){ > > > if(defined($branches{uc(substr($hexcommand,0,2))})){ > > > > > $memoffset = substr($memloc,2); > $memoffsetdec = (hex($memoffset)); > > > $offset = substr($hexcommand,3); > $offsetdec = (hex($offset)); > if($offsetdec >= 128) { > $offsetdec -= 256; > } > $offsetdec += 2; > > $dest = $memoffsetdec + $offsetdec; > > if($dest < 0 || $dest >= 256) { > print "FOUND AN ISSUE: Line $linenum of ASM branches across page boundary:\n",join("\t",($label,$nuthin,$command,$target,@rest)),"\n"; > $issues = 1; > > } > > } > > } > } > > } > > > close READ; > > > > if($rundasm){ > unlink($filename ) || die "can't remove $filename $!"; > } > > > if($issues == 0){ > print "No Problems Found\n"; > } > > } #end else, there are arguments.... > > > > > > > > > -------------------------------------------------------------------------- -------------------- > Archives (includes files) at http://www.biglist.com/lists/stella/archives/ > Unsub & more at http://www.biglist.com/lists/stella/ > > ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[stella] Re: Space Instigators - Fi, Peter Gordon | Thread | Re: [stella] BLINT: Branch, Conditi, Chris Wilkson |
[stella] Space Instigators - Final , Christopher Tumber | Date | Re: [stella] BLINT: Branch, Conditi, Thomas Jentzsch |
Month |