Re: [stella] Supercharger internals...

Subject: Re: [stella] Supercharger internals...
From: bwmott@xxxxxxxxxxxx
Date: Fri, 16 May 1997 12:44:35 -0400 (EDT)
> >> But Bob's Etch program, for example, runs perfectly on my system, although 
> >> it doesn't have the NOPs.
> 
> Well, here is what is happening, if you use an indexed address mode as in the
> example above, you don't need a NOP, even though my 6502 opcode chart says
> this takes the same number of cycles as an unindexed address mode as such:

They do unless the indexed address mode crosses a page boundary.

> plot2b
>     tax
>     ldy  enable
>     lda  $f000,y
>     sta  $fff8
>     ldy  ypos
>     lda  $f000,x
>     lda  (tmpadrlo),y
>     ldy  $80
>     lda  $f000,y
>     sta  $fff8

So we have:

  lda $f000,x
  lda (tmpadrlo),y

  cycle     action
    0       load from f0?? cause poke value to be ??
    1       load opcode for lda (tmpadrlo,y)
    2       load zp
    3       load low byte
    4       load high byte, add y to low byte
    5       load from address, fix high byte if needed
    6*      load from address  (only done if fix needed in 5th cycle)

So in this case we'd probably be looking at the 5th cycle to grab the
address unless it's always crossing a page boundary then it would be
the 6th cycle...

Without looking at the code some more I'm not sure which one is being
used.  Which one is it?

Also note that if you have:

  ldx #$ff
  lda $f0ff,x (this takes five cycles, but the value to be poked is grabbed
               on the 4th cycle)
  cmp $f800

  cycle   action
   0      load from f0fe cause poke value to be fe
   1      load the real operand from $f1fe for lda $f0ff,x

   2      load cmp opcode   
   3      load low byte 00
   4      load high byte f8
   5      load operand from f800

So here the address to be poke appears on the 5th cycle.

Then there's:

  ldy #$ff
  ldx #$ff
  lda $f0ff,x (this takes five cycles, but the value to be poked is grabbed
               on the 4th cycle)
  cmp $f8ff,y

  cycle   action
   0      load from f0fe cause poke value to be fe
   1      load the real operand from $f1fe for lda $f0ff,x

   2      load cmp opcode   
   3      load low byte ff
   4      load high byte f8, add y to low byte
   5      load operand from f8fe and fix high byte
   6      load operand from f9fe

So here the address to be poke appears on the 6th cycle I guess.

Brad

--------------------------------------------------------------------------
Bradford Mott (bwmott@xxxxxxxxxxxx)        Computer Science Department
http://www4.ncsu.edu/~bwmott/www           North Carolina State University
--------------------------------------------------------------------------

--
Archives available at http://www.biglist.com/lists/stella/archives/
E-mail UNSUBSCRIBE in the body to stella-request@xxxxxxxxxxx to be removed.

Current Thread