void dfs(int now){ if( now==n-1 ){ int c = (1<<n) - 1 - x; if( !illegal(c) ) ++ans; } else { int less = (1<<n)-1-x; while( less ){ int c = lb(less); less-=c; if( illegal(c) ) continue; else { x+=c; z+=c<<now; s+=c<<(n-now-1); dfs(now+1); x-=c; z-=c<<now; s-=c<<(n-now-1); } } } }
char * validatefile(char *f) { char *p; if(f == nil || *f == '\0') return nil; if(strcmp(f, "..") == 0 || strlen(f) >= 250) return illegal(f); for(p = f; *p; p++) if(*p < 040 || *p == '/') return illegal(f); return f; }
int check(int way[]) { int up=0; int tmp; int i; for(i=0; i<3; i++) up = up*10+way[i]; for(i=3; i<5; i++) { tmp = up*way[i]; if(!illegal(tmp) || tmp/1000) return 0; } tmp = up*way[3]*10+up*way[4]; if(!illegal(tmp) || tmp/10000) return 0; return 1; }
void pic16c62x_device::tris() { switch(m_opcode.b.l & 0x7) { case 05: STORE_REGFILE(0x85, m_W); break; case 06: STORE_REGFILE(0x86, m_W); break; default: illegal(); break; } }
void KardWidget::mousePressEvent(QMouseEvent * ) { // emit clicked() only if card not already clicked if (m_gray->isVisible()==true) { emit clicked(); } else { emit illegal(); //is it compulsory? } }
int editor_type::global (std::wstring::const_iterator& s, command_type& ct) { std::wstring illegal (L"gvqu"); command_type rct; if (! scanner.get (s, rct) || illegal.find (rct.command) != std::wstring::npos) return '?'; if ('?' == markglobal (ct) || '?' == sweepglobal (rct)) return '?'; return ct.command; }
static void tris(void) { switch(R.opcode.b.l & 0x7) { case 05: if (R.TRISA == R.W) break; else R.TRISA = R.W; P_OUT(0,R.PORTA & (~R.TRISA) & 0xf); break; case 06: if (R.TRISB == R.W) break; else R.TRISB = R.W; P_OUT(1,R.PORTB & (~R.TRISB)); break; case 07: if (R.TRISC == R.W) break; else R.TRISC = R.W; P_OUT(2,R.PORTC & (~R.TRISC)); break; default: illegal(); break; } }
static void store_long(void) { u_int16_t addr, indirect; switch (DST_MODE) { case 0: regs[DST_REG]= dstlong; return; case 1: addr = regs[DST_REG]; sl_long(addr, dstlong) return; case 2: addr = regs[DST_REG]; sl_long(addr, dstlong) regs[DST_REG] += 4; return; case 3: indirect = regs[DST_REG]; ll_word(indirect, addr); regs[DST_REG] += 4; sl_long(addr, dstlong); return; case 4: regs[DST_REG] -= 4; addr = regs[DST_REG]; sl_long(addr, dstlong); return; case 5: regs[DST_REG] -= 4; indirect = regs[DST_REG]; ll_word(indirect, addr); sl_long(addr, dstlong); return; case 6: lli_word(regs[PC], indirect); regs[PC] += 2; addr = regs[DST_REG] + indirect; sl_long(addr, dstlong); return; case 7: lli_word(regs[PC], indirect); regs[PC] += 2; indirect = regs[DST_REG] + indirect; ll_word(indirect, addr); sl_long(addr, dstlong); return; } illegal(); }
TiXmlElement* ConfigManager::AssertPath(wxString& path) { Collapse(path); wxString illegal(_T(" -:.\"\'$&()[]<>+#")); size_t i = 0; while ((i = path.find_first_of(illegal, i)) != wxString::npos) path[i] = _T('_'); TiXmlElement *localPath = pathNode ? pathNode : root; if (path.GetChar(0) == '/') // absolute path { localPath = root; path = path.Mid(1); } if (path.find(_T('/')) != wxString::npos) // need for path walking to_lower(path); wxString sub; while (path.find(_T('/')) != wxString::npos) { sub = path.BeforeFirst(_T('/')); path = path.AfterFirst(_T('/')); if (localPath != root && sub.IsSameAs(CfgMgrConsts::dotDot)) localPath = localPath->Parent()->ToElement(); else if (sub.GetChar(0) < _T('a') || sub.GetChar(0) > _T('z')) { cbThrow(InvalidNameMessage(_T("subpath"), sub, localPath)); } else { TiXmlElement* n = localPath->FirstChildElement(cbU2C(sub)); if (n) localPath = n; else localPath = (TiXmlElement*) localPath->InsertEndChild(TiXmlElement(cbU2C(sub))); } } to_upper(path); if (!path.IsEmpty() && (path.GetChar(0) < _T('A') || path.GetChar(0) > _T('Z'))) cbThrow(InvalidNameMessage(_T("key"), path, localPath)); return localPath; }
int main(int argc, char **argv) { if (argc < 2) ft_display2(); if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0') illegal_truc(); else if (argc == 3 && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0' && error_nb(argv[2], "-c") != -10) bug_chelou(); else if (argc == 3) illegal(argv); else ft_display(argc, argv); return (0); }
1196 mili secs for large data set
/* execute instructions on this CPU until icount expires */ void m6805_base_device::execute_run() { UINT8 ireg; S = SP_ADJUST( S ); /* Taken from CPU_SET_CONTEXT when pointer'afying */ do { if (m_pending_interrupts != 0) { interrupt(); } debugger_instruction_hook(this, PC); ireg=M_RDOP(PC++); switch( ireg ) { case 0x00: brset(0x01); break; case 0x01: brclr(0x01); break; case 0x02: brset(0x02); break; case 0x03: brclr(0x02); break; case 0x04: brset(0x04); break; case 0x05: brclr(0x04); break; case 0x06: brset(0x08); break; case 0x07: brclr(0x08); break; case 0x08: brset(0x10); break; case 0x09: brclr(0x10); break; case 0x0A: brset(0x20); break; case 0x0B: brclr(0x20); break; case 0x0C: brset(0x40); break; case 0x0D: brclr(0x40); break; case 0x0E: brset(0x80); break; case 0x0F: brclr(0x80); break; case 0x10: bset(0x01); break; case 0x11: bclr(0x01); break; case 0x12: bset(0x02); break; case 0x13: bclr(0x02); break; case 0x14: bset(0x04); break; case 0x15: bclr(0x04); break; case 0x16: bset(0x08); break; case 0x17: bclr(0x08); break; case 0x18: bset(0x10); break; case 0x19: bclr(0x10); break; case 0x1a: bset(0x20); break; case 0x1b: bclr(0x20); break; case 0x1c: bset(0x40); break; case 0x1d: bclr(0x40); break; case 0x1e: bset(0x80); break; case 0x1f: bclr(0x80); break; case 0x20: bra(); break; case 0x21: brn(); break; case 0x22: bhi(); break; case 0x23: bls(); break; case 0x24: bcc(); break; case 0x25: bcs(); break; case 0x26: bne(); break; case 0x27: beq(); break; case 0x28: bhcc(); break; case 0x29: bhcs(); break; case 0x2a: bpl(); break; case 0x2b: bmi(); break; case 0x2c: bmc(); break; case 0x2d: bms(); break; case 0x2e: bil(); break; case 0x2f: bih(); break; case 0x30: neg_di(); break; case 0x31: illegal(); break; case 0x32: illegal(); break; case 0x33: com_di(); break; case 0x34: lsr_di(); break; case 0x35: illegal(); break; case 0x36: ror_di(); break; case 0x37: asr_di(); break; case 0x38: lsl_di(); break; case 0x39: rol_di(); break; case 0x3a: dec_di(); break; case 0x3b: illegal(); break; case 0x3c: inc_di(); break; case 0x3d: tst_di(); break; case 0x3e: illegal(); break; case 0x3f: clr_di(); break; case 0x40: nega(); break; case 0x41: illegal(); break; case 0x42: illegal(); break; case 0x43: coma(); break; case 0x44: lsra(); break; case 0x45: illegal(); break; case 0x46: rora(); break; case 0x47: asra(); break; case 0x48: lsla(); break; case 0x49: rola(); break; case 0x4a: deca(); break; case 0x4b: illegal(); break; case 0x4c: inca(); break; case 0x4d: tsta(); break; case 0x4e: illegal(); break; case 0x4f: clra(); break; case 0x50: negx(); break; case 0x51: illegal(); break; case 0x52: illegal(); break; case 0x53: comx(); break; case 0x54: lsrx(); break; case 0x55: illegal(); break; case 0x56: rorx(); break; case 0x57: asrx(); break; case 0x58: aslx(); break; case 0x59: rolx(); break; case 0x5a: decx(); break; case 0x5b: illegal(); break; case 0x5c: incx(); break; case 0x5d: tstx(); break; case 0x5e: illegal(); break; case 0x5f: clrx(); break; case 0x60: neg_ix1(); break; case 0x61: illegal(); break; case 0x62: illegal(); break; case 0x63: com_ix1(); break; case 0x64: lsr_ix1(); break; case 0x65: illegal(); break; case 0x66: ror_ix1(); break; case 0x67: asr_ix1(); break; case 0x68: lsl_ix1(); break; case 0x69: rol_ix1(); break; case 0x6a: dec_ix1(); break; case 0x6b: illegal(); break; case 0x6c: inc_ix1(); break; case 0x6d: tst_ix1(); break; case 0x6e: illegal(); break; case 0x6f: clr_ix1(); break; case 0x70: neg_ix(); break; case 0x71: illegal(); break; case 0x72: illegal(); break; case 0x73: com_ix(); break; case 0x74: lsr_ix(); break; case 0x75: illegal(); break; case 0x76: ror_ix(); break; case 0x77: asr_ix(); break; case 0x78: lsl_ix(); break; case 0x79: rol_ix(); break; case 0x7a: dec_ix(); break; case 0x7b: illegal(); break; case 0x7c: inc_ix(); break; case 0x7d: tst_ix(); break; case 0x7e: illegal(); break; case 0x7f: clr_ix(); break; case 0x80: rti(); break; case 0x81: rts(); break; case 0x82: illegal(); break; case 0x83: swi(); break; case 0x84: illegal(); break; case 0x85: illegal(); break; case 0x86: illegal(); break; case 0x87: illegal(); break; case 0x88: illegal(); break; case 0x89: illegal(); break; case 0x8a: illegal(); break; case 0x8b: illegal(); break; case 0x8c: illegal(); break; case 0x8d: illegal(); break; case 0x8e: illegal(); break; case 0x8f: illegal(); break; case 0x90: illegal(); break; case 0x91: illegal(); break; case 0x92: illegal(); break; case 0x93: illegal(); break; case 0x94: illegal(); break; case 0x95: illegal(); break; case 0x96: illegal(); break; case 0x97: tax(); break; case 0x98: CLC; break; case 0x99: SEC; break; #if IRQ_LEVEL_DETECT case 0x9a: CLI; if (m_irq_state != CLEAR_LINE) m_pending_interrupts |= 1 << M6805_IRQ_LINE; break; #else case 0x9a: CLI; break; #endif case 0x9b: SEI; break; case 0x9c: rsp(); break; case 0x9d: nop(); break; case 0x9e: illegal(); break; case 0x9f: txa(); break; case 0xa0: suba_im(); break; case 0xa1: cmpa_im(); break; case 0xa2: sbca_im(); break; case 0xa3: cpx_im(); break; case 0xa4: anda_im(); break; case 0xa5: bita_im(); break; case 0xa6: lda_im(); break; case 0xa7: illegal(); break; case 0xa8: eora_im(); break; case 0xa9: adca_im(); break; case 0xaa: ora_im(); break; case 0xab: adda_im(); break; case 0xac: illegal(); break; case 0xad: bsr(); break; case 0xae: ldx_im(); break; case 0xaf: illegal(); break; case 0xb0: suba_di(); break; case 0xb1: cmpa_di(); break; case 0xb2: sbca_di(); break; case 0xb3: cpx_di(); break; case 0xb4: anda_di(); break; case 0xb5: bita_di(); break; case 0xb6: lda_di(); break; case 0xb7: sta_di(); break; case 0xb8: eora_di(); break; case 0xb9: adca_di(); break; case 0xba: ora_di(); break; case 0xbb: adda_di(); break; case 0xbc: jmp_di(); break; case 0xbd: jsr_di(); break; case 0xbe: ldx_di(); break; case 0xbf: stx_di(); break; case 0xc0: suba_ex(); break; case 0xc1: cmpa_ex(); break; case 0xc2: sbca_ex(); break; case 0xc3: cpx_ex(); break; case 0xc4: anda_ex(); break; case 0xc5: bita_ex(); break; case 0xc6: lda_ex(); break; case 0xc7: sta_ex(); break; case 0xc8: eora_ex(); break; case 0xc9: adca_ex(); break; case 0xca: ora_ex(); break; case 0xcb: adda_ex(); break; case 0xcc: jmp_ex(); break; case 0xcd: jsr_ex(); break; case 0xce: ldx_ex(); break; case 0xcf: stx_ex(); break; case 0xd0: suba_ix2(); break; case 0xd1: cmpa_ix2(); break; case 0xd2: sbca_ix2(); break; case 0xd3: cpx_ix2(); break; case 0xd4: anda_ix2(); break; case 0xd5: bita_ix2(); break; case 0xd6: lda_ix2(); break; case 0xd7: sta_ix2(); break; case 0xd8: eora_ix2(); break; case 0xd9: adca_ix2(); break; case 0xda: ora_ix2(); break; case 0xdb: adda_ix2(); break; case 0xdc: jmp_ix2(); break; case 0xdd: jsr_ix2(); break; case 0xde: ldx_ix2(); break; case 0xdf: stx_ix2(); break; case 0xe0: suba_ix1(); break; case 0xe1: cmpa_ix1(); break; case 0xe2: sbca_ix1(); break; case 0xe3: cpx_ix1(); break; case 0xe4: anda_ix1(); break; case 0xe5: bita_ix1(); break; case 0xe6: lda_ix1(); break; case 0xe7: sta_ix1(); break; case 0xe8: eora_ix1(); break; case 0xe9: adca_ix1(); break; case 0xea: ora_ix1(); break; case 0xeb: adda_ix1(); break; case 0xec: jmp_ix1(); break; case 0xed: jsr_ix1(); break; case 0xee: ldx_ix1(); break; case 0xef: stx_ix1(); break; case 0xf0: suba_ix(); break; case 0xf1: cmpa_ix(); break; case 0xf2: sbca_ix(); break; case 0xf3: cpx_ix(); break; case 0xf4: anda_ix(); break; case 0xf5: bita_ix(); break; case 0xf6: lda_ix(); break; case 0xf7: sta_ix(); break; case 0xf8: eora_ix(); break; case 0xf9: adca_ix(); break; case 0xfa: ora_ix(); break; case 0xfb: adda_ix(); break; case 0xfc: jmp_ix(); break; case 0xfd: jsr_ix(); break; case 0xfe: ldx_ix(); break; case 0xff: stx_ix(); break; } m_icount -= m_cycles1[ireg]; } while( m_icount > 0 ); }
void ConfigManager::DeleteSubPath(const wxString& thePath) { if (doc->ErrorId()) { cbMessageBox(wxString(_T("### TinyXML error:\n")) << cbC2U(doc->ErrorDesc())); doc->ClearError(); } wxString path(thePath); to_lower(path); Collapse(path); wxString illegal(_T(" :.,;!\"\'$%&()[]<>{}?*+-|#")); size_t i; while ((i = path.find_first_of(illegal)) != wxString::npos) path[i] = _T('_'); if (path.Last() == _T('/')) path.RemoveLast(); if (path.IsSameAs(_T("/"))) // this function will refuse to remove root! return; TiXmlElement* parent = pathNode ? pathNode : root; if (path.find(_T('/')) != wxString::npos) { wxString sub; do { sub = path.BeforeFirst(_T('/')); path = path.AfterFirst(_T('/')); if (sub.IsEmpty()) parent = root; else if (sub.IsSameAs(_T("."))) ; else if (parent != root && sub.IsSameAs(_T(".."))) parent = parent->Parent()->ToElement(); else { TiXmlElement* n = parent->FirstChildElement(cbU2C(sub)); if (n) parent = n; else return; } } while (path.find(_T('/')) != wxString::npos); } if (!path.IsEmpty()) { if (TiXmlNode *toRemove = parent->FirstChild(cbU2C(path))) { toRemove->Clear(); parent->RemoveChild(toRemove); } } }
void resizegrpfile(void) { int i; const char *File2; FILE *oldfile; FILE *newfile; #ifdef WINCIT LogEntry *CurrentUser = new LogEntry(cfg.maxrooms, cfg.maxgroups, cfg.maxjumpback); if (!CurrentUser) { illegal("no memory."); } #endif /////////////////////////////////////// msgDisp(getcfgmsg(191), cfg.Ugroups_nym); doccr(); chdir(cfg.homepath); File2 = getcfgmsg(217); msgDisp(getcfgmsg(185), grpDat); cPrintfDOS(br); unlink(File2); GroupData.Resize(newmaxgroups); zapGrpFile(File2, TRUE); Bool Success = FALSE; if ((oldfile = fopen(grpDat, FO_RB)) != NULL) { if ((newfile = fopen(File2, FO_RPB)) != NULL) { fseek(oldfile, sizeof(long), SEEK_SET); fseek(newfile, sizeof(long), SEEK_SET); for (g_slot GroupSlot = 0; (GroupSlot < cfg.maxgroups) && (GroupSlot < newmaxgroups); GroupSlot++) { GroupEntry TempEntry; if (!TempEntry.Load(oldfile)) { crashout(getcfgmsg(281), getcfgmsg(240)); } if (!TempEntry.Save(newfile)) { crashout(getcfgmsg(283), getcfgmsg(240)); } } Success = TRUE; fclose(newfile); } fclose(oldfile); } if (!Success) { crashout(getcfgmsg(218), grpDat); } // log2.dat Success = FALSE; File2 = getcfgmsg(157); msgDisp(getcfgmsg(185), log2Dat); cPrintfDOS(br); unlink(File2); if ((oldfile = fopen(log2Dat, FO_RB)) != NULL) { if ((newfile = fopen(File2, FO_WB)) != NULL) { for (l_index LogIndex = 0; LogIndex < cfg.MAXLOGTAB; LogIndex++) { char ch; for (i = 0; i < cfg.maxgroups / 8 && i < newmaxgroups / 8; i++) { fread(&ch, sizeof(ch), 1, oldfile); fwrite(&ch, sizeof(ch), 1, newfile); } ch = 0; for (; i < newmaxgroups / 8; i++) { fwrite(&ch, sizeof(ch), 1, newfile); } for (; i < cfg.maxgroups / 8; i++) { fread(&ch, sizeof(ch), 1, oldfile); } } Success = TRUE; fclose(newfile); } fclose(oldfile); } if (!Success) { crashout(getcfgmsg(218), log2Dat); } unlink(grpDat); rename(getcfgmsg(217), grpDat); unlink(log2Dat); rename(File2, log2Dat); cfg.maxgroups = newmaxgroups; CurrentUser->LogEntry2::Resize(cfg.maxgroups); if (!GroupData.IsValid() || !CurrentUser->IsValid()) { crashout(getcfgmsg(107)); } doccr(); msgDisp(getcfgmsg(190)); doccr(); doccr(); #ifdef WINCIT msgDisp(NULL); // msgCaption(ns); delete CurrentUser; #endif }
static Bool initCitadel(void) { if (!read_cfg_messages()) { #ifdef WINCIT char Buffer[128]; sprintf(Buffer, getmsg(188), getmsg(671)); MessageBox(NULL, Buffer, NULL, MB_ICONSTOP | MB_OK); #else printf(getmsg(188), getmsg(671)); #endif return (FALSE); } checkfiles(); initExtDrivers(); get_os(); cfg.battr = 0xff; setscreen(); logo(TRUE); // no go for debug version; td32 go crash crash init_internal_sound(); // some mouse initialization technology!!!! initMouseHandler(); hideCounter = 1; if (time(NULL) < 700000000L) { #ifdef WINCIT MessageBox(NULL, getcfgmsg(119), NULL, MB_ICONSTOP | MB_OK); #else doccr(); doccr(); cPrintf(getcfgmsg(119)); doccr(); #endif dump_cfg_messages(); return (FALSE); } static char prompt[92]; static char citadel[92]; char *envprompt; char *citprompt; envprompt = getenv(getcfgmsg(120)); citprompt = getenv(getcfgmsg(121)); if (citprompt) { sprintf(prompt, getcfgmsg(122), citprompt); } else if (envprompt) { sprintf(prompt, getcfgmsg(123), envprompt); } else { strcpy(prompt, getcfgmsg(124)); } putenv(prompt); sprintf(citadel, getcfgmsg(125), programName, version); putenv(citadel); #ifndef WINCIT OC.whichIO = CONSOLE; OC.SetOutFlag(OUTOK); OC.Echo = BOTH; OC.setio(); #endif VerifyHeap(1); // If we aren't reconfiguring, load the tables... if (!reconfig) { // Start by reading ETC.TAB getcwd(etcpath, 64); FILE *fd; if ((fd = fopen(etcTab, FO_RB)) != NULL) { if (filelength(fileno(fd)) != (long) sizeof(config) || fread(&cfg, 1, sizeof(config), fd) != (long) sizeof(config)) { memset(&cfg, 0, sizeof(cfg)); reconfig = TRUE; } fclose(fd); unlink(etcTab); // If ETC.TAB could be loaded, load the rest if (!reconfig) { changedir(cfg.homepath); allocateTables(); if (!LogTab.Load() || !MessageDat.LoadTable() || !RoomTab.Load()) { reconfig = TRUE; } Cron.ReadTable(WC_TWpn); } } else { if (!batchmode) { #ifdef WINCIT MessageBox(NULL, "No ETC.TAB.", NULL, MB_ICONSTOP | MB_OK); #else doccr(); discardable *d; if ((d = readData(6)) != NULL) { int i; for (i = 0; ((char **) d->next->aux)[i][0] != '#'; i++) { cPrintf(pcts, ((char **) d->next->aux)[i]); doccr(); } doccr(); discardData(d); } else { cOutOfMemory(28); } DeinitializeTimer(); critical(FALSE); #endif exit(1); } reconfig = TRUE; } } if (reconfig) { cfg.attr = 7; #ifndef WINCIT pause(200); cls(SCROLL_SAVE); cCPrintf(getcfgmsg(126)); doccr(); #endif if (!configcit()) { #ifdef WINCIT MessageBox(NULL, getcfgmsg(127), NULL, MB_ICONSTOP | MB_OK); #else doccr(); doccr(); cPrintf(getcfgmsg(127)); doccr(); #endif dump_cfg_messages(); return (FALSE); } #ifndef WINCIT setdefaultTerm(TT_ANSI); CurrentUser->SetWidth(80); #endif Cron.ReadCronCit(WC_TWpn); } else { #ifndef WINCIT if (!CreateScrollBackBuffer()) { cPrintf(getcfgmsg(60)); doccr(); } #endif if (readconfigcit) // forced to read in config.cit { if (!readconfig(NULL, 1)) { #ifdef WINCIT MessageBox(NULL, getcfgmsg(129), NULL, MB_ICONSTOP | MB_OK); #else doccr(); doccr(); cPrintf(getcfgmsg(129)); doccr(); #endif dump_cfg_messages(); return (FALSE); } } } VerifyHeap(1); makeBorders(); readBordersDat(); if (cmd_nobells) { cfg.noBells = 2; } if (cmd_nochat) { cfg.noChat = TRUE; } if (cmd_mdata != CERROR) { cfg.mdata = cmd_mdata; } if (*cfg.f6pass) { if (SameString(cfg.f6pass, getmsg(670))) { ConsoleLock.LockF6(); } else { ConsoleLock.Lock(); } } #ifndef WINCIT if (cfg.ovrEms) { if (_OvrInitEms(0, 0, 0)) { cPrintf(getcfgmsg(130)); doccr(); pause(200); } } if (cfg.ovrExt) { if (_OvrInitExt(0, 0)) { cPrintf(getcfgmsg(131)); doccr(); pause(200); } } CommPort->Init(); setscreen(); #endif logo(TRUE); // no go for debug version; td32 go crash crash #ifndef WINCIT StatusLine.Update(WC_TWp); #endif if (cfg.msgpath[(strlen(cfg.msgpath) - 1)] == '\\') { cfg.msgpath[(strlen(cfg.msgpath) - 1)] = '\0'; } // move to home path changedir(cfg.homepath); char FileName[128]; ReIndexFileInfo(); // keep fileinfo.dat nice and pretty // open message file if (!MessageDat.OpenMessageFile(cfg.msgpath)) { illegal(getmsg(78), MessageDat.GetFilename()); } // Then room file sprintf(FileName, sbs, cfg.homepath, roomDat); openFile(FileName, &RoomFile); citOpen(cfg.trapfile, CO_A, &TrapFile); initMenus(); dump_cfg_messages(); if(!read_tr_messages()) { errorDisp(getmsg(172)); } else { #ifdef WINCIT trap(T_SYSOP, "", gettrmsg(37)); #else trap(T_SYSOP, gettrmsg(37)); #endif dump_tr_messages(); } read_cfg_messages(); // uh-oh! if (!GroupData.Load()) { return (FALSE); } if (!HallData.Load()) { return (FALSE); } getRoomPos(); if (cfg.accounting) { ReadGrpdataCit(WC_TWpn); } ReadExternalCit(WC_TWpn); ReadProtocolCit(WC_TWpn); ReadMdmresltCit(WC_TWpn); ReadCommandsCit(WC_TWpn); #ifndef WINCIT ReadMCICit(FALSE); CurrentRoom->Load(LOBBY); thisRoom = LOBBY; checkdir(); if (!slv_door) { CITWINDOW *w = CitWindowsMsg(NULL, getmsg(19)); Initport(); Initport(); if (w) { destroyCitWindow(w, FALSE); } } else { CommPort->Enable(); } OC.whichIO = MODEM; OC.setio(); #endif // record when we put system up time(&uptimestamp); #ifndef WINCIT setdefaultconfig(FALSE); Talley->Fill(); #endif logo(FALSE); VerifyHeap(1); dump_cfg_messages(); compactMemory(1); return (TRUE); }
/* Generate interrupts */ static void Interrupt(void) { /* the 6805 latches interrupt requests internally, so we don't clear */ /* pending_interrupts until the interrupt is taken, no matter what the */ /* external IRQ pin does. */ #if (1) //HAS_HD63705) if( (m6805.pending_interrupts & (1<<HD63705_INT_NMI)) != 0) { PUSHWORD(m6805.pc); PUSHBYTE(m6805.x); PUSHBYTE(m6805.a); PUSHBYTE(m6805.cc); SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ if (m6805.irq_callback) (*m6805.irq_callback)(0); RM16( 0x1ffc, &pPC); change_pc(PC); m6805.pending_interrupts &= ~(1<<HD63705_INT_NMI); m6805_ICount -= 11; } else if( (m6805.pending_interrupts & ((1<<M6805_IRQ_LINE)|HD63705_INT_MASK)) != 0 ) { if ( (CC & IFLAG) == 0 ) { #else if( (m6805.pending_interrupts & (1<<M6805_IRQ_LINE)) != 0 ) { if ( (CC & IFLAG) == 0 ) { #endif { /* standard IRQ */ //#if (HAS_HD63705) // if(SUBTYPE!=SUBTYPE_HD63705) //#endif // PC |= ~AMASK; PUSHWORD(m6805.pc); PUSHBYTE(m6805.x); PUSHBYTE(m6805.a); PUSHBYTE(m6805.cc); SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ if (m6805.irq_callback) (*m6805.irq_callback)(0); //#if (HAS_HD63705) if(SUBTYPE==SUBTYPE_HD63705) { /* Need to add emulation of other interrupt sources here KW-2/4/99 */ /* This is just a quick patch for Namco System 2 operation */ if((m6805.pending_interrupts&(1<<HD63705_INT_IRQ1))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_IRQ1); RM16( 0x1ff8, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_IRQ2))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_IRQ2); RM16( 0x1fec, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_ADCONV))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_ADCONV); RM16( 0x1fea, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_TIMER1))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_TIMER1); RM16( 0x1ff6, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_TIMER2))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_TIMER2); RM16( 0x1ff4, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_TIMER3))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_TIMER3); RM16( 0x1ff2, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_PCI))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_PCI); RM16( 0x1ff0, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<HD63705_INT_SCI))!=0) { m6805.pending_interrupts &= ~(1<<HD63705_INT_SCI); RM16( 0x1fee, &pPC); change_pc(PC); } } else //#endif { RM16( 0xffff - 5, &pPC ); change_pc(PC); } } // CC & IFLAG m6805.pending_interrupts &= ~(1<<M6805_IRQ_LINE); } m6805_ICount -= 11; } } static void m6805_reset() { int (*save_irqcallback)(int) = m6805.irq_callback; memset(&m6805, 0, sizeof(m6805)); m6805.irq_callback = save_irqcallback; /* Force CPU sub-type and relevant masks */ m6805.subtype = SUBTYPE_M6805; SP_MASK = 0x07f; SP_LOW = 0x060; /* Initial stack pointer */ S = SP_MASK; /* IRQ disabled */ SEI; RM16( 0xfffe , &pPC ); change_pc(PC); } void m6805Reset() { m6805_reset(); } //static void m6805_init(int ) //int (*irqcallback)(int)) //{ // m6805.irq_callback = irqcallback; //} //static void m6805_exit(void) //{ // /* nothing to do */ //} void m6805SetIrqLine(int , int state) { /* Basic 6805 only has one IRQ line */ /* See HD63705 specific version */ if (m6805.irq_state[0] == state) return; m6805.irq_state[0] = state; if (state != CLEAR_LINE) m6805.pending_interrupts |= 1<<M6805_IRQ_LINE; } #include "6805ops.c" /* execute instructions on this CPU until icount expires */ int m6805Run(int cycles) { UINT8 ireg; m6805_ICount = cycles; do { if (m6805.pending_interrupts != 0) { if (SUBTYPE==SUBTYPE_M68705) { m68705_Interrupt(); } else { Interrupt(); } } ireg=M_RDOP(PC++); switch( ireg ) { case 0x00: brset(0x01); break; case 0x01: brclr(0x01); break; case 0x02: brset(0x02); break; case 0x03: brclr(0x02); break; case 0x04: brset(0x04); break; case 0x05: brclr(0x04); break; case 0x06: brset(0x08); break; case 0x07: brclr(0x08); break; case 0x08: brset(0x10); break; case 0x09: brclr(0x10); break; case 0x0A: brset(0x20); break; case 0x0B: brclr(0x20); break; case 0x0C: brset(0x40); break; case 0x0D: brclr(0x40); break; case 0x0E: brset(0x80); break; case 0x0F: brclr(0x80); break; case 0x10: bset(0x01); break; case 0x11: bclr(0x01); break; case 0x12: bset(0x02); break; case 0x13: bclr(0x02); break; case 0x14: bset(0x04); break; case 0x15: bclr(0x04); break; case 0x16: bset(0x08); break; case 0x17: bclr(0x08); break; case 0x18: bset(0x10); break; case 0x19: bclr(0x10); break; case 0x1a: bset(0x20); break; case 0x1b: bclr(0x20); break; case 0x1c: bset(0x40); break; case 0x1d: bclr(0x40); break; case 0x1e: bset(0x80); break; case 0x1f: bclr(0x80); break; case 0x20: bra(); break; case 0x21: brn(); break; case 0x22: bhi(); break; case 0x23: bls(); break; case 0x24: bcc(); break; case 0x25: bcs(); break; case 0x26: bne(); break; case 0x27: beq(); break; case 0x28: bhcc(); break; case 0x29: bhcs(); break; case 0x2a: bpl(); break; case 0x2b: bmi(); break; case 0x2c: bmc(); break; case 0x2d: bms(); break; case 0x2e: bil(); break; case 0x2f: bih(); break; case 0x30: neg_di(); break; case 0x31: illegal(); break; case 0x32: illegal(); break; case 0x33: com_di(); break; case 0x34: lsr_di(); break; case 0x35: illegal(); break; case 0x36: ror_di(); break; case 0x37: asr_di(); break; case 0x38: lsl_di(); break; case 0x39: rol_di(); break; case 0x3a: dec_di(); break; case 0x3b: illegal(); break; case 0x3c: inc_di(); break; case 0x3d: tst_di(); break; case 0x3e: illegal(); break; case 0x3f: clr_di(); break; case 0x40: nega(); break; case 0x41: illegal(); break; case 0x42: illegal(); break; case 0x43: coma(); break; case 0x44: lsra(); break; case 0x45: illegal(); break; case 0x46: rora(); break; case 0x47: asra(); break; case 0x48: lsla(); break; case 0x49: rola(); break; case 0x4a: deca(); break; case 0x4b: illegal(); break; case 0x4c: inca(); break; case 0x4d: tsta(); break; case 0x4e: illegal(); break; case 0x4f: clra(); break; case 0x50: negx(); break; case 0x51: illegal(); break; case 0x52: illegal(); break; case 0x53: comx(); break; case 0x54: lsrx(); break; case 0x55: illegal(); break; case 0x56: rorx(); break; case 0x57: asrx(); break; case 0x58: aslx(); break; case 0x59: rolx(); break; case 0x5a: decx(); break; case 0x5b: illegal(); break; case 0x5c: incx(); break; case 0x5d: tstx(); break; case 0x5e: illegal(); break; case 0x5f: clrx(); break; case 0x60: neg_ix1(); break; case 0x61: illegal(); break; case 0x62: illegal(); break; case 0x63: com_ix1(); break; case 0x64: lsr_ix1(); break; case 0x65: illegal(); break; case 0x66: ror_ix1(); break; case 0x67: asr_ix1(); break; case 0x68: lsl_ix1(); break; case 0x69: rol_ix1(); break; case 0x6a: dec_ix1(); break; case 0x6b: illegal(); break; case 0x6c: inc_ix1(); break; case 0x6d: tst_ix1(); break; case 0x6e: illegal(); break; case 0x6f: clr_ix1(); break; case 0x70: neg_ix(); break; case 0x71: illegal(); break; case 0x72: illegal(); break; case 0x73: com_ix(); break; case 0x74: lsr_ix(); break; case 0x75: illegal(); break; case 0x76: ror_ix(); break; case 0x77: asr_ix(); break; case 0x78: lsl_ix(); break; case 0x79: rol_ix(); break; case 0x7a: dec_ix(); break; case 0x7b: illegal(); break; case 0x7c: inc_ix(); break; case 0x7d: tst_ix(); break; case 0x7e: illegal(); break; case 0x7f: clr_ix(); break; case 0x80: rti(); break; case 0x81: rts(); break; case 0x82: illegal(); break; case 0x83: swi(); break; case 0x84: illegal(); break; case 0x85: illegal(); break; case 0x86: illegal(); break; case 0x87: illegal(); break; case 0x88: illegal(); break; case 0x89: illegal(); break; case 0x8a: illegal(); break; case 0x8b: illegal(); break; case 0x8c: illegal(); break; case 0x8d: illegal(); break; case 0x8e: illegal(); break; case 0x8f: illegal(); break; case 0x90: illegal(); break; case 0x91: illegal(); break; case 0x92: illegal(); break; case 0x93: illegal(); break; case 0x94: illegal(); break; case 0x95: illegal(); break; case 0x96: illegal(); break; case 0x97: tax(); break; case 0x98: CLC; break; case 0x99: SEC; break; #if IRQ_LEVEL_DETECT case 0x9a: CLI; if (m6805.irq_state != CLEAR_LINE) m6805.pending_interrupts |= 1<<M6805_IRQ_LINE; break; #else case 0x9a: CLI; break; #endif case 0x9b: SEI; break; case 0x9c: rsp(); break; case 0x9d: nop(); break; case 0x9e: illegal(); break; case 0x9f: txa(); break; case 0xa0: suba_im(); break; case 0xa1: cmpa_im(); break; case 0xa2: sbca_im(); break; case 0xa3: cpx_im(); break; case 0xa4: anda_im(); break; case 0xa5: bita_im(); break; case 0xa6: lda_im(); break; case 0xa7: illegal(); break; case 0xa8: eora_im(); break; case 0xa9: adca_im(); break; case 0xaa: ora_im(); break; case 0xab: adda_im(); break; case 0xac: illegal(); break; case 0xad: bsr(); break; case 0xae: ldx_im(); break; case 0xaf: illegal(); break; case 0xb0: suba_di(); break; case 0xb1: cmpa_di(); break; case 0xb2: sbca_di(); break; case 0xb3: cpx_di(); break; case 0xb4: anda_di(); break; case 0xb5: bita_di(); break; case 0xb6: lda_di(); break; case 0xb7: sta_di(); break; case 0xb8: eora_di(); break; case 0xb9: adca_di(); break; case 0xba: ora_di(); break; case 0xbb: adda_di(); break; case 0xbc: jmp_di(); break; case 0xbd: jsr_di(); break; case 0xbe: ldx_di(); break; case 0xbf: stx_di(); break; case 0xc0: suba_ex(); break; case 0xc1: cmpa_ex(); break; case 0xc2: sbca_ex(); break; case 0xc3: cpx_ex(); break; case 0xc4: anda_ex(); break; case 0xc5: bita_ex(); break; case 0xc6: lda_ex(); break; case 0xc7: sta_ex(); break; case 0xc8: eora_ex(); break; case 0xc9: adca_ex(); break; case 0xca: ora_ex(); break; case 0xcb: adda_ex(); break; case 0xcc: jmp_ex(); break; case 0xcd: jsr_ex(); break; case 0xce: ldx_ex(); break; case 0xcf: stx_ex(); break; case 0xd0: suba_ix2(); break; case 0xd1: cmpa_ix2(); break; case 0xd2: sbca_ix2(); break; case 0xd3: cpx_ix2(); break; case 0xd4: anda_ix2(); break; case 0xd5: bita_ix2(); break; case 0xd6: lda_ix2(); break; case 0xd7: sta_ix2(); break; case 0xd8: eora_ix2(); break; case 0xd9: adca_ix2(); break; case 0xda: ora_ix2(); break; case 0xdb: adda_ix2(); break; case 0xdc: jmp_ix2(); break; case 0xdd: jsr_ix2(); break; case 0xde: ldx_ix2(); break; case 0xdf: stx_ix2(); break; case 0xe0: suba_ix1(); break; case 0xe1: cmpa_ix1(); break; case 0xe2: sbca_ix1(); break; case 0xe3: cpx_ix1(); break; case 0xe4: anda_ix1(); break; case 0xe5: bita_ix1(); break; case 0xe6: lda_ix1(); break; case 0xe7: sta_ix1(); break; case 0xe8: eora_ix1(); break; case 0xe9: adca_ix1(); break; case 0xea: ora_ix1(); break; case 0xeb: adda_ix1(); break; case 0xec: jmp_ix1(); break; case 0xed: jsr_ix1(); break; case 0xee: ldx_ix1(); break; case 0xef: stx_ix1(); break; case 0xf0: suba_ix(); break; case 0xf1: cmpa_ix(); break; case 0xf2: sbca_ix(); break; case 0xf3: cpx_ix(); break; case 0xf4: anda_ix(); break; case 0xf5: bita_ix(); break; case 0xf6: lda_ix(); break; case 0xf7: sta_ix(); break; case 0xf8: eora_ix(); break; case 0xf9: adca_ix(); break; case 0xfa: ora_ix(); break; case 0xfb: adda_ix(); break; case 0xfc: jmp_ix(); break; case 0xfd: jsr_ix(); break; case 0xfe: ldx_ix(); break; case 0xff: stx_ix(); break; } m6805_ICount -= cycles1[ireg]; m6805.nTotalCycles += cycles1[ireg]; } while( m6805_ICount > 0 ); return cycles - m6805_ICount; }
static void IIError(m68_state_t *m68_state) { illegal(m68_state); // Vector to Trap handler }
void resizehallfile(void) { long l; const char *File2; char ch; FILE *oldfile; FILE *newfile; HallEntry1 tmpHall; msgDisp(getcfgmsg(184), cfg.Lhalls_nym); doccr(); chdir(cfg.homepath); // do hall.dat File2 = getcfgmsg(216); msgDisp(getcfgmsg(185), hallDat); cPrintfDOS(br); if ((newfile = fopen(File2, FO_WB)) == NULL) { illegal(getmsg(8), File2); } if ((oldfile = fopen(hallDat, FO_RB)) == NULL) { illegal(getmsg(83), hallDat); } fread(&l, sizeof(l), 1, oldfile); fwrite(&l, sizeof(l), 1, newfile); h_slot i; for (i = 0; i < cfg.maxhalls && i < newmaxhalls; i++) { if (!tmpHall.Load(i, oldfile)) { crashout(getcfgmsg(281), getcfgmsg(236)); } if (!tmpHall.Save(i, newfile)) { crashout(getcfgmsg(283), getcfgmsg(236)); } } tmpHall.Clear(); for (; i < newmaxhalls; i++) { if (!tmpHall.Save(i, newfile)) { crashout(getcfgmsg(283), getcfgmsg(236)); } } fclose(newfile); fclose(oldfile); int result = unlink(hallDat); if (result == -1) { msgDisp(getcfgmsg(187), hallDat); doccr(); } result = rename(File2, hallDat); if (result == -1) { msgDisp(getcfgmsg(188), File2); doccr(); } // hall2.dat File2 = getcfgmsg(210); msgDisp(getcfgmsg(185), hall2Dat); cPrintfDOS(br); if ((newfile = fopen(File2, FO_WB)) == NULL) { illegal(getmsg(8), File2); } if ((oldfile = fopen(hall2Dat, FO_RB)) == NULL) { illegal(getmsg(83), hall2Dat); } // inhall h_slot q; for (q = 0; q < cfg.maxhalls && q < newmaxhalls; q++) { for (i = 0; i < cfg.maxrooms / 8; i++) { fread(&ch, sizeof(ch), 1, oldfile); fwrite(&ch, sizeof(ch), 1, newfile); } } ch = 0; for (; q < newmaxhalls; q++) { for (i = 0; i < cfg.maxrooms / 8; i++) { fwrite(&ch, sizeof(ch), 1, newfile); } } for (; q < cfg.maxhalls; q++) { for (i = 0; i < cfg.maxrooms / 8; i++) { fread(&ch, sizeof(ch), 1, oldfile); } } // window for (q = 0; q < cfg.maxhalls && q < newmaxhalls; q++) { for (i = 0; i < cfg.maxrooms / 8; i++) { fread(&ch, sizeof(ch), 1, oldfile); fwrite(&ch, sizeof(ch), 1, newfile); } } ch = 0; for (; q < newmaxhalls; q++) { for (i = 0; i < cfg.maxrooms / 8; i++) { fwrite(&ch, sizeof(ch), 1, newfile); } } for (; q < cfg.maxhalls; q++) { for (i = 0; i < cfg.maxrooms / 8; i++) { fread(&ch, sizeof(ch), 1, oldfile); } } fclose(newfile); fclose(oldfile); result = unlink(hall2Dat); if (result == -1) { msgDisp(getcfgmsg(187), hall2Dat); doccr(); } result = rename(File2, hall2Dat); if (result == -1) { msgDisp(getcfgmsg(188), File2); doccr(); } cfg.maxhalls = newmaxhalls; HallData.Resize(cfg.maxhalls, cfg.maxrooms); if (!HallData.IsValid()) { crashout(getcfgmsg(107)); } doccr(); msgDisp(getcfgmsg(190)); doccr(); doccr(); #ifdef WINCIT msgDisp(NULL); // msgCaption(ns); #endif }
static void load_long(void) { u_int16_t addr, indirect; switch (DST_MODE) { case 0: srclong = regs[DST_REG]; return; case 1: addr = regs[DST_REG]; if (DST_REG == PC) { lli_long(addr, srclong) } else { ll_long(addr, srclong); } return; case 2: addr = regs[DST_REG]; if (DST_REG == PC) { lli_long(addr, srclong) } else { ll_long(addr, srclong); } regs[DST_REG] += 4; return; case 3: indirect = regs[DST_REG]; if (DST_REG == PC) { lli_word(indirect, addr) } else { ll_word(indirect, addr); } regs[DST_REG] += 4; ll_long(addr, srclong); return; case 4: regs[DST_REG] -= 4; addr = regs[DST_REG]; ll_long(addr, srclong); return; case 5: regs[DST_REG] -= 4; indirect = regs[DST_REG]; ll_word(indirect, addr); ll_long(addr, srclong); return; case 6: lli_word(regs[PC], indirect); regs[PC] += 2; addr = regs[DST_REG] + indirect; ll_long(addr, srclong); return; case 7: lli_word(regs[PC], indirect); regs[PC] += 2; indirect = regs[DST_REG] + indirect; ll_word(indirect, addr); ll_long(addr, srclong); return; } illegal(); }
/* Save (and convert if necessary) Srcflt into the float described by the * destination address */ static void save_flt(void) { u_int16_t indirect; u_int16_t addr; pdpfloat *fladdr; FpDebug((dbg_file, "\tsave_flt mode %d\n", DST_MODE)); switch (DST_MODE) { case 0: fregs[DST_REG] = Srcflt; return; case 1: fladdr = (pdpfloat *)&dspace[regs[DST_REG]]; to11float(&Srcflt, fladdr); return; case 2: fladdr = (pdpfloat *)&dspace[regs[DST_REG]]; to11float(&Srcflt, fladdr); if (DST_REG == PC) regs[DST_REG] += 2; else if (FPMODE) regs[DST_REG] += 8; else regs[DST_REG] += 4; return; case 3: ll_word(regs[DST_REG], indirect); fladdr = (pdpfloat *)&dspace[indirect]; to11float(&Srcflt, fladdr); if (DST_REG == PC) regs[DST_REG] += 2; else if (FPMODE) regs[DST_REG] += 8; else regs[DST_REG] += 4; return; case 4: if (FPMODE) regs[DST_REG] -= 8; else regs[DST_REG] -= 4; fladdr = (pdpfloat *)&dspace[regs[DST_REG]]; to11float(&Srcflt, fladdr); return; case 5: if (FPMODE) regs[DST_REG] -= 8; else regs[DST_REG] -= 4; ll_word(regs[DST_REG], indirect); fladdr = (pdpfloat *)&dspace[indirect]; to11float(&Srcflt, fladdr); return; case 6: lli_word(regs[PC], indirect); regs[PC] += 2; indirect = regs[DST_REG] + indirect; fladdr = (pdpfloat *)&dspace[indirect]; to11float(&Srcflt, fladdr); return; case 7: lli_word(regs[PC], indirect); regs[PC] += 2; indirect = regs[DST_REG] + indirect; ll_word(indirect, addr); fladdr = (pdpfloat *)&dspace[addr]; to11float(&Srcflt, fladdr); return; } illegal(); }
static void initfiles(Bool *grpZap, Bool *hallZap, Bool *msgZap, Bool *logZap, Bool *log2Zap, Bool *log3Zap, Bool *log4Zap, Bool *log5Zap, Bool *log6Zap, Bool *roomZap, Bool *roomposZap) { FILE *aFile; changedir(cfg.homepath); if (cfg.msgpath[(strlen(cfg.msgpath) - 1)] == '\\') { cfg.msgpath[(strlen(cfg.msgpath) - 1)] = 0; } autoConvert(grpDat, ((GroupEntry *) NULL)->SizeOfDiskRecord()); autoConvert(logDat, LogDatRecordSize(*(LogDatStructure *) NULL)); autoConvert(hallDat, ((HallEntry1 *) NULL)->SizeOfDiskRecord()); autoConvert(roomDat, RoomC::GetDiskRecordSize()); checkresize(); // check group file if (!citOpen(grpDat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), grpDat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); doccr(); #endif *grpZap = TRUE; } else { fclose(aFile); } // check hall file if (!citOpen(hallDat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), hallDat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); doccr(); #endif *hallZap = TRUE; } else { fclose(aFile); } // check room pos file if (!citOpen(roomposDat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), roomposDat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); doccr(); #endif *roomposZap = TRUE; } else { fclose(aFile); } // open log file if (!citOpen(logDat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), logDat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); #endif *logZap = TRUE; } else { fclose(aFile); } // open log2 file if (!citOpen(log2Dat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), log2Dat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); #endif *log2Zap = TRUE; } else { fclose(aFile); } // open log3 file if (!citOpen(log3Dat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), log3Dat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); #endif *log3Zap = TRUE; } else { fclose(aFile); } // open log4 file if (!citOpen(log4Dat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), log4Dat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); #endif *log4Zap = TRUE; } else { fclose(aFile); } // open log5 file if (!citOpen(log5Dat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), log5Dat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); #endif *log5Zap = TRUE; } else { fclose(aFile); } // open log6 file if (!citOpen(log6Dat, CO_RPB, &aFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), log6Dat); #endif #ifndef WINCIT doccr(); #endif #ifdef WINCIT errorDisp(getcfgmsg(141)); #endif #ifndef WINCIT doccr(); #endif *log6Zap = TRUE; } else { fclose(aFile); } #ifndef WINCIT if (logZap || log2Zap || log3Zap || log4Zap || log5Zap || log6Zap) { doccr(); } #endif // open message file if (!MessageDat.OpenMessageFile(cfg.msgpath)) { #ifdef WINCIT errorDisp(getcfgmsg(140), MessageDat.GetFilename()); #endif #ifndef WINCIT doccr(); #endif if (!MessageDat.CreateMessageFile(cfg.msgpath)) { illegal(getmsg(8), MessageDat.GetFilename()); } #ifdef WINCIT errorDisp(getcfgmsg(141)); #else printf("problem with msg.dat\n"); #endif #ifndef WINCIT doccr(); doccr(); #endif *msgZap = TRUE; } // open room file if (!citOpen(roomDat, CO_RPB, &RoomFile)) { #ifdef WINCIT errorDisp(getcfgmsg(140), roomDat); #endif #ifndef WINCIT doccr(); #endif if (!citOpen(roomDat, CO_WPB, &RoomFile)) { illegal(getmsg(8), roomDat); } #ifdef WINCIT errorDisp(getcfgmsg(141)); #else printf("problem with room.dat\n"); #endif #ifndef WINCIT doccr(); doccr(); #endif *roomZap = TRUE; } }
void resizelogfile(void) { #ifdef WINCIT LogEntry *CurrentUser = new LogEntry(cfg.maxrooms, cfg.maxgroups, cfg.maxjumpback); l_slot *LogOrder = new l_slot[cfg.MAXLOGTAB]; if (!LogOrder || !CurrentUser) { illegal("no memory"); } for (l_slot slot = 0; slot < cfg.MAXLOGTAB; slot++) { LogOrder[slot] = slot; } LogTab.Sort(&LogOrder); #endif chdir(cfg.homepath); // get rid of any log?.tmp files unlink(getcfgmsg(156)); unlink(getcfgmsg(157)); unlink(getcfgmsg(158)); unlink(getcfgmsg(159)); unlink(getcfgmsg(160)); unlink(getcfgmsg(161)); // and the LE*.TMP files changedir(cfg.logextdir); ambigUnlink(getcfgmsg(215)); changedir(cfg.homepath); // create new log?.tmp files with new size l_slot i = cfg.MAXLOGTAB; cfg.MAXLOGTAB = newmaxlogtab; zapLogFile(TRUE, TRUE); cfg.MAXLOGTAB = i; for (i = 0; (i < cfg.MAXLOGTAB) && (i < newmaxlogtab); i++) { msgDisp(getcfgmsg(183), ltoac(LTab(i).GetLogIndex())); #ifndef WINCIT cPrintf(getcfgmsg(282), br); #endif // Load from old files (the .DAT ones) CurrentUser->LogEntry1::ResetFileName(); CurrentUser->LogEntry2::ResetFileName(); CurrentUser->LogEntry3::ResetFileName(); CurrentUser->LogEntry4::ResetFileName(); CurrentUser->LogEntry5::ResetFileName(); CurrentUser->LogEntry6::ResetFileName(); CurrentUser->LogExtensions::ResetFileExtension(); if (!CurrentUser->Load(LTab(i).GetLogIndex())) { crashout(getcfgmsg(281), getcfgmsg(155)); } // And save to the new files (the .TMP ones) CurrentUser->LogEntry1::SetFileName(getcfgmsg(156)); CurrentUser->LogEntry2::SetFileName(getcfgmsg(157)); CurrentUser->LogEntry3::SetFileName(getcfgmsg(158)); CurrentUser->LogEntry4::SetFileName(getcfgmsg(159)); CurrentUser->LogEntry5::SetFileName(getcfgmsg(160)); CurrentUser->LogEntry6::SetFileName(getcfgmsg(161)); CurrentUser->LogExtensions::SetFileExtension(getcfgmsg(230)); if (!CurrentUser->Save(i, CurrentUser->GetMessageRoom())) { crashout(getcfgmsg(283), getcfgmsg(155)); } } doccr(); doccr(); // Back to using the .DAT files CurrentUser->LogEntry1::ResetFileName(); CurrentUser->LogEntry2::ResetFileName(); CurrentUser->LogEntry3::ResetFileName(); CurrentUser->LogEntry4::ResetFileName(); CurrentUser->LogEntry5::ResetFileName(); CurrentUser->LogEntry6::ResetFileName(); CurrentUser->LogExtensions::ResetFileExtension(); // clear RAM buffer out CurrentUser->Clear(); // Then clean up - .TMP to .DAT unlink(logDat); unlink(log2Dat); unlink(log3Dat); unlink(log4Dat); unlink(log5Dat); unlink(log6Dat); rename(getcfgmsg(156), logDat); rename(getcfgmsg(157), log2Dat); rename(getcfgmsg(158), log3Dat); rename(getcfgmsg(159), log4Dat); rename(getcfgmsg(160), log5Dat); rename(getcfgmsg(161), log6Dat); changedir(cfg.logextdir); ambigUnlink(getcfgmsg(211)); FindFileC FF; if (FF.FindFirst(getcfgmsg(215))) { do { if (FF.IsNormalFile()) { label newname; CopyStringToBuffer(newname, FF.GetShortName()); strcpy(strchr(newname, '.'), getcfgmsg(285)); rename(FF.GetShortName(), newname); } } while (FF.FindNext()); } changedir(cfg.homepath); #ifdef WINCIT msgDisp(NULL); // msgCaption(ns); delete CurrentUser; delete [] LogOrder; #endif }
/* address into Srcflt. */ static void load_flt(void) { u_int16_t indirect,addr; u_int16_t *intptr; FpDebug((dbg_file, "\tload_flt mode %d\n", DST_MODE)); switch (DST_MODE) { case 0: Srcflt = fregs[DST_REG]; fladdr=NULL; return; case 1: if (DST_REG == PC) { intptr = (u_int16_t *)&ispace[regs[DST_REG]]; intpair.lo= *intptr; intpair.hi=0; fladdr= (pdpfloat *)&intpair; } else fladdr = (pdpfloat *)&dspace[regs[DST_REG]]; from11float(&Srcflt, fladdr); return; case 2: if (DST_REG == PC) { intptr = (u_int16_t *)&ispace[regs[DST_REG]]; intpair.lo= *intptr; intpair.hi=0; fladdr= (pdpfloat *)&intpair; from11float(&Srcflt, fladdr); regs[DST_REG] += 2; } else { fladdr = (pdpfloat *)&dspace[regs[DST_REG]]; from11float(&Srcflt, fladdr); if (FPMODE) regs[DST_REG] += 8; else regs[DST_REG] += 4; } return; case 3: ll_word(regs[DST_REG], indirect); if (DST_REG == PC) { intptr = (u_int16_t *)&ispace[indirect]; intpair.lo= *intptr; intpair.hi=0; fladdr= (pdpfloat *)&intpair; from11float(&Srcflt, fladdr); regs[DST_REG] += 2; } else { fladdr = (pdpfloat *)&dspace[indirect]; from11float(&Srcflt, fladdr); if (FPMODE) regs[DST_REG] += 8; else regs[DST_REG] += 4; } return; case 4: if (FPMODE) regs[DST_REG] -= 8; else regs[DST_REG] -= 4; fladdr = (pdpfloat *)&dspace[regs[DST_REG]]; from11float(&Srcflt, fladdr); return; case 5: if (FPMODE) regs[DST_REG] -= 8; else regs[DST_REG] -= 4; ll_word(regs[DST_REG], indirect); fladdr = (pdpfloat *)&dspace[indirect]; from11float(&Srcflt, fladdr); return; case 6: lli_word(regs[PC], indirect); regs[PC] += 2; indirect= regs[DST_REG] + indirect; fladdr = (pdpfloat *)&dspace[indirect]; from11float(&Srcflt, fladdr); return; case 7: lli_word(regs[PC], indirect); regs[PC] += 2; indirect = regs[DST_REG] + indirect; ll_word(indirect, addr); fladdr = (pdpfloat *)&dspace[addr]; from11float(&Srcflt, fladdr); return; } illegal(); }
// -------------------------------------------------------------------------- // resizemsgfile(): Resizes message file. void MessageDatC::Resize(long NewSizeInBytes) { Lock(); Message *Msg = new Message; if (Msg) { char MsgFilePath2[128]; FILE *oldmsg; FILE *newmsg; const char *msgTmp = getcfgmsg(219); sprintf(MsgFilePath2, sbs, cfg.msgpath, msgTmp); if (MsgDat) { fclose(MsgDat); MsgDat = NULL; } if (!citOpen(MsgFilePath2, CO_WPB, &MsgDat)) { illegal(getmsg(8), getcfgmsg(192)); } InitializeMessageFile(NewSizeInBytes); catLoc = 0l; fclose(MsgDat); MsgDat = NULL; // open first message file if (!citOpen(MsgFilePath, CO_RPB, &oldmsg)) { msgDisp(getmsg(78), MsgFilePath); doccr(); delete Msg; Unlock(); return; } // open temp message file if (!citOpen(MsgFilePath2, CO_RPB, &newmsg)) { msgDisp(getmsg(78), MsgFilePath2); doccr(); fclose(oldmsg); delete Msg; Unlock(); return; } for (m_index ID = OldestMessageInTable(); ID <= NewestMessage(); ID++) { MsgDat = oldmsg; if (LoadAll(ID, Msg) != RMS_OK) { continue; } const m_index here = atol(Msg->GetLocalID()); if (here != ID) { continue; } msgDisp(getcfgmsg(193), cfg.Lmsg_nym, ltoac(here)); cPrintfDOS(br); MsgDat = newmsg; ResizeStore(Msg); } doccr(); doccr(); fclose(oldmsg); fclose(newmsg); MsgDat = NULL; int result = unlink(MsgFilePath); if (result == -1) { msgDisp(getcfgmsg(187), msgDat); doccr(); } result = rename(MsgFilePath2, MsgFilePath); if (result == -1) { msgDisp(getcfgmsg(188), msgTmp); doccr(); } delete Msg; if (!OpenMessageFile(cfg.msgpath)) { illegal(getmsg(78), MsgFilePath); } } else { crashout(getmsg(188), getcfgmsg(172)); } #ifdef WINCIT msgDisp(NULL); // msgCaption(ns); #endif Unlock(); }