--- nono/vm/x68kkbd.cpp 2026/04/29 17:05:25 1.1.1.14 +++ nono/vm/x68kkbd.cpp 2026/04/29 17:05:29 1.1.1.15 @@ -32,13 +32,6 @@ X68030Keyboard::X68030Keyboard() { led.resize(7); - rept_event.func = ToEventCallback(&X68030Keyboard::ReptCallback); - rept_event.time = 0; - rept_event.Regist("Keyboard Repeat"); - - mouse_event.func = ToEventCallback(&X68030Keyboard::MouseCallback); - mouse_event.Regist("Mouse"); - monitor.func = ToMonitorCallback(&X68030Keyboard::MonitorUpdate); monitor.SetSize(47, 5); monitor.Regist(ID_MONITOR_KEYBOARD); @@ -61,6 +54,15 @@ X68030Keyboard::Init() scc = GetSCCDevice(); sysport = GetSysportDevice(); + rept_event.func = ToEventCallback(&X68030Keyboard::ReptCallback); + rept_event.time = 0; + rept_event.SetName("Keyboard Repeat"); + scheduler->RegistEvent(rept_event); + + mouse_event.func = ToEventCallback(&X68030Keyboard::MouseCallback); + mouse_event.SetName("Mouse"); + scheduler->RegistEvent(mouse_event); + return true; } @@ -113,10 +115,10 @@ X68030Keyboard::MonitorUpdate(Monitor *, // キーリピート screen.Puts(0, y, "Key Repeat:"); - screen.Print(12, y++, "Delay $%x(%4dmsec)", - rept_delay_data, (int)(rept_delay / 1_msec)); - screen.Print(12, y++, "Repeat $%x(%4dmsec)", - rept_time_data, (int)(rept_time / 1_msec)); + screen.Print(12, y++, "Delay $%x(%4umsec)", + rept_delay_data, (uint)(rept_delay / 1_msec)); + screen.Print(12, y++, "Repeat $%x(%4umsec)", + rept_time_data, (uint)(rept_time / 1_msec)); // マウス int mx = mouse_x; @@ -153,7 +155,7 @@ X68030Keyboard::MonitorUpdate(Monitor *, y++; // LED の明るさ (というより暗さ) - screen.Print(0, y++, "LED Darkness: %d", led_darkness); + screen.Print(0, y++, "LED Darkness: %u", led_darkness); } // 共通 keystat を X680x0 キーコードに変換して返す。 @@ -404,46 +406,46 @@ X68030Keyboard::Command(uint32 data) } else if (data < 0x48) { // $40-$47 MSCTRL 信号制御 // こいつは頻度が高いのでログレベルを上げておく - putlog(3, "Command MSCTRL control %d", (data & 1)); + putlog(3, "Command MSCTRL control %u", (data & 1)); } else if (data < 0x50) { // $48-$4f キーデータ送出許可 - putlog(1, "Command Key send enable %d (NOT IMPLEMENTED)", (data & 1)); + putlog(1, "Command Key send enable %u (NOT IMPLEMENTED)", (data & 1)); } else if (data < 0x54) { // $50-$53 ディスプレイ制御モード選択 // (実装不要) - putlog(2, "Command Display control mode %d", (data & 1)); + putlog(2, "Command Display control mode %u", (data & 1)); } else if (data < 0x58) { // $54-$57 LED 明るさ選択 // 0 が明るく 3 が暗いので、明るさというより暗さ。 led_darkness = (data & 3); - putlog(1, "Command LED brightness %d", led_darkness); + putlog(1, "Command LED brightness %u", led_darkness); } else if (data < 0x5c) { // $58-$5b 本体からのディスプレイ制御許可 // (実装不要) - putlog(2, "Command Display control enable %d", (data & 1)); + putlog(2, "Command Display control enable %u", (data & 1)); } else if (data < 0x60) { // $5c-$5f OPT.2 によるディスプレイ制御許可 // (実装不要) - putlog(2, "Command OPT2 control enable %d", (data & 1)); + putlog(2, "Command OPT2 control enable %u", (data & 1)); } else if (data < 0x70) { // $60-$6f リピートまでの時間 rept_delay_data = data & 15; rept_delay = 200_msec + rept_delay_data * 100_msec; - putlog(1, "Command Repeat Delay %d (%d msec)", rept_delay_data, - (int)(rept_delay / 1_msec)); + putlog(1, "Command Repeat Delay %u (%u msec)", rept_delay_data, + (uint)(rept_delay / 1_msec)); } else if (data < 0x80) { // $70-$7f リピート間隔 rept_time_data = data & 15; rept_time = 30_msec + rept_time_data * rept_time_data * 5_msec; - putlog(1, "Command Repeat time %d (%d msec)", rept_time_data, - (int)(rept_time / 1_msec)); + putlog(1, "Command Repeat time %d (%u msec)", rept_time_data, + (uint)(rept_time / 1_msec)); } else { // $80-$ff LED 制御