Hi all, new here. I'm writing a Spectrum emulator, and I'm currently trying to implement the tape interface with WAV file input.
I'm returning with bit 6 of port 0xFE set if the current sample is high. I'm using value 192 as the threshold with 8-bit samples. So, if (tapebyte > 192) then the bit is set. I at least seem to be on the right path, because after issuing a LOAD "" command, I get this:
So it is apparently understanding the tape data correctly.
Then after a few seconds the screen goes blank again, and the tape file gets completely inputted... but then nothing. Just a grey/white screen forever.
What am I missing here? I never actually owned a real Spectrum, so maybe I'm just doing something wrong usage-wise.
I also maybe missing some other hardware that needs to be emulated, but the system seems pretty simple from what I've been reading. I've got the video, keyboard input and port 0xFE input, as well as doing a vblank interrupt every frame. Anything else required for the basics?
Developing an emulator, help with tape WAVs?
-
- Drutt
- Posts: 2
- Joined: Fri Jan 18, 2019 1:45 am
Re: Developing an emulator, help with tape WAVs?
Nice work! The only thing I can think of is to look at the border colour (bits 0-2 on port $FE, but only with OUT) and see how it changes during the loading. Additionally, any even port will address the ULA, not just port $FE.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Developing an emulator, help with tape WAVs?
And yet no Spectrum emulator out there can emulate it with a hundred percent accuracy.Mike Chambers wrote: ↑Fri Jan 18, 2019 1:53 am the system seems pretty simple from what I've been reading.
Check out this article. It talks about port 0xFE among other things.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
-
- Drutt
- Posts: 2
- Joined: Fri Jan 18, 2019 1:45 am
Re: Developing an emulator, help with tape WAVs?
Thanks for the tips! It actually turns out my WAV files were bad! I sourced some others, and it works!
Now on to sound support! I also need to come up with a catchy name for the emulator. Somehow "ZX Spectrum" seems a little uninspired.
Now on to sound support! I also need to come up with a catchy name for the emulator. Somehow "ZX Spectrum" seems a little uninspired.
Not surprised! Writing a usable emulator for most retro systems is easy... getting all the little quirks right is HARD!Ast A. Moore wrote: ↑Fri Jan 18, 2019 3:05 am And yet no Spectrum emulator out there can emulate it with a hundred percent accuracy.
Re: Developing an emulator, help with tape WAVs?
Good luck with your emulator!
As for loading from .wav file, it can be quite complicated.
Wav is a direct sound recording, it's an exact copy of Spectrum cassette.
In real life you never had a perfect recording, there is some background noise, some sounds are a bit shorter or longer than expected and so on.
Zx Spectrum was quite tolerant in this matter, you were able to load some tapes with quite bad quality.
If you want to test your emulator in some rough conditions don't use .wav files created on PC from .tzx files. They are too good. Use recordings from real tapes. Then you can think of adding some filters to improve the sound. I remember names like Buttersworth or Chebyshev filter, they sometimes help.
As for loading from .wav file, it can be quite complicated.
Wav is a direct sound recording, it's an exact copy of Spectrum cassette.
In real life you never had a perfect recording, there is some background noise, some sounds are a bit shorter or longer than expected and so on.
Zx Spectrum was quite tolerant in this matter, you were able to load some tapes with quite bad quality.
If you want to test your emulator in some rough conditions don't use .wav files created on PC from .tzx files. They are too good. Use recordings from real tapes. Then you can think of adding some filters to improve the sound. I remember names like Buttersworth or Chebyshev filter, they sometimes help.
Re: Developing an emulator, help with tape WAVs?
Great stuff!
Can we put the pettifogging details to one side and ask: have you got a cool name in mind ?