PASSWORD METHOD
CODE FILE.
(C) 2000 Max/Compu-Studio Ltd
-------------------------------------------------------
As usual, I don’t pretend to be a genius
pioneering power in coding - this
The method is widely used in practice as
on iBM and on Spectrum (see my log-
cash "ChV#2"). However, this way to me
seems the simplest and quite reliable
from the point of view of its implementation.
To begin with, a little theory, although later
Les practical exercises will come -
to yourself. So we have some
code file that needs to be made incomplete
foot for strangers. What to do
first of all? Any degree of complexity
algorithm for entering characters from the keyboard. to you
here your hands are freed in terms of creativity
no solutions ;)
Next. The password characters must be placed in
special buffer. Now, actually, about
the password method itself. Schematically
it looks something like this:
файл: |zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz|
пароль:|вася |
| вася |
| вася |
| вася |
| вася |
| вася |
| вася |
| вас|
Как видите,the word "Vasya" "walks" along
code file with a step “to its length”,
i.e. the password size in characters is equal to the step,
necessary for further coding. Than your
the password will be longer (within reasonable limits)
of course), the larger the step through the file.
Password entry should not be limited in length
the password you created. Others
in words - you need to make a buffer for steam-
big, but this should not mean at all
It's clear that the password itself should be like this
same sizes. This circumstance will lead
to the confusion of a man who tries
trying to crack the password. You also need to have
in view of the fact that simple coding
zeros will lead to the fact that if the pirate is up to
I think the protected file can be viewed
bugger, then your “password” is simply read-
It is in memory dump mode. It's not worth it -
how to make a sum from the numbers that make up the CS
password, because Xorka with one byte is also big
no effective - all the same zeros...
I suggest you use your brains and come...
mother some perverted method of pre-
turning password characters into codes for re-
encodings. You can do something like NEG,
or CPL, or just paired ADD and then
xor the file.
Precautions when selecting a file
for password protection. If it is known in advance
that the file is encrypted, for example,
HRUST program with an unpacker at the beginning,
then all the work onXorka will go to dust,
the fact that it will not be difficult for a hacker to restore
update using the existing unpacker code in
in a matter of minutes, “inverted” bits and so on
find out the password yourself. This is, of course, if you
he will be at this time: a friend or your re-
The kids wanted to see the protected disc
without your knowledge...
Okay, this is all bullshit. Conclusion from this
the whole whirlpool is as follows:
1) do not make the input buffer equal to the length of the pa-
role - not knowing the password size makes it difficult
its hacking.
2) don’t do primitive ksorok received-
new password.
3) do not check the password for the correct one
value by checking against a template in RAM.
4) non-xor standard compressed
files or don’t tell anyone that you have them
you're like that ;)
5) give me some money for the idea...
How can you check the quality of your password?
decide on further actions? Yes
everything is very simple - or in the der file itself -
zhi (at the beginning or end), or somewhere from-
checksums of this file carefully. Not
I recommend doing the CS in one byte, otherwise
this very same CS may simply coincide with ka-
some password typed "from the flashlight"
and then complete meditation... Best of all
it is necessary to make at least two calculations of the CS, but
withdifferent places in the file. For example: first CS
it is counted from the beginning of the file to the end, and
second KS from the beginning of the file + 1 byte and also
until the end. The more CS checks, the
you are less likely to have a fatal addition of bits
into a false CS.
That's it. Write letters...
-----
Next in this section is a collection of txt-
coding files. Some are already early
printed somewhere, what makes them moral
outdated. I don’t care - don’t read if
I don't like it! But I recommend you read on...
PUSH=evsky effect.
(C) ACTIVATOR
-------------------------------------------------------
In many demos, for example U.S., ICE
CREAM, as well as in many boot-s you
have probably encountered such an effect as “le-
moving the grid" along a smooth trajectory, i.e.
PUSH effect, as it is also called.
Its principle is not complicated, as it may seem so far.
at first glance. "foundation" in
it is still the same PUSH command,co-
which can copy 2 bytes at a time
ta. In this text I will give examples of programs
frames that will help you make this
effect.
First we have to build a sign,
on which your sprite will fly. Time
Let's take 2*16 (X - 2, Y - 16). Tabular
is built using an ordinary program on
BASIC:
10 LET adr1=30000:LET adr2=30500
20 FOR n=0 TO 2*PI STEP PI/64
30 ROKE adr1,128+127*SIN n:ROKE adr2,8
8+87*COS n
40 PLOT RACK adr1, RACK adr2
50 LET adr1=adr1+1:LET adr2=adr2+1:NEXT
n
As a result of the operation of this algorithm in
memory at address 30000 will be the coordinates
X plates, and under 30500 - the corresponding ones
its Y coordinates. Those who are more understanding can
experiment with the 30th line, me-
adding the SIN and COS values and adding
something of your own. Now you have a sprite,
there is a sign, the most important thing remains -
codes. Let's move on to them....
To fly we need 256 spry-
coms shifted cyclically in this way:
the original sprite is flexed first
16 times to the right, then one point lower and
again 16 times. If you've done everything
correct, then you should get 256sprites with a total length of 8192 (sprite length
* quantity = total length). Who doesn't want
even, or cannot manually move such
armada of sprites, I present a program that
heaven will do everything for you, i.e. right
will move all sprites:
ORG 25000
LD HL,adres;your sprite
LD DE,buffer;size 8192 for
;shifted sprite.
;Let's say #C000.
LD BC,size;sprite length 32 b.
PUSH DE
LDIR
POP HL
LD С,16
DEC1 CALL CRUNCH2
LD B,16
DEC2 CALL CRUNCH1
DJNZ DEC2
DEC C
JR NZ,DEC1
RET
CRUNCH1 PUSH Sun
LD VS,32
LDIR
PUSH HL
LD B,16
CR1 INC HL
LD A,(HL)
RRADEC HL
RR (HL)
INC HL
RR (HL)
INC HL
DJNZ CR1
РОР HL
РОР ВС
RET
CRUNCH2 PUSH ВС
PUSH DE
PUSH HL
LD ВС,#001Е
ADD HL,ВС
LD Е,(HL)
INC HL
LD D,(HL)
PUSH DE
LD D,Н
LD Е,L
DEC HL
DEC HL
LDDR
ЕХ DE,HL
РОР DE
LD (HL),D
DEC HL
LD (HL),Е
РОР HL
РОР DE
РОР ВС
RETAfter running this program you have
under the address 49152 these will be located
the most shifted sprites. Now how do you
there is a procedure that calculates the
measures the sprite and takes it out of the buffer, where
it is copied in advance.
ORG 30000
START1 LD HL,30000;address table. by X
LD A,(HL)
AND A
JR NZ,LET1
LD HL,30000
LD (START1+1),HL
JR START1
LET1 LD (START1+1),HL
AND #OF
LD Н,0
LD L,A
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
PUSH HL
START2 LD HL,30500;address table. in Y
LD A,(HL)
AND A
JR NZ,LET2
LD HL,30500
LD (START2+1),HL
JR START2LET2 LD (START2+1),HL
AND #0F
LD Н,0
LD L,A
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
POP DE
ADD HL,DE
LD DE,#FFFF-32;buffer address one-
;lots of sprites (32
;byte size)
DUP 32 ;32 times LDI
LDI
EDUP; ALASM team!!!
LD (STACK+1),SP;remember stack
LD SP,#4000;on screen
LD HL,(65503+0);buffer address +0
DUP 8
PUSH HL
EDUP
LD SP,#4100
LD HL,(65503+2);buffer address +2
DUP 8
PUSH HL
EDUPLD SP,#4200
LD HL,(65503+4);адрес буфера +4
DUP 8
PUSH HL
EDUP
LD SP,#4300
LD HL,(65503+6)
DUP 8
PUSH HL
EDUP
LD SP,#4400
LD HL,(65503+8)
DUP 8
PUSH HL
EDUP
LD SP,#4500
LD HL,(65503+10)
DUP 8
PUSH HL
EDUP
LD SP,#4600
LD HL,(65503+12)
DUP 8
PUSH HL
EDUP
LD SP,#4700
LD HL,(65503+14)
DUP 8
PUSH HL
EDUP
LD SP,#4020
LD HL,(65503+16)
DUP8
PUSH HL
EDUP
LD SP,#4120
LD HL,(65503+18)
DUP 8
PUSH HL
EDUP
LD SP,#4220
LD HL,(65503+20)
DUP 8
PUSH HL
EDUP
LD SP,#4320
LD HL,(65503+22)
DUP 8
PUSH HL
EDUP
LD SP,#4420
LD HL,(65503+24)
DUP 8
PUSH HL
EDUP
LD SP,#4520
LD HL,(65503+26)
DUP 8
PUSH HL
EDUP
LD SP,#4620
LD HL,(65503+28)
DUP 8
PUSH HL
EDUP LD SP,#4720
LD HL,(65503+30)
DUP 8
PUSH HL
EDUP
... ;and so on
You can multiply this procedure the same way
in such a way that the buffer address is with
periodically from 0 to 30, after 30 again 0 and
etc. At the very end you should do:
STACK LD SP,0 ;stack recovery
RET
Now if you run this in a loop,
then a very beautiful one will fly on the screen
a thing consisting of your original
th sprite.
Max: I do not recommend doing a loop. I understand
that the size of the effect algorithm is too large
the face is obtained and it can be made in many ways
In short, if you make a loop and select from
tables using index registers
steam, but all these teams are "heavy" from the point of view
view of the processor in terms of the amount spent
of the clock cycles, so there will be a terrible tor-
brain at work. Decide ultimately
you, but keep this in mind.-----
Working with disk
with interrupts enabled
(C) 1998 Ivan Roshchin
-------------------------------------------------------
Theoretical information
In the computer"ZX-Spectrum"execution
commands for information exchange between operational
memory and disk failure occurs when the
direct participation of the central process
Sora Z80:
As we can see, if during execution
such a command will interrupt, Z80
will be distracted by processing it and the team will
It fails with the error "data loss". So
Thus, work with the disk is affected by
certain restrictions.
It should be noted that in modern
computers use the so-called
direct memory access when exchanging information
formation between memory and some
external device occurs without involvement
CPU power:
Spectrum is not a modern computer, and
lack of hardware that
would allow "parallel" work with
disk and do something else, you have to
Replenish with software support. For
this is necessary first of allfigure out how
VG93 commands are executed
(for example, "read sector") when turned on
nal interruptions.
-----
Note: of course, all that has been said
about reading commands also applies to commands
records.
-----
Data exchange speed between VG93 and
Z80 is 250 Kbps, and the disk rotates at
speed 300 rpm. Based on these data
nykh, we determine the number of bytes on one
track (note that in the calculation
max 1 Kbit = 1000 bits, not 1024):
(250*1000/8)*60/300 = 6250 bytes
Approximately the same value (plus or minus
five bytes) can be obtained using -
to determine the length of the program track
Afrodita 3.0 frame.
Now let's calculate how many interruptions
will occur within one revolution of the dis-
ka, if their frequency is known and equal to 50
Hz:50*60/300 = 10
Thus, for each revolution of the disk
there are exactly ten interruptions. How
has already been said, if an interruption occurs
goes off while reading the sector, then this
the sector will not be read. It turns out that
this sector cannot be read even if
next revolution of the disk, because during
its reading will be interrupted again. And
we come to the conclusion that reading sectors
with interrupts enabled absolutely
impossible.
-----
Note: there is still a way to implement
reading in such conditions. If not
managed to read the sector, it is necessary to desynchronize
optimize the process of disk rotation and mon-
moments of interruption occurrence. Do it
It's very simple: stop the engine
drive, and then start it again.
After that all that remains is to repeat
reading the desired sector.
-----
But how, you ask, do they work?
personal demos in which reading sectors
combined with music playbackaccording to pre-
jerking? It turns out that not everything is so bad.
The fact is that in fact such a structure
there is no synchronization. So, at Pentago
not" at a clock frequency of 3.5 MHz intermediate
The current between interruptions is approx.
but 71680 clock cycles. In this case the frequency
interrupts is equal to:
3500000/71680 = 48.83 Hz
-----
Note: accordingly, the same
the frame rate of the one connected to
"Pentagon" monitor or TV. How
we see this is a little different from the standard
ta (50 Hz). This also leads to
which is used in many programs
a timer running on interrupts will be
lag behind by 1.4 seconds per minute, in which
can be easily verified.
-----
Now within one revolution of the disk
48.83*60/300 = 9.77 interruptions will occur
ny. Let's consider how many bytes pass
under the magnetic head in between
two interrupts:
6250/9.77 = 640 bytesIf we assume that the first interruption
happened at the moment when the magnetic
the head was at the beginning of the track,
we get the following table:
+------------------+--------------------+
| sequence number |offset from the beginning |
| interrupts | tracks,bytes |
+------------------+--------------------+
| 1 | 0 |
| 2 | 640 |
| 3 | 1280 |
| 4 | 1920 |
| 5 | 2560 |
| 6 | 3200 |
| 7 | 3840 |
| 8 | 4480 |
| 9 | 5120 |
| 10 | 5760 |
| 11 | 150 (next turnover)|
| 12 | 790 |
| 13 | 1430 |
| 14 | 2070 |
| 15 | 2710 |
| 16 | 3350 |
|17 | 3990 |
| 18 | 4630 |
| 19 | 5270 |
| 20 | 5910 |
| 21 | 300 (next turnover)|
| ... | ... |
+------------------+--------------------+
It can be seen that even if the sector is not
was on one turn of the track, quite
it is possible that it will be read next
current turnover, because moments of attack
interrupts will be offset by 150 bytes.
-----
Note: on my "Pentagon" in re-
As a result of experiments, it was found that
which is due to the reduced rotation speed
disk (299.4 rpm instead of 300) torques
interrupt occurrences are shifted not by
150, and 138 bytes. In further calculations
It is this value that will appear.
It is different for each computer, and, as
we will see that the degree of
Slow reading of sectors.
-----
Let's calculate what the half-time will be.
disk reading when interruptions are prohibitedvaniyah:
0.2*160 = 32 seconds
Now let's try to estimate what time
times the reading of one track will slow down
standard TR-DOS disk with the pre-
jerking.
-----
Note: we will assume that when
When reading a track, the program first reads
shows all sectors in a row (and some
then none of them will obviously be correct
read due to an interrupt), and
then with each subsequent revolution of the disk
tries to read everything previously wrong
a few sectors, and so on until
all sectors will not be read.
It is necessary to take into account that if successive
Several tracks are actually read (in
example, 4), and each track is read,
for example, for 2.5 disk revolutions, then all 4
tracks will be read not as 4*2.5 = 10, but
for 4*3 = 12 disk revolutions. This is due to
in that when we give a command to position
zoning to another track and then
we give the command to read the sector, the VG does not work
Zu will start reading the sector, but will wait
index pulse indicating on-
the beginning of the path.-----
Obviously, the reading time of one
horns (measured in disc revolutions) will be
determined by the reading time of the "worst"
sectors, i.e. such a sector, for reading
which will spend the greatest amount
number of attempts.
The sector length on a TR-DOS disk is
256 bytes. Let's look at the diagram how it can
such a sector is read in
worst case:
That is at the first revolution of the disk, the
This will happen when reading a byte at an offset
0, at the second revolution the moment occurs
interruption will be shifted by 138 bytes
so that the sector will not be read again, and,
finally, on the third revolution, it disappears
lurking.
So, we got thatreading time alone
the tracks will slow down 3 times. Corresponding
Surely, the entire disk will be read in 32*3=96
seconds, which is in excellent agreement with ex-
experimental data.
Now let's look at the process of reading one
MS-DOS disk tracks. Sector size -
512 bytes. In this case, reading "worst-
th" sector can occur in two
possible scenarios: either it will be read
on the fifth revolution of the disk, or on the ninth.
This is shown in the diagram:
Practice shows that reading time
one track of an MS-DOS disk on average increases
increases by 7.6 times, that is, the second va-
This option is implemented a little more often than the first.
It can be seen that due to the larger sector length
reading slows down even more than
TR-DOS disk. In this TR-DOS gets at least
some kind of advantage.
But working with an IS-DOS disk when
enabled interrupts are not allowed at all. Du-
may, you already guessed why - sector in
1024 bytes will take so long to read
what will definitely happen during this time
interruption, and maybe more than one. By
for the same reason when interrupts are enabled
you cannot format the disk or perform
track reading command.
How is simultaneous pro-
playing music and reading a disc (without all
slow down!) in such demos as POWER
UP and EYE ACHE-2? Apparently, they use
This method is used: procedurelosing
music starts after reading the very
red sector. But at the same time the call to the procedure
fools does not synchronize with interrupts,
and reading errors are accompanied by unpleasant
with our howls.
-----
CACHE PROGRAMMING.
(C) 2000 Max/Compu-Studio Ltd
-------------------------------------------------------
I wanted to talk here about the methods of working
bots with a cache, but such laziness attacked... Ko-
Rather, the principle is known how to get to
cache, and then write who knows what.
I just need to remind you of something
those who make hacking programs or
system utilities that are located in
cache - exit the cache correctly,
if damage to the main RAM can affect
on the program contained in it.
The essence of the problem is this: there is a program
which by pressing magic or reset-2 (this
when the hardware “flies” into the cache at the address
zero) does something, butthen I mean-
returns or goes to the main program
frame, but whose operation may be disrupted
not affected by any changes in RAM. And because
changes are made by coders or out of ignorance
nyu, or because of laziness... In short, for "for-
To close the cache, you need to run the command
IN A,(#7B)
and it should be in RAM, not in ke-
she. It turns out that this condition is not at all
definitely! Just look at the pro-
flash the ROM in 128 and 48 BASIC and find the co-
pussy
POP AF
RET
to implement a normal output. I have
These commands are sent to the following addresses:
48 BASIC - #0554
128 BASIC - #007D.
In the cache it is necessary two bytes before these addresses
owls, substitute the command IN A,(#7B) and pro-
the problem will solve itself. Naturally
before first do PUSH AF or
imply removing it from the stack. Looked-
it goes something like this:
PUSH AF ;cache address
IN A,(#7B);after this command
;ROM is connected.
POP AF; and this is already a ROM!
RET ;continue program
That's all. Now anyprogram that
is critical to the contents of RAM (considers it KS
or something else, like in "Black Crow"
Mednonogova) and may malfunction,
will not notice that someone is slowing her down. You can
write your own debugger or music finder
rock songs without the risk of falling out
I don't know where to go when returning...
But that's not all! Nowadays many races
there was a proliferation of all sorts of operating systems, commands
trees and other nonsense that is recommended
available for flashing into ROM. Usually offered
you can erase the 128th BASIC and write it there,
Well, for example NEOS or Real Commander vXX.
In this case, you will have to look for the above-
new sequence of bytes (commands)
mine and if I was lucky (I found it), then re-insert
transfer to other addresses painlessly
permanent exit from the cache. This is where it waits
you are the most fucked up - violation
standard is fraught with consequences... :`(
Note: this applies more to hardware
no topic than a programmer, but I will also say
here - if there is a glitch with the output, then
you need to pay attention to the series of microcircuits
in the leaflet of RAM pages, as well as those that
which are used in the cache. Preferably
so that there would be a "fast" series 1533. This
will protect against the condition when the processor
has already processed the command to disable the cache, and
The hardware has not yet done the ROM substitution andThis results in a state called
"a little pregnant" The consequences, of course,
but not childbirth, but a reset is guaranteed!
Share your thoughts about the article