On the issue of displaying the screen for interruption
Alone Coder
In the first issue of the computer magazine
ZX-Power published an article, author:
second, calling on mathematics to help, convince -
flatly refuted the programmer legend about
that someone allegedly threw the screen (without at-
ributs, i.e. 6144 bytes) per interrupt
Pentagon (71680 processor cycles).
The author was right and wrong at the same time.
He was right that in 1996 none of
programmers did not write the above effect
fecta. He was wrong in that in his own
prejudices about the impossibility of implementing
tions of the above effect he missed 1
(one) method of displaying the screen, namely the method
LD-PUSH. The POP-PUSH method requires frequent
modifications to the SP stack pointer and therefore not
provides the required speed; the LD method
PUSH modifies the stack half as often.
This is what I'm talking about:
LD SP,...
LD DE,xx
PUSH DE
LD DE,yy
PUSH DE
...
Can you point out to me that in the indicated
the article was about moving the screen, and my
the method displays only the data specified
are stored directly in the output program.
This is incorrect: LD also reads data, but
lying only in a certain area of memory -
tee. This drawback is compensated by three advantages:
advantages: freeing registers allows you to
differentiate SP by calculations; the latter yes-
It is possible to move the data receiver,
what the POP-PUSH method does not allow; same typeoperations in the program simplifies the implementation
tion.
I'll show you how to use the method, in particular
sti,for smooth scrolling up.
PROG ;start of output program
DOWN SP ┐
┐ │
LD DE,nn├16 times├192 times
PUSH DE │ │
┘ ┘
JP PROG
By DOWN SP we mean the procedure
which calculates the address of the line lying
one below that indicated in HL, and places it
in SP. The simplest example of such a procedure:
SET 7,H
LD E,(HL)
INC L
LD D,(HL)
EX DE,HL
LDSP,HL
It uses the table located at the address
sah #C000Ў#D800 and takes 35 clock cycles. Vna-
initially I used it, but because of its slowness
I had to sacrifice two
extreme columns of the screen, that is, the program
Ma no longer satisfied the given condition.
If you change it according to this pattern, then
growth will fully meet the requirements
mine:
SET 7,H
LDSP,HL
POP HL
LDSP,HL
This option uses a similar
blitz, but it’s already been eating 30 bars. The final touch
into the procedure:
INC H
RRCA
┌─JR NC,$+6
│ SET 7,H
│ LDSP,HL
│ POP HL
╘ LD SP,HL
Now only 28+3/8 measures are used
(Register A has one bit set, so
the central part is called 1 time out of 8).
If you replace JR with JP, then there are only 28 clock cycles.
The program is closed on itself. How about her
call?
We start inmain program (dispatcher)
re) a counter that points to some
a line of 192 that the program outputs.
We write a breakpoint there, i.e. JP USE, and
we jump into the program, bypassing the procedure
modification of SP (which I just talked about)
ril). It looks something like this:
BEGIN LD (HL),195
INC HL
LD DE,USE
LD(HL),E
INC HL
LD(HL),D
PUSH HL
LD DE,6
ADD HL,DE
LD (USE+1),SP
PUSH HL
LD HL,#4020;end of 1st line of screen
LD A,128
RET
USE LD SP,0
POP HL
LD (HL), code jr nc
DEC HL
LD (HL), code rrca
DEC HL
LD (HL), code inc h
LD DE,4*16+9
ADD HL,DE
BIT 7,(HL)
JR Z,$+5
LD HL,PROG;if you reached the end
JR BEGIN
To insert HALT, you need to have another
one counter (for example, HL'), which indicates
the shaft would be 96 lines lower than the first, and instead
breakpoint set JP (IX), where IX=IMER
IMER LD SP,0
EXX
HALT
LD (HL), code rrca
DEC L
LD (HL), code inc h
PUSH HL
EXX
RET
How to print letters? One line at a time: in
that line that was freed after -
changing counter N 1, in the LD parameters it is necessary
write down the corresponding lines of letters. Not for me
write to you about this: you yourself know how
this is done, and if you don’t know, then it’s still in-
It will be more interesting to discover this for yourself.
Program that depicts the effectshift up with arshin letters, there is in
Application. It's called PUSHROLL.H.
P.S.: one of the demos from FUNTOP '98
causes the screen to interrupt, but
this seems to be some other effect
since in its epilogue the shift occurs
as always, classic - for two.
Share your thoughts about the article