Inferno #02
01 мая 2001

For Coderz - how to programmatically determine the number of strokes in the line of cars equipped with Port # FF.

<b>For Coderz</b> - how to programmatically determine the number of strokes in the line of cars equipped with
Port # FF.
          TEST LINE

(C) Gris


   Hello Dear Readers.
Now I'll tell you, those who do not
knows how to programmatically determine how many cycles in a 
row at the car, equipped with Port # FF.


   A bit of history. I liked the creepy toy Ivan cool 
"TetrisSokoban" may have seen it (there is another curb the 
inscription "TESO"). Since I Scorpion, the inscription was my 
worst "kozyavilas" that I really lacked. So I decided to alter 
the conclusion on the curb. Eventually I got and I wanted to do 
a remix of this game with custom curb effect, but there

found that even Scorrion'ov length
lines are different. With the words ZS'a have options of 
lengths of lines Screen: 216, 224, 232 cycles. I thought about 
it and decided to make the auto-tuning for cars,

which is the port # FF.

   Talk about the construction of the screen I do not
I will - see the ZX-REVIEW, electronic
facilities. The essence of this method is simple, although
Our coders did not understand my implementation
thereof. The essence of port # FF is
that after he read the attributes that are being read are drawn 
on the beam screen. To determine the length of the string in

cycles necessary to calculate the cycle
prorisovaniya line. You can do this
using a variety of attributes. ZS offered to introduce an 
attribute of the top screen (E = 22528 # 5800) and read # FF 
port to until you see the attribute

twice, they say, sure we would get to it. I think that you can 
not rely on the case, because the beam may skip this attribute. 
Therefore, should some portion of the screen (row 4, I think 
enough) to fill the attributes individalnymi for each column of 
familiarity, since ray from the beginning of the screen can get 
on 1 st and 2 nd, and on the other familiarity within the first 
few. But the rest of familiarity, we need to also specifically 
designated as our task at this stage is to determine the screen 
space with which we begin measure the progress of the beam. 
Short algorithm: 

   1. Fill area attributes
increasing value from # 00 to # 1F
for each row.

   2. Form a semiconductor read from the port -
block of commands INI, pieces 100 (and you can lower yourself 
surely there) with RET at the end. 

   3. Making EI: HALT and skipping the top of the curb.

   4. Transfers control to the semiconductor from p.2

   5. Analyze the resulting data point 4 (block # FF with a 
small number of individual attributes): 

    - The end of each block "FF'ov" means the transition to a 
new line of the image; 

   - First byte is different from # FF and address in which he 
met, it is necessary "Remember";


   - Looking for the next one and the same byte
determine how many bytes to him from the first, calculating 
way, how many just run INI, while the beam

drew a line;

   - Multiply that number by the duration of the team INI - by 
16 and divide by number of blocks # FF - the number of lines.


   But the implementation of the algorithm (izvintilyayus, the 
program does not optimized):


; (C) Gris 24.12.2000g.
; Test tacts in screen line.
; Enter: no data,
; Exit: A = number of tacts in line.


        ORG # 6000

DELAY EQU # 0210
ReadFF EQU # 8000


        CALL FilAtr

        CALL MakeINI

        EI

        HALT

        DI
WAIT LD BC, DELAY; # 0210
WTLP DEC BC

        LD A, B

        OR C

        JR NZ, WTLP

        LD HL, ReadFF

        LD C, # FF

        CALL ReadFF

        CALL ANALIZ


        EI

        RET

FilAtr PUSH BC

        PUSH HL

        LD HL, # 5800

        LD B, 8
MFilLP PUSH BC

        LD B, # 20

        LD C, 0
FilLP LD (HL), C

        INC HL

        INC C

        DJNZ FilLP

        POP BC

        DJNZ MFilLP

        POP HL

        POP BC

        RET

MakeINI LD HL, ReadFF

        LD A, # ED; INI

        LD C, # A2;

        LD B, # 0
MKLP LD (HL), A

        INC HL

        LD (HL), C

        INC HL

        DJNZ MKLP

        LD (HL), # C9

        RET

ANALIZ LD HL, ReadFF

        LD BC, 0


        LD A, # FF
L1 CP (HL)

        JR NZ, AN1

        INC HL

        JR L1

AN1 LD A, (HL); LOAD ZM

        LD D, A; STORE ZM TO D

        INC HL

        INC B
L2 LD A, (HL)

        CP D

        JR Z, AN2

        CP # FF

        JR Z, AN3
E_AN3 INC B; COUNT ALL BYTES

        INC HL

        JR L2
AN3 INC C; COUNT LINES

        LD A, # FF
L3 CP (HL)

        JR NZ, L2

        INC B; COUNT ALL BYTES

        INC HL

        JR L3
AN2 LD H, 0

        LD L, B

       DUP 4;

        ADD HL, HL; MUL 1916 (INI time).

       EDUP;

        EX DE, HL

        LD H, 0

        LD L, C

        CALL DIVB2

        LD A, E

        RET

; Here we have used part of the mat.
; Library B. Mednonogova.

; MATHEMATICAL LIBRARY MATH-ZX
; (C) Corer Feet
FREE16 DEFS 16
DIVB LD D, 0; E / L - E (MOD in D)
DIVB2 PUSH HL; DE / L - E

       PUSH BC

       LD B, 8

       EX DE, HL

       LD D, E

       LD E, 0
DIV1B OR A

       RR D

       RR E

       SBC HL, DE

       JR NC, MDIVB

       ADD HL, DE
MDIVB RLA

       DJNZ DIV1B

       CPL

       LD D, L

       LD E, A

       POP BC

       POP HL

       RET







Other articles:

For Coderz - the translation algorithm of color image in gradations Spekrumovskogo gray.

Inferno - Managing obolchka magazine.

For Coderz - Aparatnye computer errors ATM-TURBO.

For Coderz - Description of a personal computer ATM-TURBO 1.

For Coderz - Description of a personal computer ATM-TURBO 2 +.

For Coderz - how to programmatically determine the number of strokes in the line of cars equipped with Port # FF.

Shelezyaka - the prefix to the phone to remove noise and clicks.

Shelezyaka - Pagemaker: refinement of weaving displays the page number memory.

Shelezyaka - NEW BRIGHT: Sixteen full-color mode.

Interview - an interview with the leader of the Samara spektrumistov Unbel! Ver / XTM.

Others - the outcome of the failed survey.

Others - ROMkadrom (humor).

Others - Safemode: computer crime and information warfare.

Others - Thoughts aloud: "All your thoughts about that Sreccy already bent, are complete nonsense ... "

Softinka - description of a new text editor ZX-WinWord V3.0.

Softinka - description of a new text editor ZX-WinWord V3.0 (Oberon Creative Pack).

Softinka - File Extractor: File Extractor.

Gameland - How to write a play. Volume 3. Part One.

Gameland - How to write a play. Volume 3. Part One.

Gameland - the latest demo spekrumovskoy Amiga version znaminitoy Toys WALKER.

Gameland - the third demo of the game Wolf 3D.

Samizdat - Dragonland: Presentation.

Samizdat - Dragonland: Wild Honey.

Samizdat - Dragonland: When the rain ...

Samizdat - "Bastard AlHimik Doctor Faustus Plumed Serpent "№ 1.

Samizdat - "Bastard AlHimik Doctor Faustus Plumed Serpent "№ 2.

Samizdat - Something like Kashpirovsky ....

Soap - Letter from nowhere.

Inferno - The authors.

Inferno - Intro.


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

Similar articles:
TREE NEWS - buggy BBS weeks ...
Humor from fido - Skateptyu dopozhka.
Obmen experience - The use of channels in the programs. Using sub-ROMs.

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