Inferno #08
30 ноября 2005

For Coderz - Small programmers' tricks.

<b>For Coderz</b> - Small programmers' tricks.
   1. Drafting tables at HL '


   In compiling the table at HL '
instead of design



         PUSH DE

         EXX

         POP DE

         LD (HL), E

         INC HL

         LD (HL), D

       (45 bars)

 You can use the

         LD A, D

         EXA

         LD A, E

         EXX

         LD (HL), A

         INC HL

         EXA

         LD (HL), A

       (40 bars)


   Observed when writing sprite motion
zhka for Pang 16C.


         2. Change case letters


   Used in ACEdit during commissioning
character (if the Caps Lock).

 RECAP CP "Є

         RET NC

         XOR 1

         CP "E

         RET NC

         XOR 1

         CP "P

         JNC BECAPRL

         CP "

         RET NC

         CP "and

         JNC BECAPOK

         CP "P

         JNC BECAPRL

         CP "A

         JNC BECAPOK

         CP "@

         RET Z

         CP "_

         RET Z

         CP "A

         RET C

         CP "{

         RET NC

         CP "[

         JC $ +5

         CP "a

        RET C
BECAPOK XOR 80
 BECAPRL XOR # 70

        RET


           3. How to count bars


   If you need to quickly figure out how to
process cycles, does not need to take ka
lkulyator and put bars on top teams
down. I use a more convenient way:

   We believe the number of teams with 4 ticks
(The team with 8 cycles is considered two, coma
ndy with 12 cycles - three, the team with 11
ticks believe in 4-cycle). Multiply by
4. Write (or store).

   We believe the number of teams with 7 ticks
(The team with 11 clock cycles are also counted). Clever
isplay 7. Write (or store).

   We believe the number of teams with 10 cycles.
Multiply by 10.

   Count the number of teams with 6 cycles (if
is). Multiply by 6.

   Other commands you can find separated
flax.

   All add up and get rezultat.Dlya
small protsedurok easy to calculate in
mind with almost no chance of making a mistake.

   If the program is large, then we can go
top-down and put sticks on paper
(Line sticks - 4-clock instructions strictly
PFA 7-clock, etc.). But it already seems
for continuous counting. For the latter to
minimize errors, consider the two-fold:
top-down and bottom up. Conveniently still under
Subtotals be written (see the example in
following sketch).


   If the procedure uses a branch that
Who like:



         JR cc, skip

        
skip

then we must proceed as follows:

   If we want the maximum number of so-
Comrade, we believe JR 7 cycles and transmission
Kai no one team (but for one 4-way
quantum team maximum is still JR =
= 12 cycles).

   If we need the average number of cycles, and
the probability that the condition is 50%,
then consider JR a 9.5 cycles, and time ful
lneniya internal  divide by 2.


   If you use a full alternative
(Two branches), then separately consider the time you
complement each branch.


               4. Microtone


   Recalculation of music with microtone during AY
it's best to make the following photon
rmule: t = f (xhi) * k (xlo), where xhi = note, xlo =
 = Microtone, and f () and k () - some functions.

   f represents a table FRQTAB,
that it is desirable to calculate on the basis that
Blitz Sound Tracker (more precisely, on the basis of parameters
parameters on which to construct the table ST,
t.k.v table ST is the mistake). The formula for
f about the following: f = fST * 248/256.
 Notes to the table go from high to low.

   k for 16 microtone (1 / 32 tone) holds
Camping within 1 + ((0 .. 14) / 256) and approximately
is 1 + (xlo/256). Since 1 + (16/256) <
<2 ^ (1 / 12), then jump the 15 th microtone
for the next note will not (but they will
very close, that gives some neravnome
rnost, noticeable by ear).

EXPER
And it was: DE =% 0nnnnnnnmmmm0000
; Was: HL = period for AY
;---------------------; BC = f (xhi)

         LD L, D;% 0nnnnnnn

         SLA L

         LD H, 'FRQTAB

         LD C, (HL)

         INC L

         LD B, (HL);% 0000xxxx

    , 37
;---------------------; + BC * xlo/256

         LD L, 0, can not be correctly rounded

         LD H, E;% mmmm0000

         SLA H

     , 56

         JR NC, $ +3; ^

         ADD HL, BC;

         ADD HL, HL;

         JR NC, $ +3; MAX 105

         ADD HL, BC;

         ADD HL, HL;

         JR NC, $ +3;

         ADD HL, BC;

         ADD HL, HL;

         JR NC, $ +3;

         ADD HL, BC; v

     , 161

        ; Now H must be added to BC

         LD A, C

         ADD A, H

         LD L, A

         ADC A, B

         SUB L

         LD H, A

     , 185

        RET


   The second approximation k (needed for 64 or
256 microtone) can be found, again analysis
cumin table chastot.Nahodim that the factor
if xlo in case 256 microtone from the center:
(2 ^ (1 / 24) -1) / 128 = 0.0002289 ў15/65536 almost
exactly! However, we add is not from the center,
instead we have (remind) table moved
relatively Sound Tracker.

   For this procedure, these extreme octaves
(2 top, 2 bottom) in Table FRQTAB USD
zhny be converted to 2 octaves closer to
center, or for high unattainable nuzh
Naya accuracy, and for the low in the multiplication
will overflow!

EXP256
And it was: DE =% 0nnnnnnnmmmmmm00
; Was: HL = period for AY
;---------------------; BC = f (xhi)

         LD L, D;% 0nnnnnnn

         SLA L

         LD H, 'FRQTAB

         LD C, (HL);% llllllll

         INC L

         LD B, (HL);% 0000hhhh

    , 37
;---------------------; DE = g (xlo)
 ; G (xlo) ~ = xlo * 15.22/16

         LD A, E

         RRA

         RRA

         RRA

         RRA

         AND # C

         SUB E

         NEG

         ADD A, A

         LD H, A

         LD L, 128> 6

    ; 91
;---------------------; + BC * g (xlo) / 65536

         JR NC, $ +3; MAX 1918

         ADD HL, BC;

        DUP 5

         ADD HL, HL;

         JR NC, $ +3; MAX 145

         ADD HL, BC;

        EDUP

     , 254

         SRL H

         RR L

         SRL H

     , 278

        ; Now H must be added to BC

         LD A, H

         ADD A, C

         LD L, A

         ADC A, B

         SUB L

         LD H, A

     , 302

        LD A, D

        CP 2 * 12

        JR NC, E256N3L

        2 upper octave

        ; HL shift 2 bits right

         SRL H

         RR L

         SRL H

         RR L

     ; MAX 352

        RET
 E256N3L

        CP 6 * 12

        RET C

        2 octaves lower

        ; HL shift 2 bits to the left

         ADD HL, HL

         ADD HL, HL

        RET


   Full program with the table and the generator
rum table looking for in your application.


                 5. Disk B


   With the change of version alasma (current -
5.03) there was a very useful sly
st, saves space at work
whose diskette ishodnikami.Realizatsiya coma
ndy MOVE in assembler, though reduced those
snotu, but not enough, now organized
additional savings.

   The thing is: it is assumed that
when you start your computer or emulator in di
skovod B tucked "system disk". Au
critical sticking the disk at startup
Unreal Speccy can realize through. Bat
or by changing the command line in the treated
tchikah file types. The latter can draw
lat or handles - via Windows Explorer or
through Total Commander, or by creating and ZAPU
Steve reg-file the appropriate form. In about
general, the choice is.

   So, to "drive system" should be just
 vengeance:

    ACEdit

    BGE

    PT3 + PT Util

    ALASM + STS

    HRUST1

    ZXRar + ZXUnRar

    PUSHER

   Laser Compact
 as well as the following standard files:

    mrip *. H - avtosborschik slow

    m2hr *. H - avtosborschik fast

    SAVEOBJ *. H - sohranyalka chunks of memory

    smallunr.H - unpacker ZXRar

    DEHRUST.C - unpacker HRUST1

   playFAST.H - Player PT3
and anything else to your taste.

   What have we got? And we got that from
Working diskettes can now all this degree
Ret! From alasma can only boot
the size of one sector!

   To load files from B to directives
 you (cite examples):

         INCLUDE "B: mrip *"

        INCBIN "B: DEHRUST"

   The remaining system programs can be
very fast and easy way to start right from
Mr Gluk Reset Service.

   Unfortunately, such a useful program
as SCUT, can not switch drives,
therefore it can not be written on a "system
Disc. "Let's wait when it will be analogous
log.

Alone Coder




Other articles:

Inferno - The authors of the magazine.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

Inferno - On the shell.

Iron - CD-ROM - a device and Tricks connection.

For Coderz - CD video on the ZX. How to write a video player with CD-ROM.

Softinka - Technical Reference disk system DISCiPLE / + D.

For Coderz - Small programmers' tricks.

Mathematics - The history of the solution of Fermat's theorem.

Gameland - Game Shestnashki.

Softinka - a description and history of the program to work with hard disk HDDoctor v0.9.

Secrets - The X button in different applications: Wolfenstein'2004, IG # 5, ACEdit, DNA OS, Wild Disk Copier.

Softinka - Improved graphics converter Gigascreen.

Sound - tube amplifier. Stereo lampochnik 2x5 Tues of old TVs.

Iron - Overview of cassette players.

Inferno - Letters to the Editor.

Gamedev - The history of the game Pang.

Gamedev - Tips for writing an arcade game.

Advertising - Ads by Roman Chuunin.

Advertising - Ads by Alexei Zhabina.

Advertising - Ads by V. Bogdanovich.

Interview - Interview with Nikolay Rodionov, author of popular books for the ZX Spectrum

For Coderz - The calculation of trigonometric and algebraic functions in a high-level languages.

DIY - scheme of 16-color video mode v1.1 for the Pentagon.

Iron - Description of Products K555TL2.

For Coderz - Programming device sound generation Turbo Sound.

Softinka - 384x304 viewer. program allows you to view color pictures, is larger than the screen.

Softinka - ZX Spectrum emulator for ZX Spectrum.


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

Similar articles:
Entry - What will be the third issue?
Entry - the contents of rooms.
Advertising - still free offers and ads.

В этот день...   28 April