skeezix
Internal Development
hey guys,
As you may know, I'm a pretty competant software guy; electronics wise, I've learned enough to know about basic housewiring and basic digital electronics, mostly from the repair side .. not the design side. Something goes wrong in my car or house, I can pull out a multimeter and have a chance at it. From repairing arcade pcboards years ago, I picked up a logic probe and chip puller and so on, and have a pretty good chance at figuring out whats going wrong in a board and fixing it. So, not completely worthless. Just mostly
But designing wise.. I took some courses in highschool (yeah, my school was cool, it had an electronics shop, wood shop, welding shop, auto shop, etc; when I was 16, I was cutting steel bars with an arc welder.. good times
-- anyway, so I know Ohms law and some basics, but am essentially clueless 
So I thought it would be cool to make a rudimentary early 80s computer from scratch; I mean, you can pick up an Arduino pr r-pi or XBoard for next to nothing and you're done; you can pick up an SoC chip and it takes almost nothing to get it working.. quit amazing really. But thats cheating. And I'm not too interested in learning the software side, since I've done that, even on low level to the metal stuff.
I've written emus, and you have to understand whats going on to a point, but my emus capped out around the early 16bit era; things started to get complex there. Multi-processor 8bit early 16bit, that was as far as I got. And you don't have to really know the electroncis down to each component to get that to work.. you need to see the schematics or board, and see every other chip and make conclusions .... a different process.
So my first cut was getting a 6502 and some pacman RAM and trying to get something going; I got a part of the way, but I've since ordered an oscilliscipe, as theres only so much you can do from guessing; an o-scope is printf for electronics, you know? Anyway, I had 3-4 breadboards going a couple weeks back.. one for power supply, one for rom and ram, another for cpu and stuff.. it just got out of control; all those data lines, big freaking mess
Anyway, I got lazy, figured that might be taking it a bit far. I'd soon be etching boards in my bathtub (been there, done that
), no time for that right now. So back to a basic, but not quite entirely basic chip, just ot reduce the number of wires I needed hopping around.
So I went back to a basic PIC that has a bit of flash rom and a bit of RAM (like, 8k of flash and a few hundred b of RAM.. good times
; wiring up a basic power supply for that, and some I/O lines so I can flash it, and its good to go; you can get going with a crystal+PIC+power, and its alive and ticking . I figurdd if I can get vic-20/C64 level of system going on (minus support chips and floppy drives and so on
, that'd be pretty instructional. (Goal here of course is to write a shitty Space Invaders game, on my own hardware, and call it a day.)
Now, most people go off and start with LEDs and stepper motors and such, easy stuff. I've worked on basic robots with guys before, from the software side. Well, most people use arduino and the built in functions nowadays - way too easy when you can buy a Robot Kit on ebay! - but I'm not using any OS, firmware, libraries, nothing, of course. (Well, most people go to the pub or something, sure, but I'm brain damaged, right?
ANYWAY, what I've been working on is trying to figure out NTSC composite output, right from the chip; stepper motors and stuff.. pfft, easy sauce. Making a little R/C car into your robot slave, not too bad. But writing output to a display, not just a serial or LED bar... I hadn't realized NTSC was such a total whore to do, but okay, I sort of get it now. This is what I wanted to learn.. low level really fiddly stuff, from the electronics side. You can get TV chips, or an SoC that has VGA out, etc, right easy, but I'm doing it with nothing, just a PIC + some short code. (Really, I shoudl figure out VGA, maybe its easier than NTSC? certainly a lot more useful/available now.. how many composite TVs have you seen in the last few years? But I've got a C64 monitor here that I didn't cook yet
.. and it sort of works! I can draw a line on there (white on black or the reverse, woowoo), and I've sort of got a handle on drawing some basic colour (which is a right bitch I tell you, at NTSC speeds.) Can't wait for my scope to arrive so I can see the waveform going on, get the timing right.. But some folks have documented this before, so I'll figure it out.
Anyway, fine, I'll bang on this a couple more weeks, in time here or there, see if I can get it going right. I should add a joystick/gamepad port and see if I can move the line back and forth, and keep it straight (harder than you think
. The old school joysticxks use a REALYL trivial interface.. take you like 5 I/O lines to wire up an Atari port and use your old Amiga joystick, piece of cake.
Essentially what I've got going is a homegrown Atari 2600, minus some features like player/missile sprites; theres no framebuffer, so I have to render to the TV display at exactly the right frequency, or it all goes to shit; I have to render every pixel just-right, with a couple of cycles in between for doing any other stuff. On the up side, I can change the resolution to whatever I like, and do colour and such ... now, I coudl go pick up a really fast crystal and PIC .. you can get PICs that run at 100mhz or more, and have lots of cycles between each NTSC pulse set, but thats cheating (and the o-scope I ordered only has 20mhz bandwidth.. so ideally I Shoudl run at 5mhz or less, so the o-scope can have a chance at monitoring the CPU. Cause how awesome is that, to watch the individual CPU ticks going by?) (sure, in emulation, I've done it to death, but thats beside the point; watching the actual electrical pulses on a scope is pretty awesome. And back in the day, the big analog desk-scopes, they're sexy beasts. Probably 30 pounds for a 4" scope display.. oh man
)
So, all that said, I'm thinking one of the next steps would be adding a framebuffer or the like; or go back to a basic chip and try to figure out how to pull SD card into RAM with some basic bootloader or something, but that might be going too far
I've never really thought about it at this low level; do I run the clock at 'double' what I'd like, and then somehow filter the oscilator signal so that every other tick goes to the PIC, and every other... other tick goes to another PIC, and have them both read a single outboard RAM chip? ie: PIC-A writing to the RAM chip, and PIC-B reading from it and managing the TV signal? That woudl more or less fake a framebuffer..
(Most systems have framebuffer in RAM, but if I'm working on the assumption that my display is bitmapped and in RAM, well, little PICs I'm aimign to sue don't have the RAM for that; and writing multi-hreading code to interleave the framebuffer render and the framebuffer population, and audio and such, is a pita when you're rolling it 100% yourself.)
Anyone have any ideas on how that (framebuffer) would work, in primitive electronics, with no cheating?
Eventually I'm going to switch over to a 16bit chip with some outboard RAM and flash/SD, so I can move from Atari 2600 level to more less-than-Genesis level, and then I can give up
jeff
As you may know, I'm a pretty competant software guy; electronics wise, I've learned enough to know about basic housewiring and basic digital electronics, mostly from the repair side .. not the design side. Something goes wrong in my car or house, I can pull out a multimeter and have a chance at it. From repairing arcade pcboards years ago, I picked up a logic probe and chip puller and so on, and have a pretty good chance at figuring out whats going wrong in a board and fixing it. So, not completely worthless. Just mostly
But designing wise.. I took some courses in highschool (yeah, my school was cool, it had an electronics shop, wood shop, welding shop, auto shop, etc; when I was 16, I was cutting steel bars with an arc welder.. good times
So I thought it would be cool to make a rudimentary early 80s computer from scratch; I mean, you can pick up an Arduino pr r-pi or XBoard for next to nothing and you're done; you can pick up an SoC chip and it takes almost nothing to get it working.. quit amazing really. But thats cheating. And I'm not too interested in learning the software side, since I've done that, even on low level to the metal stuff.
I've written emus, and you have to understand whats going on to a point, but my emus capped out around the early 16bit era; things started to get complex there. Multi-processor 8bit early 16bit, that was as far as I got. And you don't have to really know the electroncis down to each component to get that to work.. you need to see the schematics or board, and see every other chip and make conclusions .... a different process.
So my first cut was getting a 6502 and some pacman RAM and trying to get something going; I got a part of the way, but I've since ordered an oscilliscipe, as theres only so much you can do from guessing; an o-scope is printf for electronics, you know? Anyway, I had 3-4 breadboards going a couple weeks back.. one for power supply, one for rom and ram, another for cpu and stuff.. it just got out of control; all those data lines, big freaking mess
So I went back to a basic PIC that has a bit of flash rom and a bit of RAM (like, 8k of flash and a few hundred b of RAM.. good times
Now, most people go off and start with LEDs and stepper motors and such, easy stuff. I've worked on basic robots with guys before, from the software side. Well, most people use arduino and the built in functions nowadays - way too easy when you can buy a Robot Kit on ebay! - but I'm not using any OS, firmware, libraries, nothing, of course. (Well, most people go to the pub or something, sure, but I'm brain damaged, right?
ANYWAY, what I've been working on is trying to figure out NTSC composite output, right from the chip; stepper motors and stuff.. pfft, easy sauce. Making a little R/C car into your robot slave, not too bad. But writing output to a display, not just a serial or LED bar... I hadn't realized NTSC was such a total whore to do, but okay, I sort of get it now. This is what I wanted to learn.. low level really fiddly stuff, from the electronics side. You can get TV chips, or an SoC that has VGA out, etc, right easy, but I'm doing it with nothing, just a PIC + some short code. (Really, I shoudl figure out VGA, maybe its easier than NTSC? certainly a lot more useful/available now.. how many composite TVs have you seen in the last few years? But I've got a C64 monitor here that I didn't cook yet
.. and it sort of works! I can draw a line on there (white on black or the reverse, woowoo), and I've sort of got a handle on drawing some basic colour (which is a right bitch I tell you, at NTSC speeds.) Can't wait for my scope to arrive so I can see the waveform going on, get the timing right.. But some folks have documented this before, so I'll figure it out.
Anyway, fine, I'll bang on this a couple more weeks, in time here or there, see if I can get it going right. I should add a joystick/gamepad port and see if I can move the line back and forth, and keep it straight (harder than you think
Essentially what I've got going is a homegrown Atari 2600, minus some features like player/missile sprites; theres no framebuffer, so I have to render to the TV display at exactly the right frequency, or it all goes to shit; I have to render every pixel just-right, with a couple of cycles in between for doing any other stuff. On the up side, I can change the resolution to whatever I like, and do colour and such ... now, I coudl go pick up a really fast crystal and PIC .. you can get PICs that run at 100mhz or more, and have lots of cycles between each NTSC pulse set, but thats cheating (and the o-scope I ordered only has 20mhz bandwidth.. so ideally I Shoudl run at 5mhz or less, so the o-scope can have a chance at monitoring the CPU. Cause how awesome is that, to watch the individual CPU ticks going by?) (sure, in emulation, I've done it to death, but thats beside the point; watching the actual electrical pulses on a scope is pretty awesome. And back in the day, the big analog desk-scopes, they're sexy beasts. Probably 30 pounds for a 4" scope display.. oh man
So, all that said, I'm thinking one of the next steps would be adding a framebuffer or the like; or go back to a basic chip and try to figure out how to pull SD card into RAM with some basic bootloader or something, but that might be going too far
I've never really thought about it at this low level; do I run the clock at 'double' what I'd like, and then somehow filter the oscilator signal so that every other tick goes to the PIC, and every other... other tick goes to another PIC, and have them both read a single outboard RAM chip? ie: PIC-A writing to the RAM chip, and PIC-B reading from it and managing the TV signal? That woudl more or less fake a framebuffer..
(Most systems have framebuffer in RAM, but if I'm working on the assumption that my display is bitmapped and in RAM, well, little PICs I'm aimign to sue don't have the RAM for that; and writing multi-hreading code to interleave the framebuffer render and the framebuffer population, and audio and such, is a pita when you're rolling it 100% yourself.)
Anyone have any ideas on how that (framebuffer) would work, in primitive electronics, with no cheating?
Eventually I'm going to switch over to a 16bit chip with some outboard RAM and flash/SD, so I can move from Atari 2600 level to more less-than-Genesis level, and then I can give up
jeff