mirror of
https://github.com/mre/mos6502.git
synced 2024-11-30 20:51:21 +00:00
remove last of Address and AddressDiff
This commit is contained in:
parent
3de8f9158d
commit
8c6591f6a4
@ -35,7 +35,6 @@ extern crate num;
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
|
||||
pub mod address;
|
||||
pub mod cpu;
|
||||
pub mod instruction;
|
||||
pub mod memory;
|
||||
|
@ -25,8 +25,6 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
use crate::address::Address;
|
||||
|
||||
// JAM: We can probably come up with a better way to represent address ranges.
|
||||
// Address range type?
|
||||
//
|
||||
@ -39,12 +37,12 @@ use crate::address::Address;
|
||||
const ADDR_LO_BARE: u16 = 0x0000;
|
||||
const ADDR_HI_BARE: u16 = 0xFFFF;
|
||||
|
||||
pub const MEMORY_ADDRESS_LO: Address = Address(ADDR_LO_BARE);
|
||||
pub const MEMORY_ADDRESS_HI: Address = Address(ADDR_HI_BARE);
|
||||
pub const STACK_ADDRESS_LO: Address = Address(0x0100);
|
||||
pub const STACK_ADDRESS_HI: Address = Address(0x01FF);
|
||||
pub const IRQ_INTERRUPT_VECTOR_LO: Address = Address(0xFFFE);
|
||||
pub const IRQ_INTERRUPT_VECTOR_HI: Address = Address(0xFFFF);
|
||||
pub const MEMORY_ADDRESS_LO: u16 = ADDR_LO_BARE;
|
||||
pub const MEMORY_ADDRESS_HI: u16 = ADDR_HI_BARE;
|
||||
pub const STACK_ADDRESS_LO: u16 = 0x0100;
|
||||
pub const STACK_ADDRESS_HI: u16 = 0x01FF;
|
||||
pub const IRQ_INTERRUPT_VECTOR_LO: u16 = 0xFFFE;
|
||||
pub const IRQ_INTERRUPT_VECTOR_HI: u16 = 0xFFFF;
|
||||
|
||||
const MEMORY_SIZE: usize = (ADDR_HI_BARE - ADDR_LO_BARE) as usize + 1usize;
|
||||
|
||||
|
@ -25,8 +25,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
use crate::address::{Address, AddressDiff};
|
||||
use crate::memory::{STACK_ADDRESS_HI, STACK_ADDRESS_LO};
|
||||
|
||||
|
||||
// Useful for constructing Status instances
|
||||
#[derive(Copy, Clone)]
|
||||
@ -147,10 +146,6 @@ impl Status {
|
||||
pub struct StackPointer(pub u8);
|
||||
|
||||
impl StackPointer {
|
||||
pub fn to_address(self) -> Address {
|
||||
STACK_ADDRESS_LO + AddressDiff(i32::from(self.0))
|
||||
}
|
||||
|
||||
pub fn to_u16(self) -> u16 {
|
||||
let StackPointer(val) = self;
|
||||
u16::from_le_bytes([val, 0x01])
|
||||
@ -188,7 +183,7 @@ impl Registers {
|
||||
accumulator: 0,
|
||||
index_x: 0,
|
||||
index_y: 0,
|
||||
stack_pointer: StackPointer(STACK_ADDRESS_HI.get_offset()),
|
||||
stack_pointer: StackPointer(0),
|
||||
program_counter: 0,
|
||||
status: Status::default(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user