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

Re: Steal RAM -- Question



mmphosis wrote:
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.

No.

The STA absolute makes exactly one access to its target address,
and that is a write access.

This is readily deduced from the fact that it takes 4 cycles to
execute--3 cycles to fetch the op and the address and 1 cycle to
write the A register to memory.

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.

..and this question is nonsense and the answer is wrong.

The myth that a 65(C)02 "store instruction" accesses the target
twice is confusion resulting from the warning that the BASIC POKE
statement accesses the target twice--which it does because it is
an *indexed* store (as Nick pointed out).

This is an example of why the Wikipedia concept is flawed.  ;-)

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.

-michael

NadaNet networking for Apple II computers!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it's seriously underused."