A rust port of vgm2mid by Paul Jensen and Valley Bell
/*register_structs! {
	YMF278Registers {
		(0x00 => lsi_test: [ReadWrite<u8>; 0x02]),
		(0x02 => header: ReadWrite<u8, >),
		(0x03 => memory_access1: ReadWrite<u8, MemoryAccess1::Register>),
		(0x04 => memory_access2: ReadWrite<u8>),
		(0x05 => memory_access3: ReadWrite<u8>),
		(0x06 => memory_data: ReadWrite<u8>),
		(0x07 => reserved: ReadWrite<u8>),
		(0x08 => wave_table_number: [ReadWrite<u8>; 0x18]),
		(0x20 => f_number: [ReadWrite<u8, FNumber::Register>; 0x18]),
		(0x38 => octave: [ReadWrite<u8, Octave::Register>; 0x18]),
		(0x50 => total_level: [ReadWrite<u8, TotalLevel::Register>; 0x18]),
		(0x68 => key_on: [ReadWrite<u8, KeyOn::Register>; 0x18]),
		(0x80 => lfo: [ReadWrite<u8, LFO::Register>; 0x18]),
		(0x98 => ar: [ReadWrite<u8, AR::Register>; 0x18]),
		(0xB0 => dl: [ReadWrite<u8, DL::Register>; 0x18]),
		(0xC8 => rate_correction: [ReadWrite<u8, RateCorrection::Register>; 0x18]),
		(0xE0 => am: [ReadWrite<u8, AM::Register>; 0x18]),
		(0xF8 => mixing_control_fm: ReadWrite<u8, MixingControlFM::Register>),
		(0xF9 => mixing_control_pcm: ReadWrite<u8, MixingControlPCM::Register>),
		(0xFA => @END),
	}
}

register_bitfields![u8,
Status [
	IRQ 7,
	FT1 6,
	FT2 5,
	LD 1,
	BUSY 0,
],
MemoryAccess1 [
	RESERVED OFFSET(7) NUMBITS(2) [],
	MEMORYACCESS OFFSET(0) NUMBITS(6) [],
],
FNumber [
	F_NUMBER OFFSET(1) NUMBITS(7) [],
	WAVETABLE OFFSET(0) NUMBITS(1) [],
],
Octave [
  OCTAVE OFFSET(4) NUMBITS(4) [],
  PSEUDO_REVERB OFFSET(3) NUMBITS (1) [],
  F_NUMBER OFFSET(0) NUMBITS(3) [],
],
TotalLevel [
  TOTAL_LEVEL OFFSET(1) NUMBITS(7) [],
  LEVEL_DIRECT OFFSET(0) NUMBITS(1) [],
],
KeyOn [
  KEY_ON OFFSET(7) NUMBITS(1) [],
  DAMP OFFSET(6) NUMBITS(1) [],
  LFO_RST OFFSET(5) NUMBITS(1) [],
  CH OFFSET(4) NUMBITS(1) [],
  PANPOT OFFSET(0) NUMBITS(4) [],
],
LFO [
	RESERVED OFFSET(6) NUMBITS(2) [],
	LFO OFFSET(3) NUMBITS(3) [],
	VIB OFFSET(0) NUMBITS(3) [],
],
AR [
	AR OFFSET(3) NUMBITS(4) [],
	D1R OFFSET(0) NUMBITS(4) [],
],
DL [
	DL OFFSET(3) NUMBITS(4) [],
	D2R OFFSET(0) NUMBITS(4) [],
],
RateCorrection [
	Rate_Correction OFFSET(3) NUMBITS(4) [],
	RR OFFSET(3) NUMBITS(4) [],
],
AM [
	RESERVED OFFSET(3) NUMBITS(5) [],
	AM OFFSET(0) NUMBITS(3) [],
],
MixingControlFM [
	FM_R OFFSET(3) NUMBITS(3) [],
	FM_L OFFSET(0) NUMBITS(3) [],
],
MixingControlPCM [
	PCM_R OFFSET(3) NUMBITS(3) [],
	PCM_L OFFSET(0) NUMBITS(3) [],
],
];*/