bin2cas.pl updated

A place to discuss everything Dragon related that doesn't fall into the other categories.
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

bin2cas.pl updated

Post by sixxie »

bin2cas.pl has climbed all the way to version 3.0
The script has doubled in size, but a large chunk of that is the help text, which is needed because it does a chunk of stuff now:
  • Multiple input files to one output file
  • Set VDG mode, SAM register values between files
  • Each file can be dzipped
  • WAV files can use 30% faster cycles, autorun code will account for it
See the examples at the bottom of the help text to get an idea.

I've tested the default 9600Hz WAV output with the faster cycles and it survives speed adjustment of +/-6% played out to real hardware, so it should be fine on a tape. For best results, up the samplerate (e.g., "-r 22050").

Really must get around to rewriting this in C, WAV output is still pretty slow sadly.

Edit: looks like that 6% claim is only good for >= 12kHz output, so adjusted the script defaults. Must have lost track of something in my testing before!
sorchard
Posts: 531
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: bin2cas.pl updated

Post by sorchard »

It brings back memories of staying up until stupid o'clock to meet a deadline, trying to get a working loader and saver, swapping tapes around and generally forgetting where the stack is. Don't ever forget where the stack is.

That's a well thought out and *powerful* tool. Thankyou sixxie!
Stew
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: bin2cas.pl updated

Post by sixxie »

Cheers! I hope it's of some use. Yes, some options to ensure the stack location would probably be a good idea too...

I remember when playing with this basic "turboload" approach however many decades ago that my test for reliability was whether it survived two generations of copying with a dual tape deck ;)

Still on the TODO: "countdown" loader code, choice of error handling (just prints a message and halts atm, could return to BASIC), automatically move data intended for upper 32K.

I have in the past played with custom load routines that manage a tighter count than the ROM - thus able to distinguish between pulse lengths a lot better. Might look at bolting that in too. I think Superkid has its own RAM based BITIN, not sure how efficient it is...

BTW, ROTABB loads in 74 seconds...
sorchard
Posts: 531
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: bin2cas.pl updated

Post by sorchard »

74 seconds?! That's witchcraft. It must have taken 3 minutes originally.

bin2cas will definitely get some use. (1) Automating the tedious task of building a loader is a good thing (2) Getting files from PC to Dragon quicker is also a good thing.

This has got me thinking... I wonder if anyone has ever tried using an MP3 player instead of a cassette deck? Surely a digital player or a direct link could allow the interface to be pushed harder, so I'm wondering how fast the cassette input would work in theory. I'll have to have a look at the cct to see what the rolloff frequency is.

You're* TODOs all sound useful. I could have used the future map 1 capability a few weeks ago when reconstructing the BP demo...

Is the resident part of the loader relocated by bin2cas or does it sit in a fixed location?

Ah yes, Superkid is a fabulous game. I do remember something peculiar about the loader because I tried and failed to capture it to work on PC-Dragon. I think you're right and it had it's own custom low-level stuff going on. *Trivia alert* The author of Superkid, Wayne Smithson, previously wrote a text screen editor called SCREDIT. I used this for the Balldozer and ROTABB loading screens :-)

ps. Have you found the cheat mode in ROTABB yet? ;)

Edit:
*Your
Last edited by sorchard on Wed Aug 20, 2014 7:35 pm, edited 1 time in total.
Stew
User avatar
robcfg
Posts: 1532
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: bin2cas.pl updated

Post by robcfg »

When I take my Dragon to an event, I usually load the tape games from my iPod Classic at full volume and it works just dandy.

I use wav files instead of mp3 files.
User avatar
Bosco
Posts: 334
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: bin2cas.pl updated

Post by Bosco »

I've been loading WAVs onto the Dragon from my Android tablet. Works nicely plus I can also play them on the Android version of XRoar. :)
sorchard
Posts: 531
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: bin2cas.pl updated

Post by sorchard »

robcfg wrote:...I usually load the tape games from my iPod Classic at full volume...
Bosco wrote:I've been loading WAVs onto the Dragon from my Android tablet
Good information gentlemen. It has slowly dawned on me that my phone has a headphone output so I'll give that a whirl as well when I can find a working Dragon in my loft.

I've now had a look at the Dragon cassette input circuit on the schematics:

It's a zero-crossing detector built around an LM393 comparator. There's a positive feedback network giving about 30mV of hysteresis meaning we need a signal of at least 30mV pk-pk at the input of the comparator to see any activity at the output. The input network appears to have varied slightly through time. Later units seem to have settled on a low-pass RC filter comprising 470 ohms and a 20nF capacitor. Another schematic shows a manually added resistor of 270-470 Ohms. Another schematic shows no resistor at all.

The 470 Ohms resistor gives the heaviest filtering but even at 10KHz something like 200mV pk-pk at the cassette input should work. If the source has significant impedance, like a line output, then this will affect the frequency response though I'm not sure if this matters too much. A headphone output should have a nice low impedance.

The circuit is DC-coupled and relies on the source either being AC-coupled or otherwise swinging above and below zero. It is also interesting to note that the circuit will happily handle an input voltage of +/-12V therefore should be able to register RS232 levels.

The upshot of all this is that I think there is potential to achieve a much higher data rate via a direct link versus tape. e.g. CLOADM could be used to bootstrap in a loader that switches to a bit-bang style protocol, all contained in the same WAV file.
Stew
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: bin2cas.pl updated

Post by sixxie »

Quite possible!

I've never tried to push it myself, always been concerned with what would survive on a tape, but others have: https://www.youtube.com/watch?v=3dRhRAXz7iU

And on that note... I've pushed out v3.1! Waveforms should be a lot more resilient now - my testing shows that even 9600Hz output survives speed adjustment pretty well.

The change is based on some measurements I did some while ago: it now accounts for the variance in delay within the ROM before it starts measuring - e.g., there's a longer delay between bytes than there is between bits. You can select (basically) the old timing with "--timing simple".

Here are my testing notes so far - not sent many "--no-fast" wavs out to real hardware yet as I figured that such good results with "-r 9600" meant higher rates were probably going to be ok!

Code: Select all

adjust speed with:
sox input.wav output.wav speed FACTOR rate -v 48000
(result is 48kHz, but remember the source was not - that's just equivalent to
playing it out)

--fast --timing rom
                XRoar           Real
                Min     Max     Min     Max
-r 9600         0.92    1.08    0.93    1.10
-r 11025        0.90    1.10    0.90    1.13
-r 12000        0.93    1.12
-r 22050        0.86    1.19    0.86    1.20
-r 48000        0.85    1.20

--no-fast --timing rom
                XRoar           Real
                Min     Max     Min     Max
-r 9600         0.93    1.19    0.91    1.20
-r 11025        0.94    1.15
-r 12000        0.89    1.19
-r 22050        0.88    1.24
-r 48000        0.85    1.24

--no-fast --timing simple
                XRoar           Real
                Min     Max     Min     Max
-r 9600         1.00    1.15
If you're going to use --timing simple, best use -r 12000 at least. If you're actually going to record it to tape, no reason not to use -r 48000.

Thanks zephyr for building the standalone Windows executables - I hope these constant changes aren't too irritating!

Oh, WAV output a *little* faster now, as I cache runs of samples...
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: bin2cas.pl updated

Post by sixxie »

sorchard wrote:74 seconds?! That's witchcraft. It must have taken 3 minutes originally.
Something like that! It compresses well...

Now up to 79 seconds with the new timings sadly, but much more reliably ;)
Is the resident part of the loader relocated by bin2cas or does it sit in a fixed location?
The autorun is the elongated header approach - the loader sits just after the filename block (so, from $01e9 on), and the data part of the first file overwrites the "next basic token" routine.
ps. Have you found the cheat mode in ROTABB yet? ;)
No! I must admit I find it so enjoyable to fight through the levels (I think I've got to a little past where it starts making threats...) that I never thought to try and cheat ;)

Weird though: when I was young, I much prefered playing it with keyboard, now I just cannot get the hang of that, and have to use a joystick...
sorchard
Posts: 531
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: bin2cas.pl updated

Post by sorchard »

Wow. Just watched the turbo load video. That's insanely fast. One for the collective TODO list then.

I'm having a bit of trouble with bin2cas (version 3.0 for windows). I can build a cas no problem, but when I try to build a wav the resulting file won't play.

Also, if I specify --dzip, I get:

'-' is not recognized as an internal or external command,
operable program or batch file.
No data from pipe to dzip

Is there anyone using the windows version who can show me where I'm going wrong? :?
Stew
Post Reply