Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<sIO> Init(iCSpect _CSpect)
- {
- List<sIO> ports = new List<sIO>();
- for (int i=0;i<255;i++)
- {
- ports.Add(new sIO(i*8192, eAccess.Memory_Read));
- }
- return ports;
- }
- public byte Read(eAccess _type, int _address, out bool _isvalid)
- {
- _isvalid = false;
- if (state == STATE.Stopped || state == STATE.Continue) return 0;
- //so if cpu reads from 0 in any bank..
- // we then check the return address on stack
- // if and redirect
- Z80Regs regs = CSpect.GetRegs();
- if (regs.PC == 0x0000)
- {
- //get address of where we jumpped from
- ushort retaddr = (ushort)(CSpect.Peek(regs.SP) | (CSpect.Peek((ushort)(regs.SP+1))*256)) ;
- retaddr--;
- ushort jumpaddr = 0xfff0; // this is where i want the cpu redirected to!
- byte lob = (byte)(jumpaddr &255);
- byte hib = (byte)((jumpaddr/256) &255);
- CSpect.Poke(regs.SP,lob);
- CSpect.Poke((ushort)(regs.SP+1),hib);
- _isvalid = true;
- return 0xc9; //(ret command))
- }
- return 0x0; //nop
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement