base:another_hexadecimal_to_decimal_conversion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
base:another_hexadecimal_to_decimal_conversion [2020-11-13 21:37] – correction mace | base:another_hexadecimal_to_decimal_conversion [2020-11-13 21:51] – shortened two bytes mace | ||
---|---|---|---|
Line 18: | Line 18: | ||
rol lobyte | rol lobyte | ||
rol hibyte | rol hibyte | ||
- | bcs calculate // | + | bcs calculate // |
// if not, go to the next bit | // if not, go to the next bit | ||
txa | txa | ||
- | axs #$05 // ILLEGAL OPCODE, use the 3 lines below as alternative | + | axs #$05 // ILLEGAL OPCODE, |
// sec | // sec | ||
// sbc #$05 | // sbc #$05 | ||
// tax | // tax | ||
- | cpx #$ff | + | bpl loop1 |
- | bne loop1 | + | |
END: | END: | ||
rts | rts | ||
Line 34: | Line 33: | ||
ldy #$04 | ldy #$04 | ||
loop2: | loop2: | ||
- | lda table,x // get the decimal equivalent of the bit in ASCII numbers | + | lda table,x // get decimal equivalent of bit in ASCII numbers |
- | adc #$00 // add carry, | + | adc #$00 // add carry, |
beq zero // skip (speed up) when there' | beq zero // skip (speed up) when there' | ||
adc result,y // add to whatever result we alread haven | adc result,y // add to whatever result we alread haven | ||
cmp #$3a // passing 10 with the addition? | cmp #$3a // passing 10 with the addition? | ||
bcc notten | bcc notten | ||
- | sbc #$0a // if so, subtract 10, carry will take care of overflow | + | sbc #$0a // if so, subtract 10 |
notten: | notten: | ||
sta result,y | sta result,y |
base/another_hexadecimal_to_decimal_conversion.txt · Last modified: 2020-11-14 23:05 by mace