MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / ProDOS_GetVolumeHeader

Function ProDOS_GetVolumeHeader

source/ProDOS_FileSystem.h:400–456  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

398
399 // ------------------------------------------------------------------------
400 void ProDOS_GetVolumeHeader( uint8_t *pDiskBytes, ProDOS_VolumeHeader_t *pVolumeHeader_, int iBlock )
401 {
402 int base = iBlock*PRODOS_BLOCK_SIZE + 4; // skip prev/next dir block double linked list
403 ProDOS_VolumeHeader_t info;
404
405 info.kind = (pDiskBytes[ base + 0 ] >> 4) & 0xF;
406 info.len = (pDiskBytes[ base + 0 ] >> 0) & 0xF;
407
408 for( int i = 0; i < PRODOS_MAX_FILENAME+1; i++ )
409 info.name[ i ] = 0;
410
411 for( int i = 0; i < info.len; i++ )
412 info.name[ i ] = pDiskBytes[ base+i+ 1 ];
413
414 for( int i = 0; i < 8; i++ )
415 info.pad8[ i ] = pDiskBytes[ base+i+16 ];
416
417 info.date = ProDOS_Get16( pDiskBytes, base + 24 );
418 info.time = ProDOS_Get16( pDiskBytes, base + 26 );
419 info.cur_ver = pDiskBytes[ base + 28 ];
420 info.min_ver = pDiskBytes[ base + 29 ];
421 info.access = pDiskBytes[ base + 30 ];
422 info.entry_len = pDiskBytes[ base + 31 ];
423 info.entry_num = pDiskBytes[ base + 32 ];
424 info.file_count = ProDOS_Get16( pDiskBytes, base + 33 );
425
426 info.meta.bitmap_block = ProDOS_Get16( pDiskBytes, base + 35 );
427 info.meta.total_blocks = ProDOS_Get16( pDiskBytes, base + 37 );
428
429#if _DEBUG
430 LogOutput( "PRODOS: VOLUME: name: %s\n", info.name );
431 LogOutput( "PRODOS: VOLUME: date: %04X\n", info.date );
432 LogOutput( "PRODOS: VOLUME: time: %04X\n", info.time );
433 LogOutput( "PRODOS: VOLUME: cVer: %02X\n", info.cur_ver );
434 LogOutput( "PRODOS: VOLUME: mVer: %02X\n", info.min_ver );
435 LogOutput( "PRODOS: VOLUME:acces: %02X\n", info.access );
436 LogOutput( "PRODOS: VOLUME:e.len: %02X\n", info.entry_len );
437 LogOutput( "PRODOS: VOLUME:e.num: %02X\n", info.entry_num );
438 LogOutput( "PRODOS: VOLUME:files: %04X ", info.file_count );
439 LogOutput( "(%d)\n", info.file_count );
440
441 if (iBlock == PRODOS_ROOT_BLOCK)
442 {
443 LogOutput( "PRODOS: ROOT: bitmap: %04X\n", info.meta.bitmap_block );
444 LogOutput( "PRODOS: ROOT: blocks: %04X\n", info.meta.total_blocks );
445 }
446 else
447 {
448 LogOutput( "PRODOS: SUBDIR: parent: %04X\n", info.subdir.parent_block );
449 LogOutput( "PRODOS: SUBDIR: pa.len: %02X\n", info.subdir.parent_entry_num );
450 LogOutput( "PRODOS: SUBDIR: pa.num: %02X\n", info.subdir.parent_entry_len );
451 }
452#endif
453
454 if ( pVolumeHeader_ )
455 *pVolumeHeader_ = info;
456 };
457

Callers 1

Util_ProDOS_AddFileFunction · 0.85

Calls 2

ProDOS_Get16Function · 0.85
LogOutputFunction · 0.85

Tested by

no test coverage detected