Acorn Atom taped programs restore "project"

emulators, hardware and classic software for atom + system machines
Post Reply
User avatar
acory
Posts: 44
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Acorn Atom taped programs restore "project"

Post by acory »

It's been some time since I did anything Atom related...

The other week I needed to convert personal recordings on some old audio tapes into MP3 format, so that I could listen to them on my phone or tablet. I have a boom box type stereo/radio which I bought in 1979 (first year at uni). It has a 5 pin DIN output for which I created a cable to connect to the line in of my PC. I used Audacity (more or less for the first time) to get the recordings and do some simple noise removal.

Since the tape recorder was already hook up, I took a look at some old audio tapes which contained Atom programs. I then chose one cassette (more or less randomly) and converted the whole of side A to WAV 16-bit format at 48000Hz sampling.

Back in 1979 I recorded my programs onto tape using a really old mains powered mono cassette deck (I didn't use the boom box since all my older Atom recording had been done with the old mono recorder). It had an interesting feature, in that when record is selected, there is a loud "burping" heard on the recording. Ironically this allows the different recordings on the tape to be identified.

I have a picture from Audacity but no idea how to post it.

Using Audacity I could isolate each section of the recording, which are separated by the "burps" (easy to see in Audacity). So I decided to write some software in Perl to decode the wav back into binary. This was made more of a challenge since the right audio channel is horribly distorted and the waveforms for the logic levels are badly distorted for the left channel. Some manipulation in Audacity, particularly EQ helped enormously. Although I faced some problems with some WAVs which meant fixing at the sample level, I have now restored all 31 recordings. From the filenames I see that they are my attempt at writing a game. I have written the data out in both raw binary and TAP format.

I am now looking for an emulator to read in the programs/data files.
Wouterras won't work in 64 bit Win10 mode. A pity since it supports TAP format.
Atomulator (V1.28) doesnt read in TAP format.
The web based emulators also do not seem to support TAP format.

I can re-format the output from the program into any binary format, as long as it is well defined.

Currently I am alittle stuck, but close to seeing my old code for the first time since 1979.

--acory
User avatar
oss003
Posts: 3849
Joined: Tue Jul 14, 2009 12:57 pm
Location: Netherlands
Contact:

Re: Acorn Atom taped programs restore "project"

Post by oss003 »

MAME can read WAV files.....

Greetings
Kees
User avatar
CMcDougall
Posts: 7048
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland
Contact:

Re: Acorn Atom taped programs restore "project"

Post by CMcDougall »

audacity is rubbish on a PC, but seems OK on a Mac :?

48k is total overkill , it's not a blu ray movie disc!

Need to be 44k, then use CSW viewer to turn a mono .WAV into a .CSW, then use that for emulators, or into .uefHQ if the csw does not work, 80% of time csw does not work...

MP3s are useless unless using a old LAME encoder, the new v3.99 does not work :shock:
ImageImageImage
User avatar
CMcDougall
Posts: 7048
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland
Contact:

Re: Acorn Atom taped programs restore "project"

Post by CMcDougall »

ImageImageImage
User avatar
MarkMoxon
Posts: 605
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Acorn Atom taped programs restore "project"

Post by MarkMoxon »

acory wrote: Tue May 12, 2020 5:57 pm Wouterras won't work in 64 bit Win10 mode. A pity since it supports TAP format.
You can run Wouter’s Atom emulator on Windows 10 using DOSBox - I did this last week for exactly this reason (to load an Atom TAP file). It worked fine, and wasn’t that hard to get working, so that might be an option.

Mark
User avatar
hoglet
Posts: 12658
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Acorn Atom taped programs restore "project"

Post by hoglet »

acory wrote: Tue May 12, 2020 5:57 pm Atomulator (V1.28) doesnt read in TAP format.
Atomulator supports ATM files directly, using the default AtoMMC file system

As far as I understand, TAP files and ATM files are very closely related.

An ATM file is:
<16 bytes of file name>
<2 bytes of load address>
<2 bytes of exec address>
<2 bytes of length>
<data>

A TAP file is simply a concatenation of ATM files:
<ATM File> <ATM File> ...

So if you could chop up your TAP files into individual ATM files, then you would be able to work with them directly in Atomulator.

Dave
User avatar
oss003
Posts: 3849
Joined: Tue Jul 14, 2009 12:57 pm
Location: Netherlands
Contact:

Re: Acorn Atom taped programs restore "project"

Post by oss003 »

Roland wrote a conversion program long time ago.
You could create and change headers between Atom-in-PC, ATM and headerless programs.

Don't know if he still has the source?

Gree
User avatar
acory
Posts: 44
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Re: Acorn Atom taped programs restore "project"

Post by acory »

Thank you all for taking the time to reply.

I did a bit of googling and found a number of Atom emulators, some of which I had already downloaded, but only had taken a cursory glance at that time. I found about some new ones during searches of this site. I tried http://floooh.github.io/virtualkc/ but couldn't get the file load to work (apart from the built in examples). This looks interesting as it includes a debugger, which might be helpful when I continue development of my game (last worked on in 1979/1980). This emulator remaps the PC keyboard which makes it natural to work with.

Thank you @MarkMoxon. I downloaded DOSBox and was able to run the Wouterras emulator. I had problems with the mouse disappearing, which might be a DOSBox feature. It also seems to freeze up, and I have no idea why (might be DOSBox losing focus???). Response to the function keys was a bit hit and miss, which made this otherwise impressive program painful to use.

BTW I chose 48000Hz as the sampling in Audacity since the Atom tones are 1200 and 2400Hz. I though it might make it easier to detect the ones and zeroes. In any case my Perl binary extraction software is working fine, although sometimes the WAV needs some massaging due to unexpected drop outs (the signal disappears into noise).

@hoglet hit the nail on the head with Atomulator. I stumbled across this solution by chance. The Wouterras TAP format (with 22 byte header) seems identical to the file format needed by the files in the MMC folder. I tried this and I was able to list and run (nothing happened!) my code. Nice to know that TAP is a concatination of ATM. Since I only put one saved file in the TAP it looked identical to a ATM, so this is why Atomulator was happy.

While googling I came across various formats understood by the various emulators, including disk and tape formats. Is there anywhere which documents these various file formats? I was thinking of trying to write out a disk image, but thankfully I can use the Atomulator MMC solution.

I also wrote some simple Perl to convert basic programs into pure text in order to view in a PC editor. I will probably write a companion to coonvert from basic text back into atom format. The only thing which wasn't clear was "how does the Atom indicate the end of a basic program". In one file I saw a 0xFF value, but it wasn't the same in another basic file. My googling has again failed to find an answer :?

Now to take a look at my old code and see what it was doing. Kicking myself for not using REM statements :( :lol:

regards...
--acory

BTW, I wanted to post pictures of the tape waveforms, but the only way appears to be to point to an URL. Are there any recommendations of sites which allow free hosting of pictures?
User avatar
IanS
Posts: 2535
Joined: Mon Aug 31, 2009 7:02 pm
Location: UK
Contact:

Re: Acorn Atom taped programs restore "project"

Post by IanS »

acory wrote: Wed May 13, 2020 2:00 pm BTW, I wanted to post pictures of the tape waveforms, but the only way appears to be to point to an URL. Are there any recommendations of sites which allow free hosting of pictures?
Try the attachments tab lower down the screen when posting.
attachments.PNG
attachments.PNG (3.56 KiB) Viewed 3018 times
User avatar
hoglet
Posts: 12658
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Acorn Atom taped programs restore "project"

Post by hoglet »

acory wrote: Wed May 13, 2020 2:00 pm BTW I chose 48000Hz as the sampling in Audacity since the Atom tones are 1200 and 2400Hz. I though it might make it easier to detect the ones and zeroes. In any case my Perl binary extraction software is working fine, although sometimes the WAV needs some massaging due to unexpected drop outs (the signal disappears into noise).
If you have any cases where you are still struggling to recover the original data, I have some fairly sophisticated decoding software that has proved helpful in the past. We've used it to recover many of the original titles that are in the software archive.

Just post a link to the WAV file and I'll give it a try.

Dave
User avatar
acory
Posts: 44
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Re: Acorn Atom taped programs restore "project"

Post by acory »

Thank you @IanS, I do have a habit of not looking closely enough. I think I read in the forum rules that not everyone could add attachments, so it may have prevented me searching.

I'm happy to attach a sample WAV if anyone wants to try any of the usual programs.

You can see that the left and right channels have quite different waveforms. This might be due to using a stereo player if as I assume the recording was on a mono machine.

For each recording
1) cut the recording section starting at one burp and finishing before the next
2) cut the burp off and trim the trailing silence
3) amplify by 15dB
4) use the graphic EQ effect, with 1.25Khz set to 12dB , 200Hz to -6dB , 160Hz to -12dB, all lower frequencies to -20dB. This seems to help the top of the waveforms and prevent them crossing the zero level. I really needed an effect to notch boost 1200 and 2400Hz.
5) save as 16 bit WAV 48000Hz
6) run my Perl code
6a) if it crashes out, enable debugging in the source and capture all the printf debug stuff, looking for where the bit stream has got corrupted a) some small sections just dropped out and I had to use cut and paste using the top channel as a reference b) some 1200Hz crossed the zero several times due to distortion which needed individual samples to be corrected (sometimes they could be identified visually).

regards...
--acory
Attachments
The distorted left and right waveforms
The distorted left and right waveforms
A bunch of recordings showing the strange &quot;burp&quot; at the start of each new recording, which is now really helpful in identifying each recorded program.
A bunch of recordings showing the strange "burp" at the start of each new recording, which is now really helpful in identifying each recorded program.
User avatar
hoglet
Posts: 12658
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Acorn Atom taped programs restore "project"

Post by hoglet »

acory wrote: Wed May 13, 2020 5:04 pm I'm happy to attach a sample WAV if anyone wants to try any of the usual programs.
I would be interested in any "challenging" WAV files that you have.

They usually ZIP quite well, small enough to come under the attachement size limit (5MB I think).

If it's still too big, upload to dropbox or google drive and post a link.

Dave
User avatar
roland
Posts: 5148
Joined: Thu Aug 29, 2013 9:29 pm
Location: Born (NL)
Contact:

Re: Acorn Atom taped programs restore "project"

Post by roland »

oss003 wrote: Wed May 13, 2020 6:49 am Roland wrote a conversion program long time ago.
You could create and change headers between Atom-in-PC, ATM and headerless programs.
Don't know if he still has the source?
Of course I have the sources: http://acornatom.nl/atomarch/pc99-1/fpu2/

It was compiled with Borland C for DOS and OS/2 :mrgreen: The executables are also in that directory.
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN :shock:
User avatar
acory
Posts: 44
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Re: Acorn Atom taped programs restore "project"

Post by acory »

Time for an update.

So I was able to restore 47 files from my cassette tape. They are fragments of a game I was working on back in 1979, when I was in my first year at university. I recall someone coming into my room, asking to use a power socket, and pulling out the plug which was powering the Atom 5V power supply. I sort of recall that I lost work and it was the last time I worked on this project. I've always had in the back of my mind to finish it off.

So the files are a mix of BASIC source code, which act as a wrapper to the Atom assemly code, and binary star load files. In fact I was blown away that the Atom came with a built in assembler. I can see how I was working. I had to to write the code in sections due to filling the 5k of RAM with source code, then save out the assembled code as a binary file. I also saved out bitmaps as a binary file. It meant that I had to (star) load 2 or 3 binary files, before I could continue on the next BASIC program containing the next section of machine code. Link addresses were hard coded constants in the later files (yuk!).

I note with great interest and frustration a complete lack of comments. Not even one! Given the lack of RAM for the source code, perhaps I can be forgiven, but it has meant figuring out what I was doing all those years ago. For the most part I can remember the reasoning, but for some of the later code it is less clear and has taken some time to reverse engineer.

I am using Atomulator to load and run the code, as I no longer have a real Atom. It still bugs me as to what happened to it, because I did keep it in a draw for many many years and it was fully kitted out with colour board and 16k (32k?) expansion RAM. I will post comments about Atomulator in an existing thread. I am able to work with the Atom keymap on the PC keyboard, but it is not fun or productive. So I have developed my own work flow.

My Perl program to extract files from the WAV file, writes out an ATM format file (the one with the 22 byte header). I have another Perl program which converts an Atom BASIC ATM file into a pure text file. I can then edit the text file using my favourite editor, which is clearly much more productive. I then have another Perl program to convert the text file back into ATM format. I then copy the ATM file into the "mmc" folder of Atomulator, from where I can load the file in the emulator and run the code. This is a very productive way to work and it is quick to make edits and be running the new code in less than 30 seconds. I have also used custom colour syntax highlighting to help with editing.

I intend to post all the Perl programs to Github, however I have never used Github and so I need to do some research to figure out how it works. I know it is normally used for revision control rather than for release, but it seems nowadays it is preferred to Sourceforge, which appeared to be more used for release rather than revision.

I will also post my game to this forum, once it is in playable format (the source will also go on Github).

However, just yesterday I ran into a new take on the same problem I encountered back in 1979. I have put all the different assembly source code into a single BASIC program and added lots of comments (too many?), so I have run out of memory and during assembly the screen gets corrupted as the arrays located above TOP get filled in! The source code is now 25k in length. I now have to figure out a work-around. I don't think that I can relocate the start of BASIC (?18=#<nn>) because it looks like just below #2800 is an area used by DOS. A lot of the game is working, but there are several BRK commands, where code needs to be written when certain conditions are detected. Movement and scoring is working.

--acory
User avatar
oss003
Posts: 3849
Joined: Tue Jul 14, 2009 12:57 pm
Location: Netherlands
Contact:

Re: Acorn Atom taped programs restore "project"

Post by oss003 »

Nice job ... you can set ?18=#22 because DOS only uses #2000-#21FF for the catalogue and #2200-#27FF for Ramdom Access files. So as long as no Random Access files are used, you can set the page at #2200.

Greetings
Kees
User avatar
hoglet
Posts: 12658
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Acorn Atom taped programs restore "project"

Post by hoglet »

acory wrote: Fri May 22, 2020 3:00 pm So I was able to restore 47 files from my cassette tape. They are fragments of a game I was working on back in 1979, when I was in my first year at university. I recall someone coming into my room, asking to use a power socket, and pulling out the plug which was powering the Atom 5V power supply. I sort of recall that I lost work and it was the last time I worked on this project. I've always had in the back of my mind to finish it off.
You did well to recover the data; I had a quick ty on the file you sent me, and couldn't get much at all.
acory wrote: Fri May 22, 2020 3:00 pm However, just yesterday I ran into a new take on the same problem I encountered back in 1979. I have put all the different assembly source code into a single BASIC program and added lots of comments (too many?), so I have run out of memory and during assembly the screen gets corrupted as the arrays located above TOP get filled in! The source code is now 25k in length. I now have to figure out a work-around. I don't think that I can relocate the start of BASIC (?18=#<nn>) because it looks like just below #2800 is an area used by DOS. A lot of the game is working, but there are several BRK commands, where code needs to be written when certain conditions are detected. Movement and scoring is working.
Do you really want to assemble this on the Atom?

Have you considered assembling on a PC or Linux box. I typically use Beeb ASM for large projects.

(It's nice also to be using github for revision control of the source files)

Dave
User avatar
acory
Posts: 44
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Re: Acorn Atom taped programs restore "project"

Post by acory »

hoglet wrote: Fri May 22, 2020 3:12 pm Do you really want to assemble this on the Atom?

Have you considered assembling on a PC or Linux box. I typically use Beeb ASM for large projects.

(It's nice also to be using github for revision control of the source files)
No, interestingly the idea of using a PC 6502 assembler, didn't even cross my mind. It's more a case of wanting to finish something off which was never completed, but with the nostalgia factor of using the Atom, which was a real favourite computer of mine. Having said that I have quickly re-discovered that working on the Atom to write source is not ideal, what with the need to peck at keys slowly and the small screen size. Also using the emulator and having to mentally re-map keys is OK for a few commands, but quickly gets tiring. Nevertherless I was and still am blown away that the Atom included the assembler in BASIC. That's why I find it hard not to think of # as being the way to define hex numbers! I also though that ? and ! were genious commands.

I really ought to figure out how to use Github from my PC. As much as anything I have lots of source code for various projects, mainly retro computer or microprocessor related. I had the idea that it would be good to add the URL of my Github area to my CV.

Anecdotal story... I was at an interview and I was asked about the syntax for string match in Perl. Now I have written lots of Perl and used string match and regexp on a regular basis, but under the pressure of an interview my mind went blank and I could only remember the equivalent answer in Vim. I don't think that asking syntax like questions is really a good interview question. In the work situation I use so many languages that I regularly mix up or forget the syntax. A quick internet search has me corrected and moving along again.

regards...
--acory
Post Reply

Return to “acorn atom and acorn system series”