Buzz #20
31 декабря 2001

IM2 again about sore - The problem of interrupt vectors.

<b>IM2 again about sore</b> - The problem of interrupt vectors.
                      ONCE AGAIN about sore

I already wrote a similar article before, but, unfortunately, 
sent her in fidoshnuyu echo ZX.SPECTRUM, where only received 
criticism and no positive result. Now I will repeat, but on

screens of this e-zina. Hopefully, his authoritative shields 
and authors add credibility to my advice. Many of these tips

appeared, and again seem irrelevant or unimportant, but
the point is to listen and if possible to perceive them.


   Item 1 - "The problem of interrupt vectors

Everyone knows that for the effective establishment of any 
program need to use interrupt IM2, but sometimes it does not use

absolutely correct way to install these interruptions. I beg
apologies for the repetition of truths, but for some of these
Truth is not fully defined. So, in classic form
setting interrupt IM2 occurs in the following way:

a) create table interrupts;
b) setting a pointer to the interrupt routine;
c) the prohibition of the current interruption;
d) installation of a new interrupt vector table;
d) the transition mode IM2;
e) The permit is re-established interrupt IM2.

At this point, of course, many will say: "Yes, all right, 
because it happens "- but some" savings "will notice that they

miss one or more of the above steps. Immediately
clarify what happens, if not quite correctly set
Interrupt IM2. Everything is quite simple: at the time of
of the interruption, the transition program is not quite at that
subroutine which is conceived, and even do a random place
memory. The main detail of the whole problem is that this is 
happening not at all the computers and not always the same. And 
the essence of for this is not completely debugged computer's 
motherboard, as Typically, self-made. The solution to this 
problem is the correct way to install its program interrupt 
IM2, and if any, the most rotten, the Pentagon, everything will 
be fine work. Let me give an example piece of code is correct

associates IM2, and if someone does not want to delve further 
into this problem, simply copy the code in the plot itself.



       LD HL, # BE00

       LD DE, # BE01

       LD BC, # 1BF

       LD A, H

       LD (HL), C

       LDIR

       LD (HL), # C3

       LD HL, MY_INT_ROUTINE

       LD (# BFC0), HL

       DI

       LD I, A

       IM 2

       EI

       ....

Here we employ a break IM2 memory areas:
# BE00 .. # BF01 and # BFBF .. # BFC1.

In fact, this plot is a classic setup IM2. Often
just some coders do not want to sacrifice the 257-th bytes for
full table of the interrupt, and they set the pointer to the 
table in various places - who is to come up with, basically 
fell in love with them ROM area, because this usually happens 
fatal depend for their programs in some users.


Here's a first postulate:

* It is undesirable to set the interrupt vector outside the 
region Memory # 8000 .. # BF00. In memory of # 4000 .. # 7f00 or

# C000 .. # FF00 is not necessary to set the vector table, 
because Many computers with slower memory at these locations as 
time and This is the slowest memory. Fatal glitches are not

occurs, but the program can work is hindered. And in
memory area # 0000 .. # 3F00 generally better never to put
vector table, because there is not a normal
interrupt table.

But the second postulate:

* When creating the table itself correctly to interrupt only
fill the entire table (257 bytes) to the same value.

This is perhaps the worst of the place, because using the table 
of ROM (ie, filled with garbage), or filling it into RAM, you 
are thus admit the transition probability of the processor in a 
false position memory, because no one with a 100% chance you 
are not guaranteed that transition occurs only in the last two 
bytes (including Clive). Ie I'm not saying that this phenomenon 
is massive character, but judging by our city, I can assert 
that this often faced by many. When the spectrum was more 
raspostranen, Yes, and programs to do more, this phenomenon is 
common, ie then someone one does not work, then each other. Now 
I can accurate to say that one of the four spektrumistov 
familiar me (including me:), does not work, none of the 
programs with shitty interrupt table. I, on the whim of my

Pentagon officials, these programs can work out a long time,
but end up all the same - reset after some time.
Finally give your method for installing interrupt IM2, which
I think it is more convenient:

Somewhere in the beginning of the program:


       ORG # 8000

       DEFS 257, # 81; in ALASMe fill 257 bytes of code # 81

       ....


       ORG # 8181

       DI


       ; INTERRUPT ROUTINE


       EI

       RET

       ....
ENTRY:

       ....

       DI

       LD A, # 80

       LD I, A

       IM 2

       EI

       ....

Thus the table and all related activities occur on
at translation program that saves you from unnecessary
actions to the same as you would turn the table size
programs, thus agree in advance with extra busy
257-th byte, which in fact has never been conclusive.
Incidentally, it is easy to see that at # 8101 obtained 128
free bytes that can be used as cells for
variables. You need to add that if at the end of your
program to transfer control system, it is better to do
is as follows:


       DI

       LD A, # 3F

       LD I, A

       IM 1

       RET (ooooh! Almost wrote rts ;-)

Why it's worth doing it this way, read on.


   Item 2 -> interrupt vector TR-DOS.

Create the correct interrupt table IM2 according to the advice
preceding paragraph, you are not yet fully freed from
potential problems with preemption. If you want to suddenly
middle of the program, which already has your break IM2,
download anything from the disk, then you would use for this
sub TR-DOS. We do not consider loaders with
enabled interrupts IM2, it has already been considered in
various articles. The following comments apply equally to
apply to the standard work with TR-DOS by # 3D13, and
frequently used rapid loader (via a direct challenge to
low-level routines to work with VG93). Before working with
TR-DOS, many cut off the music and break through the team
DI. Shows a sad practice that is not enough
especially when using low-level routines TR-DOS.
In other words, before calling any routines TR-DOS better
switch to interrupt vector IM1 c # 3F:


       DI

       LD A, # 3F

       LD I, A

       IM 1

       CALL TR-DOS

This problem is very similar to the one described in the 
preceding paragraph, but here is a conflict between the VG93 
and procedures. Especially not delving into the details, I 
advise you to use the reduced design for access to the TR-DOS. 
When using fast downloaders using low-level calls to TR-DOS

would still only add IM1 / # 3F in the beginning of the cycle 
sector accounts for Download or record.



   Item 3 -> Interview with the keyboard.

I suppose that to this point are unlikely to heed, but I can not
do not tell us about this issue, the poll keypad. I think
Many are familiar with a term such as jitter
keyboard. I am closely acquainted with him was at the Pentagon.
In other words, not very good code survey keyboard
horseradish which rack up afterwards. Immediately I can say 
with certainty that the best way to interrogate the keyboard to 
dial any Text ... is to use a subroutine in the ROM BASIC 48. 
Many I could argue that, well, we ought not to use

routines ROM, we say, we can write it yourself. But then again
the same sad experience has shown that the most successful 
sub-program survey specifically for typesetting - it PZUshnaya 
routine of Interrupt IM1. It can, of course, simply copy

from there, but not be simpler to make the RST # 38! I use it 
the next as follows:



       XOR A

       LD (23560), A

       LD IY, # 5C3A

       RST # 38

This site is located inside my interruption IM2. This
way of course is no different high speed run
however, it is very short and important - rather bug-free.
The last key pressed then you can get anywhere
program from a cell at 23,560. For more information
about a poll the keyboard can be obtained from various
reference books on spec. All this, at first glance, heresy for
advanced coder I tell no accident. Case that
problem pops up in various cases with the most correct
form routines begin to poll the keyboard stuff. This
occurs for various reasons, including:

a) using konrollera mi-Claudia;
b) change some internal characteristics of the company (usually
Pentagon, damn it) - usually with the aging of iron;
c) turbirovanie percent.

Again, I note that it is rare, but these
unfortunate event were many times I have recorded in our
region. Well, you guessed it, the only program
which has withstood the test of glyuchnosti - this is
routine survey in ROM BASIC 48. Honestly, did not
realized that her magic, perhaps because it is in
ROM is located, and perhaps for several features at once,
only it almost never is buggy. If you just want
interviewed several keys for you, then good
way - to take command IN A, (C), rather than IN A, (254).
In other words, reading from the keyboard port with a pair of BC
is more reliable, probably due to technological
especially Z80.

All of these recommendations may seem strange to many, but
is tested on their own experience. Practical application of 
these techniques can be found in our last game FARSPACE (for

CC01), if you crawl back STS-ohm. :)

fyrex@klax.tula.ru

-------------------------------------------------- 
------------- by Fyrex / Mayhem (c) Buzz 2002 






Other articles:

21st century's swapper - svaper 21 centuries or spekovskoy scene Now there are almost no svaperov?

Are the Gods against design? - what a demo or steeper LifeForms Stellar Contour?

ASCii 2002 final results - Results ASCii'2002.

Booze charts - rule the charts.

CAFe 2002 rules - the new rules demopati in Kazan.

Catch tne buzzards - Contact Us.

CC'001 graphics compo review - overview charts with CC'001.

Copyright notice - The paper is distributed under the BUZZ FREEWARE.

Dman's CC'001 report Dman's - report CC'001.

Editorial - finally waited for 20-second Buzz.

Forever'3 final results - Results Forever'3.

How to make cool ASCII logo - how to draw a cool logo in ASCII.

I'm the only one in TNL! - All the main TNL has long been scored at the Spectrum ...

IM2 again about sore - The problem of interrupt vectors.

Interview with Arty Noonzen - an interview with the organizer of Digital Reality.

Interview with Pheel - an interview with a famous artist Spectrum.

List of voters - is not objective and outdated survey results.

Mast is a skinflint?! - Freeman otkyvaet truth about Mast'a.

Mukpockon - Stanly argument on an already boring topic 'Demo vs Game'.

Navigation - A new cool shell! How it managed?

Paracels speaking - News from: BrainWave, CPU, Demiurge Ash, Digital Reality, Excess, Extreme, Fenomen, Freeart.

Paracels speaking - News from: GAS13, Hardwave Crew, Hooy-Program, Mayhem, OCA, Perspective Group, Phantasy, Phantom Family, Placebo, POS, Progress.

Paracels speaking - News from: Rain Group, Raww Arse, Remedy, Skrju, Studio Stall, Techno Lab, 4D, Triebkraft, Wlodeck Black.

Paradox 2002 rules - demopati rules.

Phat a graphics compo review - overview charts with Phat'1.

re: nikologiya - about how people came into his head himself had called.

Realise VS release - What should be the e-journals (argues Diver).

Sceners VS newcomers - sceners against Newby.

Stanly's CC'001 report - reportage Stanly.

Support us - the newspaper is required care: musicians, artists and authors of articles.

Thank you! - write to us!

What's next? - The next issue will Buzz'a?

Who are the buzzards? - who made the BUZZ?!

ZpiXel review - an overview of the new website devoted to the chart on the ZX Spectrum.

ZpiXel.Past, present & future - the history and future of the project.

Passage - The paper "Passage": how it all began.


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

Similar articles:
AD & D - Board Game genre Advanced Dungeons & Dragons
Vintostroenie - How to assemble the screw itself on a PC.

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