6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 10:56 am

All times are UTC




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Thu Jun 08, 2023 4:53 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 491
GlennSmith wrote:
Hi,
Thanks for the write-up - have you made any further improvements ?

For your monitor, I'm very interested in what you've done - can you share your code in a downloadable format ?


Hi Glenn! I haven't done much work on this project since that last post. I got very busy with work towards the end of the season and packed up the computer lab. I do have a text file I was using to keep track of the source code for this thread. However, this is not the actual firmware; just the monitor code. The LCD and keyboard stuff for my system isn't in here. There is some level of abstraction, but it might take a bit of work to get this running on your own system.

The assembler dialect is the 8-bit mode of VASM: http://www.compilers.de/vasm.html

Attachment:
PAGIMON.txt [17.16 KiB]
Downloaded 66 times

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 08, 2023 5:28 pm 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 730
Location: Tokyo, Japan
Paganini wrote:
Another reason for using my existing LCD routines is that it gives me the chance to talk about how I modified them to work with the 4 x 20 LCD. Internally, the 4 x 20 LCD is a little bit strange. A single HD44780U can only display one or two 8-character lines. That means to get an 80 character display the manufacturers of 4 x 20 LCDs had to combine at least 5 of them. The way this works out in practice is that display line 3 is actually the second half of display line 1, and display line 4 is actually the second half of display line 2. This means that the display lines are interlaced. If you write off the end of line 1 you will appear not on line 2, but on line 3. Going off the end of line 3 brings you back to line 2, and from line 2 you go to line 4. Yikes!

It's not so strange if you understand the original design. I've not read the HD44780U data sheet in detail, but I did go through the ST7066 data sheet the other day (the HD44780U is a clone of the ST7066) and discovered some interesting things.

While the ST7066 itself has the hardware to support only one or two lines of 8 characters, the "firmware" supports two lines of 40 characters using an 80-byte frame buffer. While in standard form only characters 0-7 of each line are displayed, there's an "extension module" that adds the ability to support an additional display of two lines of 8 characters; this is simply extra I/O lines and driver hardware that displays characters 8-15 from the frame buffer.

What's going on here becomes apparent when you look at the commands; the %0001.sdxx command, with s=1 lets you shift the "head" of the frame buffer left and right. So each line in the display is actually an 8- or 16-character window into a virtual 40-character line in the frame buffer.

As a side note, 80 bytes is obviously far more memory than you need if you're not using this "virtual 40-character line" feature; even a two-line by 16-character display uses only 32 bytes of the frame buffer memory, leaving 48 bytes free. The data sheet itself also suggests what Michael suggested in an earlier post: that you can use this extra memory for whatever other purposes you like. It's not so useful on systems with a large amount of RAM, such as 16K or more, but if you're using something like a 6802 without external RAM, and thus have only 128 bytes of RAM available, I can see this being quite handy. (The presumption here is that you do have lots of ROM for the extra code to handle writing and reading that memory through the display's chip's interface.)

When manufacturers started cloning the chip, and especially when packaging such as PLCC with many more pins than DIP became available, they would usually include not just the extension module but another half extension module, allowing the ability to drive a two line by 20 character display. This still fit easily within the two-line by 40 character frame buffer concept, and so involved no changes to the interface at all.

Moving up to support a four-line by 20 character display was the obvious next step, but of course the manufacturers of the clone chips also wanted to maintain compatibility with the original chip, which meant that the virtual two-line 40-character display with a scrolling window had to be maintained for those that were using that with two-line displays. Unfortunately, expanding the frame buffer to four lines of 40 characters wasn't an option, because the %1aaa.aaaa "set DDRAM address" command has only 7 bits of address, so you can't address a 160 byte frame buffer. So instead they stuck with 80 bytes of frame buffer, and, when used for a four line display, made line three extend the "window" displayed by line one, and line four extend the "window" displayed by line two. This makes everything fit nicely in the existing 80-byte frame buffer interface, but of course introduces the "jumps" in addressing that you discovered.

_________________
Curt J. Sampson - github.com/0cjs


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 08, 2023 5:32 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Good digging - I like a bit of archaeology!


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 08, 2023 8:38 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
As a curiosity I've implemented an output device based on the 4x20 LCD display for my Ruby Boards. (It's connected to the VIA)

I'd already done it as a BCPL driver for the '816 system, bu this one is all in 65c02 code. I maintain a virtual framebuffer driver which is Acorn/BBC Micro compatible (as is the rest of the Ruby operating system), so I can use it under e.g. BBC Basic and cursor positioning, scrolling up/down, etc. all "just work".

Then I started on a "monitor" for it - somewhat of a backwards step for me as I consider the Ruby system to be an operating system than a monitor but what the heck, why not. I've incorporated the usual stuff - memory display, modifications and breakpoint handler as well as a disassembler (65c02) and I'm in the process of adding a 6x4 (24 key) keypad too because I can.

Picture here:

Attachment:
IMG_20230504_171256837.jpg
IMG_20230504_171256837.jpg [ 66.28 KiB | Viewed 1432 times ]


top line is basic ram address plus 5 bytes.
2nd line is ram address plus N bytes of the disassembly, then inside <> is the ASCII of the 5 bytes
3rd line is the disassembly.
4th is command.

The monitor ROM (implemented as a "language" ROM in Acorn/BBC Micro terms, so might even work in a Beeb) has fixed-entry point routines to do things like load file into RAM and save RAM into a file. Printing to the display is the same as printing to serial so a program that works on the display will work on serial and vice versa (I can run the monitor ROM on a serial terminal if I want)

Example under BBC Basic:

Attachment:
IMG_20230504_140732664.jpg
IMG_20230504_140732664.jpg [ 52.96 KiB | Viewed 1432 times ]


Not sure where this project is going yet, but it was a nice diversion.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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: