News for hackers. Stuff that matters.

fjmilens3

Re:The Cody Computer on Monday December 30, 2024 @06:59PM (#42554969)
> It shouldn't be too hard to replace the "custom" keyboard with a ps2 keyboard and do the ps2 driver on the propeller

You might be surprised at the knock-on effects of that.

You're not going to be able to drop in the PS/2 driver from the OBEX that easily. The Propeller has 8 cogs. Right now one manages the 6502 bus, one manages the SID emulation, one manages the NTSC video generation, four are in use for scanline rendering, and one is used to implement two separate UARTs via coroutines. So you have no free cogs, so unless you can wedge your own PS/2 driver into the UART or SID code somehow, you have nowhere for it to run.

Also, the Cody Computer has its own ROM in 65C02 assembly, and that has its own I/O routines written around the idea that it's scanning the keyboard using the 65C22 VIA. You could change some of the ROM so that it would read the PS/2 input from the Propeller (assuming you could solve the above problem), and most of the programs in Cody BASIC would work as long as you consistently translate the data. However, assembly language programs that directly scan the keyboard matrix would be completely incompatible.

The joystick ports are also scanned as part of the keyboard matrix, so you'd have to keep that separate, ditch the joysticks, or something else. That means that you don't really have the option of deleting that much code, which poses another problem because the Cody Computer's (emulated) 8-kilobyte ROM is already full from the BASIC interpreter, runtime routines, and default character set. You can also move that around and expand the boundary, but again, that introduces yet more changes so it would be harder for people to share programs, particularly low-level ones. It also reduces the sense of it really being a retro 8-bit computer.

If the Cherry MX switches are too expensive, you've got better options:

1. Buy some knockoff switches off Amazon, Alibaba, or whatever; I'm seeing 32-packs of Cherry clones for $10 to $15, tops.

2. Get a piece of junk mechanical keyboard that's really only good for scrap and try to desolder and salvage 32 of the switches.

3. Redesign the KiCad file for the keyboard to take tact switches. That said, if you're going to buy a board, an additional $10 or so for switches isn't that bad. (The very first keyboard we did actually had more keys, but all of them were tact switches; it was a neat keyboard but it wasn't a joy to type on.)

Re:The Cody Computer on Monday December 30, 2024 @03:48PM (#42553336)
> I also wonder why use NTSC for outputting video. VGA is easy enough to bitbang and pretty ubiquitous. HDMI is probably more available at this point, but has unfriendly licensing issues. DisplayPort seems better in all aspects, but it’s the least user friendly and requires a monitor rather than a small TV.

Period authenticity, color palette, and pin count, among other reasons:

The idea was to make something that really felt like an old 8-bit you could build, and composite video output was a big part of that.

The NTSC colors were also a lot closer to the "feel" I wanted the computer to have, and unlike VGA output on the Propeller, you don't have to increase the number of pins to increase the number of output colors; the color information is conveyed by the phase of the NTSC signal. On the Propeller you can get a rather large NTSC (or PAL) palette with a 3-pin DAC, but with VGA, you'd want a six-pin DAC plus H and V signals for VGA (and likely not find color matches as close to the C64 palette anyway).

You also need to take into account the timing limitations for "racing the beam" and generating the video on the fly as the Propeller firmware is doing internally; TV scan rates are comparatively slow and give you more time to assemble a line of pixels.

Lastly, as far as HDMI or DisplayPort, that was well out of scope for what I was trying to do, and likely out of range of what the Propeller could bit-bang even with its shift register hardware. I know people have done something similar with DVI output from the Pi Pico, but I'm still not sure that even the Pico could do as much as the Propeller is doing here overall, and probably not as cleanly.

One of the things about engineering, or really anything, is that's more often than not a matter of finding the least bad option given competing constraints; in this case what I thought was the best technical fit was also the one that fit the 1980s aesthetic.

Re:The Cody Computer on Monday December 30, 2024 @02:12PM (#42552447)
The Cody Computer doesn't use a PS/2 keyboard, it's actually using the 65C22 VIA and a CD4051 to scan the keyboard matrix. This is mentioned in the book and in the schematic up on Github, but for a quick version, it's conceptually very similar to the Oric (as mentioned on Garth Wilson's site: https://wilsonminesco.com/6502primer/potpourri.html).

But for the Propeller itself, there's actually a driver for PS/2 keyboards and mice written by Kwabena Agyeman. It's up on the OBEX (https://obex.parallax.com/obex/combo-ps2-keyboard-and-mouse-...) which is a good place to look for Propeller-related code. I've never used that driver personally, but that's where I would start.

Re:The Cody Computer on Monday December 30, 2024 @07:22AM (#42548665)
He's the dog in the book. :-)
Re:The Cody Computer on Monday December 30, 2024 @07:13AM (#42548613)
I would actually go so far as to say the Propeller is a good bridge into general electronics, certainly anything digital. It comes up in the context of video generation, but it can do so much more than that because of the multicore design; instead of built-in peripherals you can use a core to implement more or less what you need, certainly within an educational context where you're not as focused on peak throughput for an SPI device or something.

The problem is that the Propeller community ended up being a lot smaller than, say, the Arduino community, so learning materials aren't nearly as available outside of Parallax's publications or the forums. That said, I think that if you took a group of kids and gave them Propellers compared to a similar group with Arduinos, the Propeller group would understand a lot more about why things work the way they do.

Re:The Cody Computer on Monday December 30, 2024 @06:52AM (#42548502)
Thank you. :-)
Re:The Cody Computer on Monday December 30, 2024 @06:42AM (#42548461)
That's true. From a technical standpoint a closer example would be Jac Goudsmit's Propeddle project, or its predecessor, the Propeller-6502 hybrid made by Dennis Ferron. There's actually a long tradition of using the Propeller as the equivalent of custom silicon in such projects before people started doing the same with ARM.

I think the only thing that really holds the original Propeller back in such projects is that while the Propeller is fast, it's going to take a few cycles to interface the 6502 bus whatever you do. The Propeller runs at 20 MIPS per cog, which can easily bit-bang the bus when the 6502's running at 1 megahertz or so. But if the 6502 is running at 16 megahertz then it's not going to be able to keep up without some external decoding logic and throwing in a wait state via the 6502 RDY pin.

The newer Propeller 2 would have no such constraints, but it's also a more complex chip that you can't get in a 40-pin DIP.

Re:The Cody Computer on Monday December 30, 2024 @06:26AM (#42548387)
My guess after building it would be that it would come in around $100 to $150 depending on what you have around for 3D printing and so on. Unfortunately, I recall there being a bit of a jump in component prices circa 2020 that really hasn't resolved itself.

As one of the other commenters mentioned, keyboard switches don't come cheap. Your best bet would be to look at some of the sources for Cherry MX clones, though for my build I was able to find a US-based source for Cherry MX switches relatively cheaply. It also helps that you don't need nearly as many as for a full, traditional keyboard.

Another cost to consider is the cost of the PCBs. All of our boards (including the prototypes that didn't go anywhere) were done by Aisler and were a bit more expensive than Chinese board houses, but they always came through and I was too lazy to shop around. Per board the cost isn't bad, but consider that you're buying boards in groups of three, and then you have at least two PCBs (the main board and the keyboard).

It's also going to depend on where you live and what kind of import duties you might get hit with.

Re:The Cody Computer on Monday December 30, 2024 @06:17AM (#42548332)
I'm the person behind the project (and I have a funny feeling I used your 8x8 text driver back when I was trying to learn how the Propeller worked). Anyway, there were actually a few reasons behind the 160x200 video mode:

One was simplicity for the user. When this was all just an idea, I often compared it to a "Commodore Junior" in terms of functionality, and I wanted to keep it simple to learn from and have fun with. I thought something like the C64 or Plus/4's multicolor graphics mode would be the best compromise in terms of letting you make graphics/games but also having readable text output. A lot of old C64 games did just fine with 4x8 multicolor text, and even the VIC-20 did passably well with some of the 40-column extensions people wrote for it.

Another was simplicity from the standpoint of designing the thing. I actually looked into trying to mimic most of the VIC-II's functionality, including being able to mix low-res and high-res on the same line. I just couldn't convince myself there would be enough cycles to pull that off, or at least I'm not sharp enough to manage the feat, particularly with sprites also involved. You could do it with more cogs (Propeller cores) but since the Propeller is handling so many jobs (kind of like the TED on the Plus/4 series), there were constraints there as well. From there I went back to thinking about separate high-res and low-res modes, but that circles back to the above point about complexity.

Yet another reason was that Cody actually liked the multicolor graphics modes (and I do realize how that sounds). When I played around with different video graphics he got really big eyes and a smile watching multicolor tests on the TV. He also really enjoyed YouTube videos of Commodore Plus/4 games done in the multicolor mode it had when I was reading up on the TED. If it got his attention I found a way to work it in, and I also think a really smart Pomeranian isn't necessarily that much different from a really young boy in terms of researching your audience for this kind of thing.

(True story: At one point when I was showing Cody the Propeller breadboard I used for experimenting, he started slapping the RCA jack with his paw with a curious look like it was going to do something. I think he saw me plug that into the cable so many times that he concluded the RCA jack is what made it run or something.)