/// Xenos GPU register file. 0x6000 32-bit registers.
pub struct RegisterFile {
    pub regs: Vec<u32>,
}

impl RegisterFile {
    pub fn new() -> Self {
        Self {
            regs: vec![0u32; 0x6000],
        }
    }

    pub fn read(&self, index: u32) -> u32 {
        self.regs.get(index as usize).copied().unwrap_or(0)
    }

    pub fn write(&mut self, index: u32, value: u32) {
        if let Some(r) = self.regs.get_mut(index as usize) {
            *r = value;
        }
    }
}

impl Default for RegisterFile {
    fn default() -> Self {
        Self::new()
    }
}
