recovering games from tape

Tools, techniques and guides for software preservation - get help archiving your discs here!
Post Reply
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

recovering games from tape

Post by joachim »

I have a very-poor-quality WAV of a couple of typein-seeming games — in fact, the first "informally distributed" software I ever received — and I've been trying to either identify where they were published (if indeed they were) or get a clean version of them. So far after trying a few different tools (Diminished's recent work reminded me to post about this) I have some fragmentary blocks but nothing I can run.

The simplest solution would be to find where they have already been preserved. So, does anyone recognise either of these games?

(For archæological context purposes, note that they were accompanied by Manic Mole from Electron User July 1985.)

Code: Select all

   10REM **SHOOT THE RAPIDS**
   20REM ** BY WILLY ADAMS **
   30COLOUR<
   40VDU 19,0,4,0,0,0:VDU 19,1,2,0,0,0
   50PROCinstructions
   60REPEAT
   70PROCsetup
   80TIME=0
   90REPEAT
  223Q=T0
  100PROCrun
  110IF character<>36 THEN Q=1000
  115IF BPUTEOREOREOREOR^B*24770
  120time=l^@EOR^LPROCclearup
  140REM UNTIL D$<>"Y" AND D$<>"y"
  150CLEAR:RUN
  160DEFPROCinstructions
  170PRINTTAB(12,4);"SHOOT THE RAPIDS"
  180PRINTTAB("In this game you are in the small boat  at the bottom of the screen travelling  down a river surrounded by jungle."'
  190PRINT"You steer the boat by pressing the  "'
  200PRINT"<Z> key to go LEFT and the "'
  210PRINT" <X> key to go RIGHT"'
  220PRINT"If you hit the bank the crocodiles get  their dinner."'
  230PROCdifficulty
  240ENDPROC

Code: Select all

 1750DEFPROCinstruct
 1760CLS
 1770PRINT'SPC(15)"SUBMARINE"SPC(15)"~~~~~"
 1780PRINT" You are the captain of a destroyer <96>^BJ¹ a stretch ofsea well known for submarines. On board you have depth-"'" charges which you have to use to sink"'" the submarines."
 1790PRINT"  Th submarË<95>Í ar<83>^Z½¹ÍÑ<85>¹Ñ±åz¹:<9b>^B¢¡e move, and your depth-charge moves"'" fairly slowlyn"
 1800PRINT"  To add to your difficulties, you "'" cannot fire another depth-charge"'" until the other one has reached the"'" bottom. Also you have 6 submarines"'" to hit, which°r¹<91>½µ±å ch¹<9d>n depth!!"
 1x10PRINTTAB(0,23)"Press SPACE BAR to continue...":RA^U^EQU9Q%0^]^UQ=32
 1820CLS
 1830PRINT'''SPC(15)"PrY® th"'SPC(159"SPACE BAR"gSPC(7)" to fire your depth charge."
 1840PRINT''SPC(7)" Submarine         ";CHR$228;CHR$229;CHR$230;CHR$231
 1850PRINT''SPC(7)" Destroyer         ";CHR<92>¶¢Ú^M I<91>225;CId226;CHR<92><92>º
 
Last edited by joachim on Tue Jul 12, 2022 5:29 pm, edited 1 time in total.
tnash
Posts: 32
Joined: Mon May 02, 2022 9:56 am
Contact:

Re: recovering games from tape

Post by tnash »

Nothing obvious. There's a C64 game called Shoot The Rapids, and there are a good handful of similar sub-sinking games. Any idea where it came from?
User avatar
leenew
Posts: 4804
Joined: Wed Jul 04, 2012 4:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: recovering games from tape

Post by leenew »

I don't recognise either of those.
I have looked at the games on bbcmicro.co.uk and cross referenced with my list of all the games I have that have not yet been uploaded to the site... but I can't see anything that matches :(
(My list contains all of the known type-in games from magazines, books, and PD sites that haven't yet been uploaded.)
Maybe they are from a magazine that has not been scanned?
viewtopic.php?p=355807#p355807

Lee.
User avatar
BigEd
Posts: 5078
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: recovering games from tape

Post by BigEd »

Perhaps pop the WAV into a ZIP, attach it, and maybe someone can get some more data recovered? At minimum it serves as a challenge and a prompt to try to make better recovery methods.
tnash
Posts: 32
Joined: Mon May 02, 2022 9:56 am
Contact:

Re: recovering games from tape

Post by tnash »

140REM UNTIL D$<>"Y" AND D$<>"y"

Makes me think this is someone's work in progress. That wouldn't have made it into publication as a magazine type-in, surely?
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

Re: recovering games from tape

Post by joachim »

BigEd wrote:
Mon Jul 11, 2022 4:41 pm
Perhaps pop the WAV into a ZIP, attach it, and maybe someone can get some more data recovered? At minimum it serves as a challenge and a prompt to try to make better recovery methods.
Ok, it's too large for the forum (~38M) but you can get it, at least for now, from my Google Drive:
tape.wav (Google Drive) or, if you prefer, tape.zip (Google Drive)

Notes: the tape contains to the best of my belief:
  • FIGHT, the "Shoot the Rapids" game (I don't know who called it FIGHT or why)
  • SUB, the submarine game (this seems to be in *SPOOL format, for some reason)
  • MURDER (these titles are cheery, aren't they), which is "Detective Q" a type-in from one of the books by Tim Hartnell. Also not in BBC archive sites as far as I know, but pdfs of the books are available so I wouldn't consider it "potentially lost".
Last edited by joachim on Tue Jul 12, 2022 5:25 pm, edited 1 time in total.
User avatar
BigEd
Posts: 5078
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: recovering games from tape

Post by BigEd »

thanks!
User avatar
BigEd
Posts: 5078
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: recovering games from tape

Post by BigEd »

Here are 4 zips with a program in each. There's also a databurst before the first one which I haven't captured. I've just done some simple processing in Audacity.
Attachments
joachim-beeb-tape-prog4.wav.zip
(3.47 MiB) Downloaded 14 times
joachim-beeb-tape-prog3.wav.zip
(2.05 MiB) Downloaded 12 times
joachim-beeb-tape-prog2.wav.zip
(4.48 MiB) Downloaded 14 times
joachim-beeb-tape-prog1.wav.zip
(3.23 MiB) Downloaded 16 times
User avatar
Diminished
Posts: 877
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: recovering games from tape

Post by Diminished »

I think one of the things which is hurting this tape is a significant variation in tape speed across its length. (I'm starting to look into tracking tape speed much more accurately across the whole length of the input, rather than optimistically assuming it's a constant.)

Do you still have the original tape?

Code: Select all

leader; start 487892 smps, end 713865 smps, len 225973 smps, speed 0.987
data; start 713866 smps, end 826588 smps, len 112722 smps, speed 0.986
leader; start 826589 smps, end 861420 smps, len 34831 smps, speed 0.986
data; start 861421 smps, end 971512 smps, len 110091 smps, speed 0.986
leader; start 971513 smps, end 1006389 smps, len 34876 smps, speed 0.986
data; start 1006390 smps, end 1116481 smps, len 110091 smps, speed 0.984
leader; start 1116482 smps, end 1151444 smps, len 34962 smps, speed 0.985
data; start 1151445 smps, end 1261461 smps, len 110016 smps, speed 0.986
leader; start 1261462 smps, end 1296411 smps, len 34949 smps, speed 0.984
data; start 1296412 smps, end 1406412 smps, len 110000 smps, speed 0.986
leader; start 1406413 smps, end 1441361 smps, len 34948 smps, speed 0.984
data; start 1441362 smps, end 1551445 smps, len 110083 smps, speed 0.986
leader; start 1551446 smps, end 1586344 smps, len 34898 smps, speed 0.985
data; start 1586345 smps, end 1696492 smps, len 110147 smps, speed 0.985
leader; start 1696493 smps, end 1731388 smps, len 34895 smps, speed 0.985
data; start 1731389 smps, end 1841430 smps, len 110041 smps, speed 0.985
leader; start 1841431 smps, end 1876426 smps, len 34995 smps, speed 0.986
data; start 1876427 smps, end 1986430 smps, len 110003 smps, speed 0.986
leader; start 1986431 smps, end 2021402 smps, len 34971 smps, speed 0.985
data; start 2021403 smps, end 2131494 smps, len 110091 smps, speed 0.984
leader; start 2131495 smps, end 2166355 smps, len 34860 smps, speed 0.986
data; start 2166356 smps, end 2276393 smps, len 110037 smps, speed 0.985
leader; start 2276394 smps, end 2311313 smps, len 34919 smps, speed 0.983
data; start 2311314 smps, end 2358839 smps, len 47525 smps, speed 0.983
leader; start 2358840 smps, end 2592298 smps, len 233458 smps, speed 0.985
data; start 2592299 smps, end 2599753 smps, len 7454 smps, speed 0.983
silent; start 2599754 smps, end 2600694 smps, len 940 smps
data; start 2600695 smps, end 2605279 smps, len 4584 smps, speed 0.984
silent; start 2605280 smps, end 2629242 smps, len 23962 smps
data; start 2629243 smps, end 2634934 smps, len 5691 smps, speed 0.985
silent; start 2634935 smps, end 2848475 smps, len 213540 smps
data; start 2848476 smps, end 2852826 smps, len 4350 smps, speed 0.986
leader; start 2852827 smps, end 2887091 smps, len 34264 smps, speed 0.986
data; start 2887092 smps, end 2898541 smps, len 11449 smps, speed 0.983
silent; start 2898542 smps, end 2914506 smps, len 15964 smps
data; start 2914507 smps, end 2918848 smps, len 4341 smps, speed 0.986
leader; start 2918849 smps, end 3119549 smps, len 200700 smps, speed 0.984
data; start 3119550 smps, end 3228901 smps, len 109351 smps, speed 0.984
leader; start 3228902 smps, end 3234812 smps, len 5910 smps, speed 0.986
data; start 3234813 smps, end 3245493 smps, len 10680 smps, speed 0.986
leader; start 3245494 smps, end 3355383 smps, len 109889 smps, speed 0.986
data; start 3355384 smps, end 3464714 smps, len 109330 smps, speed 0.986
leader; start 3464715 smps, end 3470749 smps, len 6034 smps, speed 0.987
data; start 3470750 smps, end 3481074 smps, len 10324 smps, speed 0.987
leader; start 3481075 smps, end 3590532 smps, len 109457 smps, speed 0.986
data; start 3590533 smps, end 3699799 smps, len 109266 smps, speed 0.987
leader; start 3699800 smps, end 3705862 smps, len 6062 smps, speed 0.988
data; start 3705863 smps, end 3716493 smps, len 10630 smps, speed 0.976
leader; start 3716494 smps, end 3825766 smps, len 109272 smps, speed 0.986
data; start 3825767 smps, end 3934892 smps, len 109125 smps, speed 0.991
leader; start 3934893 smps, end 3941918 smps, len 7025 smps, speed 0.988
data; start 3941919 smps, end 3951706 smps, len 9787 smps, speed 0.978
leader; start 3951707 smps, end 4060582 smps, len 108875 smps, speed 0.988
data; start 4060583 smps, end 4169569 smps, len 108986 smps, speed 0.989
leader; start 4169570 smps, end 4175497 smps, len 5927 smps, speed 0.988
data; start 4175498 smps, end 4186385 smps, len 10887 smps, speed 0.988
leader; start 4186386 smps, end 4295840 smps, len 109454 smps, speed 0.990
data; start 4295841 smps, end 4404753 smps, len 108912 smps, speed 0.991
leader; start 4404754 smps, end 4410508 smps, len 5754 smps, speed 0.992
data; start 4410509 smps, end 4421021 smps, len 10512 smps, speed 0.963
leader; start 4421022 smps, end 4530039 smps, len 109017 smps, speed 0.993
data; start 4530040 smps, end 4638501 smps, len 108461 smps, speed 0.994
leader; start 4638502 smps, end 4644655 smps, len 6153 smps, speed 0.992
data; start 4644656 smps, end 4654258 smps, len 9602 smps, speed 0.989
leader; start 4654259 smps, end 4763059 smps, len 108800 smps, speed 0.993
data; start 4763060 smps, end 4871589 smps, len 108529 smps, speed 0.995
leader; start 4871590 smps, end 4880145 smps, len 8555 smps, speed 0.993
data; start 4880146 smps, end 4887784 smps, len 7638 smps, speed 0.985
leader; start 4887785 smps, end 4997237 smps, len 109452 smps, speed 0.992
data; start 4997238 smps, end 5105956 smps, len 108718 smps, speed 0.993
leader; start 5105957 smps, end 5112057 smps, len 6100 smps, speed 0.992
data; start 5112058 smps, end 5122247 smps, len 10189 smps, speed 0.985
leader; start 5122248 smps, end 5230970 smps, len 108722 smps, speed 0.992
data; start 5230971 smps, end 5339690 smps, len 108719 smps, speed 0.992
leader; start 5339691 smps, end 5345502 smps, len 5811 smps, speed 0.991
data; start 5345503 smps, end 5357340 smps, len 11837 smps, speed 0.996
silent; start 5357341 smps, end 5378220 smps, len 20879 smps
data; start 5378221 smps, end 5382574 smps, len 4353 smps, speed 0.986
leader; start 5382575 smps, end 5465405 smps, len 82830 smps, speed 0.986
data; start 5465406 smps, end 5545954 smps, len 80548 smps, speed 0.992
leader; start 5545955 smps, end 5754400 smps, len 208445 smps, speed 0.992
data; start 5754401 smps, end 5759146 smps, len 4745 smps, speed 0.988
leader; start 5759147 smps, end 5998211 smps, len 239064 smps, speed 0.993
data; start 5998212 smps, end 6107420 smps, len 109208 smps, speed 0.995
leader; start 6107421 smps, end 6142029 smps, len 34608 smps, speed 0.994
data; start 6142030 smps, end 6251278 smps, len 109248 smps, speed 0.994
leader; start 6251279 smps, end 6285872 smps, len 34593 smps, speed 0.994
data; start 6285873 smps, end 6395002 smps, len 109129 smps, speed 0.994
leader; start 6395003 smps, end 6429586 smps, len 34583 smps, speed 0.993
data; start 6429587 smps, end 6538604 smps, len 109017 smps, speed 0.995
leader; start 6538605 smps, end 6573238 smps, len 34633 smps, speed 0.995
data; start 6573239 smps, end 6682272 smps, len 109033 smps, speed 0.995
leader; start 6682273 smps, end 6716812 smps, len 34539 smps, speed 0.995
data; start 6716813 smps, end 6825853 smps, len 109040 smps, speed 0.994
leader; start 6825854 smps, end 6860461 smps, len 34607 smps, speed 0.995
data; start 6860462 smps, end 6925262 smps, len 64800 smps, speed 0.993
leader; start 6925263 smps, end 7155323 smps, len 230060 smps, speed 0.994
data; start 7155324 smps, end 7168892 smps, len 13568 smps, speed 0.996
silent; start 7168893 smps, end 7171047 smps, len 2154 smps
data; start 7171048 smps, end 7175431 smps, len 4383 smps, speed 0.994
leader; start 7175432 smps, end 7402559 smps, len 227127 smps, speed 0.998
data; start 7402560 smps, end 7511535 smps, len 108975 smps, speed 1.000
leader; start 7511536 smps, end 7546396 smps, len 34860 smps, speed 0.999
data; start 7546397 smps, end 7655208 smps, len 108811 smps, speed 1.002
leader; start 7655209 smps, end 7690014 smps, len 34805 smps, speed 1.001
data; start 7690015 smps, end 7798673 smps, len 108658 smps, speed 1.003
leader; start 7798674 smps, end 7833471 smps, len 34797 smps, speed 1.004
data; start 7833472 smps, end 7942183 smps, len 108711 smps, speed 1.003
leader; start 7942184 smps, end 7976959 smps, len 34775 smps, speed 1.002
data; start 7976960 smps, end 8085532 smps, len 108572 smps, speed 1.003
leader; start 8085533 smps, end 8120337 smps, len 34804 smps, speed 1.003
data; start 8120338 smps, end 8229046 smps, len 108708 smps, speed 1.002
leader; start 8229047 smps, end 8263733 smps, len 34686 smps, speed 1.003
data; start 8263734 smps, end 8372451 smps, len 108717 smps, speed 1.001
leader; start 8372452 smps, end 8407182 smps, len 34730 smps, speed 1.003
data; start 8407183 smps, end 8515830 smps, len 108647 smps, speed 1.002
leader; start 8515831 smps, end 8550616 smps, len 34785 smps, speed 1.003
data; start 8550617 smps, end 8659227 smps, len 108610 smps, speed 1.003
leader; start 8659228 smps, end 8693920 smps, len 34692 smps, speed 1.002
data; start 8693921 smps, end 8802469 smps, len 108548 smps, speed 1.005
leader; start 8802470 smps, end 8837131 smps, len 34661 smps, speed 1.003
data; start 8837132 smps, end 8945647 smps, len 108515 smps, speed 1.003
leader; start 8945648 smps, end 8980290 smps, len 34642 smps, speed 1.006
data; start 8980291 smps, end 9088450 smps, len 108159 smps, speed 1.005
leader; start 9088451 smps, end 9123132 smps, len 34681 smps, speed 1.007
data; start 9123133 smps, end 9219064 smps, len 95931 smps, speed 1.005
leader; start 9219065 smps, end 9321216 smps, len 102151 smps, speed 1.005
data; start 9321217 smps, end 9340074 smps, len 18857 smps, speed 1.004
edit: here's a graph, because I can
chart.png
User avatar
vanekp
Posts: 1163
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: recovering games from tape

Post by vanekp »

I cant ready any of the wave file even on a BBC so, or the tape is of not good quality or the tape deck that was used to play it back, another thing to check on the the tape is that the pressure pad is okay as I have found a lot of them come lose or the foam that was used for the pressure pad is total disintegrated, if the wave is not even readable on a BBC the chance of converting it to any usable electronic format are very small, from my experience.
Regards Peter.
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

Re: recovering games from tape

Post by joachim »

tnash wrote:
Mon Jul 11, 2022 11:30 am
Any idea where it came from?
Not really, it must have been a personal contact of some family member at work/school, and even if I knew which, they wouldn't be invested enough to remember anything useful.
Diminished wrote:
Wed Jul 13, 2022 4:56 pm
Do you still have the original tape?
Definitely maybe … in principle it's somewhere at my parents' house if they haven't thrown it out, put it on eBay, or given it to the grandchildren for destructive experiments. Visiting them is certainly on my to-do list, but it means flying to the UK and back, which I keep hearing is non-fun for one reason after another. What would you recommend me to do with the original tape, were I to have it?
User avatar
vanekp
Posts: 1163
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: recovering games from tape

Post by vanekp »

How was this then captured in the 1st place then?
also seems the tape image is a copy off a home made tape as there are all sort of sounds before the data part starts.
as I mentioned checking the tape that the pressure pad is good and recording it on a good quality tape deck but maybe the original is of very poor quality in the 1st place.
Regards Peter.
User avatar
BigEd
Posts: 5078
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: recovering games from tape

Post by BigEd »

(Did anyone have a go with my snipped and cleaned versions?)
User avatar
vanekp
Posts: 1163
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: recovering games from tape

Post by vanekp »

BigEd wrote:
Thu Jul 14, 2022 8:56 am
(Did anyone have a go with my snipped and cleaned versions?)
I did indeed with csw and quadbike also on real hardware but could not get even one readable blocks even though they do "sound" very clean.
Regards Peter.
User avatar
BigEd
Posts: 5078
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: recovering games from tape

Post by BigEd »

Thanks! I notice in the spectrogram view that this tape has lost a lot of top end compared to a previous successful recovery. And listening side by side that's clearly audible.
User avatar
Diminished
Posts: 877
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: recovering games from tape

Post by Diminished »

The waveform (top) is pretty yucky.

yuck.png
If you have a look at the power sampling instant marked by the red line, you can see that poor Goertzel (which, remember, is a mathematically perfect method of extracting frequencies from signals) is very confused about what is going on here. power0 and power1 are almost identical in value at this point, and so the confidence level (which I defined as abs {power0 - power1} ) drops basically to zero. There are innumerable examples of this.

AFAIK the only parameter that you can control here to try to change this is the window.
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

Re: recovering games from tape

Post by joachim »

FWIW I found my previous notes about how I extracted the data that I posted at the top of the thread: I used minimodem (https://github.com/kamalmostafa/minimodem), turned up all the "guess harder" options and postprocessed the output (cleaned up some obvious bit errors by hand and translated to printable format).

Missing a lot of top end sounds consistent with my observations (I wasn't smart enough to look at the spectrogram but looking at the waveform it's believable). Interesting if this is what prevents it from being read into a real Beeb.
Diminished wrote:
Thu Jul 14, 2022 11:36 am
power0 and power1 are almost identical in value at this point, and so the confidence level (which I defined as abs {power0 - power1} ) drops basically to zero. There are innumerable examples of this.

AFAIK the only parameter that you can control here to try to change this is the window.
Is your instant correctly synchronised? Wouldn't you get a confidence level of zero from a perfect recording, if you sampled at the instant it changed between 0 and 1? (Edit: oh, I suppose that's why you supplied the power0 and power1 graphs, illustrating that it doesn't look really good anywhere.)
User avatar
Diminished
Posts: 877
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: recovering games from tape

Post by Diminished »

joachim wrote:
Thu Jul 14, 2022 11:40 am
Is your instant correctly synchronised? Wouldn't you get a confidence level of zero from a perfect recording, if you sampled at the instant it changed between 0 and 1? (Edit: oh, I suppose that's why you supplied the power0 and power1 graphs, illustrating that it doesn't look really good anywhere.)
This is a great question because it cuts right to the heart of Quadbike's accuracy (or lack of it). No matter which mode you use, its method of determining the frequencies over time is always the same -- it cuts the input into short pieces, and does Goertzel power transforms on each piece at 1200 (ish) and 2400 (ish) Hz.

The different modes (-s freq/walk/pll) only change how the sampling instants are generated. Walk mode uses the traditional method of scanning the waveform for peaks and valleys, and generates sync timings based on that. PLL mode uses a software phase-locked loop to lock on to the signal's carrier, and sync timings are then derived from the reconstituted carrier signal outputted by the PLL's oscillator. Frequency mode derives sync from the Goertzel output itself -- it looks for instants where power0 becomes larger than power1 (or vice versa) indicating a bit flip, and then interpolates between these instants to fill in the sampling times between them. All three of these methods sound fine on paper, but as the maxim goes, "no plan survives contact with the enemy" -- the enemy in this case being real-world data.

Modulo any bugs, of which there are probably still many, the software's accuracy depends entirely on judicious selection of those sampling instants (as you rightly point out).

(This information should all be in QB's documentation, but I haven't written any yet.)
User avatar
BigEd
Posts: 5078
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: recovering games from tape

Post by BigEd »

Is it true that some equalisation before running quadbike will help? My usual filter is a high pass with peaks at 1200 and 2400. In this case a boost to frequencies from perhaps 2000 to 3500 might help.
User avatar
Diminished
Posts: 877
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: recovering games from tape

Post by Diminished »

BigEd wrote:
Thu Jul 14, 2022 12:20 pm
Is it true that some equalisation before running quadbike will help? My usual filter is a high pass with peaks at 1200 and 2400. In this case a boost to frequencies from perhaps 2000 to 3500 might help.
Maybe -- it does of course contain a built-in optional bandpass pre-filter from 400 Hz to 3200 Hz (for walk mode only), which can improve the shape of the waveform and give you something to work with that more closely resembles a sine wave. I don't think it would make a difference to "-s pll" or "-s freq", since "-s pll" has its own filter in order to try to isolate an input carrier signal, and "-s freq" is processed entirely in the frequency domain anyway (so stray frequencies are just ignored).
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

Re: recovering games from tape

Post by joachim »

Diminished wrote:
Thu Jul 14, 2022 11:36 am
If you have a look at the power sampling instant marked by the red line, you can see that poor Goertzel (which, remember, is a mathematically perfect method of extracting frequencies from signals) is very confused about what is going on here. power0 and power1 are almost identical in value at this point, and so the confidence level (which I defined as abs {power0 - power1} ) drops basically to zero. There are innumerable examples of this.

AFAIK the only parameter that you can control here to try to change this is the window.
How do you treat the phase information in the output of these Goertzel DFTs? "Power" makes it sound as if you're taking everything at that frequency, but in principle I think you should ignore the component that's orthogonal to the expected phase. (Except to the extent that you don't trust your sampling instant clock and want to compensate for that.)
User avatar
Diminished
Posts: 877
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: recovering games from tape

Post by Diminished »

joachim wrote:
Thu Jul 14, 2022 3:05 pm
Diminished wrote:
Thu Jul 14, 2022 11:36 am
If you have a look at the power sampling instant marked by the red line, you can see that poor Goertzel (which, remember, is a mathematically perfect method of extracting frequencies from signals) is very confused about what is going on here. power0 and power1 are almost identical in value at this point, and so the confidence level (which I defined as abs {power0 - power1} ) drops basically to zero. There are innumerable examples of this.

AFAIK the only parameter that you can control here to try to change this is the window.
How do you treat the phase information in the output of these Goertzel DFTs? "Power" makes it sound as if you're taking everything at that frequency, but in principle I think you should ignore the component that's orthogonal to the expected phase. (Except to the extent that you don't trust your sampling instant clock and want to compensate for that.)
Currently a power-spectrum version of the algorithm is used (which just makes the imaginary part vanish), so there is no phase information. The beauty of doing it this way is how unexpectedly lightweight the implementation is:

Code: Select all

qb_err_t goertzel_pwr (double *in,
                       s64_t sequence_len,
                       double omega_rads_per_sample,
                       double *power_out) {
  
  double omega;
  s64_t n;
  double sn1, sn2;
  double two_cos_omega;
  
  omega = omega_rads_per_sample;

#ifdef QB_SANITY
  if ((omega > M_PI) || (omega < 0.0)) {
    fprintf(stderr, "goertzel: BUG: bad omega (%lf)\n", omega);
    return QB_E_BUG;
  }
#endif
  
  two_cos_omega = 2.0 * cos(omega);
  
  sn1 = 0.0;
  sn2 = 0.0;
    
  for (n=0; n < sequence_len; n++) {
  
    double s;
    
    s = in[n];
  
    s = s + (two_cos_omega * sn1) - sn2;
    
    sn2 = sn1;
    sn1 = s;

  }
  
  *power_out = (sn2 * sn2) + (sn1 * sn1) - (two_cos_omega * sn1 * sn2);
  
  return QB_E_OK;
  
}
Plus there are no messy complex numbers to deal with.

But you're right. It might be worth extracting both amplitude and phase and seeing if any more insight becomes available. Thanks.
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

Re: recovering games from tape

Post by joachim »

Okay, I have basically retrieved the first program. I've patched up a lot of superficial read errors but have left in some obvious corruption in a few places where I can't even guess what it should say:

Code: Select all

3across=40
5Q=0
10REM **SHOOT THE RAPIDS**
20REM ** BY WILLY ADAMS**
30MODE4
40VDU 19,0,4,0,0,0:VDU 19,1,2,0,0,0
50PROCinstructions
60REPEAT
70PROCsetup
80¢=0
90REPEAT
95Q=40
100PROCrun
110IF character<>32 THEN Q=1000
115IF TO<82><82><82>^BGOTO720
120GETSINACS=
130PROCclearup
140REM UNTIL D$<>"Y" AND D$<>"y"
150CLEAR:RUN
160DEFPROCinstructions
170PRINTTAB(12,4);"SHOOT THE RAPIDS"
180PRINT"In this game you are in the small boat  at the bottom of the screen travelling  down a river surrounded by jungle."'
190PRINT"You steer the boat by pressing the  "'
200PRINT"<Z> key to go LEFT and the "'
210PRINT"<X> key to go RIGHT"'
220PRINT"If you hit the bank the crocodiles get  their dinner."'
230PROCdifficulty
240ENDPROC
250DEFPROCsetup
260VDU23,224,8,28,42,119,42,8,8,0
270VDU23,225,126,255,255,255,255,255,255,126
280REM ** ALTER AUTORATE
290*FX 11,1
300across=20:left = 10:right =10
310FOR I=0 TO 32
320PRINTSTRING$(10,CHR$(224));STRING$(20," ");STRING$(10,CHR$(224));
330NEXT
340ENDPROC
350DEFPROCrun
360PRINTTAB(across,30);CHR$(225);
370REM ** CLEAR KEYBOARD
380*FX 15,0
390leftbank=left+RND(3)-2
400 IF leftbank<10 THEN leftbank=34
410rightbank=right+RND(3)-2
420IF rightbank<10 THEN rightbank=20
430IF rightbank+leftbank>38 THEN 450
440left=leftbank:right=rightbank
450PRINTTAB(0,0);CHR$(11);STRING$(left,CHR$(224));STRING$(40-left-right,"  ");STRING$(right,CHR$(224));
460FORI=1 TO delay:NEXT:REM **DELAY
470D$=INKEY$(0)
480IF D$="Z" THEN across = across -1
490IF D$="X" THEN across = across +1
500PRINTTAB(across,30);
510A%=135:character=(USR(&FFF4)AND&FF00)/&100
520ENDPROC
530DEFPROCclearup
540FOR I=0 TO 5000:NEXT:REM**DELAY
550REM ** CLEAR KEYBOARD
560*FX15,0
570CLS
580PRINTTAB(0,9);"You lasted ";INT(time/100);" seconds"
585 IF INT(time/100)>50 THEN PRINT"  "
586 IF INT(time/100)>50 THEN PRINT"THAT WAS PRETTY AVERAGE!!!"
589IF INT(time/100)>50 THEN PRINT"(Perhaps you should try a harder level!!!)"
590PRINTTAB(9)"PRESS A KEY"
600REM ** RESET AUTORATE
610*FX 11,50
620D$=GET$
630
640ENDPROC
650DEF PROCdifficulty
660*FX15,1
670PRINT''"   HOW FAST DO YOU WANT TO GO? (1-9)"
680INPUT difficulty$
690REM IF VAL(difficulty$)<1 OR VAL(difficulty$) >9 THEN PRINT"INPUT A NUMBER BETWEEN 1 AND 9":GOTO 680
700delay=500-50*VAL(difficulty$)
710ENDPROC
720 CLEAR:CLS
725*FX11,50
730PRINTTAB(16,11);"*********"
740PRINTTAB(16,12);"*Iceberg*"
750PRINTTAB(16,13);"*********"
760DIM B(15,15)
770N=INT(RND(1)*15+7)
780FOR I=1 TO N
786B(INT(RND(1)*15+1),INT(RND(1)*15+1))=42
800NEXT
810SX=INT(RND(1)*15+1)
820SY=INT(RND(1)*15+1)
830IF B(SX,SY)<>0THENGOTO810
840B(SX,SY)=ASC("Z")
850YX=INT(RND(1)*15+1)
860YY=INT(RND(1)*15+1)
870IF B(YX,YY)<>0THENGOTO850
880B(YX,YY)=65
890CLS
900FOR Y=0 TO 15
910FOR X=1 TO 15
920IF B(X,Y)=0THEN950
930 PRINT CHR$(B(X,Y));
940GOTO960
950PRINT".";
960PRINT" ";
970NEXT
980PRINT
990NEXTY
1000B(YX,YY)=0
1010 PRINT"DIRECTION(N,S,E,W) "
1020D$=GET$
1030YY=YY-(D$="S" AND YY<>8)
1040YY=YY+(D$="N" AND YY<>1)
1050YX=YX-(D$="E" AND YX<>8)
1060YX=YX+(D$="W" AND YX<>1)
1070IF B(YX,YY)=90THEN GOTO1170
1080IF B(YX,YY)=42THEN GOTO1190
1090B(YX,YY)=65
1000B(SX,SY)=0
1110SX=SX+SGN(YX-SX)
1120SY=SY+SGN(YY-SY)
1130 IF B(SX,SY)=65THENGOTO1170
1140IF B(SX,SY)=42THENGOTO1210
1150B(SX,SY)=90
1160GOTO890
1170PRINT"YOU'VE BEEN HIT!!"
1180GOTO1140
1190PRINT"YOU'VE HIT AN ICEBERG"
1200GOTO1140
1210PRINT"YOU'RE SAFE.HE HIT AN ICEBERG"
1220FOR D=1 TO 3000:NEXT D
1230CLEAR
1240CLS
1250PRINTTAB(12,07)"SUBMARINE"
1260FOR D=0 TO 3000:NEXT D
Notes on extracting the program:
  • As in my initial attempts, I used minimodem, after spending a while investigating how it works, and adjusting some compile-time constants to trade speed for optimal decoding.
  • BigEd's processed versions weren't readable by minimodem, I had to use the file as originally uploaded. I'm not sure why. Although there's a chance it can be blamed on a weird-looking patch I seem to have made that I now can't understand the reason for.
  • I'd also really like to know why Diminished's pessimistic comments about the power sampling are compatible with this decoding … they would probably have induced me to give up if I hadn't already made some reasonable progress with minimodem.
  • I believe that the challenge here is all in the framing. From the fact that the decoding produces anything useful at all, it seems clear that over 99% of the bits will extract correctly if the framing is perfect. minimodem occasionally desynchronised at the character level and gave me 3–8 bytes of junk before dropping a character and resynchronising. It resynchronises itself using the known value of the start and stop bits.
  • Both the flipped bit errors and the desynchronisations seemed to be somewhat predictable based on the bytes read, which gives me hope that a sufficiently advanced preprocessing or more sophisticated algorithm could fix those too. Trying to choose the framing holistically instead of greedily would also be an interesting experiment.
Notes on the program content:

It seems that someone was trying to merge several small BASIC games into a multipart game. I never managed to trigger the second game BITD (and perhaps it's not triggerable as it stands; hard to tell because I can't work out what was in line 115). This at least explains something that's confused me since the '80s, to wit, why the next game on the tape, which is the submarine game promised at the end of this listing, is in *SPOOL format: they were trying to load it in as an overlay. Well I never.

Edit: play on bbcmic.ro (I have modified a few lines to make it run without errors)
Last edited by joachim on Sat Jul 30, 2022 3:10 am, edited 3 times in total.
joachim
Posts: 260
Joined: Wed Jun 21, 2006 2:20 am
Location: Germany
Contact:

Re: recovering games from tape

Post by joachim »

And an approximation of the second program. Again, it's apparently written as an overlay for the first program, since the line numbers are more or less continuous:

Code: Select all

1280PROCinstruct
1290MODE2:N=0:X=TIME
1300GOTO1420
1310DEF PROCinit
1320VDU 23,224,8,8,9,11,255,127,63,31
1330VDU23,36,0,0,0,0,0,0,0,0
1340VDU23,225,3,1,63,191,255,85,255,255
1350VDU23,226,128,0,163,221,255,85,255,255
1360VDU23,227,0,8,8200,254,254,252,252
1370VDU23,228,0,0,0,0,0,127,255,63
1380VDU23,229,0,0,0,0,0,255,255,255
1390VDU23,230,12,4,31,63,127,255,255,255
1400VDU23,231,0,0,0,0,0,252,254,252
1410Å^PAI=^M
1420IF N=6 THEN PROCTIME:RUN
1430Ъ^M¥»¥!
1440COLOUR 132:CLS:COLOUR134
1450FOR A%=1 TO 120:PRINT" ";
1460NEXT A%
1470COLOUR 0:PRINTTAB(10,5);CHR$(224);CHR$(225);CHR$(226);CHR$(227)
1480A%=RND(30)+12
1490A%=-0:Ã%=6:D%=0:COLOUR 132:H%=0
1500A$=INKEY$(0):IF D%=1 GOTO 1530
1510IF A$<>"" THEN COLOUR3:PRINTTAB(12,C%);CHR$(229);:D%=1:GOTO1530
1520FOR T=0 TO 30:NEXT
1530 IF D%=1 =1=UIÑ:PROCCHARGE:C%=C%+1:COLOUR3:Pª^M^M!^EI^]^U
1540IF H%=1 THEN 1420
1550COLOUR4:PRINTTAB(Pb %);CHR$(228);CHR$(229);CHR$(230);CHR$(231);
1560IF A%<17 THEN A%=A%+1 ELSE A%=0
1570VDU23,0,0;0;0;0;:COLOUR0:PRINTTAB(A%,B%);CHR$(228);CHR$(229);CHR$(230);CHR$(231);
1580GOTO1500
1590DEFPROCCHARGE
1600PRINTTAB(12,C%);CHR$(229);
1610IFC%=B%THEN PROCHIT
1620IFC%=31THEN D%=0:COLOUR4:PRINTTAB(12,31);CHR$(229);:C%=6
1630ENDPROC
1640DEFPROCHIT
1650IF A%<=12 AND (A%+3)>=12 THEN SOUND0,-15,5,10 ELSE ENDPROC
1660FORo=0 TO 1000:NEXT
1670H%=0:N=N+1
1680ENDPROC
1690DEFPROCTIME
1700COLOUR7:COLOUR129:CLS
1710PRINTTAB(7,8);(TIME-X)/100
1720PRINTTAB(6,10)"SECONDS"
1730PRINT'''"    Press SPACE":D=GET
1740GOTO1880
1750DEFPROCinstruct
1760CLS
1770PRINT'SPC(15)"SUBMARINE"SPC(15)"~~~~~~~~~"
1780PRINT"  You are the captain of a destroyer¤<96>^BJ¹<81>a stretch ofsea well`{nown for"g" submar¹<8d>es. On board you have depth-"'" charges which you have to use to sink"'" the submarines."
1790PRINT"  The submarines are constantly on the move, and your depth-charge moves"'" fairly slowly."
1800PRINT"  To add to your difficulties, you "'" cannot fire another depth-charge "'" until the other one has reached the"'" bottom. Also you have 6 submarines"'" to hit, which randomly change depth!!"
1810PRINTTAB(0,23)"Press SPACE BAR to continue...":REPEATUNTILGET=32
1820CLS
1830PRINT'''SPC(15)"Press the"'SPC(15)"SPACE BAR"'SPC(7)" to fire your depth charge."
1840PRINT''SPC(7)" Submarine         "; CHR$228;CHR$229;CHR$230;CHR$231
1850PRINT''SPC(7)" Destroyer         ";CHR$224;CHR$225;CHR$226;CHR$227
1860PRINTTAB(15,2)"Good Luck!!"''SPC(5)"Press SPACE to begin..."
1870REPEATUNTILGET=32:ENDPROC
1880 CLEAR
1890VDU23,32,0,0,0,0,0,0,0,0
1900MODE6:PRINTTAB(12,17)"SUBMARINE 2"
1910FOR D=1 TO 3000:NEXTD
Edit: play on bbcmic.ro (even more than the last one, I have hacked it around a little to make it playable)
Last edited by joachim on Sat Jul 30, 2022 3:02 am, edited 2 times in total.
User avatar
Diminished
Posts: 877
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: recovering games from tape

Post by Diminished »

joachim wrote:
Fri Jul 29, 2022 9:50 pm
And an approximation of the second program. Again, it's apparently written as an overlay for the first program, since the line numbers are more or less continuous:
Great work.
joachim wrote:
Fri Jul 29, 2022 8:27 pm
[*] I'd also really like to know why Diminished's pessimistic comments about the power sampling are compatible with this decoding … they would probably have induced me to give up if I hadn't already made some reasonable progress with minimodem.
It's probably because -- unlike me -- whoever wrote minimodem actually knew what they were doing.
Post Reply

Return to “software preservation”