1 // license:GPL-2.0+ 2 // copyright-holders:Raphael Nabet 3 #ifndef MAME_VIDEO_911_VDT_H 4 #define MAME_VIDEO_911_VDT_H 5 6 #pragma once 7 8 #include "sound/beep.h" 9 #include "emupal.h" 10 #include "screen.h" 11 12 #define vdt911_chr_region ":gfx1" 13 14 class vdt911_device : public device_t, public device_gfx_interface 15 { 16 public: 17 enum 18 { 19 /* 10 bytes per character definition */ 20 single_char_len = 10, 21 22 US_chr_offset = 0, 23 UK_chr_offset = US_chr_offset+128*single_char_len, 24 german_chr_offset = UK_chr_offset+128*single_char_len, 25 swedish_chr_offset = german_chr_offset+128*single_char_len, 26 norwegian_chr_offset = swedish_chr_offset+128*single_char_len, 27 frenchWP_chr_offset = norwegian_chr_offset+128*single_char_len, 28 japanese_chr_offset = frenchWP_chr_offset+128*single_char_len, 29 30 chr_region_len = japanese_chr_offset+256*single_char_len 31 }; 32 33 enum class screen_size { char_960 = 0, char_1920 }; 34 35 enum class model 36 { 37 US = 0, 38 UK, 39 French, 40 German, 41 Swedish, // Swedish/Finnish 42 Norwegian, // Norwegian/Danish 43 Japanese, // Katakana Japanese 44 /*Arabic,*/ // Arabic 45 FrenchWP // French word processing 46 }; 47 48 vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 49 50 uint8_t cru_r(offs_t offset); 51 void cru_w(offs_t offset, uint8_t data); 52 keyint_cb()53 auto keyint_cb() { return m_keyint_line.bind(); } lineint_cb()54 auto lineint_cb() { return m_lineint_line.bind(); } 55 56 protected: 57 // device-level overrides 58 void device_start() override; 59 void device_reset() override; 60 virtual void device_add_mconfig(machine_config &config) override; 61 ioport_constructor device_input_ports() const override; 62 63 void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 64 65 private: 66 void refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y); 67 void check_keyboard(); 68 69 void vdt911_palette(palette_device &palette) const; 70 71 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 72 73 screen_size m_screen_size; // char_960 for 960-char, 12-line model; char_1920 for 1920-char, 24-line model 74 model m_model; // country code 75 76 uint8_t m_data_reg; // dt911 write buffer 77 uint8_t m_display_RAM[2048]; // vdt911 char buffer (1kbyte for 960-char model, 2kbytes for 1920-char model) 78 79 unsigned int m_cursor_address; // current cursor address (controlled by the computer, affects both display and I/O protocol) 80 unsigned int m_cursor_address_mask; // 1023 for 960-char model, 2047 for 1920-char model 81 82 emu_timer *m_beep_timer; // beep clock (beeps ends when timer times out) 83 emu_timer *m_blink_timer; // cursor blink clock 84 emu_timer *m_line_timer; // screen line timer 85 86 uint8_t m_keyboard_data; // last code pressed on keyboard 87 bool m_keyboard_data_ready; // true if there is a new code in keyboard_data 88 bool m_keyboard_interrupt_enable; // true when keyboard interrupts are enabled 89 90 bool m_display_enable; // screen is black when false 91 bool m_dual_intensity_enable; // if true, MSBit of ASCII codes controls character highlight 92 bool m_display_cursor; // if true, the current cursor location is displayed on screen 93 bool m_blinking_cursor_enable; // if true, the cursor will blink when displayed 94 bool m_blink_state; // current cursor blink state 95 96 bool m_word_select; // CRU interface mode 97 bool m_previous_word_select; // value of word_select is saved here 98 99 uint8_t m_last_key_pressed; 100 int m_last_modifier_state; 101 char m_foreign_mode; 102 103 required_device<beep_device> m_beeper; 104 required_device<screen_device> m_screen; 105 required_ioport_array<6> m_keys; 106 107 devcb_write_line m_keyint_line; 108 devcb_write_line m_lineint_line; 109 }; 110 111 DECLARE_DEVICE_TYPE(VDT911, vdt911_device) 112 113 #endif // MAME_VIDEO_911_VDT_H 114