Close

20230212d -- LCD Display

A project log for ROM Disassembly - AlphaSmart Pro

Wherein I disassemble the ROM from a vintage typewriter-thing

ziggurat29ziggurat29 02/15/2023 at 19:452 Comments

The LCD is a 40x4 character display.  Judging by my friend [Eric]'s@EricHertz photos, this is not the common HD44780 device, but instead a Mitusbish M50530

I did find a datasheet for this device.  If it's not code compatible with the '44780, it sure is similar in operation.  Perhaps later I'll compare datasheets.

It seems we're operating in 4-bit mode, using Port D bits 5-2 for data.  I haven't figured out the other control lines, but PAb7 seems to be the one that strobes the data.  There has to be at least one more that controls 'data/instruction'.  I found several routines that fiddle with it, and have deduced these things:

This is called once during system boot, just prior to displaying

EC16             lcdInit_EC16:
EC16 15 5B 01        bclr    unk_5B 1
EC19 15 5B 02        bclr    unk_5B 2
EC1C             loop_EC1C:
EC1C BD EC 45        jsr     sub_EC45        ; XXX LCD related??? gpio flicking, PA7 high/low. return PD in A ; $8000 stuff
EC1F 84 20           anda    #$20 ; ' '      ; wait for LCD 'ready'
EC21 26 F9           bne     loop_EC1C
EC23 C6 DB           ldab    #$DB ; '¦'      ; LCD SF:  nybble mode, 5x8 font, 4x40
EC25 BD F6 74        jsr     sendLCDbyte_F674 ; send byte in B to LCD
EC28 C6 50           ldab    #$50 ; 'P'      ; LCD SE:  cursor increments after write, no change in display address start address
EC2A BD F6 74        jsr     sendLCDbyte_F674 ; send byte in B to LCD
EC2D C6 3B           ldab    #$3B ; ';'      ; LCD SD:  Display On, Cursor On, Underline Off, Cursor Blink, Character Blink
EC2F BD F6 74        jsr     sendLCDbyte_F674 ; send byte in B to LCD
EC32 C6 0D           ldab    #$D             ; LCD SU: set/reset mode cancelled
EC34 BD F6 74        jsr     sendLCDbyte_F674 ; send byte in B to LCD
EC37 C6 05           ldab    #5              ; LCD SB: set blink frequency
EC39 BD F6 74        jsr     sendLCDbyte_F674 ; send byte in B to LCD
EC3C C6 01           ldab    #1              ; LCD CH: clear display and home
EC3E BD F6 74        jsr     sendLCDbyte_F674 ; send byte in B to LCD
EC41 14 5B 02        bset    unk_5B 2
EC44 39              rts

I found some others related to sending a byte to the display (used both for commands and data) @ F674, and emitting nul-terminated text @F669, and several 'set cursor position' routines for setting the cursor position at the beginning of each of the 4 lines @ F748, F74E, F754, F75A.

Discussions

Eric Hertz wrote 02/16/2023 at 11:38 point

After reading through your logs;

LOL yer buddy Eric is quite a punk leaving you with little more than a ROM dump and poor photos to derive so many things!

Thought, I'm shocked at what you have...

4-bit mode?! On GPIOs, no-less...

I dunno how you figured out addresses. It makes a tiny bit of sense you might be able to grep the binary for whatever seems like string addresses, to find and figure out functions. But without any hardware-schematics to indicate mapping.... Seriously: Nice sleuthing!

And these instruction mnemonics... I mean... is it just me, or do they seem far more obtuse than our beloved z80's?

Oh and the keyboard scancode decyphering.... Seems entirely logical from your findings, though I'm a bit surprised the rows/cols amount to sequential results. Seems they thought about this before implementing it.

Meanwhile, I am capable of beeping out some traces, but it seems you'd figure it out before I could!

BTW to viewers: I have seen time and again that @ziggurat29 is an expert sleuther in such matters; I thought due to his expertise with Z80's... but obviously I was mistaken!

  Are you sure? yes | no

ziggurat29 wrote 02/16/2023 at 12:17 point

actually, I'm enjoying at the moment the extra challenge of puzzling it out without schematics, but I'm sure this will be an obstacle at some point.  Your photos are a huge leg-up.  Knowing some things from the board photo was critical:  the xtal freq, being able to count the conductors on the two keyboard ribbon cables, the part number of the LCD controller, and the suffix on the 68HC11.  The list of TTL part numbers, and just their placement provided insights into things that would be much more difficult to puzzle out otherwise.

If and when we get around to buzzing things out, the '138 will be interesting.  I'm still in the dark on the ADB and PS/2 connectors, but I think I can figure it out.  I remember a bit about PS/2 emulation from my TRS-80 emulator work.

Yes, the mnemonics were/are an adjustment.  But I must admit I'm a bit impressed with what can be done with only two accumulators and two index registers.

I'm about 3 days behind in posting my logs. (often authoring/editing the logs takes more time than the work being reported)  There's a lot more coming.

  Are you sure? yes | no