C# Class TweetWall.Apple2

Class for handling communications with Apple II.

The physical interface uses an FTDI USB cable running in bitbang mode to drive 3 lines connected to TTL button inputs on the Apple II game connector.

The 3 lines are used to implement an SPI protocol. 2 of the lines are standard DATA and CLK signals and the 3rd (ATTN) is used for framing the start of a command sequence.

The Apple II code is contained in the file TwitterII.m65

ファイルを表示 Open project: yergacheffe/apple2t

Public Methods

Method Description
Apple2 ( ) : System

Initializes the FT_XXX API driver and opens the device.

ClearHires ( ) : void

Erase the Apple II high-res screen

ScrollLores ( ) : void

Scrolls in GR2 screen to GR screen.

SendBuffer ( int address, byte buffer, int length ) : void

High-level utility to transfer an arbirarily-sized buffer to the Apple II at a given address. Uses the fast SendPage() protocol for as much as possible and then fills up stragglers with the slower byte-by-byte transfer.

SendByte ( int address, byte data ) : void

Transfer a byte to the Apple II. If you need to store more than a byte or two, this is a very inefficient way of doing so and you should use the SendBuffer() or SendPage() methods.

SendPage ( byte page, byte data ) : void

Transfer a complete 256-byte page to the Apple II as fast as we can.

TickleAddress ( int address ) : void

Uses the SendByte method to write the value of $00 to a given address. This is used to access the Apple II's memory-mapped soft-switches to do things like change graphics modes, etc.

Private Methods

Method Description
BitBang ( int data ) : void

Writes a byte of data containing pin states.

FT_CreateDeviceInfoList ( int &deviceCount ) : int
FT_GetDeviceInfoDetail ( int index, int &flags, int &type, int &id, int &locid, IntPtr serialNumber, IntPtr description, int &handle ) : int
FT_GetDeviceInfoList ( IntPtr buffer, int &bufferSize ) : int
FT_Open ( int deviceNumber, int &handle ) : int
FT_OpenEx ( IntPtr comString, int flags, int &handle ) : int
FT_SetBaudRate ( int handle, int baud ) : int
FT_SetBitMode ( int handle, byte Mask, byte enable ) : int
FT_Write ( int handle, byte data, int byteCount, int &bytesWritten ) : int
SendByte ( byte data ) : int

Method Details

Apple2() public method

Initializes the FT_XXX API driver and opens the device.
public Apple2 ( ) : System
return System

ClearHires() public method

Erase the Apple II high-res screen
public ClearHires ( ) : void
return void

ScrollLores() public method

Scrolls in GR2 screen to GR screen.
public ScrollLores ( ) : void
return void

SendBuffer() public method

High-level utility to transfer an arbirarily-sized buffer to the Apple II at a given address. Uses the fast SendPage() protocol for as much as possible and then fills up stragglers with the slower byte-by-byte transfer.
public SendBuffer ( int address, byte buffer, int length ) : void
address int Start address. The Apple II is 16-bit /// address bus so only values from $0000 to $FFFF make sense
buffer byte The data to copy to the Apple II
length int How many bytes to copy from buffer
return void

SendByte() public method

Transfer a byte to the Apple II. If you need to store more than a byte or two, this is a very inefficient way of doing so and you should use the SendBuffer() or SendPage() methods.
public SendByte ( int address, byte data ) : void
address int The address to store the byte
data byte The byte to store.
return void

SendPage() public method

Transfer a complete 256-byte page to the Apple II as fast as we can.
public SendPage ( byte page, byte data ) : void
page byte High byte of destinatio address. For example, /// to transfer data to addresses $800..$8FF this parameter will be 0x08
data byte 256 bytes to send
return void

TickleAddress() public method

Uses the SendByte method to write the value of $00 to a given address. This is used to access the Apple II's memory-mapped soft-switches to do things like change graphics modes, etc.
public TickleAddress ( int address ) : void
address int
return void