Page 1 of 1
ASL with Accumulator??
Posted: Thu Aug 04, 2022 8:55 pm
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
Re: ASL with Accumulator??
Posted: Thu Aug 04, 2022 9:13 pm
by Agumander
Does it recognize just ASL by itself?
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 12:03 am
by commodorejohn
Yeah, some assemblers recognize ASL A, some recognize ASL all by itself, and some allow both. It's a mite annoying.
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 12:09 am
by Dr Jefyll
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
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 3:50 am
by BillO
Context should be enough, no?
ASL without an argument should assemble to 0A.
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 4:38 am
by BigDumbDinosaur
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.
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 4:30 pm
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
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 7:02 pm
by BigDumbDinosaur
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.
Re: ASL with Accumulator??
Posted: Fri Aug 05, 2022 7:49 pm
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