2 * BUBBLE CASETTE for FM-8/7? [bubblecasette.h]
4 * Author: K.Ohta <whatisthis.sowhat _at_ gmail.com>
7 * Mar 22, 2016 : Initial
10 #ifndef _VM_FM_BUBBLECASETTE_H_
11 #define _VM_FM_BUBBLECASETTE_H_
36 BUBBLE_TYPE_128KB = 1,
47 class BUBBLECASETTE: public DEVICE {
53 bool header_changed; // if change header: e.g:change write protection flag.
63 // FD12(RO) : Positive logic
64 bool cmd_error; // bit7 : Command error
65 bool stat_tdra; // bit6: Ready to write.
66 bool stat_rda; // bit5: Ready to read.
67 bool not_ready; // bit4: Not Ready(Slot empty).
69 bool write_protect; // bit2
70 bool stat_error; // bit 1
71 bool stat_busy; // bit 0
73 // FD13(RO): Maybe positive
74 bool eject_error; // bit7
75 bool povr_error; // bit5 : Page over
76 bool crc_error; // bit4
77 bool transfer_error; // bit3
78 bool bad_loop_over_error; // bit2
79 bool no_marker_error; // bit1
80 bool undefined_cmd_error; // bit0
82 //FD14-FD15: Page address register
83 pair_t page_address; // 16bit, Big ENDIAN
84 // FD16-FD17: Page Count Resister
85 pair_t page_count; // 16bit, Big ENDIAN
90 bbl_header_t bbl_header;
91 uint32_t media_offset;
92 uint32_t media_offset_new;
96 uint8_t bubble_data[0x20000]; // MAX 128KB, normally 32KB at FM-8.
97 _TCHAR image_path[_MAX_PATH];
99 void bubble_command(uint8_t cmd);
100 bool read_header(void);
101 void write_header(void);
102 bool read_one_page(void);
103 bool write_one_page(void);
105 BUBBLECASETTE(VM_TEMPLATE* parent_vm, EMU* parent_emu);
111 uint32_t read_data8(uint32_t addr);
112 void write_data8(uint32_t addr, uint32_t data);
114 uint32_t read_signal(int id);
115 void write_signal(int id, uint32_t data, uint32_t mask);
116 bool open(_TCHAR* file_path, int bank);
118 void event_callback(int event_id, int err);
119 bool process_state(FILEIO *state_fio, bool loading);
121 bool is_bubble_inserted()
123 return bubble_inserted;
125 bool is_bubble_protected()
127 return write_protect;
129 void set_bubble_protect(bool flag)
131 if(write_protect != flag) {
132 write_protect = flag;
133 header_changed = true;
136 bool get_access_lamp()
138 return (read_access | write_access);