Inferno #07
31 мая 2005

For Coderz - Programming for the video mode 384x304.

<b>For Coderz</b> - Programming for the video mode 384x304.
  384x304: Programming

   This article was written at the request of Znahar / Rush and 
serves as a complement Niemi to the article in AlCoNews # 32. 
Reprinted that article is not entirely I will find a better 
original. 


     The scheme (Contact v2.06 by Alone Coder 'KSA-7G)

                           The first circuit

                 (As in the circuit with the breaker switch):

signal lines of a standard screen of 14 th (from scratch) 
videoadres D8 (555LE1): 13> D17 (555KP11): 14

 or D9 (1533LI1): 5 cut off +5 v <- x -
                                                > D14 
(555KP11): 14 

                       cut the +5 v <- x --- (for attributes)



                           The second chain

                      (Instead of the circuit breaker):

what was at the 13 th videoadrese before - (many are GND)

                                           x
signal standard column screen | cut old
 D4 (555IE7): 7 or D9: 4 LED / |

                1533LI1 |
enable signal 1.5k | 13th videoadres
 (Eff7 bit 6) <>> D17 (555KP11): 11

                     Diode Diode
 +5 V 1.5k

         1k
old / diode
signal a new signal curb curb
D9: 6> D10 (1533TM2): 12
 1533LI1 | 3.3k |

          --- X --- this part of the scheme is not needed if 
the 13-m 

         videoadrese was cut GND (ie, no

                       512x192, attribute to a byte or SB)


            Address fields of the screen to the main screen:

             {Address attributes - in braces}

{# D0xx} # c01f | # e000 ^ {# f0xx} # e01f | # c008 {# d0xx}

         ... | ... 8chr ... | ...

        # C7ff | # e7e0 v # e7ff | # c7e8
-------------+------------------------------------ 
+------------{# 58xx} # 401f | # 6000 ^ {# 78xx} # 601f | # 
4008 {# 58xx} 

  ... ... | ... | ... ... | ... ...

             | 24chr |

  ... ... | ... | ... ... | ... ...
{# 5axx} # 57ff | # 77e0 v {# 7axx} # 77ff | # 57e8 {# 5axx}
-------------+------------------------------------ 
+------------{# d3xx} # d81f | # f800 ^ {# f3xx} # f81f | # 
d808 {# d3xx} 

         ... | ... 6chr ... | ...
<--- 8chr ---> | # ffa0 v # ffbf | <--- 8chr --->


   Since the 0-I 1-I-thirds (or more precisely, not third, and 
fifth fractions) differ in addressing pixels only pages, but

differ greatly in addressing the attributes, then write down 
only the variant Antes procedures for the case when opened on 4 
th page and the screen - core.



   Program to 384x304 is best to write so that it was
 and a standard mode of 256x192. To do this:

  1. In all cases, to allocate # 6000 .. # 7aff and part of the 
4-th  page.


   2. For 384x304 use the area below the screen.

  3. For 256x192 use these areas, such as a buffer
 font-scale (as in ACE).

  4. When writing or alteration of the program screen sizes have
 in specific constants, so they can be changed.

  5. The routine to write for 256x192 and 384x304, or different
the same, but with a different screen size (if the active
 field at 384x304 will be controlled, then all is fine:)).

  6. After debugging procedures instead of manually changing 
the constants (and ve current conditional compilation) in the 
source organize the variables of Programme on which the program 
itself will be arranged. For each dogo parameter (width, 
height, address of the routine ...) should be have exactly one 
storage location and procedures will need to use call of 
information from this site (ie a variable). Change  variables 
at an early stage by the constant in the source. 

   7. Then remove this constant, instead make a setup.

  8. Disc surgery and other complex menus easier to organize
on the screen of 256x192 (as in ACE and ANSI). However, if the 
regime does not  will change, will be biased ...


  9. Needed to clear the screen from top to bottom, otherwise 
turns ugly (Procedure for transfer line, see AlCoNews # 32, but 
can recollection  lzovatsya procedures outlined here CLS384).


  10. Are visible everywhere on 4 sides of familiarity with the 
basic screen, plus 4 more on top and 2 below. This is done in 
the new versions of the Unreal Speccy, I think, correct. In ACN 
# 32 I suggested use of 3 familiarity top and bottom, but do 
not think that it was asymmetric (ie, no relation to real

appeared on the TV did not have).


   If the support 2 screens in the future will be able to 
support and others, as are many of them on different clones! 
Particularly tempting to look Screen 512x192 - it takes the 
same addresses # 6000 .. # 77ff. 


                Procedures for working with 384x304 screen

                  (They are! 384.H in the appendix)

, 0. on'off 384X304

 OFF384

         XOR A

        JR $ +4
 ON384

         LD A, 64

         LD BC, # EFF7

         OUT (C), A

        RET

, 1. byte right

; Looking for the next byte on the right screen
 BR384

         LD A, L

         INC L

         XOR L

         AND 32

         RET Z; 46 times out of 48

         BIT 5, H

         JR Z, br384c; 1 times out of 48

         RES 5, H; 1 times out of 48

         LD A, -24

        JR br384al
 br384c

         SET 5, H

        LD A, -32
 br384al

         ADD A, L

         LD L, A

        RET

2. y -> scr

; BC indicates the line number (from 0 to 303)
, At the exit HL = base address of the string (# 4000 instead 
of # 4018, etc.) ; Not spoil BC

 YSC384

         LD A, C

         AND 7

         LD H, A

         XOR C

         ADD A, A, A, A

         LD L, A

         LD A, # D8

         INC B

         DJNZ ys384LO

         LD A, C

         AND # C0

         RRCA

         RRCA

         RRCA

         JR NZ, $ +4

         LD A, # C0-# 38; 0-I third

        ADD A, # 38
 ys384LO ADD A, H

         LD H, A

        RET

3. xy -> scr

; BC indicates the line number (from 0 to 303)
; E - number of bytes in a row (from 0 to 47)
, At the exit HL = address of byte
 XYSC384

         CALL YSC384; y -> scr

         LD A, E

         SUB 8

         JR C, xs384l

         CP 1932

         JR C, xs384m

        SUB 32 + # 18
 xs384l

         ADD A, 8 + # 18

        JR xs384al
 xs384m

        SET 5, H
 xs384al

         ADD A, L

         LD L, A

        RET

4. scr -> attr

; Procedure is efficient at any position. HL in familiarity
 SA384

         LD A, H

         AND # C0 +24

         JP P, $ +5

         ADD A, # 86 - # C0-# C2 + # 40, # 86, after the scroll 
will be # D0 

         ADD A, # C2-# 40; # C2 after the scroll will be # 58

         RRCA

         RRCA

         RRCA

         XOR H

         AND # DF

         XOR H

         LD H, A

        RET

5. down hl

 DH384

         INC H

         LD A, H

         AND 7

         RET NZ; 266 times of 304

         LD A, L

         ADD A, 32

         LD L, A

         LD A, H

         JR C, dh384nd; 34 times of 304

         SUB 8

         LD H, A

        RET
 dh384nd AND # DF

         CP # 58

         RET C; 2 times of 304

         SET 7, H; go to last (4 th) third

         RET Z; 1 times of 304

         XOR H; # 00 / # 20

         OR # 40, go to the main screen (1-th one-third)

         LD H, A

        RET

6. clear screen (from top to bottom!)

; A = attribute
 CLS384

         LD HL, # C018

         LD BC, 304

       LD LX, A
 CLS3840

         PUSH BC

         PUSH HL

        XOR A

         CALL CLS384L

        POP HL

        PUSH HL

        CALL SA384

        LD A, LX

        CALL CLS384L

         POP HL

         POP BC

         CALL DH384

         DEC BC

         LD A, B

         OR C

         JR NZ, CLS3840

        RET
 CLS384L

         LD BC, 7

         CALL FILHL

        EXA

         LD A, L

         SUB 7 16

         LD L, A

        EXA

         LD C, 7

         CALL FILHL

        EXA

         SUB 8

         LD L, A

        EXA

         SET 5, H

        LD C, 31
 FILHL

         LD D, H, E, L

         INC E

         LD (HL), A

         LDIR

        RET

7. Drawing window (with the cleaning of its contents)

; HL = address on the screen
; B = width-1, C = hgt * 8-2
 WIN384

         PUSH HL

         LD E, -1

         LD (HL), E

         CALL HOR384

        JR WIN384P
 WIN3840 PUSH HL

         LD (HL), 128

         LD E, 0

         CALL HOR384

        LD (HL), a
 WIN384P POP HL

         CALL DH384

         DEC C

         JR NZ, WIN3840

         LD E, -1

        LD (HL), E
 HOR384

        PUSH BC
 HOR3840 CALL BR384

         LD (HL), E

         DJNZ HOR3840

         POP BC

        RET

A. Coder




Other articles:

Classics - Almanashnik. Alexander Pushkin.

For Coderz - Recognition and computation of arithmetic expressions on their character record.

Inferno - The authors of the magazine.

For Coderz - the discipline to create large projects.

Interview - Questions Konstantin Sviridov (Conan) on the site zxnext.narod.ru.

Likbez - The principles of converting graphics PC-ZX.

For Coderz - Programming disc changer / drive in Scorpio.

Softinka - DNA_OS v0.431 - package of utilities for working with hard drives, RAM-drives and floppy disks.

For Coderz - Programming under DNA_OS ZET-9, a package of tools to work with storage devices.

Softinka - The problems and shortcomings package of tools to work with storage devices DNA_OS.

Likbez - details about disk formats that are FAT.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

For Coderz - Small programmers' tricks.

Gameland - On the new games: Oneyroid, Dizzy forever, Dridlock.

For Coderz - Writing archive. Practical principles LZ packaging.

Gameland - Passage of new shipments for the game "Black Crow".

For Coderz - Programming for the video mode 384x304.

Inferno - Letters to the Editor.

Sound - Eden Megus'a about the tracker for the AY / YM.

Inferno - On the shell.

For Coderz - Fundamentals of optimization for the processor Z80.

Likbez - The location of partitions on your hard drive.

Gamedev - 3D projection of the floor / road in the games.

Sound - Wild ideas for AY trackers.

Advertising - Ads by Roman Chuunin.

Advertising - Ads by V. Bogdanovich

For Coderz - How a large Flexible Program.

Repair - Faults Pentagon 128 + and their repair.

Inferno - Content.

Miscellaneous - Thoughts on the contest for the best software.

Others - Transfer software on ZX Spectrum with a PC.

Video - On packaging for a video ZX Spectrum.


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

Similar articles:
Advertising - free advertising and ad ...
Authors - the authors of the new issue of the newspaper.
GFX'y - ... very funny, even information came from MICK-but from the DPL.
IS-DOS - How to use macros.
Interview - The Moscow musician and programmer KSA.

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