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
- type FastLoad
- type FastLoaded
- type Registers
- type Supercharger
- func (cart Supercharger) GetBank(addr uint16) banks.Details
- func (cart Supercharger) GetRAM() []bus.CartRAM
- func (cart Supercharger) GetRegisters() bus.CartRegisters
- func (cart Supercharger) ID() string
- func (cart *Supercharger) Initialise()
- func (cart Supercharger) IterateBanks(prev *banks.Content) *banks.Content
- func (cart *Supercharger) Listen(addr uint16, _ uint8)
- func (cart Supercharger) NumBanks() int
- func (cart *Supercharger) Patch(_ int, _ uint8) error
- 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) Step()
- func (cart Supercharger) String() string
- func (cart *Supercharger) Write(addr uint16, data uint8, passive bool, poke bool) error
- type Tape
Constants ¶
const MappingID = "AR"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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.
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 bus.CartRegisters interface
func (Registers) BankString ¶
BankString is like string but just the bank information. we use this when building the mapper summary, the String() function is too verbose for that
type Supercharger ¶
type Supercharger struct {
// contains filtered or unexported fields
}
Supercharger represents a supercharger cartridge
func NewSupercharger ¶
func NewSupercharger(data []byte) (*Supercharger, error)
NewSupercharger is the preferred method of initialisation for the Supercharger type
func (Supercharger) GetBank ¶
func (cart Supercharger) GetBank(addr uint16) banks.Details
GetBank implements the cartMapper interface
func (Supercharger) GetRAM ¶
func (cart Supercharger) GetRAM() []bus.CartRAM
GetRAM implements the bus.CartRAMBus interface
func (Supercharger) GetRegisters ¶
func (cart Supercharger) GetRegisters() bus.CartRegisters
GetRegisters implements the bus.CartDebugBus interface
func (Supercharger) ID ¶
func (cart Supercharger) ID() string
ID implements the cartMapper interface
func (*Supercharger) Initialise ¶
func (cart *Supercharger) Initialise()
Initialise implements the cartMapper interface
func (Supercharger) IterateBanks ¶
func (cart Supercharger) IterateBanks(prev *banks.Content) *banks.Content
IterateBank implemnts the disassemble interface
func (*Supercharger) Listen ¶
func (cart *Supercharger) Listen(addr uint16, _ uint8)
Listen implements the 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) PutRAM ¶
func (cart *Supercharger) PutRAM(bank int, idx int, data uint8)
PutRAM implements the bus.CartRAMBus interface
func (*Supercharger) PutRegister ¶
func (cart *Supercharger) PutRegister(register string, data string)
PutRegister implements the bus.CartDebugBus interface
Register specification is divided with the "::" string. The following table describes what the valid register strings 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) Step ¶
func (cart *Supercharger) Step()
Step implements the cartMapper interface
func (Supercharger) String ¶
func (cart Supercharger) String() string
type Tape ¶
type Tape interface {
Load() error
}
Tape defines the operations required by the $fff9 tape loader. With this interface, the Supercharger implementation supports both fast-loading from a Stella bin file, and "slow" loading from a sound file.
func NewFastLoad ¶
func NewFastLoad(cart *Supercharger, data interface{}) (Tape, error)
NewFastLoad is the preferred method of initialisation for the FastLoad type