Nicron #26
27 марта 1997

Programming - Z80 assembler on Russos.

<b>Programming</b> - Z80 assembler on Russos.
(C) RUSSOS

                    Eliminating one Gluck
                       leads to the other elastic, more heavy 
... 

                        (Prokodirovannoe. ..)


   Hi everyone! In rannih releases NICRON'a a series of 
articles about asembler Z-80. There was given a list of 
commands and their purpose. In this series will be continued 
this theme and will be considered already different procedures 
(print, work with windows, etc.). Basically I'll talk about the 
procedures that I wrote for her boot'a (STATION CONTROL). Of 
course, I'm not saying that the files of this are ideal. None. 
This material data is likely to for beginners, because looking 
at my next creation, he would said: "I am better!" Well, 
please! Do better! Tinkering with my procedure, study them and 
their sozdovay! Well, may be and some coder will these 
procedures in their library ... 


   What do I do with these procedures? Because I do not know in 
what asemblere you work, you cite only an example for the 
transfer to Masm, where I work.


   For a start, unload the text of the newspaper on the disc, 
then download in Word and then delete all the text, leaving 
only the text of the program. Also delete all comments in the 
procedure. Unfortunately not Masm understand the alternative 
coding and instead of the text will be delusions (encoding, 
alternative understands ALASM, but I it does not work!) and at 
the end of the program postavte icon (EXT MODE + dial 26) is 
necessary for translation into a format TASM 2. Next vygruzete 
its creation on a disk and download the TASM 4. There, press 
'I' and the request type in the name of your file (it must be 
unloaded with the extension 'C'!) and wait for the translation 
into a format TASM 4. Unloaded their text on disk, Gerizim Masm 
and click button 'I'. Will List of files in fotmate TASM 4. 
Choose the desired and convert him. Everything! Do you have a 
text format Masm. Now you can it redaktorovat and debug the STS 
in any of its versions (I 5.2) 


   To begin, I'll show you how to print to the screen. Among 
its advantages include high speed, understanding of alternative 
encoding, and a fairly simple structure. But the shortcomings: 
processing of only one control code '22 '. Others have not been 
implemented as unnecessary. I now give the text of the 
procedure, and after the examples of its use and 
recommendations for improvement. 

;---------------; Print lines.
; HL-top of the line.
; Line: 22 new coordinate printing, then the two-byte 
themselves to; rdinaty: 1'y - X, 2'oy Y, 0 - end of line 
;--------------- PRINT LD A, (HL); reception of the next byte.  
   CP # 00; check for 0.     RET Z; output if the string has 
ended.     CP # 16; preparation for the installation of a new

    CALL Z, UPR_22; coordinate: Dx, Ey.
    CALL PRINT_1; printing characters.
    INC HL; increase and
    JR PRINT; transition to a new character.
;------- UPR_22 INC HL; installation in registers D coordinates 
LD D, (HL); coordinates x, and E - y.     INC HL;

    LD E, (HL);
    RET;
;------- PRINT_1 PUSH AF; saving on the stack of all regi PUSH 
BC; displaying the.     PUSH DE;

    PUSH HL;
    CP # 16
    JR Z, UPR1_22; installation of the new coordinates.
    LD L, A; calculation addresses the top line
    LD H, # 00; simvla in the font.
    ADD HL, HL; FONT-start address-font # 100
    ADD HL, HL;
    ADD HL, HL;
    LD DE, FONT;
    ADD HL, DE;
    LD DE, (COOR); in DE address the top line of characters; 
place. ;-------; Next comes the printing character on the 
screen of the font in the familiarity , With an address located 
in the COOR. If you do not need the speed, , Then this fragment 
can replace the other files of: ; ...

; LD B, 8
; LOOP LD A, (HL)
; LD (DE), A
; INC HL
; INC D
; DJNZ LOOP
; ...
;-------; Top ftagmenta
;------- LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
    LD A, (HL)
    LD (DE), A
    INC HL
    INC D
;-------; End fragment
;------- LD DE, (COOR); loading in DE address of familiarity
    INC DE; increase familiarity address.
    LD A, D
    CP # 41; check for crossing the boundaries JR Z, PR_L1; ary 
1'ogo and 2'ogo segment     CP # 49;

    JR Z, PR_L2;
    LD (COOR), DE; memory addresses familiarity
    JR PR_L0
PR_L1 LD DE, # 4800; correction of address
    LD (COOR), DE;
    JR PR_L0;
PR_L2 LD DE, # 5000;
    LD (COOR), DE;
;------- PR_L0 POP HL; Recover registers and WHO POP DE; gate.
    POP BC;
    POP AF;
    RET;
;-------; Standard procedure for calculating the addresses in 
the file system on display ; On znakomvstam.

;------- UPR1_22 LD A, E
    AND # 18
    OR # 40
    LD H, A
    LD A, E
    AND # 07
    OR A
    RRA
    RRA
    RRA
    RRA
    ADD A, D
    LD L, A
    LD (COOR), HL
    JR PR_L0
;------- COOR DEFW # 4000; address of familiarity.
;---------------

   That procedure. I hope you understand how it works. Now, 
examples of its use. 

            First example.


   To print line in the coordinates 2 (X) and 1 (Y).

    LD HL, TXT
    CALL PRINT
    RET
;--------------- PRINT ...
;--------------- TXT DEFB 22,2,1, "NICRON - THE BEST!"
    DEFB 0; end of the line.

            EXAMPLE TWO.


   To print any character (though '') in the given coordinates 
(2,3) 

    LD A, 22
    LD DE, # 0203
    CALL PRINT_1; setting the desired print position
    LD A, # CE; code symbol ''.
    CALL PRINT_1; print.
    RET
;--------------- PRINT_1 ...
;---------------

   If desired, you can easily modify this procedure
that she understood the other control codes. On to add a check 
register A, and perform actions, the appropriate panel. code. 
If you add color, you need to add the procedure for calculation 
addresses in the file attributes of familiarity 


  If you have something not working, then call me and I'll help.


  For all questions and wishes, too, call me - chat.


  I would like to know your opinion: whether such an article in 
the future? Their opinions can tell me on the phone or leave 
Letter to the BBS, which accept mail for NICRON'a. 


                           (C) RUSSOS
                        461-84-81 (Sasha)
                        from 16.00 to 23.00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
~~~~~~~~~~~~~~ 





Other articles:

Entry - poems and maintenance facilities.

BBS - list of stations BBS ZXNet.

Programming - Z80 assembler on Russos.

Graphics - Image ANSI graphics.

Search - search for game programs.

Humor - Dembelskaya rocket ordinary Kochkurkina.

Humor - anecdotes.

Soldering Iron - LPT COVOX.

Congratulations - birthday.

Advertising - advertising and announcements.

Feedback - contact the publisher.


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

Similar articles:
Others - Registered users ZXVGS and CPM22QED.
Special Edition - International Festival of Computer Art FunTop98.
Tusovka - As correctament behave at the banquet table? Jokes.
From the world of bat - The article, a parody of various descriptions of games, "Short Guide to the descriptions of games."
Detective - Wanted version of the graphical editor Art Studio supports kempston mouse.

В этот день...   23 November