This provides an interface to serial communication over USB with FXPak and FXPak Pro devices using the USB-enabled firmware. Commands generated by this library are expected to be valid; invalid packets should be impossible to encode with this library.
The FXPak
module exposes all of the logic needed to work with an FXPak. The
following code will generate and send send a packet to reset a running
SNES/Super Famicom:
reset :: FXPak.FXPak -> IO ()
reset device =
let emptyFlags = []
packet = FXPak.packet FXPak.SNES FXPak.Reset emptyFlags FXPak.None
in FXPak.send dev packet >> return ()
and the following code will fetch the game's title portion of the SNES header in most titles:
title :: FXPak.FXPak -> IO (Maybe ByteString)
title dev =
let emptyFlags = []
headerTitleAddress = 0xFFC0
headerTitleLength = 21
packet = FXPak.packet FXPak.SNES FXPak.Get emptyFlags $ FXPak.GetBytes $ FXPak.AddressGet headerTitleAddress headerTitleLength
in FXPak.send dev packet
The understanding of what constitutes a "valid" packet is based on usb2snesw.
This library is released under a BSD 3-clause license.