Mac68k Forums

Home


Welcome, Guest
Guest Settings
Help

Mac68k Forums » Development » Hardware Hacking

Thread: video out for compact Macs


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 70 - Pages: 5 [ 1 2 3 4 5 | Next ] - Last Post: Apr 7, 2016 8:55 AM Last Post By: Bunsen Threads: [ Previous | Next ]
bigmessowires


Posts: 217
Registered: 10/29/13
video out for compact Macs
Posted: Nov 11, 2013 11:48 AM
Click to report abuse...   Click to reply to this thread Reply
I posted about this a while back here: http://68kmla.org/forums/viewtopic.php?f=29&t=22286

I think it would be cool to build some kind of video out adapter for compact Macs, either for direct connection to a modern SVGA monitor, or as some kind of frame grabber. It would mirror whatever appears on the internal CRT. I'm not sure this has much real practical value, but it would be interesting to see a Mac Plus running on a large 24" monitor, or on a projection screen. Or to do screen captures or video captures of old software running on the Mac. For a machine where the video circuitry or CRT are broken but the logic board is good, this could be a way to get it working. And combined with bbraun's keyboard and mouse emulation, it might even provide for a compact Mac KVM, or remote desktop session.

I see two possible approaches to this. One is to capture the video signal that's on the logic-to-analog board connector. That already has a 1-bit monochrome video signal, as well as sync signals, broken out on separate wires. It might be possible to rig some kind of pass-through connector for the motherboard connector to tap those lines, or extra wires could be soldered directly to the connector. The difficulty with this approach is that the Mac's native resolution and horizontal refresh rate aren't a close match to any existing video standard. An FPGA or CPLD or very fast microcontroller would be needed to buffer an entire video frame (about 20K of data), and then "rebroadcast" it with different video timings and some letter-boxing or pillar-boxing to make it fit an existing video standard like SVGA. The operation would be similar to NTSC-to-PAL converters or other scan rate converters.

Another approach suggested by bbraun is to sniff the CPU bus, and watch for writes to the frame buffer area of RAM. On the compact Mac, the frame buffer is just a region of normal RAM at a specific address. Physically attaching this to the Mac might be a challenge, but most of the necessary bus signals are present at the ROM sockets. Or with an SE or SE/30, the PDS slot might have everything needed. It might also need a way to detect the vsync signal, so it can know when to capture the frame buffer, to prevent tearing. Once again, an FPGA or CPLD or fast microcontroller could watch the bus, and maintain an internal private copy of whatever's written to the frame buffer. It could then rebroadcast this at a different resolution, for direct connection to an external monitor, or transfer the data over USB to a modern computer for display or recording.

An advantage of this second approach is that with appropriate software, it should theoretically be possible to make the external monitor into a second monitor, instead of a mirror of the first monitor. A dual screen SE or Plus!

What do you guys think? I'm not aware of anything like this that's already out there. Maybe because it's a dumb idea. :-)
bbraun


Posts: 493
Registered: 7/25/12
Re: video out for compact Macs
Posted: Nov 11, 2013 9:47 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
For the first approach, I've got a 512KE around here somewhere that took the signal off the connection between the logic board and the analog board with a passthrough connector like you're suggesting, and brought it out to a DB9, presumably for a CGA or similar monitor from that era.
The analog signal conversion seems like the easiest. Converting to VGA would allow use of the PS2/VGA KVMs that are pretty cheap.

Interfacing with the system bus is something that has been on my todo for a long time now. Here's kind of my grand plan. Someday I'll get "done" with the keyboard/mouse project, and my thought was to use a microcontroller to interface with an SCC chip to bridge localtalk to USB. That project would get me comfortable with using the microcontroller to interface with a parallel bus, the SCC in this case, and produce something useful. Then I would like to take what I learned from that project and move to either the SE, which is a smaller and simpler bus, or the 030 PDS of the SE/30 and IIsi. Snooping the SE's video accesses would be easiest so possibly a good first approach.

The SE and the 030 PDS are fairly different from a system software perspective. They're both system busses, but the SE runs in perma-24bit addressing mode, and the ROM does not support the Slot Manager, so doesn't automatically work with declaration roms and the like. So adding peripherals to the SE is a little more difficult from the system software perspective since you don't get to leverage the Slot Manager.
On the other hand, the SE has a very simple address map, and very little complication the memory controller, and no MMU means no surprises. The 030 PDS, if you're using the slot address spaces, will only map the slot's address space if a valid declaration rom is found, so that adds a hurdle for testing hardware. You can't just drop into macsbug and start banging away directly at the hardware without any software support. There are some address ranges set aside on the 030 PDS for being able to do that, but then you don't get any Slot Manager benefits.
All that said, I in no way call 'dibs' on anything. :) If someone else jumps on any of the above, that would be awesome!

Anyway, back on topic, the bus snooping approach is probably less accessible, and less advantageous for the Plus and earlier systems, although could lead to more interesting possibilities for SE and newer systems.

Another possibility is a sort of hybrid approach. Listen to the analog video signal in an mcu that can interface with newer technologies like hdmi or usb.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: video out for compact Macs
Posted: Nov 12, 2013 12:22 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Yeah, I'm not about to start work on this tomorrow either. :-) But it's fun to brainstorm.

That's true, the choice of what you do with the framebuffer data (VGA out, HDMI, USB) isn't dependent on how you collect it (video signal or bus snooping), so you can mix and match the ideas. But the more I think about it, the more I'm coming to prefer your suggestion of bus snooping. Even though the physical connection would be harder to do on machines like the Plus, it would be far easier to do on the SE or SE/30. And I think that's a huge benefit, because it means other people could eventually benefit from the hack just by plugging in a card, without having to solder any wires or anything. If you look at Floppy Emu, or your keyboard/mouse project, or dougg3's ROM SIMM, a lot of the fun factor came from being able to easily share the design with other people. So in this case, maybe the end goal could be an add-in card for the SE or SE/30 that does video mirroring, or adds a second monitor, or is a frame grabber, or a combination of all of the above.

I know pretty much zero about the slot manager or declaration ROMs and such. I should probably read Inside Mac more. It sounds like on the SE, you could pretty easily sniff for writes to the frame buffer, or maybe even to another part of the address space that's not mapped to anything in order to implement a second monitor. Although that begs a question - is there any unused region in the address space? I vaguely recall that the Plus' address space is completely filled by many redundant copies of ROM and ROM and things, but it's been a while since I looked at that info. I don't know what, if anything, causes an invalid address exception on the SE if you attempt to access an unused region in the address space. Anyway, it's just a plain 24 bit address bus.

But the SE/30 has a MMU, so I'm assuming the declaration rom is the magic that tells the MMU that address range XXX-YYY is occupied by the expansion card, so it can act appropriately when it sees memory accesses to that range. As I recall, you already did a project like that a while back.

Not knowing what's involved with the SE/30 MMU and declaration ROM, I'd look at the SE as the easier place to start. 8 MHz CPU, and all memory accesses take 4 clock cycles, so you'd have a relatively leisurely 500 ns to sniff each memory access and do something with the result. I think you'd need a CPLD to do address decoding and latch the data. A very fast microcontroller might work, if you tied the write enable signal to an interrupt, but then you'd get an interrupt for every memory write, and would have to do address decoding in software, and the interrupt service delay would have to be on the order of 100ns to capture the data before it disappeared from the bus. I'm not sure that's realistic. But with a cheap CPLD, you could do address decoding, latch the data, and store it in a small internal FIFO that the microcontroller could drain at its leisure. In that case basically anything would do, even a simple 8-bit AVR microcontroller like what's used in the Arduino.

An interesting place to start might just be an SE prototyping card. This would be a custom PCB that's physically the right size to fit the SE PDS slot, with the necessary edge connector, and with a CPLD and microcontroller on the board too, or even just a bunch of holes where you could solder in your own components for prototyping.
bbraun


Posts: 493
Registered: 7/25/12
Re: video out for compact Macs
Posted: Nov 12, 2013 2:18 AM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
I would absolutely love a prototyping card on any of the machines! PCB layout isn't my strong suit. :)

There should be unused address space on all the machines. The 68000 machines should share a fairly similar layout, and then it all gets changed up for the 020 and higher machines (all of which support nubus or at least the pseudo slots). Designing Cards and Drivers should have most of the necessary information, and Guide to the Macintosh Family Hardware should have the rest. Address maps, timing diagrams, declaration roms, etc.

For the slot manager/declaration rom stuff, basically there are "slots" in the address space, with each slot occupying $F{9-E}000000 in 24 or 32 addressing mode, and then a "super slot" space to give more room at ${9-F}0000000. When the ROM boots up, it probes the end of the address space of each slot looking for a declaration rom. If it finds one, the address space becomes valid. If not, accesses will generate a bus error. The declaration rom can occupy almost any contiguous range of the 4 bytes of bus width. So the ROM can be only 1 byte wide (most were just 27Cxxx ROMs), and occupy any of the 4 bytes, or any contiguous 2 bytes, or all 4 bytes. The declaration rom says which byte lane(s) is(are) valid. I've done some declaration rom hacking before, so I'm not too worried about it. The nice part about declaration ROMs is you can include the driver in the ROM and it'll get loaded automatically. There's also a way to boot from the declaration ROM, although the rather significant limitation there is the slot needs to be selected as the boot device in PRAM. It won't be probed unless specifically set in PRAM.

But if you're not occupying one of the slot address ranges, there's another range set aside (I forget which it is offhand, I don't recall many things using it, I think it's in the $F70000000 range?) for the card to use without the slot manager and without declaration roms. In that case, the range should always be mapped, but you need to manually load software to bang away at it.

The SE would definitely be the simplest bus that has an easily accessible connector. FWIW, if you want to go with an 030 PDS, the pinouts for the SE/30 and IIsi are the same, just operating at a different clock speed. I use the IIsi for experimentation here since its connector is easily accessible.
Beyond that, the LC slot is available in pretty much all the pizza boxes from the original LC through the powermac 62xx series. To maintain compatibility with the later machines (and PPC), the bus became decoupled from the processor bus and access times, width, etc. were compatible all the way back.
tt


Posts: 144
Registered: 8/25/12
Re: video out for compact Macs
Posted: Nov 12, 2013 2:46 AM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
A project I saw where someone had the compact mac video going out to an LCD I thought was really cool. I don't think much detail was explained about it, but I think being able to tap into the connector that goes into the analog board from the logic board would be a nice thing to have. It sounds like it could be made with a y-adapter/extension. It would provide for conversion from CRT to LCD for doing case mods. Maybe for CRT replacement too? Maybe not the most practical of ideas, but with solid state floppies, "SSD SCSI" solutions and an LCD, a compact mac could be even more compact. For me personally, emulation has never been good enough for certain programs, so seeing you guys extending the core hardware like this is very exciting.

If you tap into the logic board/bus, would creating a greyscale driver solution be possible without building a full-on video card? I don't know how quickdraw works, but say if in memory it is storing the data as grayscale, then maybe you can extract and display it in greyscale for an SE/30 and perhaps Classic II.
Arbee

Posts: 61
Registered: 11/29/12
Re: video out for compact Macs
Posted: Nov 14, 2013 1:00 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Having successfully emulated the Radius Full Page Display card for the SE in MESS, I can say a bit about how SE PDS video cards work.

The SE ROM checks for 0x55AAAA55 at 0xF80000 very early in boot (before the memory test or low memory globals are set up). If present, it JMPs through the vector at 0xF80004. You return by jumping to 0x401C04. The Radius ROM uses this primarily for what a NuBus video card would do during PrimaryInit (programming their CRTC to something valid and clearing the VRAM).

Later on, around when NuBus systems call SecondaryInit in video cards (just before DrawBeepScreen, for you experienced ROM spelunkers), it does the same thing through a signature word at 0xF80080 (also 0x55AAAA55) and a jump address at 0xF80084. It still does a JMP to this routine, but this time it's more polite and passes the return address in A1. The Radius card uses this hook to actually patch out QuickDraw to use their display and stuff. Disassembly of their ROM (which normally maps and runs at 0xC00000, with a mirror up in the 0xF800xx range) would likely be enlightening by someone a bit more familiar with the OS internals than myself :)

For the SE/30 I've yet to run into a card that doesn't pretend to be a NuBus card. It would've been possible for a single card to pretend to be multiple NuBus cards, with the limitations that the PDS slot doesn't have many unique IRQ lines and slot $E is occupied by the SE/30's on-board video.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: video out for compact Macs
Posted: Dec 10, 2013 8:30 PM   in response to: Arbee in response to: Arbee
Click to report abuse...   Click to reply to this thread Reply
The mailman delivered my new copy of Designing Cards and Drivers for the Macintosh Family! Now maybe I can start thinking about this video project for real.
tt


Posts: 144
Registered: 8/25/12
Re: video out for compact Macs
Posted: Dec 12, 2013 7:13 PM   in response to: Arbee in response to: Arbee
Click to report abuse...   Click to reply to this thread Reply
Here is the link to the project I was talking about. It looks like the PC video is going to the CRT. I was thinking the Mac video was converted to output to an LCD.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: video out for compact Macs
Posted: Dec 19, 2013 10:37 AM   in response to: tt in response to: tt
Click to report abuse...   Click to reply to this thread Reply
Maybe instead of video out, the goal should be to create grayscale video for the internal CRT? I think this would only be of interest for the SE/30, since the other compact Macs don't have Color Quickdraw. So it would basically be a clone of the Micron XCEED grayscale card. These go for like $1000 on the used market, so it would be great to have a new alternative.

Source: suggested by Ike at http://68kmla.org/forums/viewtopic.php?f=4&t=22539#p222053
bbraun


Posts: 493
Registered: 7/25/12
Re: video out for compact Macs
Posted: Dec 19, 2013 2:25 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
I know there's a ton of SE/30 nuts out there, and I'm sure they'd love such a thing.
But as crazy as it sounds, I'm not a fan of CRTs. Particularly the low refresh rate, retina searing, black on white of the old compact macs. My personal interest is more in the vein of being able to use an LCD or some other less painful display. Possibly even (I know this is blasphemy) removing the motherboard and power from the compact mac enclosure and placing it in a small enclosure to use with an external display.
Although the logical conclusion of that line of thought is really your Plus Too.
tt


Posts: 144
Registered: 8/25/12
Re: video out for compact Macs
Posted: Dec 19, 2013 2:59 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Agreed. I am a huge fan of the Xceed/SE/30, but I also see the benefit of ditching the CRT as well for really long-term hardware preservation. If it can be cheap and easy to replace a CRT with an LCD for a compact, I could see case-mod projects spring-up from that. We could ditch the analog board too right??
Trash80toHP_Mini

Posts: 45
Registered: 10/19/12
Re: video out for compact Macs
Posted: Sep 21, 2014 1:07 PM   in response to: Arbee in response to: Arbee
Click to report abuse...   Click to reply to this thread Reply
Having successfully emulated the Radius Full Page Display card for the SE in MESS, I can say a bit about how SE PDS video cards work.

w00w! If I actually understood what that meant, I probably wouldn't have been able to "see" a whole bunch of opportunities for hacks popping up.

I was looking for existing info on converting the output of a real FPD or TPD Killy Klip Card's output to an analog SVGA or better yet, DVI output compatible with 60Hz-+only+ LCDs as I didn't want to start a redundant thread.

Might your achievement help lead to developing 68000 "PDS" VidCard with a DVI connector on the Battery Cover of a Plus or the BackPlane plate of any number of PDS types. Extra credit available for the equivalent of the following:

For the SE/30 I've yet to run into a card that doesn't pretend to be a NuBus card. It would've been possible for a single card to pretend to be multiple NuBus cards, with the limitations that the PDS slot doesn't have many unique IRQ lines and slot $E is occupied by the SE/30's on-board video.

bbraun once explained to me how the Futura II SX manages to do VidCard/NIC duty while occupying a single slot. That was way over my head at the time, but that info might be applicable to your project.

http://lowendmac.com/video/futura2sx.html


Message was edited by: Trash80toHP_Mini - How the heck do you do quote tags here?

I'll catch on eventually . . . maybe . . . ::)

tt


Posts: 144
Registered: 8/25/12
Re: video out for compact Macs
Posted: Oct 17, 2014 12:58 AM   in response to: Trash80toHP_Mini in response to: Trash80toHP_Mini
Click to report abuse...   Click to reply to this thread Reply
Trash80toHP_Mini wrote:
Message was edited by: Trash80toHP_Mini - How the heck do you do quote tags here?

I'll catch on eventually . . . maybe . . . ::)

Click reply on the particular msg, then click on the quote icon in the msg editor. =)
bbraun


Posts: 493
Registered: 7/25/12
Re: video out for compact Macs
Posted: Jan 23, 2015 8:14 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Attachment semess.jpg (364.7 K)
Attachment macvideo.png (55.0 K)
This is something I've wanted to play around with for a while, and the family went out of town for a couple days, so I thought I'd hack on it a bit.
I've got one of the stm32f4discovery boards wired up to the PDS slot of an SE. The SE was chosen because 1) it's slow and has a 16bit data bus making things easier, and 2) it has the PDS slot which makes wiring things up substantially easier.

Some background on the 68000 bus and the SE:
There are two memory buffers for the SE. One at top of memory - 0x5900, and the other is top of memory - 0xD900. I believe the two are switched by flipping a pin on one of the VIAs, but at the moment I'm only focusing on capturing writes to the first memory buffer.

Since this is directly plugged into the PDS, the ARM processor I'm using has to decode the 68000's accesses directly. One tricky thing I learned while doing this is although the bus is 16bits, byte addressing is accomplished by having /LDS (lower data strobe) and /UDS (upper data strobe). There's no A0 address line so the byte can't actually be addressed, but /LDS and /UDS used in combination let you know which byte of the addressed word is being talked about. So if /UDS is low, it indicates only a single byte is on the bus, and it should end up in D8-D15 of the addressed word, and likewise if /LDS is low, it indicates the data should end up in D0-D7 of the addressed word. But, both bytes contain the same data. So if only one of the two data strobe lines are low, D0-D7 is the same as D8-D15. Neat. Full word access is when both DS lines are low at the same time.

Right now, I have the R/W pin as an interrupt, so I'm only examining writes.
I wait for the /AS line to go low (should either already be low, or approximately the same time as R/W), and read in the address.
If the write is not destined to the main video buffer, I'm currently bailing out here, since this is all I care about at the moment.
Then wait for /UDS and/or /LDS to go low indicating the data is ready to read, and then read the data in.
It handles the various cases of upper, lower, or word data on the bus, and writes it to a copy of the frame buffer on the ARM.

The ARM is also a USB serial device, which is how it gets data off the ARM and onto something else. In this case, the ARM is connected to my mac, where I wrote a separate program to just poll the ARM's internal copy of the framebuffer and display it (statically at the moment).

It's not quite right yet, things get out of sync, but the general idea seems to be panning out. The color on the screenshot is inverted due to a mismatch of the default profile of Quartz on the mac, but I'm not too worried about that at the moment. It's good enough to tell me what's wrong. :)


techknight

Posts: 110
Registered: 10/13/12
Re: video out for compact Macs
Posted: Jan 23, 2015 10:26 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Wow. Neat.

I wonder if it would just be easier to capture the video output, H/V sync, and pixel clock from the existing video circuit. Might be much easier. Wouldnt help you to create a "video card" for a 2nd extended monitor, but for mirroring it would work.

it would also come in handy when doing logic board repairs. No more analog board required.

power the logic board on my bench supply, and output its signal into some sort of display device.

Point your RSS reader here for a feed of the latest messages in all forums