void bios0x1c(void) { UINT8 buf[6]; switch(CPU_AH) { case 0x00: // get system timer calendar_get(buf); MEMR_WRITES(CPU_ES, CPU_BX, buf, 6); break; case 0x01: // put system timer MEMR_READS(CPU_ES, CPU_BX, buf, 6); mem[MEMB_MSW8] = buf[0]; calendar_set(buf); break; case 0x02: // set interval timer (single) SETBIOSMEM16(0x0001c, CPU_BX); SETBIOSMEM16(0x0001e, CPU_ES); SETBIOSMEM16(0x0058a, CPU_CX); iocore_out8(0x77, 0x36); /* through */ case 0x03: // continue interval timer iocore_out8(0x71, 0x00); if (pccore.cpumode & CPUMODE_8MHZ) { iocore_out8(0x71, 0x4e); // 4MHz } else { iocore_out8(0x71, 0x60); // 5MHz } pic.pi[0].imr &= ~(PIC_SYSTEMTIMER); break; } }
static void ok_button_clicked(GtkButton *b, gpointer d) { UINT8 calendar_buf[8]; const gchar *entryp; BOOL renewal; UINT8 val; int i; renewal = FALSE; if (np2cfg.calendar != calendar_kind) { renewal = TRUE; } if (!np2cfg.calendar) { memset(calendar_buf, 0, sizeof(calendar_buf)); for (i = 0; i < NELEMENTS(vircal); i++) { entryp = gtk_entry_get_text(GTK_ENTRY(vircal[i].entry)); val = getbcd(entryp, 2); if (val >= vircal[i].min && val <= vircal[i].max) { if (i == 1) { val = ((val & 0x10) * 10) + (val << 4); } calendar_buf[i] = (UINT8)val; } else { break; } } if (i == NELEMENTS(vircal)) { calendar_set(calendar_buf); } else { renewal = FALSE; } } if (renewal) { np2cfg.calendar = calendar_kind; sysmng_update(SYS_UPDATECFG); } gtk_widget_destroy((GtkWidget *)d); }
LRESULT CALLBACK ClndDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { TCHAR work[32]; UINT8 b; int i; HWND subwnd; switch (msg) { case WM_INITDIALOG: // 時間をセット。 calendar_getvir(cbuf); set_cal2dlg(hWnd, cbuf); if (np2cfg.calendar) { vircalendar(hWnd, FALSE); subwnd = GetDlgItem(hWnd, IDC_CLNDREAL); } else { vircalendar(hWnd, TRUE); subwnd = GetDlgItem(hWnd, IDC_CLNDVIR); } SendMessage(subwnd, BM_SETCHECK, TRUE, 0); SetFocus(subwnd); return(FALSE); case WM_COMMAND: switch(LOWORD(wp)) { case IDOK: b = (UINT8)GetDlgItemCheck(hWnd, IDC_CLNDREAL); if (np2cfg.calendar != b) { np2cfg.calendar = b; sysmng_update(SYS_UPDATECFG); } for (i=0; i<6; i++) { GetDlgItemText(hWnd, vircal[i].res, work, NELEMENTS(work)); b = getbcd(work, 2); if ((b >= vircal[i].min) && (b <= vircal[i].max)) { if (i == 1) { b = ((b & 0x10) * 10) + (b << 4); } cbuf[i] = b; } } calendar_set(cbuf); EndDialog(hWnd, IDOK); break; case IDCANCEL: EndDialog(hWnd, IDCANCEL); break; case IDC_CLNDVIR: vircalendar(hWnd, TRUE); return(FALSE); case IDC_CLNDREAL: vircalendar(hWnd, FALSE); return(FALSE); case IDC_SETNOW: calendar_getreal(cbuf); set_cal2dlg(hWnd, cbuf); return(FALSE); default: return(FALSE); } break; case WM_CLOSE: PostMessage(hWnd, WM_COMMAND, IDCANCEL, 0); break; default: return(FALSE); } return(TRUE); }