barrym95838 wrote:
[..]
BTW, here's how Woz did it, 38 years ago, before the 6502 even had an ROR instruction: (Look ma! No CLC!)
Code:
;-------------------------------------------------------------------------
; Subroutine to print a byte in A in hex form (destructive)
;-------------------------------------------------------------------------
PRBYTE PHA Save A for LSD
LSR
LSR
LSR MSD to LSD position
LSR
JSR PRHEX Output hex digit
PLA Restore A
; Fall through to print hex routine
;-------------------------------------------------------------------------
; Subroutine to print a hexadecimal digit
;-------------------------------------------------------------------------
PRHEX AND #%0000.1111 Mask LSD for hex print
ORA #"0" Add "0"
CMP #"9"+1 Is it a decimal digit?
BCC ECHO Yes! output it
ADC #6 Add offset for letter A-F
[..]
Even though the Acorn implementation uses ADC it doesn't need CLC, too. And, they have the same cycle count.
Just for completeness: if register X is free for use one can take TAX, TXA instead of PHA, PLA saving 3 cycles. Yes I know, not really fewer operations, but anyway, fewer cycles ...