Jump to content
  • 0
geek504

Quick Question: 65C02 Assembly

Question

Which one is correct? They both seem to be the same, i.e. they operate on the accumulator.

LSR

or

LSR A

Is the first one used in 6502-proper and the latter in 65C02?

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
58 minutes ago, geek504 said:

That's what I figured too... but that would only make sense if we could do LSR X or LSR Y 🙄

Personally, I don't understand why folks decorate implied ops with A, given the design of the processor it's assumed that the instruction acts on the accumulator unless otherwise specified. I feel like it speaks to a misunderstanding about the processor's X and Y registers, which are not general-purpose. They are indexing registers. This is why the instructions dealing with them are special-case: INX and INY, DEX and DEY, for instance, compared with INC and DEC which have multiple addressing modes. The special-case instructions are not "shorthand" to turn a 2-byte instruction into a 1-byte instruction, nor are they simply differentiated as some 2 bits of addressing mode on top of a 6-bit opcode.

Now, if the 6502 had multiple general-purpose registers, such that it was meaningful which one you intended to act upon, that would be a different matter. Maybe that's where the decorated implied op folks are coming from: They're used to architectures with multiple general-purpose registers, so it would be valid to see something like LSR A, LSR B, LSR C, etc. And then, it's just more comfortable for them to see LSR A or INC A, even though the 'A' serves no functional purpose.

  • Like 2

Share this post


Link to post
Share on other sites
  • 0

I would say that LSR is the more correct of the two. Depending on your assembler, both should work without issues, but if you look at the reference for the CPUs, LSR command only takes up 1 byte of memory where LSR ZP and LSR Absolute take up 2 and 3 bytes respectively.

To me that indicates, that that the LSR A is just to make the commands look alike.

Share this post


Link to post
Share on other sites
  • 0
3 minutes ago, JimmyDansbo said:

LSR A is just to make the commands look alike.

That's what I figured too... but that would only make sense if we could do LSR X or LSR Y 🙄

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
4 hours ago, StephenHorn said:

And then, it's just more comfortable for them to see LSR A or INC A, even though the 'A' serves no functional purpose.

I mean, some assemblers use/support INA and DEA for consistency with the X and Y equivalents, but those aren't official.

Share this post


Link to post
Share on other sites
  • 0

Give that LSR mem-op and crew are the operations which DON'T touch the A register,  it is understandable that some assemblers support LSR A but ACME doesn't,  so I've gotten used to omitting it now.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use