mirror of
https://github.com/Tolik-Trek/Estex-DSS.git
synced 2026-06-15 09:21:47 +03:00
77 lines
1.1 KiB
NASM
77 lines
1.1 KiB
NASM
;----------------------------------------------------------------------;
|
|
; ‚뢮¤ HL ¢ hex-ä®à¬ â¥
|
|
; de=¡ãä¥à
|
|
; hl=ç¨á«®
|
|
hex16: ld a,h
|
|
call hex8
|
|
ld a,l
|
|
; ¢ë¢®¤ "a"
|
|
hex8: push af
|
|
rrca
|
|
rrca
|
|
rrca
|
|
rrca
|
|
call .num
|
|
pop af
|
|
;
|
|
.num: and %0000'1111
|
|
add a,#90
|
|
daa
|
|
adc a,#40
|
|
daa
|
|
ld (de),a
|
|
inc de
|
|
ret
|
|
;----------------------------------------------------------------------;
|
|
|
|
|
|
;----------------------------------------------------------------------;
|
|
;!FIXIT ¥áâì ¤ã¡«ì PDIGIT
|
|
; ¢å®¤: hl=ç¨á«®, de=¡ãä¥à
|
|
hex2dec_ascii_16bit:
|
|
.n10: ld ix,.tmp1
|
|
res 7,(ix+0)
|
|
jr .decim
|
|
;
|
|
.n10000: ld ix,.tmp1
|
|
res 7,(ix+0)
|
|
ld bc,100
|
|
call .num16
|
|
jr .skip1
|
|
;
|
|
.n1000: ld ix,.tmp1
|
|
res 7,(ix+0)
|
|
.skip1: ld bc,100
|
|
call .num16
|
|
jr .skip2
|
|
;
|
|
.n100: ld ix,.tmp1
|
|
res 7,(ix+0)
|
|
.skip2: ld bc,100
|
|
call .num16
|
|
;
|
|
.decim: ld bc,10
|
|
call .num16
|
|
ld a,l
|
|
add a,"0"
|
|
jr .num16_exit
|
|
;
|
|
.num16: ld a,'0'-1
|
|
and a
|
|
inc a
|
|
sbc hl,bc
|
|
jr nc,$-3
|
|
add hl,bc
|
|
cp "0"
|
|
jr z,$+6
|
|
set 7,(ix+0)
|
|
bit 7,(ix+0)
|
|
ret z
|
|
.num16_exit:
|
|
ld (de),a ; á®åà. ¢ ¡ãä¥à¥
|
|
inc de
|
|
ret
|
|
;
|
|
.tmp1: BYTE 0
|
|
;----------------------------------------------------------------------;
|