6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Jun 28, 2024 11:45 am

All times are UTC




Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Sun Mar 13, 2022 2:25 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
Hey everyone! Just a general discussion here, no schematics or troubleshooting this time.

I was browsing the internet and came across this nifty thing:

http://www.scullcom.com/ZX80_Minstrel_schematic.pdf

In the top-right corner, they show the "ear" and "mic" connectors. Got me thinking: What if it is possible to use this "cassette" interface for data transfer today?

Searching the forum, I found these:

viewtopic.php?f=4&t=5297

viewtopic.php?f=4&t=82

But here is my neo-retro take on it: Instead of having real tape, use any computer or really any device that has a headphone/mic jack built in. Like an iPod or any modern smart phone or even a standard desktop computer. I once saw The 8-Bit Guy do this to send data into an old computer. He downloaded the audio file, connected the device to the ear and mic jacks, and hit play. Super easy!

I have done work in the past converting raw text data into audio form. In particular using 'sox' (what an amazing tool!). With a little C++, you can create your own music from a .txt file! The possibilities are there. Every modern device I know can play an .mp3 file without issue, and so what we have is a near-universal method to possibly transfer data between computers. Sound on for 1, sound off for 0, I don't know, just thinking "out loud" (har har).

Now, I know some of y'all will start talking about 'phase' or 'amplitude' or 'baud'. Yes, true, there are limitations to this type of data communication. But I'm just amazed as the simplicity and accessibility. I know y'all are pros, experts, and have seen it all. I'm just the new guy. But I'm also thinking about how to universally transfer this data between machines. UART's and RS-232 connectors are great and all, and many of you have been using them for years, but I have not. Just think of a homebrew 6502 solder-it-yourself kit sent to a true newbie, they wouldn't have any of the fancy setups and devices that you guys have. I don't even know if these fledglings would have access to a real computer [ minus their smartphone of course ]! They would *at least* have an internet connection to download .mp3 files and a device with a headphone jack, or a way to convert to a headphone jack. Seems like a good way to keep it simple for the noobs like me :)

Thoughts?

Again, just general discussion here. No specifics required.

Thanks everyone!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 8:30 am 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10837
Location: England
You certainly could do this. And if you started from absolute basics with a home-made scheme, you might eventually find yourself rediscovering some of the refinements that have been invented in the past.

What I think you will find is that the simplest possible system won't be very fast, and that's the motivation for some of the refinements.

But even the simplest possible system needs to distinguish at least two states - as you say, tone and silence is one way to do that. And then, as soon as you have two states, you get to the first challenge: how to make sense of a sequence of states, because you will surely want to turn bits into bytes.

You will probably find that you need to agree on a tempo or pacing of the bits, so the receiver can tell that a new bit is here. You need to know if a continuous tone is three ones or four ones, for example. Or if your scheme is to send short bursts of tones for the ones, you now need to know if a silence is a single zero or a pair of zeroes.

All this can be done: you need a design, then an implementation, and you'll find you'll be iterating.

Some of these low level problems are exactly what a UART solves. But a software UART is also a thing, and that's something which could indeed run on a newbie kit computer - whether it's toggled in or present in ROM.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 11:15 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
BigEd wrote:
What I think you will find is that the simplest possible system won't be very fast, and that's the motivation for some of the refinements.

Some of these low level problems are exactly what a UART solves. But a software UART is also a thing, and that's something which could indeed run on a newbie kit computer - whether it's toggled in or present in ROM.


Thanks BigEd, great points! As you say, there are particular schemes that they used in the past, and not all are the same. I do not know exactly how the Apple 1 does it, but I *think* I heard that the ZX80 had a sequence for a 1 and another sequence for a 0. Something like you are counting rising and falling edges rather than using interval times, or something. I could have read wrong of course :)

UART's are great, they simplify the software side of course. And there are many to choose from. I was just interested to see this "Minstrel" board not have any of that, just a ton of LS chips. I believe the ZX81 combined a lot of features into a programmable chip (ULA?) to replace those, but the functionality was basically the same.

When I say "newbie kit" I'm thinking of something very similar to Garth Wilson's "potpourri" design: http://www.wilsonminesco.com/6502primer/potpourri.html, as I have seen through searching this forum that many folks (including myself) start with that design. Ben Eater uses a nearly identical design as well! And so I wonder, if the ZX80 didn't need UART, could we send .mp3 data files through a VIA instead? Wild ideas (and I'm sure some folks have tried).

Thanks again BigEd, good discussion!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 1:58 pm 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10837
Location: England
Indeed, the zx81 had a ula, but a relatively simple one I think - it's the consolidation of the TTL glue that the zx80 had. So, in this case we do see a software UART. See here for the disassembly, cued up to the input routine:
https://www.tablix.org/~avian/spectrum/ ... .htm#L0340

Certainly a VIA is handy for the purpose of reading a bit, and with some ingenuity the shift registers can be used to read a byte. It's not a UART, so the software needs to do some work to read bits at the right times. There's a recent pagetable article which is very much on topic, about fast serial routines for the C64:
https://www.pagetable.com/?p=1656


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 2:05 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1084
Location: Albuquerque NM USA
An even simpler approach is use a photo transistor to scan in bar code. It is fun for newbies because it is software that they can see and able to create by drawing.

(Taking a short break from marathon debugging sessions)
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 5:57 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
BigEd wrote:
Certainly a VIA is handy for the purpose of reading a bit, and with some ingenuity the shift registers can be used to read a byte. It's not a UART, so the software needs to do some work to read bits at the right times. There's a recent pagetable article which is very much on topic, about fast serial routines for the C64:
https://www.pagetable.com/?p=1656


Thanks for that link, that is very in depth, and I like how they explain with pictures. I like pictures :)

So in a way, audio or just serial, it ends up being the same: UART or bit-bang. I'll be thinking about that.

Bill, I certainly do like the idea of using bar codes! A couple of years ago I set up a QR-Code game for Math Day that was quite fun. I don't have the time this year to re-implement it, but the idea is the same: Use a device everybody has already to help them engage in the fun. And, there is a LOT of data packed into those barcodes/QR-codes.

The magic would be to see how I could get a 6502 to interpret that! I would not know where to start. But it sounds great.

Thank you both for the input. Good discussion!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 6:04 pm 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10837
Location: England
If a photo transistor could read a barcode-like-image from a phone screen, that would be very handy for everyone with a smartphone - a web page could provide a series of images.

One thing to note about mp3 is that it's a lossy format, designed to sound about right but not care about waveforms. As such, the kinds of encodings which just use a couple of well-placed edges to encode a bit might well not work. The kinds of encodings which use very short tones might work. To use those, you might find you need some kind of tone-detecting circuit before you get to the VIA.

Edit: that said, it might be that a website can produce sampled sound which doesn't go through an mp3 kind of process, and therefore wouldn't be lossy.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 13, 2022 7:47 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8460
Location: Southern California
One place we talked about bar codes was starting at approximately viewtopic.php?p=42926#p42926 in the topic "Happy New Year and happy hacking in 2016!", in the context of dead-start computers, meaning you can get one gong with no (E)(E)PROM, flash, etc..

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2022 2:18 am 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 694
Location: North Tejas
There are three states in data communications: no signal, space (binary 0) and mark (binary 1) which is why modems tended to switch between frequencies.

A simple tone versus no tone scheme only conveys two states. One other way to do it is to interrupt the tone with short and long intervals of silence. This is similar to how Continuous Wave (CW) works, as is done with Morse Code.

At one time, the publisher of Byte Magazine sold books containing software in the form of barcodes. I have not been able to find information about how they recommended building a wand to read them.

A wand connected to an 8-bit machine and a program to print programs in barcode form would enable one way to transmit information "wirelessly." It might be able to scan the screen of the "transmitting" computer.


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2022 5:25 am 
Offline

Joined: Fri Apr 15, 2016 1:03 am
Posts: 136
Byte magazine's "PaperBytes" seems to start in the November 1976 issue: https://worldradiohistory.com/Archive-Byte/70s/Byte-1976-11.pdf on page 12.
There are months of discussion in later months of the magazine, & think they eventually published some data in this format.

TwiBright Optar http://ronja.twibright.com/optar/ https://lwn.net/Articles/242735/ is a 2d higher-density optical encoding.

QR codes.

GyroScatter http://forum.6502.org/viewtopic.php?f=4&t=6404&p=80524&hilit=paper+disk#p80524

More optical ideas: http://forum.6502.org/viewtopic.php?f=4&t=3329&hilit=paper+disk&start=705


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2022 6:31 am 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
I’m building something similar based on the 6522 datasheet T1 example and Don Lancaster’s “Bit Boffer” (Google it). The important thing here is that you need sine waves because they record better.
For a 6502 the TX can be done with a 74hc373 and some passives.(Cheap DAC) Rx needs an opamp and some passives for sine > TTL demodulation.
I think I’ll make a video on this… sometime in the next 6 months

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2022 7:26 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8460
Location: Southern California
AndersNielsen wrote:
I’m building something similar based on the 6522 datasheet T1 example and Don Lancaster’s “Bit Boffer” (Google it). The important thing here is that you need sine waves because they record better.

Triangle waves work just as well for cassettes at the frequencies and record levels used. But wow, the writeups I'm finding on Bit Boffer sure mess up the facts about cassettes and recording. (Take it from someone who worked at TEAC and repaired and aligned a thousand tape recorders in 1982-3, then later designed record/play electronics including a cheap modem for a machine at work.)

Quote:
For a 6502 the TX can be done with a 74hc373 and some passives.(Cheap DAC) Rx needs an opamp and some passives for sine > TTL demodulation.
I think I’ll make a video on this… sometime in the next 6 months

For a simple 9-level DAC (digital-to-analog coverter), you can use a 65(c)22 VIA's shift register shifting out free-run under T2 control, more or less as a PWM. See my second diagram and accompanying code after the "Digital-to-analog converters" heading of my 6502 primer's "circuit potpourri" page at http://wilsonminesco.com/6502primer/potpourri.html#DAC . What I did on my modem design however was to use a relaxation oscillator and use an ACIA's TX output to turn a transistor on and off in series with a resistor so the capacitor would charge faster or slower. I was looking for my schematics yesterday but still have not found them.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 14, 2022 10:20 am 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
GARTHWILSON wrote:
AndersNielsen wrote:
I’m building something similar based on the 6522 datasheet T1 example and Don Lancaster’s “Bit Boffer” (Google it). The important thing here is that you need sine waves because they record better.

[color=#000000]Triangle waves work just as well for cassettes at the frequencies and record levels used. But wow, the writeups I'm finding on Bit Boffer sure mess up the facts about cassettes and recording. (Take it from someone who worked at TEAC and repaired and aligned a thousand tape recorders in 1982-3, then later designed record/play electronics including a cheap modem for a machine at work.)


I trust you on that but I'd love to hear specifics :)

I've been through your DAC-writeup more than a few times. I think I'll stick with a '273 or '373 due to price and physical size - that way I only need PB6+7 on the VIA and can leave the SR for other important things. A second 6522 takes up a lot of space.
I guess the relaxation osc. approach would also work with T1/PB7? I hope you find your schematics.

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 15, 2022 8:15 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8460
Location: Southern California
AndersNielsen wrote:
and can leave the SR for other important things.
Would you need those other things at the same time you need the cassette data storage?

Quote:
I guess the relaxation osc. approach would also work with T1/PB7?
Here's the relaxation oscillator idea, although there are lots of possible variations on this theme. The 4066 is an analog switch.
Attachment:
modulatoridea.gif
modulatoridea.gif [ 10.3 KiB | Viewed 980 times ]

The resistor and capacitor values will give somewhere around 1200Hz and 2400Hz, although you might have to adjust them for any given 74HC14 Schmitt-trigger inverter since the hysteresis points are only specified to be in a range, not an exact amount like you could get with an op amp and a few more parts. Regardless, you don't have to keep sending samples to produce a continuous wave of a given frequency like you would have to with any kind of D/A converter.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 15, 2022 9:15 pm 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
GARTHWILSON wrote:
AndersNielsen wrote:
and can leave the SR for other important things.
Would you need those other things at the same time you need the cassette data storage?

Quote:
I guess the relaxation osc. approach would also work with T1/PB7?
Here's the relaxation oscillator idea, although there are lots of possible variations on this theme. The 4066 is an analog switch.
Attachment:
modulatoridea.gif

The resistor and capacitor values will give somewhere around 1200Hz and 2400Hz, although you might have to adjust them for any given 74HC14 Schmitt-trigger inverter since the hysteresis points are only specified to be in a range, not an exact amount like you could get with an op amp and a few more parts. Regardless, you don't have to keep sending samples to produce a continuous wave of a given frequency like you would have to with any kind of D/A converter.


I can see that working! I’m sure I have a 4066 somewhere so I will try it out before I commit to the “sine wave DAC”. For the other approach I have to set PB7 to flip at 9600 or 19200hz to get 1200/2400hz and it works. Probably wouldn’t at 1mhz though.
This way I guess I can get by with a lower irq frequency.

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: