Beispiel #1
0
        void WriteReg(int addr, byte val)
        {
            switch (addr)
            {
            case 0x4000:
            case 0x4001:
            case 0x4002:
            case 0x4003:
            case 0x4004:
            case 0x4005:
            case 0x4006:
            case 0x4007:
            case 0x4008:
            case 0x4009:
            case 0x400A:
            case 0x400B:
            case 0x400C:
            case 0x400D:
            case 0x400E:
            case 0x400F:
            case 0x4010:
            case 0x4011:
            case 0x4012:
            case 0x4013:
                apu.WriteReg(addr, val);
                break;

            case 0x4014:
                //schedule a sprite dma event for beginning 1 cycle in the future.
                //this receives 2 because thats just the way it works out.
                oam_dma_addr     = (ushort)(val << 8);
                sprdma_countdown = 1;
                break;

            case 0x4015: apu.WriteReg(addr, val); break;

            case 0x4016:
                if (_isVS)
                {
                    write_joyport(val);
                    VS_chr_reg = (byte)((val & 0x4) >> 2);

                    //TODO: does other stuff for dual system

                    //this is actually different then assignment
                    VS_prg_reg = (byte)((val & 0x4) >> 2);
                }
                else
                {
                    write_joyport(val);
                }
                break;

            case 0x4017: apu.WriteReg(addr, val); break;

            default:
                //Console.WriteLine("wrote register: {0:x4} = {1:x2}", addr, val);
                break;
            }
        }
Beispiel #2
0
        void WriteReg(int addr, byte val)
        {
            switch (addr)
            {
            case 0x4000:
            case 0x4001:
            case 0x4002:
            case 0x4003:
            case 0x4004:
            case 0x4005:
            case 0x4006:
            case 0x4007:
            case 0x4008:
            case 0x4009:
            case 0x400A:
            case 0x400B:
            case 0x400C:
            case 0x400D:
            case 0x400E:
            case 0x400F:
            case 0x4010:
            case 0x4011:
            case 0x4012:
            case 0x4013:
                apu.WriteReg(addr, val);
                break;

            case 0x4014: Exec_OAMDma(val); break;

            case 0x4015: apu.WriteReg(addr, val); break;

            case 0x4016:
                if (_isVS)
                {
                    write_joyport(val);
                    VS_chr_reg = (byte)((val & 0x4) >> 2);

                    //TODO: does other stuff for dual system

                    //this is actually different then assignment
                    VS_prg_reg = (byte)((val & 0x4) >> 2);
                }
                else
                {
                    write_joyport(val);
                }
                break;

            case 0x4017: apu.WriteReg(addr, val); break;

            default:
                //Console.WriteLine("wrote register: {0:x4} = {1:x2}", addr, val);
                break;
            }
        }
Beispiel #3
0
        void WriteReg(int addr, byte val)
        {
            switch (addr)
            {
            case 0x4000:
            case 0x4001:
            case 0x4002:
            case 0x4003:
            case 0x4004:
            case 0x4005:
            case 0x4006:
            case 0x4007:
            case 0x4008:
            case 0x4009:
            case 0x400A:
            case 0x400B:
            case 0x400C:
            case 0x400D:
            case 0x400E:
            case 0x400F:
            case 0x4010:
            case 0x4011:
            case 0x4012:
            case 0x4013:
                apu.WriteReg(addr, val);
                break;

            case 0x4014: Exec_OAMDma(val); break;

            case 0x4015: apu.WriteReg(addr, val); break;

            case 0x4016:
                if (_iskeyboard)
                {
                    // eventually keyboard emulation will go here
                }
                else
                {
                    write_joyport(val);
                }
                break;

            case 0x4017: apu.WriteReg(addr, val); break;

            default:
                //Console.WriteLine("wrote register: {0:x4} = {1:x2}", addr, val);
                break;
            }
        }
Beispiel #4
0
        void WriteReg(int addr, byte val)
        {
            switch (addr)
            {
            case 0x4000:
            case 0x4001:
            case 0x4002:
            case 0x4003:
            case 0x4004:
            case 0x4005:
            case 0x4006:
            case 0x4007:
            case 0x4008:
            case 0x4009:
            case 0x400A:
            case 0x400B:
            case 0x400C:
            case 0x400D:
            case 0x400E:
            case 0x400F:
            case 0x4010:
            case 0x4011:
            case 0x4012:
            case 0x4013:
                apu.WriteReg(addr, val);
                break;

            case 0x4014: Exec_OAMDma(val); break;

            case 0x4015: apu.WriteReg(addr, val); break;

            case 0x4016:
                write_joyport(val);
                break;

            case 0x4017: apu.WriteReg(addr, val); break;

            default:
                //Console.WriteLine("wrote register: {0:x4} = {1:x2}", addr, val);
                break;
            }
        }
Beispiel #5
0
        private void WriteReg(int addr, byte val)
        {
            switch (addr)
            {
            case 0x4000:
            case 0x4001:
            case 0x4002:
            case 0x4003:
            case 0x4004:
            case 0x4005:
            case 0x4006:
            case 0x4007:
            case 0x4008:
            case 0x4009:
            case 0x400A:
            case 0x400B:
            case 0x400C:
            case 0x400D:
            case 0x400E:
            case 0x400F:
            case 0x4010:
            case 0x4011:
            case 0x4012:
            case 0x4013:
                apu.WriteReg(addr, val);
                break;

            case 0x4014:
                //schedule a sprite dma event for beginning 1 cycle in the future.
                //this receives 2 because that's just the way it works out.
                oam_dma_addr     = (ushort)(val << 8);
                sprdma_countdown = 1;

                if (sprdma_countdown > 0)
                {
                    sprdma_countdown--;
                    if (sprdma_countdown == 0)
                    {
                        if (cpu.TotalExecutedCycles % 2 == 0)
                        {
                            cpu_deadcounter = 2;
                        }
                        else
                        {
                            cpu_deadcounter = 1;
                        }
                        oam_dma_exec       = true;
                        cpu.RDY            = false;
                        oam_dma_index      = 0;
                        special_case_delay = true;
                    }
                }
                break;

            case 0x4015: apu.WriteReg(addr, val); break;

            case 0x4016:
                if (_isVS)
                {
                    write_joyport(val);
                    VS_chr_reg = (byte)((val & 0x4) >> 2);

                    //TODO: does other stuff for dual system

                    //this is actually different then assignment
                    VS_prg_reg = (byte)((val & 0x4) >> 2);
                }
                else
                {
                    write_joyport(val);
                }
                break;

            case 0x4017: apu.WriteReg(addr, val); break;

            default:
                //Console.WriteLine("wrote register: {0:x4} = {1:x2}", addr, val);
                break;
            }
        }