base:8_bit_to_hexadecimal_conversion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
base:8_bit_to_hexadecimal_conversion [2017-08-20 00:07] – tww_ctr | base:8_bit_to_hexadecimal_conversion [2017-08-20 00:30] (current) – tww_ctr | ||
---|---|---|---|
Line 67: | Line 67: | ||
jsr NIB2HEX ; print nibble | jsr NIB2HEX ; print nibble | ||
rts | rts | ||
- | |||
; | ; | ||
Line 76: | Line 75: | ||
adc #$30 ; Accu < 10 | adc #$30 ; Accu < 10 | ||
jmp BSOUT ; Print #$30 - #39 | jmp BSOUT ; Print #$30 - #39 | ||
- | HEX sbc #$09 ; Accu >= 10, subtract #$09 to get " | + | HEX adc #$36 ; Accu >= 10, subtract #$09 to get " |
jmp BSOUT ; Print Accu (HEX nibble) and bye | jmp BSOUT ; Print Accu (HEX nibble) and bye | ||
</ | </ | ||
- | Alternatively, | + | Version not using KERNAL: |
+ | |||
+ | < | ||
+ | // Dest. = YREG:XREG | ||
+ | // Value to utput = ACC | ||
+ | OUTHEX: | ||
+ | sty $fb | ||
+ | stx $fc | ||
+ | ldy #$00 | ||
+ | pha | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | tax | ||
+ | lda tab,x | ||
+ | sta ($fb),y | ||
+ | iny | ||
+ | pla | ||
+ | and #$0f | ||
+ | tax | ||
+ | lda tab,x | ||
+ | sta ($fb),y | ||
+ | rts | ||
+ | |||
+ | tab: | ||
+ | | ||
+ | </ |
base/8_bit_to_hexadecimal_conversion.1503180431.txt.gz · Last modified: 2017-08-20 00:07 by tww_ctr