ASL with Accumulator??

Building your first 6502-based project? We'll help you get started here.
Post Reply
AAGDOS
Posts: 3
Joined: 04 Aug 2022

ASL with Accumulator??

Post by AAGDOS »

What is the operand for use with ASL when shifting bits in the accumulator?

The Programmers Reference Guide (CBM) shows "ASL A", but there seems to be no way to write the "A" which the C64 Assembler recognizes??

Any help would be appreciated!

Anthony G
User avatar
Agumander
Posts: 129
Joined: 17 Jul 2018
Location: Long Island, NY
Contact:

Re: ASL with Accumulator??

Post by Agumander »

Does it recognize just ASL by itself?
User avatar
commodorejohn
Posts: 299
Joined: 21 Jan 2016
Location: Placerville, CA
Contact:

Re: ASL with Accumulator??

Post by commodorejohn »

Yeah, some assemblers recognize ASL A, some recognize ASL all by itself, and some allow both. It's a mite annoying.
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: ASL with Accumulator??

Post by Dr Jefyll »

commodorejohn wrote:
Yeah, some assemblers recognize ASL A, some recognize ASL all by itself, and some allow both. It's a mite annoying.
And I think there's even a third option. Don't some assemblers allow ASLA (with no space) for this? That is, make the A part of the mnemonic? Worth a try, anyway! :)

Welcome, Anthony!

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: ASL with Accumulator??

Post by BillO »

Context should be enough, no?

ASL without an argument should assemble to 0A.
Bill
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: ASL with Accumulator??

Post by BigDumbDinosaur »

AAGDOS wrote:
What is the operand for use with ASL when shifting bits in the accumulator?

The Programmers Reference Guide (CBM) shows "ASL A", but there seems to be no way to write the "A" which the C64 Assembler recognizes??

The official MOS Technology assembly language syntax would be ASL A, with A being one of the reserved assembler symbols—the CBM PRG is correct in its reference. A similar syntax is specified for other accumulator-based instructions, such as LSR, ROL and ROR. WDC has continued this standard in their assembly language specifications for the 65C02 and 65C816. An assembler that exactly follows that standard is a “compliant assembler.”

65xx-family assemblers have often been non-compliant and in some cases, wildly inconsistent. For example, the Kowalski assembler that I use recognizes ASL with no operand as valid syntax to left-shift the accumulator. In that assembler, ASL A would be interpreted as shifting whatever is in location A, and would halt with an error if A hasn’t been defined. Even more inconsistent are the accumulator-based decrement and increment instructions. In a compliant assembler, those would be written as DEC A and INC A, respectively. In the Kowalski assembler assembling code for the 65C02, it would be DEA and INA, respectively. However, when assembling code for the 65C816, it would be DEC and INC, neither with an operand.

Something else that can trip you up is what the assembler recognizes as valid numeric radices. The aforementioned Kowalski assembler, by default, uses @ to present binary numbers, such as @10100101. The MOS Technology standard uses %, such as %10100101. Some other assemblers use a trailing B to indicate binary, such as 10100101B.

The only way to be sure with the assembler you are using is to read the documentation and/or experiment. The Commodore MADS and HDC65 assemblers are fully compliant, so they should recognize an instruction such as ASL A as valid.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
AAGDOS
Posts: 3
Joined: 04 Aug 2022

Re: ASL with Accumulator??

Post by AAGDOS »

To all,

Thank you for the informative information! I struggled with ASLA and ASL A, neither of which were recognized by the C64 Macro Assembler Development System (CBM 1982).- MADS.

I did return to the simple ASL with no Operand, and it worked running Monitor$C000.

.A 033C LDA #$01
.A ASL
.A BRK

I should have tried this sooner!!

Anthony G
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: ASL with Accumulator??

Post by BigDumbDinosaur »

AAGDOS wrote:
To all,

Thank you for the informative information! I struggled with ASLA and ASL A, neither of which were recognized by the C64 Macro Assembler Development System (CBM 1982).- MADS.

I did return to the simple ASL with no Operand, and it worked running Monitor$C000.

.A 033C LDA #$01
.A ASL
.A BRK

I should have tried this sooner!!

Anthony G

Historical note: the M/L monitor that is provided with MADS (two monitor versions, actually—one runs at $8000 and the other at $C000) is Jim Butterfield's Supermon 64. Also note that the monitors are not the MADS assembler. The latter is a symbolic macroassembler, whereas the assembler in the M/L monitor is not.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
AAGDOS
Posts: 3
Joined: 04 Aug 2022

Re: ASL with Accumulator??

Post by AAGDOS »

Thanks for the clarification on the M/L monitors. I tend to use the assembler terms interchangeably.

For short and quick codes, I usually use "Monitor$C000" directly, since it assembles and runs on the spot. For longer ones, I use the full set...Editor64, Assembler 64, LoLoader64, and Monitor$C000. The full set does require a number of loads, and it is not so easy to just back up and do it all over again when the .obj file doesn't work! I used just Monitor$C000 when checking out the ASL syntax.

Again, thanks.
Anthony G
Post Reply