Psion Organiser II UDG Framebuffer, Part 1.75

In 2009 I wrote about using the user defined characters of the Hitachi HD44780 LCD controller as a poor man’s framebuffer. See this post for details about my experiments on a Psion Organiser II back then.

Well, somewhere this year I revisited that project and wrote a set of Psion OPL programs to create and manipulate a small framebuffer implemented in eight characters of the Psion’s little LCD. Actually, since I’m nowadays the proud owner of a Psion Organiser II model LZ64 , the LCD is larger than it was in 2009. ;)

The library of OPL programs is called UDGFB and is available on Github. Should I ever update it, expect it to appear there.

More technical details about UDGFB after the break…

The framebuffer uses the user-defined characters printed in the following configuration:

1
2
udg0 udg1 udg2 udg3
udg4 udg5 udg6 udg7

The following functions are defined:

  • clearfb:

    clears the framebuffer

  • printfb:(xpos, ypos)

    print framebuffer UDGs at location (xpos, ypos)

  • pset:(x, y, s)

    set pixel at (x, y) to state s, where “s” is 0 or 1

  • pixel%:(x, y)

    get value of pixel at (x, y)

  • blitup:

    scroll all pixels one row up, duplicates row 15

The following functions are for internal use:

  • pokeudg:(char, row, value)

    write value to udg row of udg character

  • peekudg%:(char, row)

    read byte defining row of udg character

An example of how to use UDGFB follows below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fbtest:
  local x%, y%

  clearfb:
  printfb:(8, 2)

  at 3,1
  print "Framebuffer Test";

  y%  = 0
  while y% <= 15
    x% = 0
    while x% <= 19
      pset:(x%, y%, 1)
      x% = x% + 1
    endwh
    y% = y% + 1
  endwh

  while y% >= 0
    x% = 19
    while x% >= 0
      pset:(x%, y%, 0)
      x% = x% - 2
    endwh
    y% = y% - 2
  endwh

  at 8,4 : print "done";

The techniques used should be easily adaptable to all HD44780 based LCD modules. I may have a go trying this on an Arduino and a bare character LCD module. But first I’d like to port UDGFB, or at least the most frequently called functions, to machine code for the Organiser II.

More in about a year or four. In this pace, that is… :)

Comments