Required, required...
ZXNet echo conference «code.zx»
From Alexander Bondarenko → To All 26 May 2003
*Hello, All!*
Subject: procedures for printing 1-byte, 2-byte, 3-byte numbers, in any
system, with or without "blank zero" formatting, the output number is in the form
additional arithmetic (maybe with a minus) or regular arithmetic. Who has what -
throw it, you'll get a great deal.
/That’s all, All, you can scroll further.../
From Aleksandr Majorov → To Alexander Bondarenko 29 May 2003
Hello Alexander!
26 May 03 22:37, Alexander Bondarenko -> All:
AB> Subject: procedures for printing 1-byte, 2-byte, 3-byte numbers,
AB> in
AB> any system, with or without "blank zero" formatting, output
AB> number in the form of additional arithmetic (may be with a minus) or
AB> regular. Whoever has what, throw it in, you'll get a great deal.
Are you sure that you need exactly the _print_?
Or is it still possible to convert numbers from HEX to DEC?
Here is the translation of 1 and 2 byte numbers into an ASCII string. All numbers are positive,
the presence of trailing zeros is optional.
╒═════════════════════════ Home decode.asm ═════════════════════════╕
;these are examples of use
DECODE_BC4 PUSH HL: LD HL,WORK_BUFF_S
CALL DECODE_BC
LD HL,WORK_BUFF_S+2
POP DE: LD BC,4: LDIR: RET
DECO_NUM CALL DECODE_A
LD (HL),D: INC HL: LD (HL),E
INC HL: LD (HL),A: RET
; now let's go p/p
;*************************
;TRANSFER [BC] TO ASCII NUMBER, TO [A] -
;NUMBER OF DIGITS, IF #00 - WITHOUT ZEROS
;WRITE THE RESULT IN HL (WITH ADDING ZEROS)
DECODE_BCA PUSH AF
LD HL,WORK_BUFF_S: PUSH HL
PUSH BC: LD BC,#0730
LD (HL),C: INC HL: DJNZ $-2
LD(HL),B
POP DE
CALL WDECOD
POP HLLD A,7: POP BC: SUB B
CP 7: JR Z,DECO_BCA0
ADD A,L: LD L,A: RET NC
INC H: NETWORK
;SETTING HL HA FIRST HE HULE CHARACTER,
;T.E. HA ZHACHEHIE NUMBER WITHOUT LEFT HULEY
DECO_BCA0 LD A,(HL)
OR A: JR Z,DECO_BCA1
CP “0”: RET NZ
INC HL: JR DECO_BCA0
DECO_BCA1 DEC HL: RET
;******************************************************
;CONVERT [BC] TO ASCII-NUMBER, IN 6-DIgit
DECODE_BC PUSH BC: LD BC,#0620
LD (HL),C: INC HL: DJNZ $-2
POP OF
WDECOD AND OF,HL
LD B,3
DECOD PUSH BC: LD B,16: XOR A
SBIT ADD HL,HL: ADC A,A: DAA
JR NC,$+3: INC HL
DJNZ SBIT: LD C,A
AND #0F: ADD A,"0"
DEC OF: LD (FROM),A
LD A,C: RRCA: RRCA: RRCA: RRCA
AND #0F: ADD A,"0"
DEC OF: LD (FROM),A
POP BC: DJNZ DECOD
RET
;*********************************************
;CONVERT [A] TO ASCII-NUMBER
;RESULT IN D-E-A
DECODE_A PUSH BC: LD DE,#3030 ;ASCII "0"
LD BC,100*256+10
CP B : JR C,DECOD_A2
SUB B: INC D: JR $-5
DECOD_A2 CP C: JR C,DECOD_A3
SUB C: INC E: JR DECOD_A2
DECOD_A3 ADD A,"0"
POP BC: RED
╘═══════════════════ Context decode.asm ══════════════════════
Alexander
From Alexander Bondarenko → To Aleksandr Majorov 3 June 2003
*Hello, Aleksandr!*
Catch my ideas about the subject “Required-required...”, which I was talking about
on May 29, 2003 your footcloth to comrade. Alexander Bondarenko.
AB>> Subject: procedures for printing 1-byte, 2-byte, 3-byte
AB>> numbers, in any system, formatted with "blank zeros" or
AB>> without, the output number in the form of additional arithmetic (may
AB>> be with a minus) or regular. Whoever has what, throw it in, great
AB>> learn.
AM> Are you sure that you need exactly the _print_ item?
Envelopes are also suitable.
AM> Or is it still possible to transfer numbers from HEX to DEC?
Translation of numbers from HEX to text, DEC -> text. BIN -> text I won’t be lazy myself -
I'll do it.
AM> Here is the translation of 1 and 2 byte numbers into an ASCII string. Ve numbers
AM> positive, the presence of trailing zeros is optional.
Okay.
/That’s all, Aleksandr, you can scroll further.../
From Eugene Palenock → To Alexander Bondarenko 7 June 2003
Hi Alexander!
03 Jun 03 23:36, Alexander Bondarenko -> Aleksandr Majorov:
AB> Translate numbers from HEX to text,
If fast then so
ld bc, 303fh
ld a, d
rra
rra
rra
rra
or a, b
and a, c
cp '9'+1+30h
jp c, m1a
add a, 7
m1a: ld (buff+0), al
ld a, d
or a, b
and a, c
cp '9'+1+30h
jp c, m1b
add a, 7
m1b: ld (buff+1), al
ld a, e
rra
rra
rra
rra
or a, b
and a, c
cp '9'+1+30h
jp c, m1c
add a, 7
m1c: ld (buff+2), al
ld a, d
or a, b
and a, c
cp '9'+1+30h
jp c, m1d
add a, 7
m1d: ld (buff+3), al
ret
buff: db '1234