コード例 #1
0
ファイル: driver.cs プロジェクト: DarrenRainey/xnamame036
 public MachineCPU(int cpu_type, int cpu_clock,
     MemoryReadAddress[] memory_read, MemoryWriteAddress[] memory_write,
 IOReadPort[] port_read, IOWritePort[] port_write,
     vblank_interrupt_callback vblank_interrupt, int vblank_interrupts_per_frame,
     vblank_interrupt_callback interrupt = null, int ips = 0)
 {
     this.cpu_type = cpu_type; this.cpu_clock = cpu_clock;
     this.memory_read = memory_read; this.memory_write = memory_write;
     this.port_read = port_read; this.port_write = port_write;
     this.vblank_interrupt = vblank_interrupt; this.vblank_interrupts_per_frame = vblank_interrupts_per_frame;
     this.timed_interrupt = interrupt;
     this.timed_interrupts_per_second = ips;
 }
コード例 #2
0
ファイル: memory.cs プロジェクト: DarrenRainey/xnamame036
        IOWritePort[] install_port_write_handler_common(int cpu, int start, int end, mem_write_handler handler, int install_at_beginning)
        {
            int i, oldsize;

            oldsize = writeport_size[cpu];
            writeport_size[cpu]++;

            if (writeport[cpu] == null)
            {
                writeport[cpu] = new IOWritePort[writeport_size[cpu]];
            }
            else
            {
                Array.Resize<IOWritePort>(ref writeport[cpu], writeport_size[cpu]);
            }

            if (writeport[cpu] == null) return null;

            if (install_at_beginning != 0)
            {
                /* can't do a single memcpy because it doesn't handle overlapping regions correctly??? */
                for (i = oldsize; i >= 1; i--)
                {
                    Array.Copy(writeport[cpu], i - 1, writeport[cpu], i, 1);
                    //memcpy(&writeport[cpu][i], &writeport[cpu][i - 1], sizeof(struct IOWritePort));
                }

                i = 0;
            }
            else
            {
                i = oldsize;
            }
            writeport[cpu][i] = new IOWritePort();
            writeport[cpu][i].start = start;
            writeport[cpu][i].end = end;
            writeport[cpu][i].handler = handler;

            return writeport[cpu];
        }