Think #29.5
24 июля 1999
  Звук  

Iron - General Sound, CMOS-clock.

<b>Iron</b> - General Sound, CMOS-clock.
                  IRON



                               (C) STINGER



     Programming Guide

              General Sound.


       Version v1.03. Revision 003.



 1. Brief technical characteristics of the GS.

    -------------------------------------

Processor: Z80, 12MHz, without wait cycles
ROM: 32k, 27256
RAM: Static Ram 128k total, 112k dos
           orally available for the modules and samples in

           Basic version
INT: 37.5 KHz
Channels: 4 independent 8-bit channel
           la, each with 6-bit controlled
           field level.



  2. Brief description of GS, or

                     much every Labuda.

     -----------------------------------


  GS - musical card, designed to play music modules and
individual samples (effects).


  Modules for the GS - it is the standard Amiga
PCshnye and 4-channel MOD files, and samples - as Amiga signed 
sample, and PCshnye unsigned sample. 


  MOD player file in GS is
practically a complete analog ProTracker'a
on the Amiga was created with intensive use of sources 
ProTracker'a. (Sources were from Protracker'a v2.1A by Lars 
"ZAP" Hamre - Amiga Freelancers) 


  MOD Player Pro supports all the teams
Tracker'a, except for two things:

 E01 Filter On Amiga-specific commands
                 yes, includes a filter high
                 frequencies.

 EFX Invert Loop I have not seen the player,
which would support this team. Perhaps it is supported on some 
older players. 


  GS represents himself, in essence, a complex microprocessor 
with its own CPU, ROM, RAM, and ports, and absolutely no 
depends on the main processor Spectrum, that allows, for 
example, upload your own favorite module, reset the Spectrum, 
download the assembler and create your favorite music. Soft 
inside the GS is fully takes problem playing sound, the 
interpretation of module, etc. Programming GS'a reduces the 
transmission of byte by byte module and / or samples, and then 
you only need give commands like: start the module, set the 
global volume of the playback module, run the sample # 09 in 
Channel # 02, etc. 


  If you intend to load the module
together with the samples, make sure you first need to download 
the module, and then sampled. 


  When you load the module is highly recommended
left free to 2k of memory, ie, load modules with a maximum 
length 110K. This condition is not necessary, but its execution 
is highly desirable for compatibility with future versions. 


  Similarly, highly recommended to leave
80 bytes for each sample, for example,
If you want to download 63-Kbyte
module and 18 samples, we have:

 Total_Sample_Length = 112 * 1024-63 * 1024-2 *
* 1024-18 * 80 = 46688 bytes


  This is the total length of sample, which, when
this state of affairs can be downloaded.


  If, for example, is required to compute
as will fit in memory GS'a 2 KB sample, it is calculated as 
follows: 

 112 * 1024 / (2048 +80) = 53 sample.


  In GS'e have 4 physical channels, which are losing the sound.


  Channels 0 and 1 - left, and 2 and 3 - Right.


 3. Interface with the Spectrum.

    -----------------------


  GS looks at the world with 4 registers:

1. Command register - register of commands available to the 
port of entry at 187. In This register is written to the 
command. 

2. Status register - status register,
readable port at 187.


  Register bits:


   7 - Data bit, flag data

   6 - Undefined

   5 - Undefined

   4 - Undefined

   3 - Undefined

   2 - Undefined

   1 - Undefined

   0 - Command bit, flag teams


  This register allows to define the state of GS, in particular 
whether it is possible to read or write the next byte of data, 
or apply another command, etc.


3. Data register - Register of data available for the port of 
entry at 179. In this Spectrum Registry records data, for 
example, it may be arguments to commands. 

4. Output register - register output port is available for 
reading at 179. From This register reads the Spectrum data

going from the GS.


  Command bit in the status register is set by hardware after 
writing team into the instruction register. Reset to 0 it can 
only GS, which indicates a certain stage of execution. 


  Data bit in the register states can be
set or reset as optional
Spectrum and optional GS: recording
Spectrum in the data register it hardware
set to 1, and after reading GS'om
from this register is reset to 0. When
GS record in the register display it (all the same
Data bit) is set by hardware to 1, and
after reading from this port Spectrum
cleared by hardware to 0.


  Despite the fact that the data register and output register 
are located in space port addresses to the same address

and affect the same bits of data, they are two separate 
registers. Value, once recorded in One of these registers, it 
remains unchanged until a new record. 


  Status bits of data are often undefined, and if the 
specification of commands not the values ​​of this bit on 
opredennyh stages of execution of a command is not valid make 
any assumptions about the value of this bit. 


 4. The command system GS.

    -----------------


  At first, let me digress from the actual system commands. GS, 
as is known, is designed mainly for playing modules and 
samples. In this version (1.03) GS ROM dopukaetsya downloading 
a module and / or up to 32 samples. 


  Each sample loading it into memory
gets a unique identifier
that uniquely identifies the call to
given samples of the teams, which require
number of samples. The first loaded
sample receives a number (handle) = 1, the next - the number 2, 
etc. 


  The same applies to modules and
this one loaded module will
have a handle = 1 after boot.


  A feature of this version is also something that must first 
load the module, and then sampled. 


  Features command descriptions:


  Teams are described as follows:

 1. Hex command code
 2. Team Name
 3. Actions taken in the performance

     Team
 4. Instruction format
 5. Comments to the team


  The command format is described as follows:

 GSCOM EQU 187
 GSDAT EQU 179

SC # NN: Send a command code to the register

             teams


          LD A, # NN

          OUT (GSCOM), A

WC: Waiting for relief Command bit


     WCLP IN A, (GSCOM)

          RRCA

          JR C, WCLP

SD Data: Send data to data register


          LD A, Data

          OUT (GSDAT), A

WD: Waiting for reset Data bit, on

          Indeed, waiting until GS

          will not accept the data sent to him


     WDLP IN A, (GSCOM)

          RLCA

          JR C, WDLP

GD Data: Take the data from the register

            Data


          IN A, (GSDAT)

WN: Waiting for installation Data bit, on

          Indeed, the expectation of regular data

          by GS


     WNLP IN A, (GSCOM)

          RLCA

          JR NC, WNLP



               Command GS:

# 00 Reset flags -

    Resets the flags and Command Data bit

    bit.


    SC # 00

    WC


    (Data bit = 0, Command bit = 0)

# 0E Go in Covox mode

    Goes into Kovoks directly

    copies the data register in the two DACs

    (Right and left) channels.

    To exit this mode - record # 00

    into the instruction register.


    SC # 0E

    WC


    SD \

    SD \

    ... / It's conclusion in DACs

    SD /


    SC # 00

    WC

# F3 Warm restart

    Resets all GS, but misses

    stages of determining the number of pages

    memory and their proveki, which greatly

    accelerates the process of initialization.


    SC # F3

    WC

# F4 Cold restart

    Full restart of GS with all the verification
    kami. In fact, JP # 0000.


    SC # F4

    WC

# 20 Get total RAM

    Get the total available memory

    on the GS. (In the basic version is 112k)


    SC # 20

    WC

    GD RAM.L (youngest part)

    WN

    GD RAM.M (middle part)

    WN

    GD RAM.H (oldest part)

Total RAM = 65536 * RAM.H +256 * RAM.M + RAM.L

# 21 Get free RAM

    Get the total amount of free memory

    on the GS.


    SC # 20

    WC

    GD RAM.L (youngest part)

    WN

    GD RAM.M (middle part)

    WN

    GD RAM.H (oldest part)

 Free_RAM = 65536 * RAM.H +256 * RAM.M + RAM.L

# 23 Get number of RAM Pages

    Get the number of pages on the GS.


    SC # 23

    WC

    GD Number_RAM_Pages


    In the basic version of 3 pages.

# 2A Set Module Master Volume

    Set the play volume

    modules.


    SD Module_Master_Volume [# 00 .. # 40]

    SC # 2A

    WC

   [GD Old_Master_Volume] - Old loudly.


    A small example of using this

    Team:


    (This assumes that the module is played)


           LD B, # 40


     LOOP: LD A, B

           OUT (GSDAT), A

           LD A, # 2A

           OUT (GSCOM), A

           EI

           HALT

           DJNZ LOOP


           LD A, # 32

           OUT (GSCOM), A


  Described above gradually lowers the volume
playing module, and then stops
him.

# 2B Set FX Master Volume

    Set the play volume

    effects.


    SD FX_Master_Volume [# 00 .. # 40]

    SC # 2B

    WC

   [GD Old_FX_Volume] - Old Volume


  Similarly to the previous command, but operates on the 
samples. 


  With these two commands, you can adjust the volume balance of 
the module and samples, etc.


# 2E Set Current FX

    Set the current effect. Just

    assigns this value CURFX
    inclusion. If any team needs

    number of samples (sample handle), then we can

    Instead, give her room # 00 and

    Larry substitute instead

    zero value of the variable CURFX. (See

    Team # 38, # 39, # 40 - # 4F for understanding
    of the above.)


    SD Cur_FX

    SC # 2E

    WC

# 30 Load Module

    Module loading into memory.


    SC # 30

    WC

   [GD Module_Handle]-module number

   (Command bit = 0, Data bit = 0)

    SC # D1 (Open Stream-open stream)

    WC


    SD \

    WD \

    ... Bytes module

    SD /

    WD /


    SC # D2 (Close Stream-close stream)

    WC


    Example:

             LD HL, Mod_adress

             LD DE ,0-Mod_length

             LD C, GSCOM


             LD A, # 30

             CALL SENDCOM

             LD A, # D1

             CALL SENDCOM


             LD A, (HL)

     LOOP: IN B, (C)

             JP P, READY

             IN B, (C)

             JP M, LOOP

     READY: OUT (GSDAT), A

             INC HL

             LD A, (HL)

             INC E

             JP NZ, LOOP

             INC D

             JP NZ, LOOP

     WAIT: IN B, (C); wait prinatiya

             JP M, WAIT; last byte

             LD A, # D2

             CALL SENDCOM

             IN A, (GSDAT); Module Number

             OUT (GSDAT), A

             LD A, # 31


    SENDCOM: OUT (GSCOM), A

    WAITCOM: IN A, (GSCOM)

             RRCA

             JR C, WAITCOM

             RET

# 31 Play module

    Playback module.


    SD Module_Handle - module number

    SC # 31

    WC

# 32 Stop module

    Stop playback module.


    SC # 32

    WC

# 33 Continue module

    Continue playing the module after

    stop.


    SC # 33

    WC

# 38 Load FX

    Download sample effect in memory.

    Loads unsigned samples

    (PC type)


    SC # 38

    WC

   [GD FX_Handle]-number sample

   (Command bit = 0, Data bit = 0)

    SC # D1 (Open Stream-open stream)

    WC


    SD \

    WD \

    ... Bytes sample

    SD /

    WD /


    SC # D2 (Close Stream-close stream)

    WC


  When loading each sample, in memory of GS
created for this sample the title,
which describes the various options
sample. After downloading these parameters are set to certain 
values, as then:



  Note = 1960, Volume = # 40, FineTune = 0, SeekFirst = # 0F, 
SeekLast = # 0F, Priority = # 80, No Loop and the internal 
variable is set to CurFX FX_Handle. 


  Then the teams # 40, # 41, # 42, # 45, # 46
and # 47 may be, these default values ​​to change on their own. 
This is required because the team # 39 to initiate playback of 
the sample using the parameters from the header of the sample. 


  In its natural form samples are usually
poorly packaged compressors, but the compressibility is usually 
possible to pick up, if we translate sample in the Delta-form, 
ie, storing absolute values ​​sample, and the relative offset 
from the previous byte. Around here and so can be translated 
sample in Delta-form:



            LD HL, Start_of_sample

            LD DE ,0-Length_of_sample

            LD C, # 2000


      LOOP: LD A, (HL)

            SUB C

            LD C, (HL)

            LD (HL), A

            INC E

            JP NZ, LOOP

            INC D

            JP NZ, LOOP


    And here's how you upload a sample:


             LD IX, Parameters

             LD HL, Sample_adress

             LD DE ,0-Sample_length

             LD C, GSCOM


             LD A, # 38

             CALL SENDCOM

             LD A, # D1

             CALL SENDCOM


             LD A, (HL)

     LOOP: IN B, (C)

             JP P, READY

             IN B, (C)

             JP M, LOOP

     READY: OUT (GSDAT), A

             INC HL

             ADD A, (HL)

             INC E

             JP NZ, LOOP

             INC D

             JP NZ, LOOP

     WAIT: IN B, (C); wait prinatiya

             JP M, WAIT; last byte

             LD A, # D2

             CALL SENDCOM


      ; Now overrides

      ; Sample by default your

      ; Values


             LD A, (IX + # 00)

             OUT (GSDAT), A; Nota

             LD A, # 40

             CALL SENDCOM

             LD A, (IX + # 01)

             OUT (GSDAT), A; Volume

             LD A, # 41


    SENDCOM: OUT (GSCOM), A

    WAITCOM: IN A, (GSCOM)

             RRCA

             JR C, WAITCOM

             RET

# 39 Play FX

    Playing effect.


    SD FX_Handle - number of samples

    SC # 39

    WC


  In performing this command
the following: see the channels listed in
SeekFirst parameters of our sample, and if
though, would be one of them is free, and it played a sample, 
otherwise look the channels listed in SeekLast and if One of 
them is free, and it is played sample, if not free, then looked 
through all the channels listed SeekLast, from They choose the 
channel with the lowest priority and is compared to the 
priority of our sample (ie the sample that we

want to lose), if this sample will be a higher priority than 
the sample already playing in the channel, then playing in the 
channel sample will be stopped, and our sample will be

run in this channel instead of the old sample. Here are a 
priority scheme here ... 


  When the sample is run in a channel, it
note, volume, etc parameters recorded in the data channel from 
the header sample.



  In general, something to play with the sample
required parameters, you can set
these parameters after loading the sample and safely use the 
command # 39. If the parameters have changed, it is possible to 
do as follows: Team # 2E do

current required sample, the teams # 4x change its parameters, 
and then run it with # 39. 


  An alternative method of triggering samples
provide the team # 80 .. # 9F, the performance of these teams 
you directly in the instruction code indicates in which channel 
you want to run the sample, and besides, you can also point to 
a note and / or volume you want to run the sample. 

# 3A Stop FX in channels

    Stop playing effects

    preset channels, which are specified

    in the mask channel (Channel Mask).

    In her unit in the n-dimensional bit

    indicates that the effect of n-dimensional

    channel you want to stop


    SD Channel_Mask

    SC # 3A

    WC


  Described above is ideal
the work of this team, but unfortunately not
so simple in this world, and this team
act wrong, namely: a unit in the bit
7 stops to sample the zero channel, and
etc. In future versions this will be fixed, but for now I 
recommend stopping in general, all samples mask # FF. 

# 3E Load FX (Extended version)

    Download sample effect in memory.

    Allows you to load samples with a sign.

    (Amiga type)


    SD # 01 (Signed sample)

    SC # 3E

    WC

   [GD FX_Handle]-number sample

   (Command bit = 0, Data bit = 0)

    SC # D1 (Open Stream-open stream)

    WC


    SD \

    WD \

    ... Bytes sample

    SD /

    WD /


    SC # D2 (Close Stream-close stream)

    WC

# 40 Set FX Sample Playing Note

    Installation notes default

    current effect.


    SD Note [0 .. 95]

    SC # 40

    WC

Note =
 0 C-0
 1 C # 0
12 C-1
24 C-2
36 C-3 (C-1 in the Amiga)
48 C-4 (C-2 in the Amiga)
60 C-5 (C-3 in the Amiga)
72 C-6
84 C-7


  In this version of the Sound Generators Wave 2,
3 may play an octave 3, 4 and 5, so the valid values ​​Note
is the range of 36 to 71.

# 41 Set FX Sample Volume

    Setting the default volume for

    current effect.


    SD FX_Volume [# 00 .. # 40]

    SC # 41

    WC

# 45 Set FX Sample Priority

    Set a priority for

    current effect.

    (See the command # 39)


    SD FX_Priority [# 01 .. # fe]

    SC # 45

    WC

# 46 Set FX Sample Seek First parameter

    Setting Seek First to

    current effect.

    (See the command # 39)


    SD FX_SeekFirst

    SC # 46

    WC

# 47 Set FX Sample Seek Last parameter

    Setting Seek Last for

    current effect.

    (See the command # 39)


    SD FX_SeekLast

    SC # 47

    WC

# 60 Get Song Position

    Getting the value of the variable

    Song_Position in the current module.


    SC # 60

    WC

    GD Song_Position [# 00 .. # FF]


  Can be interpreted as the number of
lost pattern module. After starting
module takes the value 0 and incremented after playing a 
regular pattern. This variable can be used for synchronizing 
processes in Spectrum with the playback module. You can, for 
example, at the beginning of procedures for handling interrupts 
to SC # 60, then perform procedures of the various operations

screen skrullinga lines, etc. (Ie
that was sufficient to execute the command delay), and then 
read port 179 (GD Song_Position), and compare it with the 
required, and in case of a tie, go to the next part of demos, 
that is, 


  if (Song_Position == My_Position) then goto Next_Part_Of_Demo

# 61 Get Pattern Position

    Getting the value of the variable

    Pattern_Position in the current module.


    SC # 61

    WC

    GD Pattern_Position [# 00 .. # 3F]


  Get the value of the bias in the pattern
(No ROW), use - similar to
previous command, but you want to see that this value varies 
quite quickly, and therefore


 if (Pattern_Position> = My_Position) then
goto Next_Part_Of_Demo

# 62 Get Mixed Position

    Get the value Pattern_Position,

    slightly mixed with Song_Position.


    SC # 62

    WC

    GD Mixed_Position



    Mixed_Position: (in bits)


    7-Song_Position.1

    6-Song_Position.0

    5-Pattern_Position.5

    4-Pattern_Position.4

    3-Pattern_Position.3

    2-Pattern_Position.2

    1-Pattern_Position.1

    0-Pattern_Position.0


  Ie if you get Mixed_Position and be done with it AND # 3F, 
then we obtain the spitting image Pattern_Position, and if 
after receiving its a bit RLCA, RLCA, AND # 02 - it

will be lower two bits Song_Position. See
Note to teams # 60 and # 61.

# 63 Get Channel Notes

    Get the notes of all the channels of the module.


    SC # 63

    WC

    GD Note_of_channel_0

    WN

    GD Note_of_channel_1

    WN

    GD Note_of_channel_2

    WN

    GD Note_of_channel_3


  If in any channel value of the notes
changed from the last command executed
# 63, then bit 7 is obtained zanacheniya


            Note_of_channel_N

will be zero, if the value is the same
thing as it was before, then this bit will be in the unit. 
Younger seven bits and is proper note from 0 to 95, if the 
value is 127, it means that no samples in the channel does not 
play. This command is mainly intended to build on its basis the 
various analyzers. 

# 64 Get Channel Volumes

    Get the volume of all channels

    module.


    SC # 64

    WC

    GD Volume_of_channel_0

    WN

    GD Volume_of_channel_1

    WN

    GD Volume_of_channel_2

    WN

    GD Volume_of_channel_3


    See the description of the command # 63

# 80 Direct Play FX Sample (# 80 .. # 83)

    Playing the sample in a given channel.


    SD Sample_Number

    SC # 80 .. # 83 (Junior bits determine

                 directly to the number of spacecraft
                 signal, which requires

                 play sample)

    WC

# 88 Direct Play FX Sample (# 88 .. # 8B)

    Playing the sample in a given channel

    with a given note.


    SD Sample_Number

    SC # 88 .. # 8B (lower bits define

                 directly to the number of spacecraft
                 signal, which requires

                 play sample)

    WC

    SD Note [0 .. 95]

    WD

# 90 Direct Play FX Sample (# 90 .. # 93)

    Playing the sample in a given channel

    with a given volume.


    SD Sample_Number

    SC # 90 .. # 93 (Junior bits determine

                 directly Room

                 channel, which requires

                 is to play a sample)

    WC

    SD Volume [# 00 .. # 40]

    WD

# 98 Direct Play FX Sample (# 98 .. # 9B)

    Playing the sample in a given channel
    le with a given note and volume.


    SD Sample_Number

    SC # 88 .. # 8B (lower bits define

                 directly Room

                 channel, which requires

                 is to play a sample)

    WC

    SD Note [0 .. 95]

    WD

    SD Volume [# 00 .. # 40]

    WD

        __________________________


               === Cut ===



               CMOS-clock



                         Alexander Mayorov

                         Dmitry Lomov


  In this issue we decided to tell you about
such a wonderful thing as a chip
CMOS-clock. What kind of a beast and
what it is, you ask?

  But see for yourself!


  This chip provides independent computer calculation time, the 
production of interrupt signals from the alarm, and can also be 
used as a small NVRAM 50 bytes.



  Feature of the CMOS-clock is their
extremely low power consumption! (By
directory of the current consumption of 0.1
to 4mA!).


  If this chip to connect a backup power source, the 
calculation of time and preservation of information in the 
internal RAM will be guaranteed and if you disable your 
computer. 


  You may ask - well, why do I need?

  Indeed, in normal clock
computer is not very much and want.


  But! If you're writing from time to time
letter ekhi, the data clock relieve you
the need to constantly look at the calendar and clock, to put 
down time / date. But for the BBS, or "Myler" watch very, very 
needed! 


  Actually need to watch yavilas
one of the reasons for the creation of a new version of the BBS.
About which, perhaps, will be discussed in the following issues 
Newskah. 



        Well, now closer to the point!


  Chip called 512VI1, its proprietary prototype MS 146,818, and 
most rulez - DALLAS 1287, has an internal battery and quartz 
for 10 years. 


  It should be said that such chips
stand in the PC 286 and 386, and therefore available
Thanks to the great Upgrades ...



      To begin pin assignment:


  NC 01 is not used

  02 OSC1 input generator

  03 OSC2 output of the generator

  04 AD0 \

  05 AD1 \

  06 AD2 \

  07 AD3 multiplexed bus

  08 AD4 address / data

  09 AD5 /

  10 AD6 /

  11 AD7 /

  12 GND ground

  13 / CE chip-select

  14 AS address strobe

  15 R / W Read / Write

  NC 16 is not used

  17 / DS data strobe

  18 / RES reset input

  19 / IRQ output interrupt request

  20 SED frequency control CKOUT

  21 CKOUT output signals of a clock hour
               frequencies

  22 PS control failure voltage peaks
               Tania

  23 SQW output of program-controllable
               of the frequency divider

  24 + Ucc +3 ... +5 V

 And now the details:


  At the conclusion 02 (OSC1) must submit
frequency of the external oscillator, or connected to pin 02/03 
(OSC1/OSC2) quartz. 


  Conclusions 4 ... 11 (AD0. .. AD7) - Bus address / data bus 
connects to the data prrotsesora.



  Pin 13 (/ CE) - the choice kristala.Pri available log. "1" on 
this input chip blocked.


  There is one more feature: at this entrance should be the 
status log. "0" for the entire cycle of treatment to the chip. 
Ie simultaneously with (or before) the choice of register 
address input / CE shall be established a log. "0", and its 
status should not be change during the entire cycle of 
treatment to selected case!


  The most convenient and easy to install
on this input state of the log. "0" for
the entire duration of the computer.


  The choice of register number is fed to the bus ADDRESS / 
DATA (AD0. .. AD7) and submission log. "1" to input 14 (AS)



  Read / write data from / to register (a)
used the findings in 1915 (R / W) - Selecting the read / write 
(or a log. "1" and "0") and 17 (DS) - Data Strobe.



  When a log. "0" to output R / W data is written into the 
previously selected register, and the feeding log. "0" on output

DS - data read from the register.


  Poyavlyanie log. "0" on pin 19 (/ IRQ)
reports on the process of system interruptions
BIS. In all other cases, the data output is in the third logic 
state (high-impedance). 


  Submission of a log. "0" on the 22-th output (/ PS) informs 
the BIS that failed supply voltage, and the contents of the 
registers unreliable. If there is a reserve

power source, then this input file
log. "1."


  On the derivation of 23 (SQW) have the momentum
frequency, which is obtained by dividing the clock generator 
frequency by a factor defined by software.



  At the exit 21 (CKOUT) have the momentum,
frequency depends on the input state
20 (SED). If there is there a log. "1" SQW output frequency 
equal to the frequency generator (OSC1-OSC2). In the presence of

log. "0" input SED output frequency
SQW four times menshe frequency oscillator (OSC1-OSC2).


  In the chip are 64 eight-
register. When you work with them must first
indicate which register to work (record number in the address 
register) and then perform the read / write. 


             Non registers


       # 00 sec

       # 01 SEC (ALARM)

       # 02 MINUTES

       # 03 Minutes (ALARM)

       # 04 HOURS

       # 05 HOURS (ALARM)

       # 06 DAY OF THE WEEK

       # 07 DAY OF THE MONTH

       # 08 A MONTH

       # 09 YEAR

       # 0A REGISTER A

       # 0B B REGISTER

       # 0C REGISTER C

       # 0D REGISTER D


       # 0E general-purpose RAM

       ... RAM is general-purpose

       # 3F general-purpose RAM


# 0C, # 0D - read only
# 00, # 0A - senior level read-only



         DESCRIPTION OF THE REGISTERS A. .. D



        REGISTER A (individual bits)


7 UIP "1" in this bit indicates that

      being updated information and hours
      mi can not work, wait

      some time. Cycle Time

      updates depending on the frequency

      Clock:



     frequency duration

       MHz refresh cycle, ms


     4.194304 248

     1.048576 248

     0.032768 1984



              32768 1048576 4194304 RESET
6 DV2 frequency 0 0 0 1
5 DV1 quartz 1 0 0 1
DV0 4 0 1 0 x

3 RS3 Set the frequency on pin
2 RS2 SQW (23), and period interrupt
1 RS1 IRQ (19)
0 RS0

 IRQ - interrupt signal to the issuance of any
post. frequency or at the end of the update cycle, or from an 
alarm clock. 

  IRQ = 1000 / SQW

 SQW is used to feed the signal from the
Alarm
 For example: the frequency of SQW = 256 Hz, period
is equal to 1000/256 = 3.9ms



  D3 D2 D1 D0 Frequency, Hz PERIOD, ms


  0 0 1 1 8192 0.122

  0 1 0 0 4096 0.244

  0 1 0 1 2048 0.488


  ....................................


  1 1 1 0 4 250

  1 1 1 1 2 500


        REGISTER B (individual bits)


7 SET "1" ban update

       (To set the time).

6 PIE interrupt enable, with a period

       specified in the RS-bit register A.

       Cleared by Reset'u.

5 AIE resolution Interrupt Alarm
       ka. Cleared by Reset'u.

4 UIE interrupt enable at the end

       update cycle. Cleared

       by Reset'u.

3 SQWE permit issuance of information on you
       course of SQW. Cleared by Reset'u.

2 DM type of data: 0 - BCD

                   1 - Binary

A 24/12 score: 0 - 12 hours

              1 - in 24 hours

0 DSE "1" enables automatic transfer
       move from summer to winter time

       back.
 Daylight saving time is carried out in
3h nights voskesene last April, and
on winter nights in 1 hour the last Sunday in October.



        REGISTER C (individual bits)



  All bits are reset to Reset'u or
reading Register C.
7 IRQF flag interrupt request. Establishes
        Lebanon into a "1" on condition that:

        (PF and PIE) or (AF and AIE) or

        (UF and UIE).

        If IRQF = "1", then the output IRQ

        (19) is set to "0".

6 PF ustanavlvaetsya in front of a signal

        at the output of the internal divider

        frequency selected in accordance

        with RS-digits.

5 AF is set to 1 if the coincidence

       current time and time Alarm
       nick.

UF 4 is set to 1 after

       update cycle.

3 = 0
...
0 = 0



        REGISTER D (individual bits)


7 is set to log. "0" if

       food was wasted and information

       unreliable.

       Set to "1" on Reset'u

       or when reading the register D.

6 = 0
...
0 = 0



              Data Format



  Sunday = 1, Monday to. = 2, etc.


  January = 1 February = 2, etc.


  1997 = 97 1998 = 98, etc.


  Records the number of days per month and accounted for leap 
years. If the registers # 00 ... # 09 record number in the range

# C0 ... # FF - it is indifferent state.
Ie if the clock alarm = # FF, then it will fire every hour.



         The alarm

       When the alarm



  Necessary in the case {B} to set
AIE = SQWE = 1 UIE = PIE = 0.

  Frequency of the sound output is given by SQW
RS-bit register {A}. At operation
Alarm IRQ output will be installed in
log. "0". Ie for sound generation need
merge the outputs of OR SQW and IRQ

 You can put the RC-chain, which, after
nokotorogo time after the IRQ in
# 0 sfoormiruet reset signal, and the sound stops.



             Connection scheme



  If you have a controller SMUG, then
all you need to do is stick a chip CMOS-hours in accordance 
socket. 



  Well, if you "bad luck", you will have
little Popayán ...


                Generator



                  2 (OSC1)


     22M

                  3 (OSC2)


             470k



                    quartz:

October 20 32.768 kHz

             * 1.048576 MHz

                    4.194304 MHz



   Choice Crystal and voltage control



                        5.1K

                                  24 (+ Un)



      / 5.1K / 13 (/ CE)

     / / K

                       KT315
 5 \ \ e

      \ \


    KS133



                5.1K
 24 (+ Un) 22 (PS)



            Nutrition Products



              \

               \

      B 5 / 24 (+ Un)

              /



              \

               \

               /

              /


             +

              battery, 3.6V



         Connecting to a Computer



  You must connect the signals AD0 ... AD7
on the data bus of the processor.

  Signal / RES (18) connected to the / RESET
Processor (26-th output)


  The remaining conclusions - AS, R / W, / DS to
connected to address decoder.



            Status signals



                          AS R / W / DC

  Nothing 0 1 1

  number selection register 1 1 1

  Reading from register 0 1 0

  write to register 0 0 1



   For example, on a yellow card for Scorpio
findings of AS, / DS, R / W signals can be fed
with m / D54:


       D54/13 through an inverter to AS

       D54/11 at / DS

       D54/15 in the R / W


  In this case, the port addresses CMOS-hours
will be stationed in TR-DOS area.


  In this arrangement, including analysis of
Only bits 1 and 7, but in order to avoid conflicts with other 
ports are recommended such port addresses 


         The choice of register # D8

         Reading from register # 58

         Entry in the register # 58


  When ispolnovanii Scorpio for the read / write data, you can 
use n / n TR-DOS:


# 3FF0 - OUT (C), A

        RET

# 3FF3 - IN A, (C)

        RET


  On computers that have the ROM TR-DOS
There are no such instructions recommend the following program:

; Write data to register
; In:
; [C] - register number of CMOS-hours
; [B] - value to be written
WRREG LD A, C

        CALL SETREG

        LD A, B

        LD C, # 1958

        JR OUTPAR
; Reading data from register
; In
; [C] - register number of CMOS-hours
; Out:
; [A] - schitanye from the register value
RDREG LD A, C

        CALL SETREG

        LD A, # D8

        LD C, # 1F

        CALL OUTPAR

        LD C, # 1958

        LD IX, # 3EF3

        CALL JPTR

        LD A, H

        RET
SETREG LD C, # D8
OUTPAR LD IX, # 2A53
JPTR PUSH IX

        JP # 3D2F






Other articles:

From the Author - Entered the University of ...

News - is nearing the end of the work to create CD-ROM.

Overview of new products - Chainik in horror flat.

Iron - General Sound, CMOS-clock.

Form - The survey of readers.

WANTED - Searching software ...

Advertising - Advertisements and announcements ...


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

Similar articles:
ASCii'2001 party report - Report on De (pi) mopati in Izhevsk and official results.
Presentation - Novgorod Group Digital Reality about yourself.
From the Editor - The first responses of the newspaper.
Hard-a - Midi interface device.

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