cbmimage
Loading...
Searching...
No Matches
internal helper

Macros

#define CBMIMAGE_ARRAYSIZE(_x)
 Helper to determine the size of a C style array.
 

Typedefs

typedef uint16_t cbmimage_get_sectors_in_track_fct(cbmimage_image_settings *settings, uint16_t track)
 
typedef int cbmimage_ts_to_blockaddress_fct(cbmimage_image_settings *settings, cbmimage_blockaddress *block)
 
typedef int cbmimage_lba_to_blockaddress_fct(cbmimage_image_settings *settings, cbmimage_blockaddress *block)
 
typedef int cbmimage_chdir_fct(cbmimage_image_settings *settings, cbmimage_dir_entry *dir_entry)
 
typedef int cbmimage_set_bam_fct(cbmimage_image_settings *settings)
 

Functions

static int cbmimage_i_d81_set_bam (cbmimage_image_settings *settings)
 
static int min (int a, int b)
 
static int max (int a, int b)
 

Detailed Description

Macro Definition Documentation

◆ CBMIMAGE_ARRAYSIZE

#define CBMIMAGE_ARRAYSIZE ( _x)
Value:
(sizeof (_x) / sizeof (_x)[0])

Helper to determine the size of a C style array.

Parameters
[in]_xThe array to examine
Returns
The number of array elements in _x

Typedef Documentation

◆ cbmimage_chdir_fct

typedef int cbmimage_chdir_fct(cbmimage_image_settings *settings, cbmimage_dir_entry *dir_entry)

type for a function that helps in chdir'ing

Parameters
[in]settingspointer to the image data internal settings
[in]dir_entrypointer to the dir_entry to which to chdir.
Returns
  • 0 if no error occurred
  • != 0 if an error occurred
Remarks
  • This function must test if the directory entry is actually a directory to which it can change. If it is not valid, it should return with an error value != 0. In this case, the chdir is aborted and returns with an error, too.

◆ cbmimage_get_sectors_in_track_fct

typedef uint16_t cbmimage_get_sectors_in_track_fct(cbmimage_image_settings *settings, uint16_t track)

type for a function that gets the number of sectors on a specific track of the image

Parameters
[in]settingspointer to the image data internal settings
[in]trackthe track number for which to obtain the number of sectors
Returns
Number of sectors on this specific track in the image
Remarks
  • This is the number of sectors on this specific track. Due to the nature of many CBM disk images, including D64, D71 and D40 images, the number of sectors can vary from track to track.
    To obtain the maximum number of sectors on any track, use cbmimage_get_max_sectors() instead!
  • As the CBM sector numbering goes, the sector range is from 0 to the result of this call minus 1.
    For example, for D64 images on the first speed zone (i.e., tracks 1 to 17), this function will return 21, giving a range of 0 .. 20.

◆ cbmimage_lba_to_blockaddress_fct

typedef int cbmimage_lba_to_blockaddress_fct(cbmimage_image_settings *settings, cbmimage_blockaddress *block)

type for a function that converts the LBA to T/S block address

Parameters
[in]settingspointer to the image data internal settings
[in,out]blockpointer to a block address with an initialized LBA address
Returns
  • 0 if no error occurred
  • != 0 if an error occurred
Remarks
  • the block address is completely created from the lba parameter
  • an error occurs if the lba block does not exist on this type of image

◆ cbmimage_set_bam_fct

typedef int cbmimage_set_bam_fct(cbmimage_image_settings *settings)

type for a function that occupies additional BAM entries

Parameters
[in]settingspointer to the image data internal settings
Returns
  • 0 if no error occurred
  • != 0 if an error occurred
Remarks
  • This function is used for D71 images, which mark track 53 (18 + 35, 2nd directory track) as occupied.
  • This function is also used for D81 images after chdir'ing. In this case, the 1581 marks all blocks outside of the partition as used.

◆ cbmimage_ts_to_blockaddress_fct

typedef int cbmimage_ts_to_blockaddress_fct(cbmimage_image_settings *settings, cbmimage_blockaddress *block)

type for a function that converts the T/S to LBA block address

Parameters
[in]settingspointer to the image data internal settings
[in,out]blockpointer to a block address with an initialized T/S address
Returns
  • 0 if no error occurred
  • != 0 if an error occurred
Remarks
  • the block address is completely created from the ts parameter
  • an error occurs if the track/sector combination does not exist on this type of image

Function Documentation

◆ cbmimage_i_d81_set_bam()

static int cbmimage_i_d81_set_bam ( cbmimage_image_settings * settings)
static

Occupy additional BAM entries for 1581 sub-dirs

Parameters
[in]settingspointer to the image data internal settings
Returns
  • 0 if no error occurred
  • != 0 if an error occurred
Remarks
  • This function is used after chdir'ing. In this case, the 1581 marks all blocks outside of the partition as used.

◆ max()

static int max ( int a,
int b )
inlinestatic

compute the maximum of two values

Parameters
[in]aone value
[in]bthe other value
Returns
Returns the maximum of both values a and b.

◆ min()

static int min ( int a,
int b )
inlinestatic

compute the minimum of two values

Parameters
[in]aone value
[in]bthe other value
Returns
Returns the minimum of both values a and b.