Nicron #15
10 января 1997

Programming - a course of study assembler Wlodek Black, continued.

<b>Programming</b> - a course of study assembler Wlodek Black, continued.
                                                           z80

[Continued].

(C) WLODEK BLACK

        00Ch. Special teams.

NOP (No Operation) - the command "no operation". No-op,
on which no action is performed. Command Code - 00.
Command is executed in 4 takta.Primenyaetsya when debugging 
programs (Especially foreign) to tighten the real-time programs

time, for "nailing" of obsolete commands (example -
obessmerchivanie games).

HALT (stop) - stop the processor. Executing
HALT, the CPU stops. But the tire does not turn off!
The fact of execution of a stop command tells the processor to 
other devices exhibiting a special signal "HALT" on the 18-m 
output of its chips. HALT signal can be used by other devices 
to permit or encourage any actions that may not be used at all. 
At the MSX computer and "Spectrum" command HALT can be used 
freely. Emerge from stopping the processor can only interrupt 
(Read more about interruption - on) or reset (RESET). HALT 
command is normally used to organize long-term cycles of 
passive waiting, synchronizing interrupt (in the MSX and 
Spectrum - with a refresh rate of 50 Hz). 

            00Dh. INTERRUPTION.


   Russian title of "termination" and his original 
"interruption" absolutely accurately determine the phenomenon 
occurring in the microprocessor system after the 16 th leg of 
the processor comes a short pulse of the zero logic level, 
called interrupt request signal.


   Interrupt request signal is denoted by "INT".

   We assume that interrupts are enabled (you can disable the 
processor to respond to the signal INT with the help of special 
teams) 

   The presence of INT signal processor checks after each 
command. Finding this signal, the processor instead of sample 
of memory and executing the following command goes to service 
interruption. Cycle entry in the interrupt service consists of 
the following steps: 1. The processor acknowledges receipt of 
the interrupt request. I Z80 for this special pin output is 
not, so it generates interrupt acknowledge signal in a logical 
combination of signals IORQ = 0, RD = 1, WR = 1, which clearly 
regarded not as appealing to the port. Decrypt a combination of 
signals device interrupt requests immediately removes the 
interrupt request signal. Generate interrupt acknowledge signal 
(INTA), plus provide priority service multiple devices capable 
of simultaneous interrupt requests can special device - the 
interrupt controller. But we will not go into the details - in 
the Spectrum and MSX own chip priority interrupt controller is 
not used. 2. Prohibited from receiving further requests to 
interrupt, continue to resolve with the help of a special 
command in the program. 3. In the stack send mail command, 
before which there was an interruption. 4. The transition is 
made to the interrupt service routine, address inputs which can 
be defined by three fundamentally different ways (3 types of 
interrupts). 


   As can be seen, interrupt actually interrupts the execution 
of user programs, and make it can at any time and anywhere in 
the main program. From this directly implies the need to ensure 
a correct return from interrupt, so that the main program is 
not sensed interrupts. Point (e) Return the CPU itself sends a 
stack, but the preservation of registers should take care of 
the programmer. Programmer to know the contents of interrupt 
service routine, it knows which registers using this procedure. 
Registers whose contents are changed when the interrupt service 
routines must be saved in the stack: Entry point into the 
service of interrupts: -> PUSH AF


      PUSH HL

      PUSH DE

      PUSH BC

       . . .

    

       . . .

      POP BC

      POP DE

      POP HL

      POP AF

      EI; sure you want to enable interrupts
       before returning

      RET; return to the main program

The system interrupt routines, which is in ROM, of course
correctly saves and restores information in the registers.

            Why do we need an interrupt.

There are a number of events are rare, but
microprocessor system which must respond immediately. There is 
also a need to regularly perform some actions that are linked 
to real time. Enumerate those and others can be up to infinity, 
so here we will only on what specifically do interrupt the 
computer MSX. 

   So, with a frequency of 50 Hz:
polled keyboard - codes typed characters are placed in
buffer, fixed special cases (Ctrl + Stop, etc.) is
countdown timer, moving all the data for background
music (if the queue was specified) decrements the interval
for Beysikovogo operator "ON INTERVAL GOTO".

   In the Spectrum interrupt polled keyboard and made the 
countdown, keyboard input buffer in the Spectrum not, so the 
code is only recorded one last key, keys.


   On the usefulness of the mechanism of the interrupt can be 
judged by the following rough life example: Suppose you are 
sitting the computer and typing program, and the kitchen is

Time is heated kettle. If the kettle has a whistle, you have to 
periodically run the kitchen and check to see if boiled He (the 
survey states kettle). In the presence of a whistle, you can 
not worry - the maker himself will give a signal (interrupt 
request on kettle). But if this is also the phone rings, you

will have to decide what event requires a response priority 
(priority interrupts). 

[To be continued].





Other articles:

Entry - the contents of rooms.

BBS - list of stations BBS ZXNet.

Iron - an overview of the microprocessor Zilog Z380, continued.

Programming - a course of study assembler Wlodek Black, continued.

Congratulations - greetings, congratulations and wishes.

Graphics - Image ANSI graphics.

Games - A citizen's go ... game: "Seymour At The Movies".

Search - search for game programs.

Stories - police bikes.

Radio - novice - revision to ZX.

Advertising - advertising and announcements.

Feedback - contact the publisher.


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

Similar articles:
Demo Party - Results of the Latvian demopati PHAT'9.
ZX-waggons - Overview of electronic media: Nicron 112-113, Polesie 11, ZX-News 49, Born Dead 0D.

В этот день...   4 May