Example #1
0
        public byte?GetByteAt(uint address)
        {
            if ((address & 0xfffc) == 0x0800)
            {
                return(null);
            }                                                   // mirrored register
            else if ((address &= AddressMask) >= this.Storage.Length)
            {
                return(null);
            }

            this.Log("Get register byte at address " + address.ToString("x3"));
            IORegister reg    = this.Storage[address];
            bool       offset = (address & 1) > 0;

            if (!offset)
            {
                return((byte)reg.Get());
            }
            else
            {
                return((byte)((reg.Get() & 0xff00) >> 8));
            }
        }
Example #2
0
        public uint?GetWordAt(uint address)
        {
            if ((address & 0xfffc) == 0x0800)
            {
                return(null);
            }                                                   // mirrored register
            else if ((address &= AddressMask) >= this.Storage.Length)
            {
                return(null);
            }
            address &= 0x00ff_fffc;  // force align

            this.Log("Get register word at address " + address.ToString("x"));
            IORegister reg = this.Storage[address];

            // force alignment makes these accesses a lot simpler!
            return((uint)(reg.Get() | (this.Storage[address + 2].Get() << 16)));
        }