From C64-Wiki
Jump to navigationJump to search

ADC after a BCS instruction[edit source]

As stated

In a few special cases (such as immediately following a BCS), the carry is always clear in any situation where the CPU reaches the ADC instruction; this allows for leaving out the CLC, saving 1 byte and 2 machine cycles execution time.

describes following situation:

BCS greater_or_equal
; if not jumped here, after passing the BCS the carry is definitely in clear state!
ADC #8

This is the optimization to save the CLC. wink

On the other hand, one can take advantage of a set carry too:

BCC less
; if not jumped here, after passing the BCC the carry is definitely in set state!
ADC #7  ; adds 8 (7 + carry)

Layout[edit source]

With this article, I'm implicitly suggesting the layout of this article as a general "template" for the 56 instructions (not including various addressing modes) – knowing that on the german wiki you have an article for each of the a-hundred-and-some instructions, including the addressing modes. Quite frankly, I believe my solution is just as easy to "approach" for the reader, whilst at the same time avoiding the "kludge" that comes from the inability to use the # character directly in article titles.

I have a database set up to "spit" out the articles in a short time, so before I do that and make subsequent policy changes that much harder, have your say...! – said BinaryDane 00:39, 7 November 2007 (CET)

From my site its ok. You can release your database. --Sledgie 06:44, 8 November 2007 (CET)
It's ok for me, but I'm not an expert in assembler... --Jodigi 17:04, 8 November 2007 (CET)
Done! We now have articles on all 56 instructions covered in Commodore/Mos Technology's old documents :-D ... said BinaryDane 00:39, 9 November 2007 (CET)