void scsiioint(NEVENTITEM item) { TRACEOUT(("scsiioint")); if (scsiio.membank & 4) { pic_setirq(scsiirq[(scsiio.resent >> 3) & 7]); TRACEOUT(("scsi intr")); }
static void bankselect(void) { if (epsonio.bankioen & 0x02) { CPU_ITFBANK = 1; TRACEOUT(("EPSON ITF - Enable")); } else { CPU_ITFBANK = 0; TRACEOUT(("EPSON ITF - Disable")); } }
void scsicmd_bios(void) { UINT8 flag; UINT8 ret; REG8 stat; UINT cmd; REG8 dstid; TRACEOUT(("BIOS 1B-C* CPU_AH %.2x", CPU_AH)); if (CPU_AH & 0x80) { // エラーぽ return; } flag = MEMR_READ8(CPU_SS, CPU_SP+4) & 0xbe; ret = mem[0x0483]; cmd = CPU_AH & 0x1f; dstid = CPU_AL & 7; if (ret & 0x80) { mem[0x0483] &= 0x7f; } else if (cmd < 0x18) { switch(cmd) { case 0x00: // reset stat = 0x00; break; case 0x03: // Negate ACK stat = scsicmd_negate(dstid); break; case 0x07: // Select Without AMN stat = scsicmd_select(dstid); break; case 0x09: // Select Without AMN and Transfer stat = bios1bc_seltrans(dstid); break; default: TRACEOUT(("cmd = %.2x", CPU_AH)); SCSICMD_ERR stat = 0x42; break; } ret = stat2ret[stat >> 4] + (stat & 0x0f); TRACEOUT(("BIOS 1B-C* CPU_AH %.2x ret = %.2x", CPU_AH, ret)); mem[0x0483] = ret; } else { if ((ret ^ cmd) & 0x0f) {
REG8 lio_gcircle(GLIO lio) { GCIRCLE dat; SINT16 cx; SINT16 cy; SINT16 rx; SINT16 ry; REG8 pal; SINT16 d1; SINT16 d2; SINT16 d3; lio_updatedraw(lio); MEMR_READS(CPU_DS, CPU_BX, &dat, sizeof(dat)); // チェック if (dat.flag & 0x7f) { TRACEOUT(("LIO GCIRCLE not support flags: %.2x", dat.flag)); } cx = (SINT16)LOADINTELWORD(dat.cx); cy = (SINT16)LOADINTELWORD(dat.cy); rx = (SINT16)LOADINTELWORD(dat.rx); ry = (SINT16)LOADINTELWORD(dat.ry); pal = dat.pal; if (pal == 0xff) { pal = lio->work.fgcolor; } if (rx != ry) { TRACEOUT(("LIO GCIRCLE not support ellipse")); return(LIO_SUCCESS); } // 単純な円の描画 d1 = 0; d2 = ry; d3 = 0 - ry; while(d1 <= d2) { draw4(lio, cx, cy, d1, d2, pal); draw4(lio, cx, cy, d2, d1, pal); lio->wait += 8 * (10 + 10 + 10); d1++; d3 += (d1 * 2) - 1; if (d3 >= 0) { d2--; d3 -= d2 * 2; } } return(LIO_SUCCESS); }
BRESULT getmp3_open(GETSND snd, UINT8 *ptr, UINT size) { UINT pos; if ((size < 10) && (!memcmp(ptr, "ID3", 3))) { pos = (ptr[6] & 0x7f); pos <<= 7; pos |= (ptr[7] & 0x7f); pos <<= 7; pos |= (ptr[8] & 0x7f); pos <<= 7; pos |= (ptr[9] & 0x7f); pos += 10; TRACEOUT(("ID3 Tag - size:%dbyte(s)", pos)); if (size < pos) { goto mp3opn_err; } ptr += pos; size -= pos; } if (__mp3_open(snd, ptr, size) != SUCCESS) { goto mp3opn_err; } return(SUCCESS); mp3opn_err: return(FAILURE); }
BRESULT __mp3_open(GETSND snd, UINT8 *ptr, UINT size) { MPEGL3 *mp3; if (size < 4) { goto mp3opn_err; } mp3 = mp3_create(ptr); if (mp3 == NULL) { goto mp3opn_err; } snd->datptr = ptr; snd->datsize = size; snd->snd = mp3; snd->dec = (GSDEC)mp3_dec; snd->decend = mp3_decend; snd->samplingrate = mp3->c.samplingrate; snd->channels = mp3->c.channels; snd->blocksize = 1728; snd->blocksamples = mp3->c.outsamples; snd->bit = 16; TRACEOUT(("mp3: %dHz %dkbps", mp3->c.samplingrate, mp3->c.kbitrate)); return(SUCCESS); mp3opn_err: return(FAILURE); }
static UINT mp3_dec(GETSND snd, short *dst) { UINT8 *src; MPEGL3 *mp3; int r; src = snd->datptr; mp3 = (MPEGL3 *)snd->snd; if (snd->datsize < 4) { goto mp3dec_err; } r = mp3_predecode(mp3, src); if (r) { if ((r != MPEGHEAD_RENEWAL) || (snd->samplingrate != mp3->c.samplingrate) || (snd->channels != mp3->c.channels)) { TRACEOUT(("mp3 decord err")); goto mp3dec_err; } } if (snd->datsize < mp3->c.insize) { goto mp3dec_err; } snd->datptr += mp3->c.insize; snd->datsize -= mp3->c.insize; mp3_decode(mp3, dst, src, mp3->c.insize); return(mp3->c.outsamples); mp3dec_err: return(0); }
void ccnl_nfn_continue_computation(struct ccnl_relay_s *ccnl, int configid, int continue_from_remove){ DEBUGMSG(TRACE, "ccnl_nfn_continue_computation()\n"); struct configuration_s *config = ccnl_nfn_findConfig(ccnl->km->configuration_list, -configid); if(!config){ DEBUGMSG(DEBUG, "nfn_continue_computation: %d not found\n", configid); return; } //update original interest prefix to stay longer...reenable if propagate=0 do not protect interests struct ccnl_interest_s *original_interest; for(original_interest = ccnl->pit; original_interest; original_interest = original_interest->next){ if(!ccnl_prefix_cmp(config->prefix, 0, original_interest->pkt->pfx, CMP_EXACT)){ original_interest->last_used = CCNL_NOW(); original_interest->retries = 0; original_interest->from->last_used = CCNL_NOW(); break; } } if(config->thunk && CCNL_NOW() > config->endtime){ DEBUGMSG(INFO, "NFN: Exit computation: timeout when resolving thunk\n"); DBL_LINKED_LIST_REMOVE(ccnl->km->configuration_list, config); //Reply error! //config->thunk = 0; return; } ccnl_nfn(ccnl, NULL, NULL, config, NULL, 0, 0); TRACEOUT(); }
// GN : グラフィック表示オン (Nonaka.K) int isfcmd_51(SCR_OPE *op) { SINT32 num; POINT_T pt; DISPWIN dispwin; if ((scr_getval(op, &num) != SUCCESS) || (scr_getpt(op, &pt) != SUCCESS)) { return(GAMEEV_WRONGLENG); } dispwin = &gamecore.dispwin; if ((num >= 0) && (num < GAMECORE_MAXVRAM)) { dispwin->flag |= DISPWIN_VRAM; dispwin->vramnum = num; dispwin->posx = pt.x; dispwin->posy = pt.y; vramdraw_setrect(gamecore.vram[num], NULL); vramdraw_draw(); } else { dispwin->flag &= ~DISPWIN_VRAM; } TRACEOUT(("vram disp: %d", num)); return(GAMEEV_SUCCESS); }
BOOL vramdraw_create(void) { SYS_T *sys; VRAMHDL v; sys = &gamecore.sys; #ifndef SIZE_QVGA v = vram_create(sys->width, sys->height, FALSE, DEFAULT_BPP); #else v = vram_create(320, 240, FALSE, DEFAULT_BPP); #endif mainvram = v; if (v == NULL) { TRACEOUT(("couldn't create mainvram")); return(FAILURE); } // vram 0と1は最初から開いてます… #ifndef SIZE_QVGA gamecore.vram[0] = vram_create(sys->width, sys->height, TRUE, DEFAULT_BPP); gamecore.vram[1] = vram_create(sys->width, sys->height, TRUE, DEFAULT_BPP); #else gamecore.vram[0] = vram_create(320, 240, TRUE, DEFAULT_BPP); gamecore.vram[1] = vram_create(320, 240, TRUE, DEFAULT_BPP); #endif unionrect_rst(&gamecore.vramrect); return(SUCCESS); }
REG8 scsicmd_transfer(REG8 id, UINT8 *cdb) { SXSIDEV sxsi; UINT leng; if (scsiio.reg[SCSICTR_TARGETLUN] & 7) { return(0x42); } sxsi = sxsi_getptr((REG8)(0x20 + id)); if ((sxsi == NULL) || (!(sxsi->flag & SXSIFLAG_READY))) { return(0x42); } TRACEOUT(("sel ope code = %.2x", cdb[0])); switch(cdb[0]) { case 0x00: // Test Unit Ready return(0x16); // Succeed case 0x12: // Inquiry leng = scsicmd_datain(sxsi, cdb); #if 0 if (leng > scsiio.transfer) { return(0x2b); // Abort } else if (leng < scsiio.transfer) { return(0x20); // Pause } #endif return(0x16); // Succeed } SCSICMD_ERR return(0xff); }
int cistlv_isData(unsigned char *buf, int len) { struct cisco_tlvhdr_201501_s *hp = (struct cisco_tlvhdr_201501_s*)buf; unsigned short hdrlen, pktlen; // payloadlen; TRACEIN(); if (len < (int) sizeof(struct cisco_tlvhdr_201501_s)) { DEBUGMSG(ERROR, "cistlv header not large enough"); return -1; } hdrlen = hp->hlen; // ntohs(hp->hdrlen); pktlen = ntohs(hp->pktlen); // payloadlen = ntohs(hp->payloadlen); if (hp->version != CISCO_TLV_V1) { DEBUGMSG(ERROR, "cistlv version %d not supported\n", hp->version); return -1; } if (pktlen < len) { DEBUGMSG(ERROR, "cistlv packet too small (%d instead of %d bytes)\n", pktlen, len); return -1; } buf += hdrlen; len -= hdrlen; TRACEOUT(); if(hp->pkttype == CISCO_PT_Content) return 1; else return 0; }
REG8 scsicmd_select(REG8 id) { SXSIDEV sxsi; TRACEOUT(("scsicmd_select")); if (scsiio.reg[SCSICTR_TARGETLUN] & 7) { TRACEOUT(("LUN = %d", scsiio.reg[SCSICTR_TARGETLUN] & 7)); return(0x42); } sxsi = sxsi_getptr((REG8)(0x20 + id)); if ((sxsi) && (sxsi->flag & SXSIFLAG_READY)) { scsiio.phase = SCSIPH_COMMAND; return(0x8a); // Transfer Command要求 } return(0x42); // Timeout }
FLISTH DOSIOCALL file_list1st(const OEMCHAR *dir, FLINFO *fli) { OEMCHAR path[MAX_PATH]; file_cpyname(path, dir, NELEMENTS(path)); file_setseparator(path, NELEMENTS(path)); file_catname(path, str_wildcard, NELEMENTS(path)); TRACEOUT(("file_list1st %s", path)); #if defined(OEMCHAR_SAME_TCHAR) const TCHAR *tcharpath = path; #else TCHAR tcharpath[MAX_PATH]; oemtotchar(tcharpath, NELEMENTS(tcharpath), path, (UINT)-1); #endif HANDLE hdl; WIN32_FIND_DATA w32fd; hdl = FindFirstFile(tcharpath, &w32fd); if (hdl != INVALID_HANDLE_VALUE) { do { if (setflist(&w32fd, fli) == SUCCESS) { return(hdl); } } while(FindNextFile(hdl, &w32fd)); FindClose(hdl); } return(FLISTH_INVALID); }
static void IOOUTCALL epsonio_oc07(UINT port, REG8 dat) { TRACEOUT(("EPSON ROM MODE - %.2x", dat)); switch(dat) { case 0x2a: // 0010|1010 case 0x2b: CopyMemory(mem + 0x1e8000, mem + 0x1c8000, 0x18000); break; case 0x2c: // 0010|1100 case 0x2d: CopyMemory(mem + 0x1e8000, mem + 0x0e8000, 0x10000); CopyMemory(mem + 0x1f8000, mem + 0x1c0000, 0x08000); break; case 0xa6: // 1010|0110 CopyMemory(mem + 0x1c8000, mem + 0x0e8000, 0x10000); CopyMemory(mem + 0x1d8000, mem + 0x1c0000, 0x08000); CopyMemory(mem + 0x1e8000, mem + 0x0e8000, 0x10000); CopyMemory(mem + 0x1f8000, mem + 0x1c0000, 0x08000); break; case 0xe6: // 1110|0110 CopyMemory(mem + 0x1d8000, mem + 0x1c0000, 0x08000); CopyMemory(mem + 0x1f8000, mem + 0x1c0000, 0x08000); break; } (void)port; }
static REG8 scsicmd_cmd(REG8 id) { SXSIDEV sxsi; TRACEOUT(("scsicmd_cmd = %.2x", scsiio.cmd[0])); if (scsiio.reg[SCSICTR_TARGETLUN] & 7) { return(0x42); } sxsi = sxsi_getptr((REG8)(0x20 + id)); if ((sxsi == NULL) || (!(sxsi->flag & SXSIFLAG_READY))) { return(0x42); } switch(scsiio.cmd[0]) { case 0x00: return(0x8b); // Transfer Status要求 case 0x12: // inquiry scsicmd_datain(sxsi, scsiio.cmd); scsiio.phase = SCSIPH_DATAIN; return(0x89); // Transfer Data要求 } SCSICMD_ERR return(0xff); }
void cs4231io_reset(void) { cs4231.enable = 1; cs4231.adrs = 0x22; cs4231.dmairq = cs4231irq[(cs4231.adrs >> 3) & 7]; cs4231.dmach = cs4231dma[cs4231.adrs & 7]; if (cs4231.dmach != 0xff) { dmac_attach(DMADEV_CS4231, cs4231.dmach); } cs4231.port[0] = 0x0f40; cs4231.port[1] = 0xa460; cs4231.port[2] = 0x0f48; cs4231.port[4] = 0x0188; cs4231.port[5] = 0x0f4a; TRACEOUT(("CS4231 - IRQ = %d", cs4231.dmairq)); TRACEOUT(("CS4231 - DMA channel = %d", cs4231.dmach)); }
static void fetch_if4dos(void) { REG16 off; REG16 seg; IF4DOS if4dos; off = MEMR_READ16(IF4DOSPTR_SEG, IF4DOSPTR_OFF + 0); seg = MEMR_READ16(IF4DOSPTR_SEG, IF4DOSPTR_OFF + 2); MEMR_READS(seg, off, &if4dos, sizeof(if4dos)); hostdrv.stat.drive_no = if4dos.drive_no; hostdrv.stat.dosver_major = if4dos.dosver_major; hostdrv.stat.dosver_minor = if4dos.dosver_minor; hostdrv.stat.sda_off = LOADINTELWORD(if4dos.sda_off); hostdrv.stat.sda_seg = LOADINTELWORD(if4dos.sda_seg); TRACEOUT(("hostdrv:drive_no = %d", if4dos.drive_no)); TRACEOUT(("hostdrv:dosver = %d.%.2d", if4dos.dosver_major, if4dos.dosver_minor)); TRACEOUT(("hostdrv.sda = %.4x:%.4x", hostdrv.stat.sda_seg, hostdrv.stat.sda_off)); }
// GADELETE :アニメーションの削除 (T.Yui) int isfcmd_69(SCR_OPE *op) { SINT32 num; if (scr_getval(op, &num) != SUCCESS) { return(GAMEEV_WRONGLENG); } TRACEOUT(("anime del %d", num)); anime_trush(num); return(GAMEEV_SUCCESS); }
// WO : ウィンドウオープン Nonaka.K, T.Yui DRS cmd:28 int isfcmd_29(SCR_OPE *op) { BYTE num; if (scr_getbyte(op, &num) != SUCCESS) { return(GAMEEV_WRONGLENG); } TRACEOUT(("cmd 29")); textwin_open(num); return(GAMEEV_SUCCESS); }
void ccnl_nfn_nack_local_computation(struct ccnl_relay_s *ccnl, struct ccnl_buf_s *orig, struct ccnl_prefix_s *prefix, struct ccnl_face_s *from, int suite) { DEBUGMSG(TRACE, "ccnl_nfn_nack_local_computation\n"); ccnl_nfn(ccnl, prefix, from, NULL, NULL, suite, 1); TRACEOUT(); }
// WC : ウィンドウのクローズ (T.Yui) DRS cmd:29 int isfcmd_2a(SCR_OPE *op) { BYTE num; if (scr_getbyte(op, &num) != SUCCESS) { return(GAMEEV_WRONGLENG); } TRACEOUT(("cmd 2a")); textwin_close(num); textwin_cmdclose(num); // ドーターメーカーだとコマンドも閉じるらしい… return(GAMEEV_SUCCESS); }
// GAOPEN : アニメーションファイルのオープン (T.Yui) int isfcmd_65(SCR_OPE *op) { SINT32 num; char label[ARCFILENAME_LEN+1]; if ((scr_getval(op, &num) != SUCCESS) || (scr_getlabel(op, label, sizeof(label)) != SUCCESS)) { return(GAMEEV_WRONGLENG); } TRACEOUT(("anime open: %d %s", num, label)); anime_open(num, label); return(GAMEEV_SUCCESS); }
// GASTOP : アニメーションのストップ (T.Yui) int isfcmd_5d(SCR_OPE *op) { BYTE cmd; SINT32 param1; SINT32 param2; if ((scr_getbyte(op, &cmd) != SUCCESS) || (scr_getval(op, ¶m1) != SUCCESS) || (scr_getval(op, ¶m2) != SUCCESS)) { return(GAMEEV_WRONGLENG); } TRACEOUT(("anime stop: %d %d %d", cmd, param1, param2)); anime_end(cmd, param1, param2); return(GAMEEV_SUCCESS); }
void CPUCALL ia32_interrupt(int vect, int soft) { // TRACEOUT(("int (%x, %x) PE=%d VM=%d", vect, soft, CPU_STAT_PM, CPU_STAT_VM86)); if (!soft) { INTERRUPT(vect, FALSE, FALSE, 0); } else { if (CPU_STAT_VM86 && (CPU_STAT_IOPL < CPU_IOPL3) && (soft == -1)) { TRACEOUT(("BIOS interrupt: VM86 && IOPL < 3 && INTn")); } INTERRUPT(vect, TRUE, FALSE, 0); } }
void ESC1(void) { UINT32 op, madr; GET_PCBYTE(op); // TRACEOUT(("use FPU d9 %.2x", op)); if (op >= 0xc0) { } else { madr = calc_ea_dst(op); if ((op & 0x38) == 0x38) { TRACEOUT(("FSTCW")); cpu_vmemorywrite_w(CPU_INST_SEGREG_INDEX, madr, 0xffff); } } }
// WS : ウィンドウ表示位置設定 Nonaka.K, T.Yui int isfcmd_20(SCR_OPE *op) { BYTE num; RECT_U scrn; BYTE val; if ((scr_getbyte(op, &num) != SUCCESS) || (scr_getrect(op, &scrn) != SUCCESS)) { return(GAMEEV_WRONGLENG); } scr_getbyte(op, &val); TRACEOUT(("window: %d %d %d %d", scrn.s.left, scrn.s.top, scrn.s.width, scrn.s.height)); textwin_setpos(num, &scrn.s, NULL); return(GAMEEV_SUCCESS); }
// GL : グラフィックロード表示 (Nonaka.K) int isfcmd_56(SCR_OPE *op) { SINT32 num; char label[ARCFILENAME_LEN+1]; if ((scr_getval(op, &num) != SUCCESS) || (scr_getlabel(op, label, sizeof(label)) != SUCCESS)) { return(GAMEEV_WRONGLENG); } TRACEOUT(("load: %d %-12s", num, label)); if ((num >= 0) && (num < GAMECORE_MAXVRAM)) { cgload_data(&gamecore.vram[num], ARCTYPE_GRAPHICS, label); effect_vramdraw(num, NULL); } return(GAMEEV_SUCCESS); }
// GASET : アニメーションデータのセット (T.Yui) int isfcmd_66(SCR_OPE *op) { SINT32 num; SINT32 major; SINT32 minor; SINT32 reg; if ((scr_getval(op, &num) != SUCCESS) || (scr_getval(op, &major) != SUCCESS) || (scr_getval(op, &minor) != SUCCESS) || (scr_getval(op, ®) != SUCCESS)) { return(GAMEEV_WRONGLENG); } TRACEOUT(("anime data set %d %d %d %d", num, major, minor, reg)); anime_setdata(num, major, minor, reg); return(GAMEEV_SUCCESS); }
// WSS : メッセージウィンドウの表示 (T.Yui) int isfcmd_2e(SCR_OPE *op) { SINT32 num; TEXTWIN textwin; if (scr_getval(op, &num) != SUCCESS) { return(GAMEEV_WRONGLENG); } TRACEOUT(("cmd 2e")); textwin = textwin_getwin(num); if (textwin) { textwin->flag &= ~TEXTWIN_TEXTHIDE; vramdraw_setrect(textwin->textctrl.vram, NULL); vramdraw_draw(); } return(GAMEEV_SUCCESS); }