Re: [stella] Poor man's cart dumper

Subject: Re: [stella] Poor man's cart dumper
From: Glenn Saunders <mos6507@xxxxxxxxx>
Date: Sun, 14 Aug 2005 18:27:49 -0400
I downloaded activePerl but that example didn't work
for me.  It just copied the file contents over witout
altering it.  So I wrote this VBScript program that
can run in windows scripting host like this:

CScript cartmaker.vbs [filename input] [filename
output (optional)]

Pass in filenames, no path.  You have to run this in
the same working directory as your hex file.

I tried dumping Oystron to hex and then converting it
over with this and the BIN works fine.  Very cool that
this can be done with just a stock 2600 and a hacked
up cable!




SNIP BELOW THIS LINE
================================================


'NAME this cartmaker.vbs

'must have at least one parameter
if WScript.Arguments.Count = 0 then
   WScript.Echo "Usage: CScript cartmaker.vbs
[filename input] [filename output (optional)]"
   WScript.Quit 1
elseif WScript.Arguments.Count < 2 then
	'autogenerate output filename based on base filename
of input
	parsed_filename = split(WScript.Arguments(0),".")
	out_filename = parsed_filename(0) & ".bin"
ELSE
	'just use the parameter
	out_filename = WScript.Arguments(1)
END if


Dim fso, infile, outfile

Set fso = CreateObject("Scripting.FileSystemObject")

'get current directory
With CreateObject("WScript.Shell") 
  .CurrentDirectory = WScript.ScriptFullName & "\.." 
  currDir = .CurrentDirectory 
End With
WScript.StdOut.Write(currDir)



Set infile = fso.OpenTextFile(currDir &
WScript.Arguments(0), 1)
hex_string = trim(infile.ReadAll())

'convert each hex byte-pair to binary byte
for each this_hex_byte in split(hex_string," ")
   bin_string = bin_string &
chr(HexToDec(this_hex_byte))
next

Set outfile = fso.OpenTextFile(currDir & out_filename,
2, True)
outfile.write(bin_string)

Function HexToDec(ByVal sHex)
HexToDec = CINT("&H" & sHex)
End Function
 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread