1 // HD44780U.h - description. -*- C++ -*-
3 // Copyright (C) 1999, 2000 Red Hat.
4 // This file is part of SID and is licensed under the GPL.
5 // See the file COPYING.SID for conditions for redistribution.
8 #define HD44780U_DEF_H 1
12 #include <sidcomputil.h>
13 #include <sidbusutil.h>
14 #include <sidpinutil.h>
15 #include <sidattrutil.h>
16 #include <sidschedutil.h>
17 #include <sidwatchutil.h>
19 static const int DRAM_SIZE = 80;
20 static const int CGRAM_SIZE = 64;
21 static const int ROM_SIZE = 256;
32 using sid::host_int_1;
33 using sid::host_int_4;
35 using namespace sidutil;
37 class HD44780U: public virtual component,
38 public no_accessor_component,
39 public fixed_attribute_map_component,
40 public no_relation_component,
41 public fixed_bus_map_component,
42 public fixed_pin_map_component
46 /* The following pin replaces 58(!) pins on the real chip.
47 * Instead of 16 row and 40 column selectors, I encode the row and column
48 * on the row_col pin. The pin is only driven if the pixel is on.
50 output_pin row_col_pin; // single pixel on/off at [row,col]
52 /* The frame pin is a synthetic pin added to tell the display when a
53 * refresh is starting/ending.
58 host_int_1 ir; // instruction register
59 host_int_1 dr; // data register
60 host_int_1 ac; // address counter
63 char two_lines; // two lines if non-zero
64 char big_font; // 5X10 font if non-zero
65 char display; // display on/off
66 char cursor; // cursor on/off
67 char blink; // blink on/off
68 char incr; // incr/decr
71 host_int_1 dram[DRAM_SIZE]; // data ram
72 host_int_1 cgram[CGRAM_SIZE]; // character generator ram
73 host_int_1 rom[ROM_SIZE][8]; // stored character rom
74 host_int_1 rom10[32][11]; // 5X10 character rom
76 bool access_cgram; // access DDRAM vs CGRAM
80 void incr_ac(); // inc/dec ac
86 friend class callback_byte_bus<HD44780U>;
87 callback_byte_bus<HD44780U> busif;
89 sid::bus::status busRead( host_int_4 laddr, host_int_1& data );
90 sid::bus::status busWrite( host_int_4 laddr, host_int_1 data );
92 void execute( unsigned char );
94 // send DDRAM contents to the display
97 friend class scheduler_event_subscription<HD44780U>;
98 scheduler_event_subscription<HD44780U> refresh_sync;
106 int current_schedule; // one of the above
107 host_int_4 refresh_period; // in milliseconds
109 bool blinking_chars_are_visible;
111 // Triggerpoint manager
112 friend class self_watcher<HD44780U>;
113 self_watcher<HD44780U> trigger_mgr;
115 // Virtual pin interfaces between self_watcher and fixed_pin_map_component
116 sid::component::status
117 pin_factory( const string& n ) { return trigger_mgr.create_virtual_pin(n); }
120 pin_junkyard( const string& n ) { trigger_mgr.destroy_virtual_pin( n ); }
126 HD44780U( bool use_japan_rom );
130 ~HD44780U () throw() {}
135 component::status restore_state( const string& state );
137 friend ostream& operator << (ostream& op, const HD44780U& copy_obj);
138 friend istream& operator >> (istream& ip, HD44780U& ovwrite_obj);
141 #endif // HD44780U_DEF_H