Thursday, March 24, 2011

Efficient Inefficency

So I recently downloaded DASM, an assembler for 6502 microprocessor (and several others, or so they say). I'm fairly interested in learning the gist of how Atari games were/are made. Anyway, DASM is a command line program. According to the tutorial I'm following, the appropriate arguments for getting the Atari-style 6502 Assembly is:

dasm filename.asm -lfilename.txt -f3 -v5 -ofilename.bin

As you can see, that's a fairly lengthy command to type over and over. Fortunately, you can arrow up. But with stella, geany, rm, cd, mv, cp, and occasionally nano in the mix, hitting up can get confusing. So, I racked my brain (quite unsuccessfully) over that bash tutorial I read through awhile back. Then I racked through google (a tad more successfully). My intent was to be able to type dasm "filename.asm" and have the script handle the rest of that stuff.

Five hours later...

exec < $1
if [ -e $1 ]; then
echo ${#1}
adjustedlength=$[ ${#1} - 4 ]
`echo dasm $1 -l$newfiles.txt -f3 -v5 -o$newfiles.bin`
echo "File does not exist."

Yes... five hours later. I'm certainly not the best basher in da house. But if I compile thousands and thousands of kernels/games with DASM, it'll probably balance out. heh. I'm sort of tempted to figure out how to add a delete argument to it. As previously noted, the thing creates three files in one go.

No comments:

Post a Comment