Deja Vu #09
13 ноября 1999

Coding - how to print 42 characters per line (with trabutami), the procedure is quick print sprites with pixel precision.

<b>Coding</b> - how to print 42 characters per line (with trabutami), the procedure is quick print sprites with pixel precision.
(C) D.M0r0Zz
__________________________________________



   Hello! Theme of today's program: fast printing 42 characters 
per line, the attributes in this mode, the old songs about 
scroll'e and rapid withdrawal of sprites with pixel precision 
(stack free). Let's go! 

1. Quick Print 42 characters per line.



   So, to begin to create three
additional font, and each of them
will be 2 times larger than the original (4096 bytes
each), plus everything else, every
of the fonts will follow the sign for the addresses of his 
characters (512 bytes). This fakingom engaged podproga called 
CREAT. Call'nut it should at the very beginning, and then may 
be safely used PRINT, more about which below. 

   Warning: none of the labels can not be held absolutely no 
semantic load;) 


FONT EQU BASE ADDRESS FONT
FONT2 EQU 49152
FONT3 EQU FONT2 +4096 +512
FONT4 EQU FONT3 +4096 +512


CREAT

        LD DE, FONT2

        LD HL, FONT

        LD BC, 2048
F_CR1 LD A, (HL)

        RLCA

        RLCA

        AND 3

        LD (DE), A

        INC DE

        LD A, (HL)

        RLCA

        RLCA

        AND 252

        LD (DE), A

        INC DE

        INC HL

        DEC BC

        LD A, B

        OR C

        JR NZ, F_CR1

        LD B, 0

        LD IX, FONT2 +4096

        LD HL, FONT2

        LD DE, 16
F_CR11 LD (IX), L

        INC IX

        LD (IX), H

        INC IX

        ADD HL, DE

        DJNZ F_CR11



        LD HL, FONT

        LD DE, FONT3

        LD BC, 2048
F_CR2 LD A, (HL)

        RRCA

        RRCA

        RRCA

        RRCA

        AND 15

        LD (DE), A

        INC DE

        LD A, (HL)

        RRCA

        RRCA

        RRCA

        RRCA

        AND 240

        LD (DE), A

        INC DE

        INC HL

        DEC BC

        LD A, B

        OR C

        JR NZ, F_CR2

        LD B, 0

        LD IX, FONT3 +4096

        LD HL, FONT3

        LD DE, 16
F_CR21 LD (IX), L

        INC IX

        LD (IX), H

        INC IX

        ADD HL, DE

        DJNZ F_CR21



        LD BC, 2048

        LD HL, FONT

        LD DE, FONT4
F_CR3 LD A, (HL)

        RRCA

        RRCA

        AND 63

        LD (DE), A

        INC DE

        LD A, (HL)

        RRCA

        RRCA

        AND 128 64

        LD (DE), A

        INC DE

        INC HL

        DEC BC

        LD A, B

        OR C

        JR NZ, F_CR3

        LD B, 0

        LD IX, FONT4 +4096

        LD HL, FONT4

        LD DE, 16
F_CR31 LD (IX), L

        INC IX

        LD (IX), H

        INC IX

        ADD HL, DE

        DJNZ F_CR31

        RET



   Well, now you can and anything stamped: address text in the 
HL and boldly call PRINT (screen should be ochishen), whose 
meaning is that for each character in the shift of familiarity 
has its own font, IY stores the address of the transition to a 
conclusion with the necessary displacement. To save time, 
address "Offset fonts" are taken from previously created tables 
and sundry can make table and a standard font.



PRINT XOR A

        LD (Y_POZ_ +1), A

        LD DE, # 4000

        LD (S_TBL_ +1), DE



        LD (SP_I +1), SP

        LD IX, O1_

        LD IY, FUCK1_
;> Install launch configuration.

O1_ LD A, (HL)

        CP 1933

        JP NC, O4_

        CP 1932

        JP NZ, O9_
;
; If blank, then immediately go to the next; schemu symbol
;

        INC HL

        EX DE, HL

        LD A, LY

        CP FUCK1_ '& ampL

        JP Z, O11_

        LD HL, S_TBL_ +1

        INC (HL)
O11_ LD A, LY

        CP FUCK1_ '& ampL

        LD IY, FUCK2_

        JP Z, O111_

        CP FUCK2_ '& ampL

        LD IY, FUCK3_

        JP Z, O111_

        CP FUCK3_ '& ampL

        LD IY, FUCK4_

        JP Z, O111_

        LD IY, FUCK1_
O111_ EX DE, HL

        JP (IX)
;
; Style design METKA '& ampL means that
; Taken the low byte address METKA.
;
O9_ CP # 0D; transition to sled.stroku

        JP Z, Y_POZ_

        CP 3; end of the text

        JP Z, SP_I

        INC HL

        CP # 10; feature attributes

        JR NZ, O1_

        INC HL

        JP (IX)


O4_ INC HL

        EXX

        LD L, A

        LD H, 0
S_TBL_ LD DE, 0

        JP (IY)
;
; Shift 2 bits from the start of familiarity
;
FUCK4_ LD IY, FUCK1_

        LD BC, FONT4 +4096

        JP FUCK0_
;
; Shift 4 bits from the beginning znakometsa
;
FUCK3_ LD IY, FUCK4_

        LD BC, FONT3 +4096

        JP FUCK0_
;
; Shift of 6 bits from the start of familiarity
;
FUCK2_ LD IY, FUCK3_

        LD BC, FONT2 +4096
FUCK0_ ADD HL, HL

        ADD HL, BC

        LD SP, HL

        POP HL

        LD SP, HL

        EX DE, HL

        POP DE

        LD A, E

        OR (HL)

        LD (HL), A

        INC L

        LD (HL), D

        INC H

        POP DE

        LD (HL), D

        DEC L

        LD A, E

        OR (HL)

        LD (HL), A

        INC H

        POP DE

        LD A, E

        OR (HL)

        LD (HL), A

        INC L

        LD (HL), D

        INC H

        POP DE

        LD (HL), D

        DEC L

        LD A, E

        OR (HL)

        LD (HL), A

        INC H

        POP DE

        LD A, E

        OR (HL)

        LD (HL), A

        INC L

        LD (HL), D

        INC H

        POP DE

        LD (HL), D

        DEC L

        LD A, E

        OR (HL)

        LD (HL), A

        INC H

        POP DE

        LD A, E

        OR (HL)

        LD (HL), A

        INC L

        LD (HL), D

        INC H

        POP DE

        LD (HL), D

        DEC L

        LD A, E

        OR (HL)

        LD (HL), A

        LD HL, S_TBL_ +1

        INC (HL)

        EXX

        JP (IX)
;
; Character output without bias
;
FUCK1_ ADD HL, HL

        ADD HL, HL

        ADD HL, HL

        LD BC, FONT

        ADD HL, BC

        LD SP, HL

        EX DE, HL

        POP DE

        LD (HL), E

        INC H

        LD (HL), D

        INC H

        POP DE

        LD (HL), E

        INC H

        LD (HL), D

        INC H

        POP DE

        LD (HL), E

        INC H

        LD (HL), D

        INC H

        POP DE

        LD (HL), E

        INC H

        LD (HL), D

        LD IY, FUCK2_

        EXX

        JP (IX)
;
; Address calculation sled.linii.Standartno.
;
Y_POZ_ LD A, 0

        CP 1923

        JP Z, SP_I

        INC A

        LD (Y_POZ_ +1), A

        EX DE, HL

        LD B, A

        AND # 18

        ADD A, # 40

        LD H, A

        LD A, B

        AND 7

        RRCA

        RRCA

        RRCA

        LD L, A

        LD (S_TBL_ +1), HL

        EX DE, HL

        INC HL

        LD IY, FUCK1_

        JP (IX)
SP_I LD SP, 0

        RET


2. Set the attributes on the screen with fonts
    that in 42 characters per line.



         LD DE, # 5800

         LD BC, TEXT_ADRES;

         LD A, 68; default attribute

         LD (A_CC +1), A
A_S0 LD HL, A_TABLE
A_S1 LD A, (BC)

         INC BC

         CP 1932

         JR NC, A_K

         CP 3; CODE END OF TEXT

         RET Z

         CP # 0D; CODE END OF LINE

         JR Z, A_N

         CP # 10; attribute code

         JR Z, A_C
A_K LD A, E

         EX AF, AF

         LD A, E

         ADD A, (HL)

         LD E, A
A_CC LD A, 0

         LD (DE), A

         EX AF, AF

         LD E, A

         INC HL

         JR A_S1
A_C LD A, (BC)

         LD (A_CC +1), A

         INC BC

         JR A_S1
A_N LD A, E

         EX AF, AF

         LD A, E

         ADD A, (HL)

         LD E, A

         LD A, (A_CC +1)

         LD (DE), A

         EX AF, AF

         LD E, A

         LD HL, # 20

         ADD HL, DE

         EX DE, HL

         LD A, D

         CP # 5B

         JR C, A_S0

         RET
A_TABLE DB 0,0,1,2,3,3,4,5,6,6,7

         DB 8,9,9,10,11,12,12,13,14

         DB 15,15,16,17,18,18,19,20

         DB 21,21,22,23,24,24,25,26

         DB 27,27,28,29,30,30,31,31



   This procedure creates a similar
to shift the screen down on a familiarity.

ADRES EQU # 4000; address from which we
; Shifts
N EQU 24; NUMBER scrollable
; LINES
KUDA EQU # C000; where to put PROCEDURE


         LD IX, KUDA

         LD DE, ADRES +16

         LD HL, ADRES + # 20

         LD B, N * 8

         LD (IX), # F3; DI

         INC IX

         LD (IX), # ED

         INC IX

         LD (IX), # 73

         INC IX

         INC IX

         INC IX; LD (NNNN), SP
CKL1 PUSH HL, DE

         CALL SETS

         CALL SETS

         POP DE, HL

         CALL DN_DE; STANDARD Proc
         CALL DN_HL; fools to find

         DJNZ CKL1; SLED.POZITSII
; For quick Scroll ATTRIBUTES
And it should be changed address, Remove "* 8" FRONT
; N and replace "Kala" at finding a trace.
; POSITION Attributes

         LD (IX), # 31

         INC IX

         LD (KUDA +3), IX

         INC IX

         INC IX

         LD (IX +0), # FB; EI

         LD (IX +1), # C9; RET

         RET


SETS LD (IX +0), # 31

         LD (IX +1), L

         LD (IX +2), H

         LD (IX +3), # F1

         LD (IX +4), # C1

         LD (IX +5), # D1

         LD (IX +6), # E1

         LD (IX +7), # D9

         LD (IX +8), # C1

         LD (IX +9), # D1

         LD (IX +10), # E1

         LD (IX +11), # DD

         LD (IX +12), # E1

         LD (IX +13), # 31

         LD (IX +14), E

         LD (IX +15), D

         LD (IX +16), # DD

         LD (IX +17), # E5

         LD (IX +18), # E5

         LD (IX +19), # D5

         LD (IX +20), # C5

         LD (IX +21), # D9

         LD (IX +22), # E5

         LD (IX +23), # D5

         LD (IX +24), # C5

         LD (IX +25), # F5

         PUSH BC

         LD BC, 16

         ADD HL, BC

         EX DE, HL

         ADD HL, BC

         EX DE, HL

         LD BC, 26

         ADD IX, BC

         POP BC

         RET

   Similarly, we can get the scroll in the opposite direction.

3. Quick conclusion sprite up

    pixel.



   My proposed algorithm differs
from all previously published the fact that before
Begin the table is created (and where did
without them) with a length of 256 bytes (that is how much
different combinations of bits contained in 1
byte), the tables are stored halves shifted bytes.

   Example of creating a pair of these tables for
Print sprite with a shift in the 2-bit bytes from the beginning 
("ld" free;)). 

SM2_1 EQU # C000
SM2_2 EQU # C100
; Tables should go with a flat addresses 1 per
And another for kazhdogosdviga need 2
; Table t.k.bayt divided into 2 pieces.

        HL, SM2_1

        DE, SM2_2

        C, 0
CREAT A, C

        SRL A; shift for the first half

        SRL A; right by 2 bits

        (HL), A

        A, C

        SLA A; second part will be shifted

        SLA A; a 6-bit to the left.

        SLA A

        SLA A

        SLA A

        SLA A

        (DE), A

        INC HL

        INC DE

        INC C

        JR NZ, CREAT



   Similarly, you can get the other shifts. Generally, it is 
not necessary print with pixel accuracy, in many

cases, excellent results are obtained
at step 2 pixels.


   An example of "naked" horizontal printing
line sprite 2-byte offset
2 bits (bc-address in the screen, de-a sprite).


        A, (DE); took byte sprite

        L, A; in hl obtain location

        H, SM2_1 '&H; shifted to the right bytes

        A, (HL); took ...

        (BC), A; put ...

        INC L; sled.znakomesto ...

        INC H; moved to table the "Left"
; Shifts.

        A, (HL); took ...

        (BC), A; put ...

        INC DE; sled.bayt sprite

        DEC H; again switched to the original
; Table.

        A, (DE); took byte sprite

        L, A; and were shifted version

        A, (BC); the same ...

        OR (HL)

        (BC), A

        INC H

        INC C

        A, (HL)

        (BC), A



        etc.


   I hope you get the point;). As we see,
pretty decent speed, even without using the stack.

P.S. I have tried several times to go
after Xas'a in Alasm, but then LD forget to dial, then click on 
EDIT at the disc draws me to sleep, and instead of "#" 
persistently put the point ...


   Help, good people;).


         WARNING WARNING !!!!!



   Anyone who wants to get me angry
hitting and what would his treacherous crime knew then all the 
poor provincial Yousser, write! 





Other articles:

Apperativchik - the entry of the authors.

Apperativchik - On the control of Deja Vu.

Apperativchik - Freebie number 2: pirates and hacked versions of the magazine.

Apperativchik - Dejavu Info: How to buy the magazine Deja Vu.

Topic - Swap: "From letters to parcels" as found in the city Spektrumistov.

Topic - Tusovka: CSP'99 - interview with Slack Den.

Topic - Tusovka: CSP'99 - an interview with the main coder'om young Novosibirsk group AREASoft

Topic - Tusovka: CSP'99 - interview with one of the publishers 'electronic journal Deja Vu' Daniel / Playgear Co. / Binary Dimension.

Topic - Tusovka: CSP'99 - interview with one of Rybinsk of Cav / Auryn.

Topic - Tusovka: CSP'99 - an interview with the father of Playgear cool uncle Ze Pagan.

Topic - Tusovka: CSP'99 - an interview with the main coder'om Flash and concurrently one of the founders of the group - Alex Rider.

Topic - Tusovka: CSP'99 - poll as the party was held in a nutshell, the general impression.

Topic - Tusovka: Legend of the way passed Crazy Siberian Party 1999.

drop of solder - HD discs: Finalization of the drive controller to work with HD-disks.

drop of solder - The decision PROBLEMS 1.2MB drive.

drop of solder - increase the amount of RAM up to 1024K on SPECCY option Taganrog 128K!

drop of solder - circuit programmer for chip-only memory (ROM).

drop of solder - a dot-matrix printers.

drop of solder - ISA-Spectrum: card inserted into the ISA slot is IBM, which is part or a complete computer ZX-Spectrum.

Software - demoscene: Obzor'ing demozov: 63 bit III, Jam, Anamnesis, 7 Up, 63 bit IV, DemoDyin, Napalm, Crapmo 2, Bunch of Arce, Devotion, WorkStop, Energy , Yes.

Software - Game Review: MIST: Monstrland Part Two, Bomb Lakes, Marbles, KluXer, 4x4 Puzzle, Soldiers, Boats.

Software - Gun Commander: User's Guide.

Coding - coding for Dummies: civilized way in TR-DOS.

Coding - coding for Dummies: More about one of the ways to survey the keyboard.

Coding - coding for Dummies: How does the "Boot" from the inside.

Coding - coding for Dummies: refine MINI BOOT V3.0.

Coding - how to print 42 characters per line (with trabutami), the procedure is quick print sprites with pixel precision.

Coding - Bystrai printing 64 characters per line.

Coding - Conversion of numbers from the stack calculator in the character string.

Coding - fast print 2x2 sprite familiarity, up to familiarity.

Coding - Hrust Library svobodnopasppostpanyaemaya library window procedure by means of eccentricity can be packaged and paspakovyvat VARIOUS data.

Coding - Error Handling TR-DOS when working through # 3D13.

Coding - a set of procedures for constructing the user interface.

Coding - pishim virus invisible to TR-DOS.

Another world - The illusion of safety: Terrifying tales of Windows security and the Internet (Part One).

Hall of Fame - 3 methods to distinguish pealny ZX Spectrum from emulyatopov.

Hall of Fame - the charter of the National Fund of the Spectrum (HFSP).

Hall of Fame - Reserves: an attempt to present the perfect ZX Spectrum.

Hall of Fame - boiling: "And there still alive Speccy, sympathy Boxing?" Reflections in hearing.

Hall of Fame - schA say number 1: optimization of procedures, the announcement of the magazine and the new arcade toy.

Hall of Fame - schA say number 1: disassembly and Serg'a Playgear, hacking calling card, the announcement Crazy Siberian Party '2000.

Hall of Fame - A brief history of the Kemerovo group Digital Life Group.

Seven and 1 / 2 - Student mythology.

Seven and 1 / 2 - April Fools' Day 2 (end).

Seven and 1 / 2 - fairy tales for children.

Seven and 1 / 2 - Features a national ruleza or pure Siberian project (the story of Crazy Siberian Party 1999).

Samples pen - memory: story of the game "Black Crow".

Samples pen - story, "Elixir of the Beast."

Samples pen - "Last Warrior".

Advertising - text ads and announcements.

Advertising - a graphical advertising and announcements.


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

Similar articles:
a rest - Syphilis: A Story of the historian. The story of a scientist. Story doctor. Story patient. Story patient.
Charter OmegaNet - The draft statute Omega Net (SPbZXNet) v2.0.
Nove!? - All about games Italian Supercar, Ooutrun Europa, Football, Kenny Soccer Manager, Star Sstrike 2.
Feedback - contact the publisher.

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