From: Ricky Z. <zha...@gm...> - 2018-07-02 19:45:32
|
You can always make any changes to BII. Because BII code base is extremely stable (I mean code structure change) and there is nothing change in guest OS. I recently patched 24 bit ROM to emulate the hard drive in System 6. The hard part is to find the right spot to add features. I haven’t read how serial port is emulated in BII. But I did RTFC on 68K CPU emulation, Macintosh ROM and emulate 8 bit frame buffer to SDL. If you are interested in contribution of your serial port research, you are welcome add yours in the wiki: https://github.com/cebix/macemu/wiki/Basilisk-II-Peripheral-Hardware-Emulation-Analysis <https://github.com/cebix/macemu/wiki/Basilisk-II-Peripheral-Hardware-Emulation-Analysis>. There are more stuffs I wrote. But maybe nobody is interested it in. To emulate a virtual device in guest OS, you must know how to develop serial port driver or whatever manager in System 7 (or 6). Synchronization or asynchronization does not really matter. Because you can either redirect the pipe from guest OS to host OS in asynchronization or just control the timer in synchronization. TBH, I still don’t understand the MIDI application INs and OUTs. How and why do you expose serial port in guest OS to the serial port in host OS? Do you have serial/parallel port MIDI keyboard (a physical hardware in host OS)? The more related infos you can provide from the programming point of view, the better people can help. thanks, Ricky > On Jul 2, 2018, at 11:54 AM, Brent Busby <br...@ke...> wrote: > > Signed PGP part > Ricky Zhang <zha...@gm...> writes: > >> I’m not clear what is the in and out of your application running >> inside BII. What’s the connection between virtual tty in host OS Linux >> and your application in guest OS? > > Well, Midi applications in the old classic Mac environment usually > offered a choice of using your modem or printer port, and Basilisk > connects both of those to serial device nodes on the UNIX side. For > telecomm programs, this seems to work flawlessly. ZTerm works so well > in Basilisk that I could hookup a Hayes modem and call BBS's if I knew > any dialup BBS's to call these days. > > For Midi, it seems that things are more complicated on the classic Mac > platform than it is in emulators for other OS's, due to old style Mac > serial ports being asynchronous. Midi runs at the oddball baud rate of > 31250bps, not a multiple of 300 like one normally expects. Since serial > ports on a Mac don't really have any baud rate of their own, they depend > on an adapter device to send a 1MHz clock signal _into_ the port, then > divide that into 1/32nds to obtain that exact baud rate of 31250bps. > > I don't know what would be needed to fake that, but I think that's why > on any other platform emulator, getting Midi bytes out just amounts to > letting the data go out the port, but the old m68k Mac is depending on > some external hardware to do something from the outside to generate > sync. Pin 7 of the DIN connector was the GPi pin, which received this > signal (potentially 500kHz, 1MHz, or 2MHz, but usually 1MHz). The > serial ports were capable of being driven very fast this way, and could > even be used as network ports for AppleTalk, but Midi doesn't need to > clock them anywhere near that fast. > > And yet...wouldn't it need the same thing from a modem, and have the > same problem? The port is asynchronous when modems use it too, and yet > programs like ZTerm are able to get bytes in and out just fine. Perhaps > it's because the term program is providing the baud rate itself, whereas > a classic Mac Midi program would be expecting some sort of 1MHz sync to > be provided in hardware externally? > > That's what I'm not understanding. If the Mac serial port needs > external clock to get anything done, how come a terminal program can use > it but a Midi application can't? > >> A side topic — Basilisk II can build with SDL V1. We can enable >> playing midi by SDL mixer — >> https://www.libsdl.org/projects/SDL_mixer/docs/index.html >> <https://www.libsdl.org/projects/SDL_mixer/docs/index.html>. >> >> Don’t count on anyone implement this feature for you. You’d better get your hand dirty. > > Believe me, I've already been digging around in the source for Basilisk, > ttymidi, hairless-midiserial, the Alsa libraries, etc. I'm convinced > now though that the data is being stopped in Basilisk. If the Mac > application producing the data is a terminal program like ZTerm, all I > need to get data from the serial device on the Linux side is 'cat': > > cat /dev/tnt1 > > will echo to my terminal whatever goes into ZTerm, and I don't even have > to care about the baud rate on either end. That means it's trivial to > get data from the serial device if it went in at all. But Midi data > never comes out, not with cat, not with ttymidi, not with anything. > > I think what I'm wanting though is guidance from people who already know > how the Basilisk code works. I've been digging around in serial.cpp and > serial_unix.cpp, and I'm afraid I don't understand the state of the code > as it is now enough to make any changes to it. > > |