[WORKING] Simple 6502 SBC from scratch (Deck65)
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
GARTHWILSON wrote:
and3rson wrote:
Garth - your LCD ASM examples were very helpful!
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
So PS/2 took me some time, but I'm really surprised how easy it was to implement, including make/break/extended scancode handling as well as shifted characters. My biggest mistake was forgetting to terminate my functions with `rts` and wondering why weird code is being called.
Also, some WDC instructions are totally awesome, including SMBx, RMBx, & STZ. ROR seems to work properly with shifting the carry bit in - I heard some myths about "bug" with it, maybe it's only relevant for some ancient 6502 NMOS revisions.
I think my PS/2 bit handling code could be slightly improving by juggling with VIA's shift register after start bit was received, but I decided to keep it simple and read all 11 bits in a bit-banging style.
Now I'll be able to do some interaction with my device. Probably the most helpful commands that I'll implement first will be reading/writing memory locations - that's gonna heavily reduce the amount of EPROM flashes!
Finally, having LOAD command to run arbitrary code from ROM or SD card in C64 format (i. e. binary that's prefixed with little-endian address specifying where to load the code) will be nice, especially for playing SID songs. I'll try to keep my code @ github updated at all times. EDIT: I've considered an option of porting one of small BASIC variants (e. g. TinyBASIC, since it's free for non-commercial use), but decided to stick with a simple 1-character-command terminal for now:
Also, some WDC instructions are totally awesome, including SMBx, RMBx, & STZ. ROR seems to work properly with shifting the carry bit in - I heard some myths about "bug" with it, maybe it's only relevant for some ancient 6502 NMOS revisions.
I think my PS/2 bit handling code could be slightly improving by juggling with VIA's shift register after start bit was received, but I decided to keep it simple and read all 11 bits in a bit-banging style.
Now I'll be able to do some interaction with my device. Probably the most helpful commands that I'll implement first will be reading/writing memory locations - that's gonna heavily reduce the amount of EPROM flashes!
Finally, having LOAD command to run arbitrary code from ROM or SD card in C64 format (i. e. binary that's prefixed with little-endian address specifying where to load the code) will be nice, especially for playing SID songs. I'll try to keep my code @ github updated at all times. EDIT: I've considered an option of porting one of small BASIC variants (e. g. TinyBASIC, since it's free for non-commercial use), but decided to stick with a simple 1-character-command terminal for now:
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
Nice progress so far, I'm impressed.
In the long run, that LCD will be a bit too small for your computer.
But generating a video signal was a topic we had quite a few times here in the forum,
either by using a microcontroller, a CPLD, or "a handful" of TTL chips.
//The TTL approach tends to be too big for a beginner's project.
Looking forward to watching the progress of your project.
In the long run, that LCD will be a bit too small for your computer.
But generating a video signal was a topic we had quite a few times here in the forum,
either by using a microcontroller, a CPLD, or "a handful" of TTL chips.
//The TTL approach tends to be too big for a beginner's project.
Looking forward to watching the progress of your project.
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
ttlworks wrote:
Nice progress so far, I'm impressed.
In the long run, that LCD will be a bit too small for your computer.
But generating a video signal was a topic we had quite a few times here in the forum,
either by using a microcontroller, a CPLD, or "a handful" of TTL chips.
//The TTL approach tends to be too big for a beginner's project.
Looking forward to watching the progress of your project.
In the long run, that LCD will be a bit too small for your computer.
But generating a video signal was a topic we had quite a few times here in the forum,
either by using a microcontroller, a CPLD, or "a handful" of TTL chips.
//The TTL approach tends to be too big for a beginner's project.
Looking forward to watching the progress of your project.
Yes, I've been thinking about video a lot. And yes - I think I read nearly all existing topics on video solutions here! Ideally, I'd want to achieve it with some constraints:
- FPGA: I wouldn't want anything in my SBC that could replace the entire SBC itself.
- VIC chip: this would totally be cheating!
Those constraints were pretty much inspired by original David Murray's vision of a "perfect" 8-bit machine, and while his X16 team decided to go with FPGA for video to make their system richer as a commercial device, I still don't want to dive into FPGAs. Yes, they provide huge possibilities and allow to implement all logic in a single chip, but it just doesn't feel "oldschool" enough. I even almost ditched the idea of using GAL22V10 for address decoder at some point because I felt like it was "too simple". (Well, I still ditched it in favor or NANDs, but I might still use it for my future versions.)
Some serious (and esoteric) options:
- As you mentioned - discrete logic: Having a simple video like Apple-1 made purely of basic components would be really fun, but I'm afraid it might end up being really big (and complex!). But that's a totally viable option, I could even design in a PC-card style and plug it into my main SBC. Though this would mean my SBC is no longer a SBC, but a DBC!
- Second 6502 & DMA: It would be interesting to have a separate 6502 solely to render video. Instead of DMA, second 6502 could have its own RAM and some glue logic to sync it with primary data bus.
- *Heresy alert!!!* - Z80: I never actually developed for it, but I own several Speccies (originals as well as few clones from soviet era). Would be fun to try and make it lean under 6502's control and handle video rendering, just for the sake of it.
- Some exotic "video"-interfaces: a printer? A matrix of nixie tubes with shift registers? (Damn, that's gonna cost a fortune.) Etch-a-sketch with two stepper motors?
But really, my main fetish is composite video. I always liked it - I grew up with it, it had a nice round connector and always worked with no effort whatsoever. And all the artifacts like noise & jailbars just add to the atmosphere. I suck at analog electronics, but a possibility of generating composite video signal makes me want to learn it better!
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
Not sure if this would be of any interest to you, but, I used a $5 Pi Zero and a fork of the PiGFX "bare metal" VT-100 Terminal Emulator software on one of my projects which produced HDMI and composite video output (I only ever tried HDMI video). I've attached a DipTrace file with the proper hole dimensions and outline for a Pi Zero if you'd like to take a peek. Geoff Graham's ASCII Video Terminal also produces composite (and VGA) video output.
- Attachments
-
- Pocket 1802 v3.zip
- (15.62 KiB) Downloaded 181 times
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
and3rson wrote:
Yes, I've been thinking about video a lot. And yes - I think I read nearly all existing topics on video solutions here! Ideally, I'd want to achieve it with some constraints:
- FPGA: I wouldn't want anything in my SBC that could replace the entire SBC itself.
Yes, with FPGA I can get nice video and a nice board, but It almost feels like cheating!
- VIC chip: this would totally be cheating!
- FPGA: I wouldn't want anything in my SBC that could replace the entire SBC itself.
- VIC chip: this would totally be cheating!
Neil
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
and3rson wrote:
Yes, I've been thinking about video a lot.
and3rson wrote:
- VIC chip: this would totally be cheating!
Same thing for EF9367 and TMS9918.
and3rson wrote:
Some serious (and esoteric) options:
- As you mentioned - discrete logic: Having a simple video like Apple-1 made purely of basic components would be really fun, but I'm afraid it might end up being really big (and complex!).
But that's a totally viable option, I could even design in a PC-card style and plug it into my main SBC. Though this would mean my SBC is no longer a SBC, but a DBC!
- As you mentioned - discrete logic: Having a simple video like Apple-1 made purely of basic components would be really fun, but I'm afraid it might end up being really big (and complex!).
But that's a totally viable option, I could even design in a PC-card style and plug it into my main SBC. Though this would mean my SBC is no longer a SBC, but a DBC!
My solution was to make the TTL CRT controller a separate unit, running with its own clock, mirroring 6502 write cycles into its own display RAM.
So that the SBC doesn't need to be changed, and is able to work without the CRT controller being attached to it.
and3rson wrote:
- Second 6502 & DMA: It would be interesting to have a separate 6502 solely to render video.
Instead of DMA, second 6502 could have its own RAM and some glue logic to sync it with primary data bus.
Instead of DMA, second 6502 could have its own RAM and some glue logic to sync it with primary data bus.
Hmm... looks like Mouser doesn't have IDT dual port RAMs anymore, and I don't have any practical experience with that W65C02 BE pin...
and3rson wrote:
- *Heresy alert!!!* - Z80: I never actually developed for it, but I own several Speccies (originals as well as few clones from soviet era).
Would be fun to try and make it lean under 6502's control and handle video rendering, just for the sake of it.
Would be fun to try and make it lean under 6502's control and handle video rendering, just for the sake of it.
and3rson wrote:
- Some exotic "video"-interfaces: a printer? A matrix of nixie tubes with shift registers? (Damn, that's gonna cost a fortune.) Etch-a-sketch with two stepper motors?
"oscilloscope vector display" probably would be boring, because there are a lot of oscilloscope clock projects in the internet...
and3rson wrote:
But really, my main fetish is composite video. I always liked it - I grew up with it, it had a nice round connector and always worked with no effort whatsoever.
And all the artifacts like noise & jailbars just add to the atmosphere. I suck at analog electronics, but a possibility of generating composite video signal makes me want to learn it better!
And all the artifacts like noise & jailbars just add to the atmosphere. I suck at analog electronics, but a possibility of generating composite video signal makes me want to learn it better!
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
ttlworks wrote:
As long as you don't want to use/display colors, genenerating a composite video signal isn't "rocket science".
However, on the composite video front - I started with that for the Ruby Board - my intention was to use the board 'host' processor to do it - an ATmega 1280p and it worked well and I had 320x240 pixel display, so 40 columns x 30 lines of 8x8 font text, or pixel graphics....
It worked well. The down-side was it was using some 60-70% of all CPU cycles in the ATmega so I moved to plan B.
However while I don't think you need to go quite as deep as the transistor level in the Pong document above, doing it in TTL is do-able...
The down-side and another reason I gave up on composite video... At the time I was thinking of offering it as a kit, but just how many people still have a TV or monitor that will accept composite video? A few, but not many now...
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
drogon wrote:
... how many people still have a TV or monitor that will accept composite video? A few, but not many now...
I've got a couple of these little 4.3" monitors that sync' on either PAL or NTSC and work well. Basically just an inexpensive TFT display and PAL/NTSC adapter stuffed into a nice plastic case. I've also heard you can modify the display for 5 volt operation instead of 12 volts.
Cheerful regards...
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
ttlworks wrote:
and3rson wrote:
- Second 6502 & DMA: It would be interesting to have a separate 6502 solely to render video.
Instead of DMA, second 6502 could have its own RAM and some glue logic to sync it with primary data bus.
Instead of DMA, second 6502 could have its own RAM and some glue logic to sync it with primary data bus.
and3rson, you and others may enjoy such an implementation from many years ago (back when 64K was so... much... RAM...
Yes it's 6809, but 68xx family bus cycles are the same as 65xx's. Also, as Dieter hints, the BE input featured by modern 65xx CPUs might be something that could be used to advantage in a modern, 65xx dual-CPU, shared-RAM design...
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
drogon wrote:
However while I don't think you need to go quite as deep as the transistor level in the Pong document above, doing it in TTL is do-able...
On the other hand, I just remembered that we happen to have a dissection of the NES PPU in the forum... //for PAL and NTSC video output.
Michael wrote:
My TV has a composite input but they've all but disappeared on new TV sets.
I wasn't aware that the composite video input on modern TV sets went the way of the Dodo.
Looks like SCART on new TV sets also went extinct.
Hmm... rolling your own DVI/HDMI interface might be possible,
but I'm not sure if it's a good idea.
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
I wasn't aware that the composite video input on modern TV sets went the way of the Dodo.
Looks like SCART on new TV sets also went extinct.
Hmm... rolling your own DVI/HDMI interface might be possible,
but I'm not sure if it's a good idea.
Here in the UK there is no analog terrestrial TV broadcast anymore. It's been digital for some time now, so finding an old TV for the old Channel 36 outputs from old computers is a little problematic...
Other than 2 old monitors I use for Apple II's the only thing left I have is an old portable TV that has video/scart and a now redundant TV input...
Those little reversing camera monitors are popular though.
-Gordon
Looks like SCART on new TV sets also went extinct.
Hmm... rolling your own DVI/HDMI interface might be possible,
but I'm not sure if it's a good idea.
Here in the UK there is no analog terrestrial TV broadcast anymore. It's been digital for some time now, so finding an old TV for the old Channel 36 outputs from old computers is a little problematic...
Other than 2 old monitors I use for Apple II's the only thing left I have is an old portable TV that has video/scart and a now redundant TV input...
Those little reversing camera monitors are popular though.
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
drogon wrote:
Here in the UK there is no analog terrestrial TV broadcast anymore.
So trying to build RF modulators (like they were in some old computers) won't make sense.
Hmm... it's a pity that 320*240 monochrome graphic LCDs without a LCD controller already integrated became pretty exotic.
Because my TTL CRT controller was able to generate an analog video signal while working as a LCD controller...
;---
Jeff, that block diagram of the dual 6809 computer looks nice.
In 6502 computers, sometimes the 6502 (during PHI2=HIGH) and a CRT controller (during PHI2=LOW) had shared the bus.
In theory, it might be possible to build something where two 6502 CPUs are sharing the bus.
Clock generation and correct timing might become a bit tricky, of course.
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
It's getting harder to find cheap LCD screens that accept other than HDMI now, too, though I still have one. It offends my sense of aesthetics to stick a raspberry pi or similar on the board just to get video output (ignoring the size of the ram required!) so I'll carry on with the 74xxx SVGA, thanks!
Pal or NTSC is essentially trivial even if you grow the circuitry from scratch and the only real issue with VGA or SVGA is that if you want to share memory with the processor, you end up with a dot clock of 25.5MHz or 40MHz and that implies an easy system clock of 3 and a bit or 5MHz or a multiple thereof.
Though to be fair, once you get to those resolutions, you're starting to have to look beyond a simple bitmap font (though I'm not convinced that a 6502 could handle a truetype font with any great facility!). Nonetheless, I shall persevere!
Neil
Pal or NTSC is essentially trivial even if you grow the circuitry from scratch and the only real issue with VGA or SVGA is that if you want to share memory with the processor, you end up with a dot clock of 25.5MHz or 40MHz and that implies an easy system clock of 3 and a bit or 5MHz or a multiple thereof.
Though to be fair, once you get to those resolutions, you're starting to have to look beyond a simple bitmap font (though I'm not convinced that a 6502 could handle a truetype font with any great facility!). Nonetheless, I shall persevere!
Neil
Re: [WORKING] Simple 6502 SBC from scratch (65ad02)
ttlworks wrote:
Jeff, that block diagram of the dual 6809 computer looks nice.
Quote:
In 6502 computers, sometimes the 6502 (during PHI2=HIGH) and a CRT controller (during PHI2=LOW) had shared the bus.
In theory, it might be possible to build something where two 6502 CPUs are sharing the bus.
In theory, it might be possible to build something where two 6502 CPUs are sharing the bus.
Quote:
Clock generation and correct timing might become a bit tricky, of course.
Bottom line: you mustn't allow the RAM's /WE input to go low immediately when one device's turn ends and the other device's turn begins. There needs to be a bit of delay (address setup time) before /WE is allowed to go low. And familiar designs using a CPU and a CRT controller already successfully manage this.
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html