Documentation ¶
Overview ¶
Package supercharger implements the tape based cartridge format. The implementation is complex enough for it to be spread over more than one file and so for purposes of clarity it has been placed in its own package.
The supercharger is interfaced in the same way as other cartridge formats. The fastload mechanism however, requires special handling, which is unfortunate but unavoidable. It is worth summarising here:
As a result of a fast-load of a BIN file into supercharger memory, the supercharger package will return an error of type supercharger.FastLoaded
The FastLoaded error indicates an exception to the normal running of the emulation. For the loading to complete the error needs special handling. There are two places in Gopher2600 where this handling takes place. One is in the debugger.inputLoop() and the other in hardware.run() (the latter is called from the playmode package).
Wherever it is handled, the error should be caught and interpreted as a function and called, with a reference to the emulator's CPU, RAM and Timer.
Index ¶
- Constants
- func NewSupercharger(cartload cartridgeloader.Loader) (mapper.CartMapper, error)
- type FastLoad
- type FastLoaded
- type Registers
- type SoundLoad
- type Supercharger
- func (cart *Supercharger) CopyBanks() []mapper.BankContent
- func (cart *Supercharger) GetBank(addr uint16) mapper.BankInfo
- func (cart *Supercharger) GetRAM() []mapper.CartRAM
- func (cart Supercharger) GetRegisters() mapper.CartRegisters
- func (cart *Supercharger) GetTapeState() (bool, mapper.CartTapeState)
- func (cart *Supercharger) ID() string
- func (cart *Supercharger) Listen(addr uint16, _ uint8)
- func (cart *Supercharger) Mapping() string
- func (cart *Supercharger) NumBanks() int
- func (cart *Supercharger) Patch(_ int, _ uint8) error
- func (cart *Supercharger) Plumb()
- func (cart *Supercharger) PutRAM(bank int, idx int, data uint8)
- func (cart *Supercharger) PutRegister(register string, data string)
- func (cart *Supercharger) Read(fullAddr uint16, passive bool) (uint8, error)
- func (cart *Supercharger) ReadHotspots() map[uint16]mapper.CartHotspotInfo
- func (cart *Supercharger) Reset(randSrc *rand.Rand)
- func (cart *Supercharger) Rewind()
- func (cart *Supercharger) SetTapeCounter(c int)
- func (cart *Supercharger) Snapshot() mapper.CartMapper
- func (cart *Supercharger) Step(_ float32)
- func (cart *Supercharger) Write(addr uint16, data uint8, passive bool, poke bool) error
- func (cart *Supercharger) WriteHotspots() map[uint16]mapper.CartHotspotInfo
Constants ¶
const MappingID = "AR"
Variables ¶
This section is empty.
Functions ¶
func NewSupercharger ¶
func NewSupercharger(cartload cartridgeloader.Loader) (mapper.CartMapper, error)
NewSupercharger is the preferred method of initialisation for the Supercharger type.
Types ¶
type FastLoad ¶
type FastLoad struct {
// contains filtered or unexported fields
}
FastLoad implements the Tape interface. It loads data from a binary file rather than a sound file.
On success it returns the FastLoaded error. This must be interpreted by the emulator driver and called with the arguments listed in the error type.
Format information for fast-loca binary rom mailing list post:
Subject: Re: [stella] Supercharger BIN format From: Eckhard Stolberg Date: Fri, 08 Jan 1999.
type FastLoaded ¶
FastLoaded error is returned on success of FastLoad.load(). It must be honoured (ie. caught and the function called) by the driving emulator for the fastload process to complete.
It is unusual to use an error in this way but this is the only effective way of sending a signal that something unusual has happened. In that sense, it is an error, the normal run of the emulator has been interrupted and must be handled.
That there is nothing else like this in the 2600 emulation, using an error like this is justified. It is an exception to the rule, so to speak, and setting up another way of sending the "fast load completed" signal is inappropriate.
!!TODO: is there a good way of handling FastLoading completion through the cartridgeloader.OnLoader() mechanism?
func (FastLoaded) Error ¶
func (er FastLoaded) Error() string
type Registers ¶
type Registers struct { Value uint8 Delay int // 0=off, 1=trigger // the last value to be written to (not including fff8 writes) LastWriteValue uint8 LastWriteAddress uint16 // config byte, raw value ConfigByte uint8 // config byte broken into parts WriteDelay int BankingMode int RAMwrite bool ROMpower bool // contains filtered or unexported fields }
Registers implements the mapper.CartRegisters interface.
type SoundLoad ¶ added in v0.7.1
type SoundLoad struct {
// contains filtered or unexported fields
}
SoundLoad implements the Tape interface. It loads data from a sound file.
Compared to FastLoad this method is more 'authentic' and uses the BIOS correctly.
func (*SoundLoad) GetTapeState ¶ added in v0.7.1
func (tap *SoundLoad) GetTapeState() (bool, mapper.CartTapeState)
func (*SoundLoad) Rewind ¶ added in v0.7.1
func (tap *SoundLoad) Rewind()
Rewind implements the mapper.CartTapeBus interface.
func (*SoundLoad) SetTapeCounter ¶ added in v0.7.1
SetTapeCounter implements the mapper.CartTapeBus interface.
type Supercharger ¶
type Supercharger struct {
// contains filtered or unexported fields
}
Supercharger represents a supercharger cartridge.
func (*Supercharger) CopyBanks ¶ added in v0.7.1
func (cart *Supercharger) CopyBanks() []mapper.BankContent
IterateBank implements the mapper.CartMapper interface.
func (*Supercharger) GetBank ¶
func (cart *Supercharger) GetBank(addr uint16) mapper.BankInfo
GetBank implements the cartMapper interface.
func (*Supercharger) GetRAM ¶
func (cart *Supercharger) GetRAM() []mapper.CartRAM
GetRAM implements the mapper.CartRAMBus interface.
func (Supercharger) GetRegisters ¶
func (cart Supercharger) GetRegisters() mapper.CartRegisters
GetRegisters implements the mapper.CartDebugBus interface.
func (*Supercharger) GetTapeState ¶ added in v0.7.1
func (cart *Supercharger) GetTapeState() (bool, mapper.CartTapeState)
GetTapeState implements the mapper.CartTapeBus interface
Whether this does anything meaningful depends on the interal implementation of the 'tape' interface.
func (*Supercharger) ID ¶
func (cart *Supercharger) ID() string
ID implements the cartMapper interface.
func (*Supercharger) Listen ¶
func (cart *Supercharger) Listen(addr uint16, _ uint8)
Listen implements the cartMapper interface.
func (*Supercharger) Mapping ¶ added in v0.10.1
func (cart *Supercharger) Mapping() string
Mapping implements the mapper.CartMapper interface.
func (*Supercharger) NumBanks ¶
func (cart *Supercharger) NumBanks() int
NumBanks implements the cartMapper interface.
func (*Supercharger) Patch ¶
func (cart *Supercharger) Patch(_ int, _ uint8) error
Patch implements the cartMapper interface.
func (*Supercharger) Plumb ¶ added in v0.7.1
func (cart *Supercharger) Plumb()
Plumb implements the mapper.CartMapper interface.
func (*Supercharger) PutRAM ¶
func (cart *Supercharger) PutRAM(bank int, idx int, data uint8)
PutRAM implements the mapper.CartRAMBus interface.
func (*Supercharger) PutRegister ¶
func (cart *Supercharger) PutRegister(register string, data string)
PutRegister implements the mapper.CartDebugBus interface
the register argument must be one of the following and after the = sign, the type to which the data argument will be converted.
value = int delay = int (0 ... 6) ramwrite = bool rompower = bool
note that PutRegister() will panic() if the register or data string is invalid.
func (*Supercharger) Read ¶
func (cart *Supercharger) Read(fullAddr uint16, passive bool) (uint8, error)
Read implements the cartMapper interface.
func (*Supercharger) ReadHotspots ¶ added in v0.7.1
func (cart *Supercharger) ReadHotspots() map[uint16]mapper.CartHotspotInfo
ReadHotspots implements the mapper.CartHotspotsBus interface.
func (*Supercharger) Reset ¶ added in v0.7.1
func (cart *Supercharger) Reset(randSrc *rand.Rand)
Reset implements the mapper.CartMapper interface.
func (*Supercharger) Rewind ¶ added in v0.7.1
func (cart *Supercharger) Rewind()
Rewind implements the mapper.CartTapeBus interface
Whether this does anything meaningful depends on the interal implementation of the 'tape' interface.
func (*Supercharger) SetTapeCounter ¶ added in v0.7.1
func (cart *Supercharger) SetTapeCounter(c int)
SetTapeCounter implements the mapper.CartTapeBus interface
Whether this does anything meaningful depends on the interal implementation of the 'tape' interface.
func (*Supercharger) Snapshot ¶ added in v0.7.1
func (cart *Supercharger) Snapshot() mapper.CartMapper
Snapshot implements the mapper.CartMapper interface.
func (*Supercharger) Step ¶
func (cart *Supercharger) Step(_ float32)
Step implements the cartMapper interface.
func (*Supercharger) WriteHotspots ¶ added in v0.7.1
func (cart *Supercharger) WriteHotspots() map[uint16]mapper.CartHotspotInfo
WriteHotspots implements the mapper.CartHotspotsBus interface.