Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

D64Drive Class Reference

#include <1541d64.h>

Inheritance diagram for D64Drive:

Inheritance graph
[legend]
Collaboration diagram for D64Drive:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 D64Drive (IEC *iec, char *filepath)
virtual ~D64Drive ()
virtual uint8 Open (int channel, char *filename)
virtual uint8 Close (int channel)
virtual uint8 Read (int channel, uint8 *byte)
virtual uint8 Write (int channel, uint8 byte, bool eoi)
virtual void Reset (void)

Private Member Functions

void open_close_d64_file (char *d64name)
uint8 open_file (int channel, char *filename)
void convert_filename (char *srcname, char *destname, int *filemode, int *filetype)
bool find_file (char *filename, int *track, int *sector)
uint8 open_file_ts (int channel, int track, int sector)
uint8 open_directory (char *pattern)
uint8 open_direct (int channel, char *filename)
void close_all_channels ()
void execute_command (char *command)
void block_read_cmd (char *command)
void buffer_ptr_cmd (char *command)
bool parse_bcmd (char *cmd, int *arg1, int *arg2, int *arg3, int *arg4)
void chd64_cmd (char *d64name)
int alloc_buffer (int want)
void free_buffer (int buf)
bool read_sector (int track, int sector, uint8 *buffer)
int offset_from_ts (int track, int sector)
uint8 conv_from_64 (uint8 c, bool map_slash)

Private Attributes

char orig_d64_name [256]
FILE * the_file
uint8ram
BAMbam
Directory dir
int chan_mode [16]
int chan_buf_num [16]
uint8chan_buf [16]
uint8buf_ptr [16]
int buf_len [16]
bool buf_free [4]
char cmd_buffer [44]
int cmd_len
int image_header
uint8 error_info [683]

Constructor & Destructor Documentation

D64Drive::D64Drive IEC iec,
char *  filepath
 

Definition at line 54 of file 1541d64.cpp.

References __CHECK_NULL, bam, chan_buf, chan_mode, CHMOD_COMMAND, CHMOD_FREE, CTOR, open_close_d64_file(), orig_d64_name, ram, Drive::Ready, Reset(), strcpy, the_file, and uint8.

D64Drive::~D64Drive  )  [virtual]
 

Definition at line 91 of file 1541d64.cpp.

References DTOR, open_close_d64_file(), ram, and Drive::Ready.


Member Function Documentation

int D64Drive::alloc_buffer int  want  )  [private]
 

Definition at line 929 of file 1541d64.cpp.

References buf_free.

Referenced by open_direct().

void D64Drive::block_read_cmd char *  command  )  [private]
 

Definition at line 786 of file 1541d64.cpp.

References buf_len, buf_ptr, chan_buf, chan_mode, CHMOD_DIRECT, ERR_NOCHANNEL, ERR_OK, ERR_SYNTAX30, parse_bcmd(), read_sector(), and Drive::set_error().

Referenced by execute_command().

void D64Drive::buffer_ptr_cmd char *  command  )  [private]
 

Definition at line 806 of file 1541d64.cpp.

References buf_len, buf_ptr, chan_buf, chan_mode, CHMOD_DIRECT, ERR_NOCHANNEL, ERR_OK, ERR_SYNTAX30, parse_bcmd(), and Drive::set_error().

Referenced by execute_command().

void D64Drive::chd64_cmd char *  d64name  )  [private]
 

Definition at line 882 of file 1541d64.cpp.

References bam, close_all_channels(), conv_from_64(), NAMEBUF_LENGTH, open_close_d64_file(), orig_d64_name, read_sector(), and uint8.

Referenced by execute_command().

uint8 D64Drive::Close int  channel  )  [virtual]
 

Implements Drive.

Definition at line 545 of file 1541d64.cpp.

References chan_buf, chan_buf_num, chan_mode, CHMOD_DIRECT, CHMOD_FREE, close_all_channels(), free_buffer(), ST_OK, and uint8.

Referenced by close_all_channels().

void D64Drive::close_all_channels  )  [private]
 

Definition at line 577 of file 1541d64.cpp.

References Close(), and cmd_len.

Referenced by chd64_cmd(), Close(), execute_command(), open_close_d64_file(), and Reset().

uint8 D64Drive::conv_from_64 uint8  c,
bool  map_slash
[private]
 

Todo:
use prefs

Definition at line 1028 of file 1541d64.cpp.

References uint8.

Referenced by chd64_cmd().

void D64Drive::convert_filename char *  srcname,
char *  destname,
int *  filemode,
int *  filetype
[private]
 

Definition at line 227 of file 1541d64.cpp.

References FMODE_APPEND, FMODE_READ, FMODE_WRITE, FTYPE_PRG, FTYPE_REL, FTYPE_SEQ, FTYPE_USR, NAMEBUF_LENGTH, strchr(), and strncpy.

Referenced by open_file().

void D64Drive::execute_command char *  command  )  [private]
 

Definition at line 677 of file 1541d64.cpp.

References bam, block_read_cmd(), buffer_ptr_cmd(), chd64_cmd(), close_all_channels(), ERR_OK, ERR_SYNTAX30, ERR_WRITEPROTECT, Drive::error_len, Drive::error_ptr, ram, read_sector(), Reset(), Drive::set_error(), uint16, and uint8.

Referenced by Open(), and Write().

bool D64Drive::find_file char *  filename,
int *  track,
int *  sector
[private]
 

Definition at line 283 of file 1541d64.cpp.

References bam, dir, BAM::dir_sector, BAM::dir_track, Directory::entry, DirEntry::name, Directory::next_sector, Directory::next_track, read_sector(), DirEntry::sector, DirEntry::track, DirEntry::type, and uint8.

Referenced by open_file().

void D64Drive::free_buffer int  buf  )  [private]
 

Definition at line 955 of file 1541d64.cpp.

References buf_free.

Referenced by Close().

int D64Drive::offset_from_ts int  track,
int  sector
[private]
 

Definition at line 1014 of file 1541d64.cpp.

References num_sectors, NUM_TRACKS, and sector_offset.

Referenced by read_sector().

uint8 D64Drive::Open int  channel,
char *  filename
[virtual]
 

Implements Drive.

Definition at line 156 of file 1541d64.cpp.

References chan_mode, CHMOD_FREE, ERR_NOCHANNEL, ERR_OK, execute_command(), open_direct(), open_directory(), open_file(), open_file_ts(), Drive::set_error(), ST_OK, and uint8.

void D64Drive::open_close_d64_file char *  d64name  )  [private]
 

Definition at line 107 of file 1541d64.cpp.

References close_all_channels(), error_info, fclose, fopen, fread, fseek, ftell, image_header, memset, NUM_SECTORS, rewind, the_file, and uint8.

Referenced by chd64_cmd(), D64Drive(), and ~D64Drive().

uint8 D64Drive::open_direct int  channel,
char *  filename
[private]
 

Definition at line 513 of file 1541d64.cpp.

References alloc_buffer(), buf_len, buf_ptr, chan_buf, chan_buf_num, chan_mode, CHMOD_DIRECT, ERR_NOCHANNEL, ram, Drive::set_error(), ST_OK, and uint8.

Referenced by Open().

uint8 D64Drive::open_directory char *  pattern  )  [private]
 

Definition at line 369 of file 1541d64.cpp.

References bam, BAM::bitmap, buf_len, buf_ptr, chan_buf, chan_mode, CHMOD_DIRECTORY, dir, BAM::dir_sector, BAM::dir_track, BAM::disk_name, Directory::entry, match(), DirEntry::name, Directory::next_sector, Directory::next_track, DirEntry::num_blocks_h, DirEntry::num_blocks_l, read_sector(), ST_OK, strchr(), DirEntry::type, type_char_1, type_char_2, type_char_3, and uint8.

Referenced by Open().

uint8 D64Drive::open_file int  channel,
char *  filename
[private]
 

Definition at line 188 of file 1541d64.cpp.

References convert_filename(), ERR_FILENOTFOUND, ERR_WRITEPROTECT, find_file(), FMODE_READ, FMODE_WRITE, FTYPE_PRG, open_file_ts(), Drive::set_error(), ST_OK, and uint8.

Referenced by Open().

uint8 D64Drive::open_file_ts int  channel,
int  track,
int  sector
[private]
 

Definition at line 330 of file 1541d64.cpp.

References buf_len, chan_buf, chan_mode, CHMOD_FILE, ST_OK, and uint8.

Referenced by Open(), and open_file().

bool D64Drive::parse_bcmd char *  cmd,
int *  arg1,
int *  arg2,
int *  arg3,
int *  arg4
[private]
 

Definition at line 827 of file 1541d64.cpp.

Referenced by block_read_cmd(), and buffer_ptr_cmd().

uint8 D64Drive::Read int  channel,
uint8 byte
[virtual]
 

Implements Drive.

Definition at line 590 of file 1541d64.cpp.

References buf_len, buf_ptr, chan_buf, chan_mode, CHMOD_COMMAND, CHMOD_DIRECT, CHMOD_DIRECTORY, CHMOD_FILE, ERR_OK, Drive::error_len, Drive::error_ptr, read_sector(), Drive::set_error(), ST_EOF, ST_OK, ST_READ_TIMEOUT, and uint8.

bool D64Drive::read_sector int  track,
int  sector,
uint8 buffer
[private]
 

Definition at line 966 of file 1541d64.cpp.

References ERR_ILLEGALTS, ERR_NOTREADY, fread, fseek, ftell, image_header, offset_from_ts(), Drive::set_error(), and the_file.

Referenced by block_read_cmd(), chd64_cmd(), execute_command(), find_file(), open_directory(), Read(), and Reset().

void D64Drive::Reset void   )  [virtual]
 

Implements Drive.

Definition at line 907 of file 1541d64.cpp.

References bam, buf_free, close_all_channels(), cmd_len, ELOG1, ERR_STARTUP, read_sector(), Drive::set_error(), and uint8.

Referenced by D64Drive(), and execute_command().

uint8 D64Drive::Write int  channel,
uint8  byte,
bool  eoi
[virtual]
 

Implements Drive.

Definition at line 644 of file 1541d64.cpp.

References chan_mode, CHMOD_COMMAND, CHMOD_DIRECTORY, CHMOD_FREE, cmd_buffer, cmd_len, ERR_FILENOTOPEN, ERR_WRITEFILEOPEN, execute_command(), Drive::set_error(), ST_OK, ST_TIMEOUT, and uint8.


Member Data Documentation

BAM* D64Drive::bam [private]
 

Definition at line 89 of file 1541d64.h.

Referenced by chd64_cmd(), D64Drive(), execute_command(), find_file(), open_directory(), and Reset().

bool D64Drive::buf_free[4] [private]
 

Definition at line 98 of file 1541d64.h.

Referenced by alloc_buffer(), free_buffer(), and Reset().

int D64Drive::buf_len[16] [private]
 

Definition at line 96 of file 1541d64.h.

Referenced by block_read_cmd(), buffer_ptr_cmd(), open_direct(), open_directory(), open_file_ts(), and Read().

uint8* D64Drive::buf_ptr[16] [private]
 

Definition at line 95 of file 1541d64.h.

Referenced by block_read_cmd(), buffer_ptr_cmd(), open_direct(), open_directory(), and Read().

uint8* D64Drive::chan_buf[16] [private]
 

Definition at line 94 of file 1541d64.h.

Referenced by block_read_cmd(), buffer_ptr_cmd(), Close(), D64Drive(), open_direct(), open_directory(), open_file_ts(), and Read().

int D64Drive::chan_buf_num[16] [private]
 

Definition at line 93 of file 1541d64.h.

Referenced by Close(), and open_direct().

int D64Drive::chan_mode[16] [private]
 

Definition at line 92 of file 1541d64.h.

Referenced by block_read_cmd(), buffer_ptr_cmd(), Close(), D64Drive(), Open(), open_direct(), open_directory(), open_file_ts(), Read(), and Write().

char D64Drive::cmd_buffer[44] [private]
 

Definition at line 100 of file 1541d64.h.

Referenced by Write().

int D64Drive::cmd_len [private]
 

Definition at line 101 of file 1541d64.h.

Referenced by close_all_channels(), Reset(), and Write().

Directory D64Drive::dir [private]
 

Definition at line 90 of file 1541d64.h.

Referenced by find_file(), and open_directory().

uint8 D64Drive::error_info[683] [private]
 

Definition at line 105 of file 1541d64.h.

Referenced by open_close_d64_file().

int D64Drive::image_header [private]
 

Definition at line 103 of file 1541d64.h.

Referenced by open_close_d64_file(), and read_sector().

char D64Drive::orig_d64_name[256] [private]
 

Definition at line 84 of file 1541d64.h.

Referenced by chd64_cmd(), and D64Drive().

uint8* D64Drive::ram [private]
 

Definition at line 88 of file 1541d64.h.

Referenced by D64Drive(), execute_command(), open_direct(), and ~D64Drive().

FILE* D64Drive::the_file [private]
 

Definition at line 86 of file 1541d64.h.

Referenced by D64Drive(), open_close_d64_file(), and read_sector().


The documentation for this class was generated from the following files:
Generated on Tue Feb 8 04:11:49 2005 for E32frodo by doxygen 1.3.3