GithubHelp home page GithubHelp logo

datajerk / c2t Goto Github PK

View Code? Open in Web Editor NEW
64.0 64.0 11.0 4.27 MB

Retro Code (Apple II, Cosmac VIP) to Tape/Text

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.41% Assembly 7.47% C 90.06% Shell 0.59% Python 1.48%

c2t's People

Contributors

datajerk avatar ep00ch avatar raphlinus avatar ryandesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c2t's Issues

23kbps is possible

Apologies if this issue is not the right place to post notice of the explorations I've made. I have a prototype of 23kbps transfer to an Apple IIe (work done at the Recurse Center), and think it might be practical to port this into c2t. However, I have concerns about repeatability. I would also be quite willing to push my prototype to a branch if people are interested in experimenting with it.

The basic plan for my work is to try to encode 4 bits of information per audio cycle. I encode 2 bits in the top half of the pulse, 2 in the bottom. Each pulse width is (44 + 27 * sym) µs where sym is 0 through 3, and the pulses are generated in a band-limited way. This image should illustrate the technique:

screen shot 2017-10-01 at 6 41 49 pm

To decode, my code senses top and bottom half pulse widths separately, and each shifts 2 bits into the accumulator. Two of those cycles produce a byte. The full asm code is a shade over 128 bytes. Assuming an average symbol of 1.5, 2 bits per "pulse", 2 / (44 + 27 * 1.5) µs = ~23.6kbps. In testing, I've been transferring images to the hi-res buffer (8kB), and that takes around 2.5s, as expected.

I've prototyped my waveform generation code in Python, but it's not actually all that complicated, and I'd be happy to redo it in C. I'm particularly proud of the band-limited pulse generation approach, as I believe that it's much less sensitive to the sampling rate of the audio path (in fairness, I've only tested at 48KHz).

Now for the part I'm most uncertain about: in exploring the analog pathway with an oscilloscope, I find that the comparator output is biased pretty strongly to "1". This oscilloscope photo should show what I mean:

img_20170926_184209

I've studied the schematic and info about the 741 op-amp, and don't understand why this is happening - the effect is much larger than the DC offset suggested in the datasheet. I also suspect that the amount is not consistent. If the waveform requires calibration to a specific device, it makes it much less appealing.

Is it worth pursuing this? Would other Apple 2 owners be willing to run tests on their machines, and maybe poke with a scope? Would you be open to having this land in c2t?

Instadisk not working.

Hello.

After I make an audio file out of a disk image and try to load it in my apple 2e it gives me an error right after saying it started loading instadisk, eta 9 sec. I also can't load files from the apple disk server. What might cause this problem?

P.S. I read somewhere that it only supports NTSC computers and not PAL ones. (USA and Euro ones). I am using my computer in Europe but I ordered it from the USA, so I believe that it's not a Euro version.
Thanks in advance.

INCLUDES report as missing

Maybe not an issue, but I had to change #INCLUDE <fake6502.h> to read #INCLUDE "fake6502.h" for the compiler to find it. I had to do it for the #INCLUDE <c2t.h> as well.

This on on Windows 10 v1809 and MinGW v2013072200 (MinGW is not installed on my boot drive).

Just an FYI. After those edits, it compiled and ran beautifully.

Build errors on Linux

Hi, I am trying to build from source on Linux Mint but I am getting several errors.
First the tar command fails:
curl -sLO https://github.com/mrdudz/cc65-old/raw/master/cc65-sources-2.13.3.tar.bz2
tar zxf cc65-sources-2.13.3.tar.bz2

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
make: *** [Makefile:52: cc65-2.13.3/bin/cl65] Error 2

I installed cc65 and removed the requirement of cc65-2.13.3/bin/cl65 from the Makefile.
Now I can have make to try to build the code but I get multiple compiler errors: all related to undeclared symbols:
c2t-96h.c:710:42: error: ‘inflatecode’ undeclared (first use in this function); did you mean ‘inflateEnd’?
710 | for(j=0;j<sizeof(inflatecode)/sizeof(char);j++) {
| ^~~~~~~~~~~
| inflateEnd
Same for fastload8000, fastloadcd, diskload8000, diskload9600, diskloadcode2 and diskloadcode3.
What am I doing wrong? I don't see these arrays declared in the c2t.c source.

Enable more warnings

Consider enabling -Wextra and -Wpedantic to see a bunch of warnings about your code such as:

c2t.c:244:12: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                for(j=0;j<strlen(argv[i]);j++) {
                        ~^~~~~~~~~~~~~~~~

and:

c2t.c:1436:11: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
void usage()
          ^
           void

and:

./fake6502.h:995:22: warning: assigning to 'void (*)()' from 'void *' converts between void pointer and function pointer [-Wpedantic]
        loopexternal = funcptr;
                     ^ ~~~~~~~

You currently repeat the warning flags in several places in the Makefile. Consider using a variable to store them so you only have to update them in one place in the future.

Can a ProDOS formatted Insta-disk be produced with c2t?

I compiled version 0.997 and it is generally working amazingly well. This is a truly impressive concept and program.

However I am having difficulty determining if I can use this utility to package a ProDOS disk image of file type '.po' and how/if I would do that?

When using the 'c2t -8 prodos243.po prodos243.wav' for example, the wave file is produced in 28k segments.
The resultant .wav file is loaded on my old iPhone SE (with audio out jack).
Applesoft LOAD command loads the file successfully, formats the blank disk in drive 1 and writes the data.

However the Apple II crashes to monitor when I try and boot the disk, presumably because the interleave and sector formats of a ProDOS disk are quite different than a DOS 3.3 that the program is designed to handle.
Attempts to read the catalog of the produced disk from a known utility program is also unsuccessful.

Is there any particular or recommended mechanism of managing a .po image with c2t ?

WARNING: simulated inflate failed at 1000

With the disk image: https://archive.org/download/a2_asimov_dangerous_dave
When doing ./c2t dangerous_dave.dsk dangerous_dave.wav

I get the following errors:

WARNING: simulated inflate failed at 1000
Segment: 0, start: 0x503D, length: 16322, deflated: 43.07%, data time:14, inflate time:0.00
WARNING: simulated inflate failed at 1000
Segment: 1, start: 0x5960, length: 13983, deflated: 51.23%, data time:12, inflate time:0.00
WARNING: simulated inflate failed at 1001
Segment: 2, start: 0x6CE7, length: 8984, deflated: 68.67%, data time:8, inflate time:0.00
WARNING: simulated inflate failed at 1000
Segment: 3, start: 0x5B2D, length: 13522, deflated: 52.84%, data time:12, inflate time:0.00
WARNING: simulated inflate failed at 1000
Segment: 4, start: 0x7071, length: 8078, deflated: 71.83%, data time:7, inflate time:0.00

From glancing through the code, I'm not sure why compression is on by default. I thought it would be controlled by the flag here:

c2t/c2t.c

Line 158 in dc09517

case 'c': // compression

It's awesome that you are emulating the decompression!

Micro-Professor MPF-II Apple-II clone?

Hello,
what do you think is possible (in theory) to do the same for this Apple-II clone?
https://en.wikipedia.org/wiki/Microprofessor_II

I was not able to find any information about cassette data format of MPF-II, but comparing WAV files from Apple-II and MPF-II, it becomes clear that they are different.

Do you think it would be possible to reverse engineer an audio file from MPF-II if, for example, save a block of memory from Monitor with known bytes to a file?

c2t-96h fails, 8000 c2t works

I've yet to produce a file from -96h (or any other 9600 file) that loads. Consistently all fail checksum and dump to monitor. I've tried this from multiple output devices, at various output levels, with the same result. I've tested this with my 65C02 and 6502, and with the full enhancement kit installed or not. Nothing seems to get 9600 to succeed.

I know the intent was for -96h to be quite a bit more compatible hardware-wise but I think I've got an outlier here. Anything that'd be useful for me to test or experiment with to narrow things down?

Support for AppleSingle input files

cc65 now outputs AppleSingle files. These encapsulate both the executable program and its metadata such as its load address. AppleCommander can add such AppleSingle files to a disk image properly.

But to use these files with c2t, I first have to decode the file (applesingle file.as -o file) and then give the decoded file to c2t, telling it what load address to use.

Might c2t be enhanced to natively support AppleSingle input files so that manually specifying the load address would not be necessary?

Web-based option w/emscripten

Hi!

I thought it would be interesting to have a purely web-based version of c2t. I've made a prototype, and I'd love to discuss how/whether it would make sense to integrate with c2t, co-host and promote as a sibling project to Apple Disk/Game Server, etc.

The prototype (source at https://github.com/jepler/web-c2t/) allows you to upload a disk image (dsk, do, po) and perform the conversion to audio locally within the web browser. No data is transmitted on the internet, and no server or back-end is necessary. This lacks a ton of polish, format/no-format and hifi/8k options, etc. I know enough about web technology to cobble, but not to make a polished final product.

Similar to the Apple ][ Disk Server, after conversion you just LOAD on the Apple II and then hit play on the generated audio file.

I've transferred a couple of disks this way, such as Zork III and it seems to work just as well as the Disk Server or using c2t locally.

image

PXL_20220312_151956529

[Build error] cl65: Don't know what to do with `100'

When I try to build both v0.996 and the current master, I get the following error:

cl65 -t none --listing --list-bytes 100 autoload.s 
cl65: Don't know what to do with `100'
make[1]: *** [autoload] Error 1
hexdump: autoload: No such file or directory
hexdump: autoload: Bad file descriptor
hexdump: autoload: No such file or directory
hexdump: autoload: Bad file descriptor
hexdump: inflate: No such file or directory
hexdump: inflate: Bad file descriptor
hexdump: inflate: No such file or directory
hexdump: inflate: Bad file descriptor
hexdump: fastload9600: No such file or directory
hexdump: fastload9600: Bad file descriptor
hexdump: fastload9600: No such file or directory
hexdump: fastload9600: Bad file descriptor
hexdump: fastload8000: No such file or directory
hexdump: fastload8000: Bad file descriptor
hexdump: fastload8000: No such file or directory
hexdump: fastload8000: Bad file descriptor
hexdump: fastloadcd: No such file or directory
hexdump: fastloadcd: Bad file descriptor
hexdump: fastloadcd: No such file or directory
hexdump: fastloadcd: Bad file descriptor
hexdump: diskload9600: No such file or directory
hexdump: diskload9600: Bad file descriptor
hexdump: diskload9600: No such file or directory
hexdump: diskload9600: Bad file descriptor
hexdump: diskload8000: No such file or directory
hexdump: diskload8000: Bad file descriptor
hexdump: diskload8000: No such file or directory
hexdump: diskload8000: Bad file descriptor
hexdump: diskload2: No such file or directory
hexdump: diskload2: Bad file descriptor
hexdump: diskload2: No such file or directory
hexdump: diskload2: Bad file descriptor
hexdump: diskload3: No such file or directory
hexdump: diskload3: Bad file descriptor
hexdump: diskload3: No such file or directory
hexdump: diskload3: Bad file descriptor
-i used with no filenames on the command line, reading from STDIN.
-i used with no filenames on the command line, reading from STDIN.
-i used with no filenames on the command line, reading from STDIN.
-i used with no filenames on the command line, reading from STDIN.
-i used with no filenames on the command line, reading from STDIN.
-i used with no filenames on the command line, reading from STDIN.

Despite this, the build process continues. However, the released version builds only c2t (the current master builds both c2t and c2t-96h.

Using macOS Sierra with command-line tools from the latest Xcode (9.0), and cl65 V2.16 installed with Homebrew (brew install cc65).

Edit: added cl65 version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.