public static Vic Create(C64.BorderType borderType) { return(new Vic( Cycles, Lines, Pipeline, 17734472 / 18, HblankStart, HblankEnd, VblankStart, VblankEnd, borderType, 7375, 7882)); }
public static Vic Create(C64.BorderType borderType) { return(new Vic( Cycles, Lines, Pipeline, 14318181 / 14, HblankStart, HblankEnd, VblankStart, VblankEnd, borderType, 6136, 8182)); }
public static Vic Create(C64.BorderType borderType) { return(new Vic( Cycles, Lines, Pipeline, 14328225 / 14, HblankStart, HblankEnd, VblankStart, VblankEnd, borderType, 908, 1000 )); }
private void ConfigureBlanking(int lines, int hblankStart, int hblankEnd, int vblankStart, int vblankEnd, C64.BorderType borderType) { var newHblankStart = hblankStart; var newHblankEnd = hblankEnd; var newVblankStart = vblankStart; var newVblankEnd = vblankEnd; var hBorderSize = 16; // must be a multiple of 4 var vBorderSize = hBorderSize * _pixelRatioNum / _pixelRatioDen; // to keep top and bottom in proportion var maxWidth = _rasterXPipeline.Max(); switch (borderType) { case C64.BorderType.Full: newHblankStart = -1; newHblankEnd = -1; _hblank = false; newVblankStart = -1; newVblankEnd = -1; _vblank = false; break; case C64.BorderType.Normal: newHblankStart = hblankStart; newHblankEnd = hblankEnd; newVblankStart = vblankStart; newVblankEnd = vblankEnd; _vblank = true; _hblank = true; break; case C64.BorderType.SmallProportional: _vblank = true; _hblank = true; newHblankStart = 0x158 + PixBufferSize + hBorderSize; newHblankEnd = 0x018 + PixBufferSize - hBorderSize; newVblankStart = 0xFA + vBorderSize; newVblankEnd = 0x32 - vBorderSize; break; case C64.BorderType.SmallFixed: _vblank = true; _hblank = true; newHblankStart = 0x158 + PixBufferSize + hBorderSize; newHblankEnd = 0x018 + PixBufferSize - hBorderSize; newVblankStart = 0xFA + hBorderSize; newVblankEnd = 0x32 - hBorderSize; break; case C64.BorderType.None: newHblankStart = 0x158 + PixBufferSize; newHblankEnd = 0x018 + PixBufferSize; newVblankStart = 0xFA; newVblankEnd = 0x32; _vblank = true; _hblank = true; break; } // wrap values if (_hblank) { newHblankStart = WrapValue(0, maxWidth, newHblankStart); newHblankEnd = WrapValue(0, maxWidth, newHblankEnd); } if (_vblank) { newVblankStart = WrapValue(0, lines, newVblankStart); newVblankEnd = WrapValue(0, lines, newVblankEnd); } // calculate output dimensions _hblankStartCheckXRaster = newHblankStart & 0xFFC; _hblankEndCheckXRaster = newHblankEnd & 0xFFC; _vblankStart = newVblankStart; _vblankEnd = newVblankEnd; _bufWidth = TimingBuilder_ScreenWidth(_rasterXPipeline, newHblankStart, newHblankEnd); _bufHeight = TimingBuilder_ScreenHeight(newVblankStart, newVblankEnd, lines); _buf = new int[_bufWidth * _bufHeight]; _bufLength = _buf.Length; VirtualWidth = _bufWidth * _pixelRatioNum / _pixelRatioDen; VirtualHeight = _bufHeight; }
public Vic(int newCycles, int newLines, IList <int[]> newPipeline, int newCyclesPerSec, int hblankStart, int hblankEnd, int vblankStart, int vblankEnd, C64.BorderType borderType, int pixelRatioNum, int pixelRatioDen) { Util.DebugWriteLine("C64 VIC timings:"); Util.DebugWriteLine("RX FTCH BA ACT"); for (var i = 0; i < newPipeline[0].Length; i++) { Util.DebugWriteLine("{0:x4} {1:x4} {2:x4} {3:x8}", newPipeline[0][i], newPipeline[1][i], newPipeline[2][i], newPipeline[3][i]); } _pixelRatioNum = pixelRatioNum; _pixelRatioDen = pixelRatioDen; _rasterXPipeline = newPipeline[0]; _fetchPipeline = newPipeline[1]; _baPipeline = newPipeline[2]; _actPipeline = newPipeline[3]; _totalCycles = newCycles; _totalLines = newLines; _cyclesPerSec = newCyclesPerSec; ConfigureBlanking(newLines, hblankStart, hblankEnd, vblankStart, vblankEnd, borderType); _sprites = new Sprite[8]; for (var i = 0; i < 8; i++) { _sprites[i] = new Sprite(i); } _sprite0 = _sprites[0]; _sprite1 = _sprites[1]; _sprite2 = _sprites[2]; _sprite3 = _sprites[3]; _sprite4 = _sprites[4]; _sprite5 = _sprites[5]; _sprite6 = _sprites[6]; _sprite7 = _sprites[7]; _bufferC = new int[40]; _pixBuffer = new int[PixBufferSize]; _pixBorderBuffer = new int[PixBorderBufferSize]; }
public Motherboard(C64 c64, C64.VicType initRegion, C64.BorderType borderType, C64.SidType sidType, C64.TapeDriveType tapeDriveType, C64.DiskDriveType diskDriveType) { // note: roms need to be added on their own externally _c64 = c64; int clockNum, clockDen; switch (initRegion) { case C64.VicType.Pal: clockNum = 17734475; clockDen = 18; break; case C64.VicType.Ntsc: clockNum = 14318181; clockDen = 14; break; case C64.VicType.NtscOld: clockNum = 11250000; clockDen = 11; break; case C64.VicType.Drean: clockNum = 14328225; clockDen = 14; break; default: throw new System.Exception(); } CartPort = new CartridgePort(); Cassette = new CassettePort(); ColorRam = new Chip2114(); Cpu = new Chip6510(); Pla = new Chip90611401(); Ram = new Chip4864(); Serial = new SerialPort(); switch (sidType) { case C64.SidType.OldR2: Sid = Chip6581R2.Create(44100, clockNum, clockDen); break; case C64.SidType.OldR3: Sid = Chip6581R3.Create(44100, clockNum, clockDen); break; case C64.SidType.OldR4AR: Sid = Chip6581R4AR.Create(44100, clockNum, clockDen); break; case C64.SidType.NewR5: Sid = Chip8580R5.Create(44100, clockNum, clockDen); break; } switch (initRegion) { case C64.VicType.Ntsc: Vic = Chip6567R8.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.Ntsc, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.Ntsc, Cia1_ReadPortA); break; case C64.VicType.Pal: Vic = Chip6569.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.Pal, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.Pal, Cia1_ReadPortA); break; case C64.VicType.NtscOld: Vic = Chip6567R56A.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.NtscRevA, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.NtscRevA, Cia1_ReadPortA); break; case C64.VicType.Drean: Vic = Chip6572.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.Pal, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.Pal, Cia1_ReadPortA); break; } User = new UserPort(); ClockNumerator = clockNum; ClockDenominator = clockDen; // Initialize disk drive switch (diskDriveType) { case C64.DiskDriveType.Commodore1541: case C64.DiskDriveType.Commodore1541II: DiskDrive = new Drive1541(ClockNumerator, ClockDenominator); Serial.Connect(DiskDrive); break; } // Initialize tape drive switch (tapeDriveType) { case C64.TapeDriveType.Commodore1530: TapeDrive = new TapeDrive(); Cassette.Connect(TapeDrive); break; } BasicRom = new Chip23128(); CharRom = new Chip23128(); KernalRom = new Chip23128(); }