mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-03-21 18:30:27 +00:00
Fixed dotted_quad().
Omitting the middle digit because it is '0' must only be done if the high digit was omitted too (because it was '0'). If the high digit is '1' or '2' (and therefore not omitted) then the middle digit must never be omitted.
This commit is contained in:
parent
7558997ab2
commit
2594daeb6b
@ -35,7 +35,8 @@ _dotted_quad:
|
||||
rts
|
||||
|
||||
convert_byte:
|
||||
; hex to bcd routine taken from Andrew Jacob's code at http://www.6502.org/source/integers/hex2dec-more.htm
|
||||
; hex to bcd routine taken from Andrew Jacob's code at
|
||||
; http://www.6502.org/source/integers/hex2dec-more.htm
|
||||
sed ; switch to decimal mode
|
||||
lda #$00 ; ensure the result is clear
|
||||
sta tmp1 ; BCD low
|
||||
@ -53,19 +54,23 @@ convert_byte:
|
||||
bne :-
|
||||
cld ; back to binary
|
||||
|
||||
lda tmp1
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
pha
|
||||
lda tmp2
|
||||
beq :+
|
||||
ora #'0'
|
||||
sta dotted_quad,y ; write x00 if not 0
|
||||
sta dotted_quad,y ; write x00
|
||||
pla
|
||||
iny
|
||||
: lda tmp1
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
beq :+
|
||||
ora #'0'
|
||||
sta dotted_quad,y ; write 0x0 if not 0
|
||||
bne :++ ; always
|
||||
: pla
|
||||
beq :++
|
||||
: ora #'0'
|
||||
sta dotted_quad,y ; write 0x0
|
||||
iny
|
||||
: lda tmp1
|
||||
and #$0F
|
||||
|
Loading…
x
Reference in New Issue
Block a user