Vic 20 Basicode

You need an actual VIC.

Moderator: Moderators

Malcohol
Vic 20 Drifter
Posts: 30
Joined: Mon Apr 04, 2011 4:04 pm
Location: Ireland

Re: Vic 20 Basicode

Post by Malcohol »

Hi again.

I've now been messing around with BASICODE itself. It seems that emulators and audio data converters seem to have quite a lot of trouble with it.

I've tried various options, but the only success I had so far is with a combination of wav2prg and the vice c64 emulator. I can occasionally get Fuse, a ZX Spectrum emulator, to load it, but it's very unreliable.

It seems wav2prg has a VIC-20 mode and does generate a file, but this file always fails to load when I try it with the loader that was posted earlier in this thread. (I don't believe memory is the issue, as I've been testing with one-line test program).

Can anyone suggest why the equivalent workflow is not working with the VIC-20, and what alternative paths I could use for testing a basicode program on VIC-20? I've only tried VICE so far. Are there other VIC-20 emulators which have audio loading support? Are there other audio-to-file convertors I should try?

(I have used the clipboard to paste my program into VICE and I can confirm that it works in theory. However, this does not guarantee that it's loadable as basicode. For example, I do not know how much memory the loader itself requires. Perhaps loading my program goes over budget.)

Thanks for any help or suggestions,

Malcolm
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Vic 20 Basicode

Post by nippur72 »

are you trying to load the BASICODE interpreter from the .wav file? or a basicode program that you have previously encoded in wav?

Generally speaking, WAV support for the VIC20 is awful, I also experienced lot of troubles, so when I have to deal with an audio recording I plug the FPGA or the real VIC-20.

I might add an option for loading/saving .wavs in my online emulator (https://nippur72.github.io/vic20-emu) it should be not too difficult. The only annoyance is dealing with MOTOR and SENSE.
Malcohol
Vic 20 Drifter
Posts: 30
Joined: Mon Apr 04, 2011 4:04 pm
Location: Ireland

Re: Vic 20 Basicode

Post by Malcohol »

Hi.

The basicode loader is working fine from that d64 that was posted earlier in the thread. I'm now trying to test a WAV I created containing data encoded in the BASICODE format. Since BASICODE was intended to be a widely supported common-language, I'd like to confirm my file is valid by loading it on a few different systems.

Most of the tools I've tried which convert from WAV to an emulator format (e.g. tap, tzx, uef, etc) do not recognize the data. Perhaps they depend on recognizing the format. So far, I have got wav2prg to create a c64 compatible tap, which will load into vice. Unfortunately, the same tools didn't work for vic20, despite wav2prg having a vic20 mode.

Up to this point, I've only been vaguely aware of the FPGA emulator world, but it does sound like an FPGA setup could be the way to go. I assume real-time audio input is well supported? Is MiSTer the way to go, or are there other good options?

Thanks,

Malcolm
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Vic 20 Basicode

Post by nippur72 »

I don't know much of BASICODE, how do you create such WAV files? And more importantly, is the same WAV supposed to load on different systems? That would be very interesting. My guess is that it does use each system's ROM routines for saving and loading--if so, the actual audio recording would be not portable.
Malcohol wrote: Thu Dec 24, 2020 7:09 am Up to this point, I've only been vaguely aware of the FPGA emulator world, but it does sound like an FPGA setup could be the way to go. I assume real-time audio input is well supported? Is MiSTer the way to go, or are there other good options?
Yes I suggest the MiSTer; I don't have one but I'm pretty sure it supports loading via audio input plug. I instead have a MiSTica unit, which is the previous generation of FPGA. I implemented the tap audio support on the VIC20 and C64 by myself, by coding it in verilog and vhdl; I think that code has been now incorporated on the MiSTer as well.
Malcohol
Vic 20 Drifter
Posts: 30
Joined: Mon Apr 04, 2011 4:04 pm
Location: Ireland

Re: Vic 20 Basicode

Post by Malcohol »

I wrote the code for generating the WAV myself (it's in this PR: https://github.com/robhagemans/basicode ... er/pull/45). It's certainly possible there's a bug, but it definitely works in some cases.

What makes BASICODE interesting (at least for me) is that it really is a loader format common to multiple platforms. It allowed multiplatform software to be broadcast over the radio (or distributed on cassette). It's worth checking out the Wikipedia article.

Thanks for the info about MiSTer!

Malcolm
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Vic 20 Basicode

Post by nippur72 »

I've read the Wikipedia article and looked and your PR, that is very interesting! The BASICODE format looks similar to the Kansas City Standard, for which I wrote a encoder/decoder program (see https://github.com/nippur72/z80ne-wav it's called "Z80NE" because it was used on the Z80NE computer).

Some questions:

1) does your WAV loads back using the minimodem utility described in the Wikipedia article? I suggest to apply a very light lowpass filter to the WAV file (and perhaps add some noise) to make it look like a real tape recording.

2) can you describe the steps for loading such a file on the VIC-20 ? E.g. what I have to load on the VIC and what commands have to be issued. I would like to test it on the FPGA, playing the audio from the PC.
Malcohol
Vic 20 Drifter
Posts: 30
Joined: Mon Apr 04, 2011 4:04 pm
Location: Ireland

Re: Vic 20 Basicode

Post by Malcohol »

Yes, it is very similar to the Kansas City Standard. (The Z80NE looks interesting, btw. I hadn't heard of it before.)

The WAVs I generate can be successfully read with minimodem. That suggests that the lowest level of encoding is correct. It doesn't validate higher level features like the checksum, however. I have also confirmed that the program works in C64 and ZX Spectrum emulators. Nevertheless, the VIC-20 remains an important platform for me because of its low base memory.

Before you go to any trouble, I should mention that I bit the bullet and ordered a MiSTer. All going well, I will be able to test this stuff myself in a week or so. If you are curious, however, I'll describe the steps for testing it:

The first thing that needs to be loaded is the BASICODE loader. On an emulator, this only works on an unexpanded Vic-20. Here's the d64 you shared earlier in this thread: https://drive.google.com/file/d/1oXPJCH ... sp=sharing

After the loader has finished initializing, you type:
SYS 7168 (this deletes the loader's own basic program from line 1000 up)
SYS 7203 (this starts the loading code, which will merge in the new BASICODE program from tape)

Here's the audio of my BASICODE program in its current state:
https://drive.google.com/file/d/1uCmkdH ... sp=sharing

There's a chance it will exceed the VIC-20's memory, so here's a minimal test program which should confirm if that's causing problems:
https://drive.google.com/file/d/1dDbL9H ... sp=sharing

It goes without saying that the playability of the game will be limited. Not only is it written in basic, but there are many extra GOSUBs because I have to use subroutines in place of machine specific operations. That's fine. This is just a proof-of-concept.

Thanks again.

Malcolm
Malcohol
Vic 20 Drifter
Posts: 30
Joined: Mon Apr 04, 2011 4:04 pm
Location: Ireland

Re: Vic 20 Basicode

Post by Malcohol »

Hello again. I received the components of my MiSTer over the break, and I finally had a chance today to stick them together. In general, things seem to be working. However, as far as I can tell, the Vic 20 core doesn't load from the audio in port. Additionally there's no easy way to tell the system that the play button has been pressed (I did get round the latter problem using an empty tap file). It may be that the tape audio support has not made it to MiSTer yet. Oh well. Thanks, anyway.

Malcolm
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Vic 20 Basicode

Post by nippur72 »

I had a look at Mister source code, and it seems the WAV loading has been removed from some reason... that's a shame!

I also don't see the AUDIO_IN connected to the C1530 as in the MiST version... I guess they are not aligned and the Mister is lagging. I hope that will be solved quickly.

If I have time, I will also experiment with a simple WAV2TAP utility of my own.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Vic 20 Basicode

Post by nippur72 »

update: I wrote a very crude WAV conversion utility in JavaScript, here's the repo on GitHub:

https://github.com/nippur72/commodore-tap-wav

I tried to load both on the VICE emulator and FPGA and they do work, apparently.
User avatar
vicist
Vic 20 Afficionado
Posts: 355
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Re: Vic 20 Basicode

Post by vicist »

Looks like each machine had its own load/save routines.
This item is on ebay at the moment.

ebay listing

s-l1601.jpg
s-l1600.jpg
Malcohol
Vic 20 Drifter
Posts: 30
Joined: Mon Apr 04, 2011 4:04 pm
Location: Ireland

Re: Vic 20 Basicode

Post by Malcohol »

Thanks for that. I see it's closing now and I _am_ tempted. Alas, due to Brexit, it's no longer easy for me to buy from UK based sellers*.

Thanks anyway,

Malx

* It's certainly still possible, but a bit of a hassle. If sellers use eBay's world shipping program, then the cost far too high. If they haven't, I typically would have to contact them in advance to get an estimate of the shipping cost.
Post Reply