Skip to content

Instantly share code, notes, and snippets.

Created November 29, 2012 16:36
Show Gist options
  • Save anonymous/4170213 to your computer and use it in GitHub Desktop.
Save anonymous/4170213 to your computer and use it in GitHub Desktop.
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef int BOOL;
struct CDROM_iso9660_directory_record {
uint8_t record_size;
uint8_t num_sectors_extattrrec;
uint32_t data_sector;
uint32_t data_sector_be;
uint32_t data_size;
uint32_t data_size_be;
WORD year;
BYTE month;
BYTE day;
BYTE hour;
BYTE minute;
BYTE second;
uint8_t flags;
uint8_t interleaved_unit_size;
uint8_t interleaved_gap_size;
uint16_t volume_seq;
uint16_t volume_seq_be;
uint8_t identifier_length;
uint8_t identifier[1];
} __attribute__ ((packed)) CD_iso9660_directory_record;
struct disk_packet
{
byte size_pack;
byte reserved1;
byte no_of_blocks;
byte reserved2;
word offset;
word segment;
dword lba1;
dword lba2;
} __attribute__((packed)) disk_pack;
void LBASectorRead(void *buffer, unsigned long lba)
{
unsigned char bError = 0;
REGS regs;
disk_pack.size_pack = 16;
disk_pack.no_of_blocks = 1;
disk_pack.reserved1 = 0;
disk_pack.reserved2 = 0;
disk_pack.segment = (((unsigned int)buffer >> 16) << 12);
disk_pack.offset = ((unsigned int)buffer & 0xffff);
disk_pack.lba2 = lba >> 32;
disk_pack.lba1 = lba & 0xffffffff;
regs.b.ds = (((unsigned int)&disk_pack >> 16) << 12);
regs.b.si = ((unsigned int)&disk_pack &0xffff);
regs.b.dl = 0x9f;
regs.b.ah = 0x42;
int386(0x13,&regs,&regs);
//printf("Error: %d\n",regs.b.ah);
}
struct CDROM_iso9660_directory_record dr;
LBASectorRead( &dr,24-1);
dr.identifier[
dr.identifier_length] = '\0';
printf("cd: %s",dr.identifier); nl();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment