For instance, A contains the value #60. If you directly put it on screen, on the Oric you'll get the ASCII char for "(c)".
But how to display "60" instead, which will require two bytes ? ("6" and "0").
I got the answer very quickly thanks to the forum at 6502.org, which had this topic and an incredible solution I'm copying/pasting here with a little extra (and sad) information about its author...
Code: Select all
; A = entry value
sed ;2 @2
tax ;2 @4
and #$0F ;2 @6
cmp #9+1 ;2 @8
adc #$30 ;2 @10
tay ;2 @12
txa ;2 @14
lsr ;2 @16
lsr ;2 @18
lsr ;2 @20
lsr ;2 @22
cmp #9+1 ;2 @24
adc #$30 ;2 @26
cld ;2 @28
; A = MSN ASCII char
; Y = LSN ASCII char
Lee passed away peacefully in his sleep on September 21, 2013. Being a Sunday coder in 6502, I had never heared of him, but he seems to have a well deserved good reputation, which the efficiency of the above code can confirm.
Thanks to this code I can display values while an Oric program is loading. Priceless.