Package libsidplay

Klasse C64

java.lang.Object
libsidplay.C64
Alle implementierten Schnittstellen:
DatasetteEnvironment, C1541Environment, UserportPrinterEnvironment

public abstract class C64 extends Object implements DatasetteEnvironment, C1541Environment, UserportPrinterEnvironment
Commodore 64 emulation core. It consists of the following chips: PLA, MOS6510, MOS6526(a), VIC 6569(PAL)/6567(NTSC), RAM/ROM.
Some connectors exist additionally: Keyboard, two Joysticks, parallel cable and some memory expansions and other cartridges can be plugged in.
Autor:
Antti Lankila, Ken Händel
  • Felddetails

    • clock

      protected CPUClock clock
      System clock
    • pla

      private final PLA pla
      MMU chip
    • cpu

      private final MOS6510 cpu
      CPU
    • cia1

      protected final MOS6526 cia1
      CIA1
    • cia2

      protected final MOS6526 cia2
      CIA2
    • keyboard

      protected final Keyboard keyboard
      Keyboard
    • parallelCable

      protected IParallelCable parallelCable
      Attached parallel cable
    • palVic

      protected final VIC palVic
      Specific VIC used for PAL.
    • ntscVic

      protected final VIC ntscVic
      Specific VIC used for NTSC.
    • ramBank

      protected final SystemRAMBank ramBank
      System memory array
    • context

      protected final EventScheduler context
      System event context
    • callsToPlayRoutine

      protected int callsToPlayRoutine
      Number of entrances to play routine to determine tune speed
    • lastUpdate

      private long lastUpdate
      Last time tune speed has been measured
    • tuneSpeed

      private double tuneSpeed
      detected tune speed
    • playRoutineObserver

      protected IMOS6510Extension playRoutineObserver
      The interested party for playroutine entrances.
    • joystickPort

      protected final IJoystick[] joystickPort
      Joystick port devices
    • disconnectedJoystick

      private final IJoystick disconnectedJoystick
      Implementation of a disconnected Joystick
    • zeroRAMBank

      private final C64.ZeroRAMBank zeroRAMBank
      Zero page memory bank
  • Konstruktordetails

    • C64

      public C64(byte[] charBin, byte[] basicBin, byte[] kernalBin)
    • C64

      public C64(Function<EventScheduler,MOS6510> cpuCreator, byte[] charBin, byte[] basicBin, byte[] kernalBin)
  • Methodendetails

    • setPlayAddr

      public void setPlayAddr(int playAddr)
      Set play routine address to watch by CPU emulation.
      Parameter:
      playAddr - Observe calls of SID player (JSR $PlayAddr).
    • determineTuneSpeed

      public final double determineTuneSpeed()
      Determine tune speed (calls of play routine per frame).
      Gibt zurück:
      current tune speed
    • setParallelCable

      public final void setParallelCable(IParallelCable parallelCable)
    • reset

      public void reset()
      Perform the equivalent of full power-on reset of C64, re-initializing everything.
    • getRAM

      public byte[] getRAM()
      Return the array backing C64 RAM
      Gibt zurück:
      the RAM
    • getCPU

      public MOS6510 getCPU()
      Return CPU emulator
      Gibt zurück:
      the cpu
    • setPlayRoutineObserver

      public void setPlayRoutineObserver(IMOS6510Extension observer)
      Install a play routine observer to hook the JSR command of the CPU. It gets called, if the player address gets called.
      Parameter:
      observer - play routine observer
    • getVIC

      public VIC getVIC()
      Get VIC chip emulator (PAL/NTSC).
      Gibt zurück:
      VIC chip
    • getVicMemBase

      public int getVicMemBase()
    • insertSIDChips

      public final void insertSIDChips(BiFunction<Integer,SIDEmu,SIDEmu> sidCreator, IntFunction<Integer> sidLocator)
      Insert SID chips to be used.
      Parameter:
      sidCreator - Responsible to decide which SID chips we need (SIDEmu) and which we don't need (NONE). SID number and old SID are mapped to new SID.
      sidLocator - Responsible to determine the base address of the SID chips we need
    • configureVICs

      public void configureVICs(Consumer<VIC> action)
      Configure PAL and NTSC VIC.
      Parameter:
      action - VIC consumer
    • configureSIDs

      public final void configureSIDs(BiConsumer<Integer,SIDEmu> action)
      Configure all available SIDs.
      Parameter:
      action - SID chip consumer
    • configureSID

      public final void configureSID(int chipNum, Consumer<SIDEmu> action)
      Configure one specific SID.
      Parameter:
      chipNum - SID chip number
      action - SID chip consumer
    • setSIDListener

      public void setSIDListener(SIDListener listener)
      Get SID register write notifications.
    • setClock

      protected void setClock(CPUClock clock)
      Set system clock (PAL/NTSC).
      Parameter:
      clock - system clock (PAL/NTSC)
    • getClock

      public CPUClock getClock()
      Get system clock (PAL/NTSC).
      Gibt zurück:
      system clock (PAL/NTSC)
    • getEventScheduler

      public EventScheduler getEventScheduler()
      Get C64's event scheduler
      Gibt zurück:
      the scheduler
    • setCustomKernal

      public void setCustomKernal(byte[] kernalRom)
      Installs a custom Kernal ROM.
      Parameter:
      kernalRom - Kernal ROM replacement (null means original Kernal)
    • getKeyboard

      public Keyboard getKeyboard()
      Get current keyboard emulation.
      Gibt zurück:
      current keyboard emulation
    • setJoystick

      public final void setJoystick(int portNumber, IJoystick joystickReader)
      Set joystick implementation.
      Parameter:
      portNumber - joystick port (0-1)
      joystickReader - joystick implementation or null (disconnected)
    • isJoystickConnected

      public final boolean isJoystickConnected(int portNumber)
      Is joystick connected?
      Parameter:
      portNumber - joystick port (0-1)
      Gibt zurück:
      joystick connected?
    • setCartridge

      public final void setCartridge(CartridgeType type, int sizeKB) throws IOException
      Insert a cartridge of a given size with empty contents.
      Parameter:
      type - cartridge type
      sizeKB - size in KB
      Löst aus:
      IOException - never thrown here
    • setCartridge

      public final void setCartridge(CartridgeType type, File file) throws IOException
      Insert a cartridge loading an image file.
      Parameter:
      type - cartridge type
      file - file to load the RAM contents
      Löst aus:
      IOException - image read error
    • setCartridgeCRT

      public final void setCartridgeCRT(InputStream is) throws IOException
      Insert a cartridge of type CRT loading an image.
      Parameter:
      is - input stream to load the RAM contents
      Löst aus:
      IOException - image read error
    • getCartridge

      public final Cartridge getCartridge()
      Get current multi purpose cartridge of the expansion port of the C64.
      Gibt zurück:
      multi purpose cartridge
    • isCartridge

      public boolean isCartridge()
      Gibt zurück:
      is a multi purpose cartridge inserted into the expansion port of the C64?
    • ejectCartridge

      public final void ejectCartridge()
      Eject multi purpose cartridge from the expansion port of the C64.