ZX Review #3-4
22 июля 1997

Forum - Davydov. According to materials published in the ZX-REVIEW: Some issues related to autostart BASIC programs. Redefine Keys. How to print 42 characters per line. The procedure of multiplication HL = B * C. Refinement cloning downloaders. Mini-driver disk.

<b>Forum</b> - Davydov. According to materials published in the ZX-REVIEW:
 Some issues related to autostart BASIC programs. Redefine Keys. How to print 42 characters per line. The procedure of multiplication HL = B * C. Refinement cloning downloaders. Mini-driver disk.
(C) Davydov VM
Nizhny Novgorod Region., S.Zaprudnoe.


        Materials,

    published in ZX REVIEW.

 SOME ISSUES
 Auto-BASIC PROGRAM.

    (ZX REVIEW 94 / 5, p. 29).


    The correspondent asked a question
the launch of the machine code BASIC-programs. According to 
these suggestions do not be a problem, but it should be borne 
in mind one subtlety.


    Although mostly in BASIC
written long spouts 01.02
sector program in BASIC nobody forbade, and can
meet the program uses all the memory. Run it from
native code will not succeed. When
Upload it overwrite procedure
run. A boot, for which
it all meant and should run any program.
In addition, when using
BASIC to load and run
program in machine code need only pass the name of
file into a string BASIC Type:

CLEAR VAL "65535":
RANDOMIZE USR VAL "15619":
REM: RUN "ANY NAME"

in place and put ANY NAME
RET to return to BASIC, and all
Larry will do the rest
TR-DOS. The size of the program at
this fall.

    Incidentally, the same restrictions
refer to the location in memory
relotsiruemoy procedure "LOADMERGE" (ZX REVIEW 96/4-5, p.80).

    Summary: boots with the intermediate output of the BASIC 
language written not of feeble mind, but for versatility.




        REDEFINE KEYS

   (ZX REVIEW 96/4-5, p.79).


    Seeing in three places mask
% 11111, very much wanted
shorten the procedure. Source
option declined by only two
bytes. Simultaneously, increased
performance of six cycles
although the performance is not
required. All are equal before the survey, the following keys 
have set retarding cycle or

procedure for releasing the standby
keys, or unwillingly,
You can assign a single key on the
all functions.

    At the end of the procedure is added
a few lines to wait for a key is released. They are marked
commentary; ***
1410.

  REDEF LD BC, # 7FFE

          LD H, # 1F

  KEY_L IN A, (C)

          AND H

          CP H

          JR NZ, KEY_PR

          RRC B

          JR C, KEY_L

          JR REDEF

  KEY_PR XOR H

          LD L, A

          LD H, B

  WAIT_L IN A, (C); ***

          AND L; ***

          JR Z, WAIT_L; ***

          RET
2

    If the procedure required performance, increase
him for one clock cycle would be if, instead of the sequence


          CP H

          JR NZ, KEY_PR

use


          JP PE, KEY_PR


    In addition to the previous
propose a variant of the procedure for determining the code key 
was pressed. At the entrance to the procedure in the case H - 
high byte address port, L - Mask bit down

keys. At the output of A - code key pressed. Modifies registers 
HL and DE. HL - address in ROM of which is taken the code in 
the battery; DE - offset from start of table

located at # 0205.
140.
 TRANSF XOR A
 LOOP_1 ADD A, # 08

         RL L

         JR NC, LOOP_1
 LOOP_2 INC A

         RL H

         JR C, LOOP_2

         SUB # 21

         LD E, A

         JP # 0347


     Note. At # 0347
in ROM is the following snippet:


        LD HL, # 0205

        LD D, # 00

        ADD HL, DE

        LD A, (HL)

        RET


     Control keys in the table at # 0205 correspond to the 
following codes: 


       # 0D - ENTER

       # 0E - SYMBOL SHIFT

       # E3 - CAPS SHIFT
2


        The printing process

      42 characters per line.


    In ZX REVIEW 95 / 5 has been published how to print 42 
characters per line (Dmitry Sergeev). In ZX REVIEW 96/4-5 shows 
its simplified version (Matyushev Alexander). 

    Because they use
one algorithm, they share common
limitations.

    First of all, not entirely correctly worked through 
printing using color attributes. The calculation of the address 
attributes is the left corner of familiarity 6x8 and if the 
character is two familiarity 8x8, at the right

the color is painted, only the left
part of the symbol.

    Eliminate this possible, for example, in this way. For 
listing in the ZX 96/4-5, p. 102 between lines 0870 and 0880 
insert the following snippet:

140.

  LD A, (XTXT)

  AND 3

  JP PE, NO_INCX; transition to

                 3 line 0880

  INC HL

  LD A, (23659)

  LD (HL), A
2

    For a listing of the ZX 95 / 5,
p.30 similar piece to insert between lines 0133
and 0134.

    The second limitation relates to
algorithm for printing. As used in the screen scrolling
memory clearing nearby familiarity, use this
procedure can only print on the blank screen from left to right 
and top to bottom. For these purposes the procedure is quite 
compact. 

    To make the procedure to change the universality of the 
procedure PRSYM. 

    The algorithm can be, for example, so. It is clear from the 
bit-layout 8x8 and familiarity 6x8 pixels.




       Familiarity 8x8


    1 2 3

765432 10 7654 3210 76 543210

765432 76 5432 7654 32 765432


    1 2 3 4


       Familiarity 6x8



    For the first familiarity 6x8 bytes need to take the screen
corresponding to the first 8x8 familiarity, to impose on the 
AND mask 

          % 00000011,
add to the result of OR byte of character generator and the 
final result send to the screen in the first familiarity 8x8.



    To print the second familiarity 6x8:

  1. Get byte character generator.

  2. Cyclic shift bits to obtain the following location:

          54321076

  3. The value obtained in
Clause 2, to impose on the AND mask:

         % 00000011

  4. Get byte screen corresponding to the first familiarity 8x8
and apply for AND mask

         % 11111100

  5. Combine the results of OR A.3 and A.4 and the resulting 
value to send to the screen in the first familiarity 8x8.


  6. The value obtained in
Clause 2, to impose on the AND mask

         % 11110000

  7. Get byte screen corresponding to the second familiarity 8x8
and apply for AND mask

         % 00001111

  8. Combine the results of OR A.6 and A.7 and the resulting 
value to send to the screen in the second familiarity 8x8. 


    Printable third familiarity 6x8:

  1. Get byte character generator.

  2. Cyclic shift bits to obtain the following location:

          32107654

  3. The value obtained in
Clause 2, to impose on the AND mask:

         % 00001111

  4. Get byte screen corresponding to the second familiarity
8x8, and impose on the AND mask

         % 11110000

  5. Combine the results of OR A.3 and A.4 and the resulting 
value to send to the screen in the second familiarity 8x8. 

  6. the value obtained in
Clause 2, to impose on the AND mask

         % 11000000

  7. Get byte screen corresponding to the third familiarity
8x8, and impose on the AND mask

         % 00111111

  8. Combine the results of OR A.6 and A.7 and the resulting 
value to send to the screen in the third familiarity 8x8.



   Printable fourth familiarity 6x8:

  1. Get byte character generator.

  2. Cyclic shift bits to obtain the following location:

        10765432

  3. The value obtained in
Clause 2, to impose on the AND mask:

       % 00111111

  4. Get byte screen corresponding to the third familiarity
8x8, and impose on the AND mask

       % 11000000

  5. Combine the results of OR A.3 and A.4 and the resulting 
value to send to the screen in the third familiarity 8x8.



    On it and finish it. Will be the topic for the competition 
section "Etudes". Having reached this stage, I

decided to see how to make
printing 42 characters per line in
major programs and found a similar algorithm in the editor, 
assembler XAS ((c) Max Petrov) and a text editor ZX / IBM 
EDITOR ((c) Oleg Khokhlov). The desire to reinvent the wheel

lost, and lead fragments
others' programs do not consider it possible for ethical 
reasons. 



   PROCEDURE FOR MULTIPLICATION HL = B * C.

    (ZX REVIEW 96/4-5, p. 69).


    Propose options for procedures,
which is long, but
runs faster when multiplied
large numbers (B> 15) and has no
zero-error syndrome.

    The numbers in the comments mean: numerator - Length (bytes)
denominator - the time (cycles).


         LD L, C; 1 / 4

         LD D, B; 1 / 4

         LD H, 0, 2 / 7

         LD E, 0, 2 / 7

         LD B, 8, 2 / 7
; --------; 8 / 29
;----------------------------
LOOP LD A, 1, 2 / 7

         AND L; 1 / 4

         JR Z, PASS; 2 / 7


         ADD HL, DE; 1 / 11
PASS RR H; 2 / 8

         RR L; 2 / 8

         DJNZ LOOP; 2 / 13 8
; ---------; 12/472
Or (58 * 8 +8)
;-----------------------------
         RET; 1 / 10
; ==============================
; TOTAL: 21/511


    If the value of the register B of 1
15 procedure multiplication method of repeated addition (ZX
96/4-5, p. 69) is faster.

    Algorithm for multiplication method
additions, with shifts in detail
described in the book of R. Tokheym "Fundamentals of Digital 
Electronics, the world, 1988., P. 238-240.


    Practical application protsedry multiplication may find
For example, when calculating the address of the start line 
two-dimensional array. 



      CHANGES all sectors

          Bootloader.

  (OA Litvinov, ZX REVIEW 96/4-5,

            p. 88).


    Described a very annoying effect when using the 5
interpreter TR-DOS, which everyone knew, but did not speak. I
collided with him in 1994, when engaged in adapting a drive
accumulated tape versions. Did not pay special attention to 
him, until by chance I saw when the cover is removed the 
computer that this happens to the drive. Head begins to search 
for unknown that, but judging by her behavior,

somewhere about 255 tracks. The head rests on the limiter, and
stepper motor hard trying to move it even further. So
You can align and shoot down. I struggled with this effect less 
elegant and fast way, positioning the drive head to the zero 
track before reading the next block. This eliminates a 
consequence, but it would be know the reason.


    Maybe someone from readers
found the cause of the violation of positioning? As I said,
This effect is manifested mainly when downloading programs that 
are structured as follows: packed screen, then the main code 
block. After unpacking the screen in 50% cases violation of 
positioning. 

    And the use of loaders
using function 5 interpreter TR-DOS, with the union
blocks in a single file, it is most convenient for
programmers, thinking about the interests of users. Loader
the most compact and runs on
any version of the TR-DOS. Program
constructed in this way, you can always restore the fracture 
directory. BASIC-part program is easy to find by bytes

# 80, # AA, and calculate the total number of sectors, looking 
at boot disk using

Monitor type ADM, did not amount to
labor, even for beginners.


 MINI-Driver Disk

    (ZX REVIEW 95 / 4, p. 10).


    This driver has one small drawback, leading to
great inconvenience to users. It works only with
drive "A", although more than half the users have to
At least two drives. If
with its use to create
procedure pending shipment to the disk state, which before
record will not issue warnings such as "INSERT DISK
INTO DRIVE 'A' ", and the user
decides to relax a bit and load the game with a drive "B", 
leaving the system disk with the result of his work in the 
drive "A", then his thoughts about the developer of such a disk 
version is unlikely to can be expressed in the literary 
language. Even if you find a place to post messages and force 
the user to rearrange the drives look like it will be not very 
professional. 

    In addition, the driver has a fairly long and requires
for their placement inseparable part in the memory. As a 
result, it is easier to adapt the tape version program using 
the functions 5 and 6 of the interpreter TRDOS. Yes, and it 
will work on any drive in any version

TR-DOS.



        READING TRACKS

    (ZX REVIEW 95 / 4, p.56).


    Correspondent mentions the protection of "MICROPROTECTOR", 
use the command SH-93 "reading paths". If, in step through 
Mikroprotektora see memory load address after its 
implementation, notably the violation information. Therefore, 
MICROPROTECTOR'e after reading track is used quite

long cycle of finding the correct sequence of bytes, located on 
the white space at the end of track. 

    A program for reading FDU
track is also easy to detect
Misrepresentation 20-30
bytes after the start of field data.

    Used directly, click "read track" is really difficult. The 
book A. Larchenko and Rodionova "ZXSPECTRUM 'TR-DOS ...", 
house" Piter ", 1994, str.209, written: "In view of certain 
hardware features of Beta Disk'a execution of this command is a 
loss of synchronization microcontroller. 

    Maybe somebody knows what
needs to be fixed in BETA DISK for
that did not happen out of sync?



    ABOUT LIVE PROGRAMMING

           KR1818VG93

     (ZX REVIEW 95 / 2, p. 12)


    Interesting idea about direct
Access to the registers by VG93
disable ROM. If it is necessary
for personal use, you can
just set the toggle switch that disables ROM. And about
VG93 was published enough to write at least potrekovaya 
copyist, though The program of view and transfer files to

disks of different formats.

    You can also disable selector addresses in the disk 
interface. At the same time will have access to controller port 
from any address in memory. 







Other articles:

TR-DOS for beginners - Part 1.

Authoring - General Sound - Multimedia for the ZX Spectrum!

Business Card - Introducing the new electronic journal "Major Wares" (c) Codebusters & VMG

Computer novella - Knight Lore "legends of chivalry times."

New Programs - I. Roshchin. HELP_Z80. Davydov. Catalog's Base v1.8.

description of the shell of the journal "ZX-REVIEW"

Crossing Dragon - Aavlon, Castle of Dreams, Erik the Viking.

Crossing Dragon - Eureka!, Eye of Bain, Kentilla.

Crossing - Sherlock, Apollo, Shadows of Mordor, Rigels Revenge, Temple of Terror, ID, That's the Spirit, Return to Ithaka.

Retro - Dzh.Hardman, E. Hyuzon. Top 40 procedures.

Expert Tips - Castle Master.

Expert Tips - Firelord.

Expert Tips - Stonkers.

Forum Games - Insult Megademo, Catch 23, Livingstone, Rock Star ate my Hampster, UFO-2: Devils of the Abyss, Terminator 2, Venturama, The Spririts, Nipper, Sweewo'S World, King's Bounti -2, Hacker 2, Black Magic, Satcom, Star Heritage.

Forum - A. Gura. Code programmer.

Forum - A. Strelnikov. Prospects of development of ZX Spectrum.

Forum - Davydov. According to materials published in the ZX-REVIEW: Some issues related to autostart BASIC programs. Redefine Keys. How to print 42 characters per line. The procedure of multiplication HL = B * C. Refinement cloning downloaders. Mini-driver disk.

Forum - With 'Light'. Music processor ZX-Speccy.

Forum - Dmitry Fyodorov: Print images with a mask with pixel precision. Algorithm for calculating the address coordinates to within a pixel.

Forum - I. Roshchin. Sharing ZX ASM 3.0 and STS 5.1.

Forum - M. Bekarev. The calculation of the address display area of familiarity, and vice versa.

Forum - VP Fedin. Refinement Profi for conflict-free peripheral connectivity.

Forum - S. Astrov. Pseudorandom number generator.

reader-reader - V. Sirotkin. Protection program (look at the problem).

reader-reader - I. Roshchin. Display driver for the computer, "Pentagon-128.

Studies - A. Savinov: The procedure for displaying a double-height characters. Procedure "dissolution" of characters.

Studies - A. Urzha. The procedure for drawing a circle.

Studies - V. Sirotkin. Program checksum.

Studies - E. Volchkov. Improvement routines address calculation system on display file.

Studies - E. Frost. Running line.

Studies - I. Komandin. The program display screen.

Studies - I. Roshchin. Two graphic effect.

Studies - M. Lazutov: The modernization program font. Program encode / decode block codes. The effect of the attributes.

Studies - O. Smolyankin: Procedures for cleaning the screen. Output of text messages on the screen.


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

Similar articles:
Intro - poems Lisica, the number 13 ...

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