;LAST UPDATE: 24.03.2014 savelij
HEX4DEC PUSH HL
EXX
LD HL,TXT_DEC
PUSH HL
PUSH HL
LD B,9
EXX
LD HL,CHISLA4
REPT 9
CALL BCDEMHL
ENDM
H2D1 LD A,0X30
ADD A,E
EXX
LD (HL),A
INC HL
LD (HL),0
LD A,B
EXX
POP HL
LD B,A
LD A,(HL)
CP 0X30
JR NZ,$+7
LD (HL),0X20
INC HL
DJNZ $-8
POP HL
POP DE
INC HL
INC HL
INC HL
LD BC,7
LDIR
RET
CHISLA4 DB 0X00,0XCA,0X9A,0X3B;1000000000
DB 0X00,0XE1,0XF5,0X05;100000000
DB 0X80,0X96,0X98,0X00;10000000
DB 0X40,0X42,0X0F,0X00;1000000
DB 0XA0,0X86,0X01,0X00;100000
CHISLA2 DB 0X10,0X27,0X00,0X00;10000
DB 0XE8,0X03,0X00,0X00;1000
CHISLA1 DB 0X64,0X00,0X00,0X00;100
DB 0X0A,0X00,0X00,0X00;10
;BCDE-(ADR)=BCDE
BCDEMHL XOR A
EX AF,AF'
BCDEMHL1 LD A,E
SUB (HL)
INC HL
LD E,A
LD A,D
SBC A,(HL)
INC HL
LD D,A
LD A,C
SBC A,(HL)
INC HL
LD C,A
LD A,B
SBC A,(HL)
LD B,A
DEC HL
DEC HL
DEC HL
EX AF,AF'
INC A
EX AF,AF'
LD A,B
CP 0XC4
JR C,BCDEMHL1
LD A,(HL)
ADD A,E
LD E,A
INC HL
LD A,(HL)
ADC A,D
LD D,A
INC HL
LD A,(HL)
ADC A,C
LD C,A
INC HL
LD A,(HL)
ADC A,B
LD B,A
DEC HL
DEC HL
DEC HL
EX AF,AF'
DEC A
ADD A,0X30
INC HL
INC HL
INC HL
INC HL
EXX
LD (HL),A
INC HL
EXX
RET