fmt rom address

This commit is contained in:
Alex Janka 2024-02-07 15:47:24 +11:00
parent e648ea17d2
commit 0ae8697eb8

View file

@ -1,4 +1,7 @@
use std::ops::{Add, Sub}; use std::{
fmt::UpperHex,
ops::{Add, Sub},
};
pub(crate) use self::types::*; pub(crate) use self::types::*;
@ -33,6 +36,15 @@ pub(crate) enum RomAddress {
MappedBank(MappedBankAddress), MappedBank(MappedBankAddress),
} }
impl UpperHex for RomAddress {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
RomAddress::Bank0(a) => a.fmt(f),
RomAddress::MappedBank(a) => a.fmt(f),
}
}
}
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub(crate) enum IoAddress { pub(crate) enum IoAddress {
Joypad, Joypad,