Skip to content

Commit a2c3599

Browse files
committed
suppoet kana on paste
1 parent 054098e commit a2c3599

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/vm/bmjr/memory.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ void MEMORY::reset()
129129
drec_bit = drec_in = false;
130130

131131
key_column = 0;
132+
kana_mode = false;
133+
kana_pulse = 0;
132134
nmi_enb = break_pressed = false;
133135

134136
sound_sample = 0;
@@ -269,6 +271,10 @@ void MEMORY::event_frame()
269271
{
270272
blink_count++;
271273

274+
if(kana_pulse != 0) {
275+
kana_pulse--;
276+
}
277+
272278
timer_irq_req = true;
273279
update_irq_line();
274280

@@ -297,6 +303,17 @@ void MEMORY::update_key_data()
297303
if(key_stat[0xa1]) key_data &= ~0x40; // カナ記号 -> R-SHIFT
298304
if(key_stat[0xa3]) key_data &= ~0x80; // カナ -> R-CTRL
299305
#endif
306+
if(kana_mode && key_stat[0xa0]) {
307+
key_data |= 0x20;
308+
key_data &= ~0x40;
309+
}
310+
if(kana_pulse != 0) {
311+
if(kana_mode) {
312+
key_data &= ~0x80;
313+
} else {
314+
key_data &= ~0x10;
315+
}
316+
}
300317
}
301318

302319
void MEMORY::update_irq_line()
@@ -307,6 +324,11 @@ void MEMORY::update_irq_line()
307324

308325
void MEMORY::key_down(int code)
309326
{
327+
if(code == VK_KANA) {
328+
kana_mode = !kana_mode;
329+
kana_pulse = 8;
330+
update_key_data();
331+
}
310332
// pause -> break
311333
if(code == 0x13) {
312334
if(nmi_enb) {

src/vm/bmjr/memory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class MEMORY : public DEVICE
5454
uint32_t drec_clock;
5555

5656
uint8_t key_column, key_data;
57+
bool kana_mode;
58+
int kana_pulse;
5759
bool nmi_enb;
5860
bool break_pressed;
5961

0 commit comments

Comments
 (0)