6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Mar 29, 2024 3:02 pm

All times are UTC




Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
PostPosted: Mon Mar 05, 2012 10:11 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1668
Location: Sacramento, CA
Atmel has a 40-pin Microcontroller that has enough internal SRAM to drive a 320x240 monochrome graphics display. I have it connected to a 320x240 LCD but it can easily be adapted to NTSC or PAL composite video.

The LCD I'm using is the same one I built my Text only display on.
( http://sbc.rictor.org/io/vid4.html )

I have a text only mode that can scroll the screen faster and the graphics mode can put text in the graphics memory. Scrolling in graphics mode will take more time but should work resonably well.

I plan to set up drawing commands that would support: point set/reset, line drawing, box draw and fill, circle draw and fill.

The idea is that the host system will just send a series of commands to the display and it will do all the generation. To enhance speed, the display will only provide a busy/ready status pin. Edge clipping will be built into the display system.

Interface right now is RS-232, but it will support SPI and possibly a parallel mode using a 22V10 GAL.

Having said all that, would any of you be interested in having something like this? If so, what type of interface would you prefer (RS-232, SPI, Parallel, other?)

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 05, 2012 10:29 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
parallel port, a simple memory location or off a 65c22.

I had liked the Elm 320 by 200 using a CPLD, but an Atmel 40 such as a mega16 or meg32 wiuld be nice.

and to be a brat, a 256 by 256 resolution?

registers and addressing?
00 setup
01 character to poke
02 x location
03 y location

sorry, no brains today, but something easy...

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 05, 2012 11:26 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
Quote:
parallel port, a simple memory location or off a 65c22.

Hardwarewise, what would be even simpler and take fewer resources would be to use the 6522's shift register (through the CB1 & CB2 pins). Softwarewise it would be just as simple too. This synchronous serial would be even simpler than SPI and go at a speed of one bit per two 6502 clocks, meaning about four instructions per byte, assuming write-only and using one more hardware bit for the Atmel part to tell the 6502 if it's not ready for more data yet. For maximum speed (if it's an issue at all), the Atmel's input buffer should be big enough that the 6502 can send whole groups of bytes between buffer-full checks.

I'd be in favor of a choice of interfaces. That's how you'll get the most orders. Have the holes there to mount the 65SIB connector for SPI too. RS-232 would require a line receiver (a 1489 is cheap for receive-only and requires only 5V and takes less board space than the well known MAX232 which needs external capacitors), and the parallel port requires the 22V10, but users wouldn't have to pay for all the stuffing options, only the one(s) they want. It may take a jumper to tell the uC which interface to pay attention to, or maybe it would just use whichever one brings in valid data first after reset.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 12:50 am 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
Sofwatre would be simple, but ti would take more time as you would need to do shifting operations while doing simple memory addresses takes less opcodes.

(ok, am biased, we always did this method for the old arcade games)

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 3:09 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
I might not be quite accurate, but here's the way I'm imagining it going.

For simple text, you send out a stream consisting of a byte for command followed by 3 more for X-Y location (since 320 won't fit in a single byte), then the counted or null-terminated string. If the string were 20 characters, that's 24 bytes written to the VIA SR (all to the same address). Other commands could change the size, color, or angle of the next text to be sent.

Drawing an arc, polygon, etc. could be similar to how gerber files do it but probably more compact since the commands don't have to be readable text like gerber, and all written to the VIA SR address. Drawing an arc would mean sending the arc-command byte, the coordinates of the center of the circle, the radius, and the number of degrees where to begin and end the arc. That's no more than 11 bytes total, allowing for 16-bit signed numbers for circles whose centers are far outside the viewing area. The uC figures out the rest of how to draw it. "Pen" color and width are whatever you told it last, the default being 1 pixel.

Giving it raster data might include a command byte followed by the X-Y locations of two oposite corners of the area of interest, and then the raster data. An additional byte might tell it to overwrite, do AND, OR, XOR, etc., and whether to first keep a record of what was already there in case you want to restore it later.

I've thought of doing something like that for my raster graphics on analog oscilloscope.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 4:35 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1668
Location: Sacramento, CA
OK, I can add a synchronous serial interface for a VIA to the list easily enough.

I forgot to mention that I will have several fonts preloaded but the active font will be stored on RAM, so you can add a custom font. You can even store that font to on-board EEPROM so you don't have to reload it after every boot-up.

There is 128K of Flash so having all the graphics functions you want should not be an issue.

I am toying with the idea of supporting sprites also. Not sure yet if the refresh engine can handle that in real time or not. I have to test that.

The hard part will be finding an LCD that is inexpensive and is big enough to be useful in a decent quantity. I'd like to find one with LED backlights vs. CCFL to make the power supply easier too.

Would anyone be interested in composite video, or is direct LCD drive the first choice?

I might also play with driving a VGA monitor - even though the pixels will be pretty big. For that, I think I will need to scan two lines for each pixel to keep the aspect more square. That will be another experiment to test.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 4:56 am 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
This project sounds great, just what i needed!
For a while now i was wondering what i am going to do with my 68000 sbc, i planned to use the 6502 sbc as a workbench/tinkering computer, but the 68000 sbc has dma, and a math co-processor, and i would also like to make it of some use. As for the 6502 sbc, i already managed to get the 6847 CRTC working, so i will stick with it. I was looking on ebay for a big tft lcd screen for the 68000 sbc, but then i had the issue with the lcd controller(that is why i started that lcd interface topic). So this project just sounds what i needed, if possible i would like to be able to get a kit like package(just the components, and lcd, without the pcb) for a low price.

As for the interface, i prefer to interface with the cpu bus, like I've done with my 6502 sbc, the pic16f877 interface(for ps2 keyboard, rtc and lcd), since other methods require additional hardware. Also composite out would be great.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 7:42 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
Quote:
Would anyone be interested in composite video, or is direct LCD drive the first choice?

Would it matter, as long as you're handling all the intelligence in your product? Or is the idea that you wouldn't necessarily provide the screen itself, only the circuit board?

I was just thinking on the 8-bit port-- you could make it look like a printer couldn't you (except with a smaller connector than the big Centronics parallel connector)?

I didn't catch the first time around that it would just be monochrome, but that doesn't bother me a bit. If you can kind of standardize the interface, you could make it easy for your customers to make migration later to color (if there's a market for it, which I expect there will be).

I looked at your text-only display link, and I will comment that I like the DOS/ANSI [Edit: that should say IBM437] character set. I wish it were available in the GUIs, because the GUIs don't really have an equivalent where you always get smooth, unbroken lines of various kinds, let alone in 8-bit characters for program source code. My DOS text editor has facilities for drawing these that make it as easy as CAD, making source-code boxes, diagrams, tables, etc. much more attractive and clear, and the special characters used in engineering especially are available there, again in 8-bit bytes, like ±½°, φ2, 1μF, 50Ω, I²C, 2π, ΔT, etc.. I think that when I sent you the I²C code I had to try to convert it, and I was still left with some non-8-bit characters. The screen below is all done in 8-bit DOS/ANSI [Edit: that should say IBM437] characters, including the windowing boxes with their vertical and horizontal scroll bars and scrolling arrows at the ends of them.

Image

My EPROM programmer draws the socket and how to insert the EPROM, in color, again all in DOS/ANSI [Edit: that should say IBM437] characters.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 4:04 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
thought it would be easier interna programming wise to use a 256 bye 256 resolution. the oldl Game Plan arcade games were that resolution for that reason.

one thing super nice, this would make a fantastic debugging tool since the commands to create information would be quite simple. Think of an internal status display or debugging aid.... many good reasons....

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 4:22 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1668
Location: Sacramento, CA
256 across is easy. For NTSC, there are only 262.5 scan lines (non-interlaced) and I'm not sure that there are 256 that are actually visible.

I can test that once I get the composite output set up.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 06, 2012 4:33 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
yup so you dont need a 2 byte counter to rollover and all. Makes life easier :D

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 03, 2012 3:37 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1668
Location: Sacramento, CA
Still progressing slowly.

I have point set, point clear, line, box, fill box, circle, and fill circle graphics routines completed. Am debating on adding the clear line, box, circle, fills routines as well.

For text, I have basic text generation with scrolling up, down, left, and right on a character basis. I also have set up vertical smooth scrolling. However, new characters generated will not be offset based on partially scrolled lines (hope that makes sense).

I have the basic DOS font, two C-64 fonts, two PET fonts, and an Apple 2 font to select from. I still need to write the code to import a custom font. There is enough EEPROM to allow the custom font to be stored and reloaded. Those routines are finished.

Next will be adaptations to composite video and various input methods and buffers.

Final steps will be creating the command interface and writing a demo application to showcase the features.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 03, 2012 9:40 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
I wouldn't call that slow! Sounds awesome Daryl. How did you go about the circle coordinates? Lookup table?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 03, 2012 10:52 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 384
Location: Minnesota
Quote:
I have point set, point clear, line, box, fill box, circle, and fill circle graphics routines completed. Am debating on adding the clear line, box, circle, fills routines as well.


I don't know anything about the Amtel microcontroller's instruction set, but if it has an indirect jump of some sort you can write your top-level routines just once. Before you get into them you just set the jump to point to a "pixel set" or "pixel clear" routine. The top-level routines don't care what's going on at that level; as far as they're concerned they just call a "plot pixel here" routine whose first instruction is the indirect jump that points to whatever you're currently doing to pixels (set? clear? ORing with whatever's already there? Any of the, I think 16, possible monochrome raster ops).

Or you could do it with a flag. Either way, there's far less code duplication. If there's something in the memory layout that makes it easy to plot whole bytes at a time (for horizontal lines, perhaps), that's just an extension of the basic idea.

And clearing boxes makes it possible to easily re-write just sections of the screen without having to erase and re-create the unchanged parts as well. Speaking of which, I don't see "clear whole screen" in your list of operations, but surely it must be there?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 03, 2012 11:34 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
Quote:
And clearing boxes makes it possible to easily re-write just sections of the screen without having to erase and re-create the unchanged parts as well.

Would having layers make it easier, or harder? I can imagine situations where you would want to be able to move or change something without having to change what's behind it or leave a trail of black wherever it went.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: