[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Steal RAM -- Question



Greetings Nick,

I appreciate you responding.  And, you are right, STA ABS performs
_one_ write.  I checked out Understanding The Apple II, page 5-28.
Okay, so now I know the source of this WRTCOUNT business.

I said:

> The STA instruction on a 6502 will access the memory location twice.

Perhaps I need to say:

> The STA instruction on a NMOS 6502 should access the memory location twice.

My use of the word "will" is too strong because I have no idea what is
going to happen in the next five seconds.  And, I am qualifying this
with the "NMOS" 6502 because I don't know the behaviour of the store
instruction for a CMOS 6502, WDC 65816, and other 6502 derivatives.

I used the word access not write.  In my experience, the store
instruction on a NMOS 6502 makes two accesses to the memory location
which can be important with memory-mapped IO.  Also from what I read,
there are some NMOS "Read-Modify-Write" instructions that read data,
write unmodified data, then write modified data:  inc, dec, asl, lsr,
rol, ror.  From reading the WDC Programming manual, with the CMOS
chips, these instructions read data twice, then write modified data
once which is different than what the NMOS implementation does.  And,
the 65816 behaves either way depending on whether it is in emulation or
native mode.

I found this question here:
http://funkytroll.com/challenge/GDC2001.txt

Which of the following instructions will cause the Apple ]['s speaker
to make the softest possible click?
*a STA $C030
-b LDA $C030
-c BIT $C031
-d MOV EAX, DWORD PTR ds:[0C030h]

If I am wrong about the "the 6502 store instruction doing two access to
memory", then explain why the answer to this question is *a.

Kind regards,
mmphosis

sicklittlemonkey wrote:
> mmphosis wrote:
> > The STA instruction on a 6502 will access the memory location twice.
>
> Sorry, but that's wrong. STA ABS performs _one_ write. The common
> misapprehension comes from the 6502 instruction used by the Applesoft
> or Integer Basic POKE commands: STA (ZP),Y which  does strobe twice.
>
> > Or, using a single store instruction, should accomplish the same thing:
> >     STA $C081 ; LC Card RAM bank2, Read ROM instead of RAM, WR-enable
>
> Nope. Check out Understanding The Apple II, page 5-28.
> You'll be surprised how tricky this area really is. ;-)
> 
> Cheers,
> Nick.