Voyager #03
19 октября 1998

Laboratory - The algorithm output decimal numbers on the screen from the register of DE & HL.

<b>Laboratory</b> - The algorithm output decimal numbers on the screen from the register of DE & HL.
                 *



     When writing programs often need to display numbers on 
screen. The printing process is 16-ary write numbers is not 
difficult, more difficult situation deal with the withdrawal of 
decimal numbers. It is desirable that program to work as 
quickly as possible and did not have more restrictions on the 
range of output numbers. 

     The first procedure is just implementing the original 
algorithm the output of decimal numbers on the screen monitor 
the register DE'HL. Ie, it converts 32-bit number into a string 
of characters. This procedure is designed to work in the CP / M,

but I think that you can easily understand how to use it in 
their programs on the Spectrum ... 


        . Z80
? EQU 0


D1836: DW?
D1838: DB?
T1839: DB?


PRINTDEHL:

        LD BC, 0; [BC]: = 0

        LD (D1836), BC; Clear values

        LD (D1838), BC

        LD C, 20H; For c = 1 to 32
A1433: ADD HL, HL

        RL E

        RL D; sla dehl, a

        PUSH HL

        LD HL, D1836; Getting formed

                          ; Line
T143C: LD B, 004H; For b = 1 to 4
A143E: LD A, (HL); [a ]:=([ hl])

        ADC A, A; [a]: = [a] * 2 + Carry

        DAA; Decimal. correction

        LD (HL), A; ([hl ]):=[ a]

        INC HL; [hl]: = [hl] +1

        DJNZ A143E; Next b

        POP HL

        DEC C;

        JR NZ, A1433; Next c

        LD BC, 0410H; [b]: = 4; [c]: = 16

        LD HL, T1839; a line with

                          ; End
A144F: LD A, (HL); [a ]:=([ hl])

        RRA;

        RRA; [a]: = int ([a] / 16)

        RRA; 4 devyatibitnyh
A1453: RRA; rightward shift

        CALL A1465; derive Jr.

                          ; Discharge

        LD A, 1, (former chief)

                          ; Number

        SUB B; There can be

        JR NZ, A145D; displays 8 digits

        LD C, A; decimal
A145D: LD A, (HL); if the number is 0, then

        DEC HL; should be withdrawn

        CALL A1465; one decimal time
        DJNZ A144F; number of zero

        RET; Output
A1465: AND 0FH; [c] = 10h until

        JR Z, A146B; yet found

        LD C, 0, (in the senior ranks)
A146B: OR 00110000B; level equal to zero.

                          ; Thus, vmes
        SUB C; then zero values

        PUSH BC; output gaps

        PUSH HL

        LD E, A; inferred character

        LD C, 2; code of the function 'Print

                          ; To the console '

        CALL 5; call CP / M for

                          ; Print symbol

        POP HL

        POP BC

        RET






Other articles:

Inform - The plans of the magazine.

Authors - The authors of the journal and editorial contacts.

Inform - Guide magazine.

Locman - On the game SubSunk.

Locman - Game Description DARK SIDE.

loafer - Complete walkthrough MIRROR.

Kaleidoscope - On the game Star Dust roads.

Kaleidoscope - On the second virtual computer art festival Art Comp-99.

Kaleidoscope - The presentation of text utilities - Text Utility V2.8i.

Skeleton - Description of the sound card DMA SOUND.

Skeleton - an undocumented feature of the processor Z80.

History - Life After Willie. Softografiya Matthew Smith.

History - On fidoshnom slang.

Laboratory - Intro POORGUY! - Inside (original text with commentaries).

Laboratory - ZX-SPECTRUM and operating systems.

Laboratory - Procedures from MicroSoft.

Laboratory - The algorithm output decimal numbers on the screen from the register of DE & HL.

Laboratory - The algorithm of division and multiplication of large numbers.

PROFI CLUB - Studying CP / M (compatibility, processors, terminals).

Humor - Ladder - advice to competent user.

Humor - Verse "OA programmers.

Mail - Letters from readers in the magazine.

Advertising - Advertisements and announcements ...

ZXTraders - Deystvyyuschie distributors software ZX Spectrum in Russia and Ukraine


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Demo Party - unofficial results Di: Halt'99 with comments Diver'a.
about everything about everything - The secret origin of Homo Sapiens.
FunTop98 - that did not happen.
Entry - the contents of the issue.

В этот день...   6 May