Xemu [doxygen]  hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
d81access.h
Go to the documentation of this file.
1 /* Various D81 access method for F011 core, for Xemu / C65 and M65 emulators.
2  Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3  Copyright (C)2016-2022 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18 
19 #ifndef XEMU_COMMON_D81ACCESS_H_INCLUDED
20 #define XEMU_COMMON_D81ACCESS_H_INCLUDED
21 
22 #define D81_SIZE 819200
23 
24 #define PRG_MIN_SIZE 16
25 
26 #ifdef PRG_MAX_SIZE_OVERRIDE
27 #define PRG_MAX_SIZE PRG_MAX_SIZE_OVERRIDE
28 #else
29 #define PRG_MAX_SIZE 0xD700
30 #endif
31 
32 #define D81ACCESS_EMPTY 0
33 #define D81ACCESS_IMG 1
34 #define D81ACCESS_PRG 2
35 #define D81ACCESS_DIR 4
36 #define D81ACCESS_CALLBACKS 8
37 #define D81ACCESS_RO 0x100
38 #define D81ACCESS_AUTOCLOSE 0x200
39 #define D81ACCESS_FAKE64 0x400
40 #define D81ACCESS_D64 0x800
41 #define D81ACCESS_D71 0x1000
42 #define D81ACCESS_D65 0x2000
43 
44 #if 0
45 typedef int(*d81access_rd_cb_t) ( int which, void *buffer, off_t offset, int sector_size );
46 typedef int(*d81access_wr_cb_t) ( int which, void *buffer, off_t offset, int sector_size );
47 extern void d81access_attach_cb ( int which, off_t offset, d81access_rd_cb_t rd_callback, d81access_wr_cb_t wd_callback );
48 #endif
49 
50 // must be defined by the caller!
51 extern void d81access_cb_chgmode ( const int which, const int mode );
52 
53 extern int d81access_read_sect ( const int which, Uint8 *buffer, const Uint8 side, const Uint8 track, const Uint8 sector, const int sector_size );
54 extern int d81access_write_sect ( const int which, Uint8 *buffer, const Uint8 side, const Uint8 track, const Uint8 sector, const int sector_size );
55 
56 extern void d81access_init ( void );
57 extern int d81access_get_mode ( int which );
58 extern void d81access_close ( int which );
59 extern void d81access_close_all ( void );
60 extern void d81access_attach_fd ( int which, int fd, off_t offset, int mode );
61 extern int d81access_attach_fsobj ( int which, const char *fn, int mode );
62 extern Uint8 *d81access_create_image ( Uint8 *img, const char *diskname, const int name_from_fn );
63 extern int d81access_create_image_file ( const char *fn, const char *diskname, const int do_overwrite, const char *cry );
64 
65 #endif
d81access_init
void d81access_init(void)
Definition: d81access.c:56
d81access_attach_fd
void d81access_attach_fd(int which, int fd, off_t offset, int mode)
Definition: d81access.c:145
d81access_cb_chgmode
void d81access_cb_chgmode(const int which, const int mode)
Definition: commodore_65.c:282
fn
const char * fn
Definition: roms.c:42
Uint8
uint8_t Uint8
Definition: fat32.c:51
d81access_get_mode
int d81access_get_mode(int which)
Definition: d81access.c:72
d81access_read_sect
int d81access_read_sect(const int which, Uint8 *buffer, const Uint8 side, const Uint8 track, const Uint8 sector, const int sector_size)
Definition: d81access.c:539
d81access_create_image
Uint8 * d81access_create_image(Uint8 *img, const char *diskname, const int name_from_fn)
Definition: d81access.c:604
d81access_close_all
void d81access_close_all(void)
Definition: d81access.c:100
d81access_close
void d81access_close(int which)
Definition: d81access.c:78
d81access_write_sect
int d81access_write_sect(const int which, Uint8 *buffer, const Uint8 side, const Uint8 track, const Uint8 sector, const int sector_size)
Definition: d81access.c:572
d81access_create_image_file
int d81access_create_image_file(const char *fn, const char *diskname, const int do_overwrite, const char *cry)
Definition: d81access.c:701
d81access_attach_fsobj
int d81access_attach_fsobj(int which, const char *fn, int mode)
Definition: d81access.c:173