src/mess/formats/d88_dsk.c
| r6338 | r6339 | |
| 238 | 238 | return d88_read_sector(floppy,head,track,sec,buffer,buffer_len); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | static floperr_t d88_write_sector(floppy_image *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) |
| 242 | { |
| 243 | UINT64 offset; |
| 244 | UINT32 sector_length; |
| 245 | |
| 246 | offset = d88_get_sector_offset(floppy,head,track,sector); |
| 247 | |
| 248 | if(d88_get_sector_length(floppy,head,track,sector,§or_length) != FLOPPY_ERROR_SUCCESS) |
| 249 | return FLOPPY_ERROR_SEEKERROR; |
| 250 | |
| 251 | if(offset == 0) |
| 252 | return FLOPPY_ERROR_SEEKERROR; |
| 253 | |
| 254 | if(buflen > sector_length) |
| 255 | return FLOPPY_ERROR_INTERNAL; |
| 256 | |
| 257 | floppy_image_write(floppy,buffer,offset,sector_length); |
| 258 | |
| 259 | return FLOPPY_ERROR_SUCCESS; |
| 260 | } |
| 261 | |
| 262 | static floperr_t d88_write_indexed_sector(floppy_image *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) |
| 263 | { |
| 264 | int sec; |
| 265 | |
| 266 | sec = d88_get_sector_id(floppy,head,track,sector); |
| 267 | return d88_write_sector(floppy,head,track,sec,buffer,buflen,ddam); |
| 268 | } |
| 269 | |
| 241 | 270 | static void d88_get_header(floppy_image* floppy,UINT32* size, UINT8* prot, UINT8* type, UINT32* offsets) |
| 242 | 271 | { |
| 243 | 272 | UINT8 header[D88_HEADER_LEN]; |
| r6338 | r6339 | |
| 327 | 356 | callbacks->get_sector_length = d88_get_sector_length; |
| 328 | 357 | callbacks->read_sector = d88_read_sector; |
| 329 | 358 | callbacks->read_indexed_sector = d88_read_indexed_sector; |
| 359 | callbacks->write_sector = d88_write_sector; |
| 360 | callbacks->write_indexed_sector = d88_write_indexed_sector; |
| 330 | 361 | callbacks->get_indexed_sector_info = d88_get_indexed_sector_info; |
| 331 | 362 | callbacks->get_sectors_per_track = d88_get_sectors_per_track; |
| 332 | 363 | |