Re: LD BC, nn
- From: pak21@xxxxxxxxx (Philip Kendall)
- Date: 2 Sep 2005 15:39:38 +0100
In article <1125669641.729139.232470@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
gareth <garethrichardadams@xxxxxxxxx> wrote:
[ Contention delays ]
>After reading the FAQ I came up with this:
Looks about right; some comments below.
>// Read op-code into variable opCode
>opCode = _spectrum.Memory.Peek(_PC);
>switch (opCode)
>{
> case 0x0: //00 NOP - This is the simplest Z80 instruction, and simply
>does nothing.
> _spectrum.TState += 4; //This instruction takes 4 clock cycles to
I'd suggest putting this outside the opcode switch as it happens for
every instruction not part of the opcode fetch.
> case 0x1: //01 LD BC,0x0000 - Load the next 16 bits into the BC
>register
> _spectrum.TState +=4; //The first part of the instruction (getting
>opCode) takes 4 clock cycles;
> _B = _spectrum.Memory.Peek((ushort)(_PC+1));
Should be _C, not _B.
> spectrum.TState +=3; //The second part of the instruction (loading
Again, I'd suggest making this part of Peek(); every memory access takes
at least three tstates.
Two more general hints:
1) Use autogenerated code. Writing out code for ~1000 separate opcodes
will just lead to errors.
2) Use a test suite to test your opcodes. There's one in the Fuse
distribution :-)
Cheers,
Phil
--
Philip Kendall <pak21@xxxxxxxxxxxxx>
http://www.srcf.ucam.org/~pak21/
.
- Follow-Ups:
- Re: LD BC, nn
- From: Paul Dunn
- Re: LD BC, nn
- References:
- LD BC, nn
- From: gareth
- Re: LD BC, nn
- From: Sean Lincolne
- Re: LD BC, nn
- From: Philip Kendall
- Re: LD BC, nn
- From: gareth
- LD BC, nn
- Prev by Date: Re: 2 Years Old Today
- Next by Date: Re: LD BC, nn
- Previous by thread: Re: LD BC, nn
- Next by thread: Re: LD BC, nn
- Index(es):
Relevant Pages
|
|