Info Guide #01 |
|
Programming - On the derivation of the screen for one interrupt.
On the derivation of the screen for the interruption Alone Coder The first issue of PC Magazine ZX-Power was opubikovana article, whose author, calling in aid of mathematics, convincingly refuted programming legend of that someone allegedly threw a screen (without attributes t.e.6144 bytes) per one interrupt Pentagon (71680 CPU cycles). The author was right and wrong simultaneously. Rights, it was that in 1996 none of the Programmers do not write the above effekta.Ne rights, he was in the fact that its bias on the impossibility of implementing the above-mentioned effect, he missed a (One) way to display the screen, namely a method LD-PUSH. POP-PUSH method requires frequent modification of the stack pointer SP and therefore not provides the desired speed, the method also modifies the stack LDPUSH least twice. That's what I say: LD SP, ... LD DE, xx PUSH DE LD DE, yy PUSH DE ... You can tell me that in this article dealt with the moving screen, and my method displays only those data which are specified directly in the program output. This is wrong: LD also reads the data, but lying only in a certain area of memory. This shortcoming redeem three advantages: exemption registers allows us to modify SP calculations, the most recent offers the ability to move data receiver, which makes the method POP-PUSH; uniformity of operations in the program simplifies the implementation. Show you how to use the method, in particular, for smooth scrolling upwards. PROG; beginning of the program output DOWN SP LD DE, nn 16 times 192 times PUSH DE JP PROG Under DOWN SP means protsedurka, which calculates the address of a string lying one below this in the HL, and puts it in SP.Prosteyshy example of such protsedurki: SET 7, H LD E, (HL) INC L LD D, (HL) EX DE, HL LD SP, HL It uses a table, lying in the address # C000Ў # D800 and takes 35 clock cycles. At first, I did and used, but because of its slowness, I had to donate two outermost columns of the screen, so the program no longer satisfies the given condition. If you change it to this model, the rate will be quite meet the required: SET 7, H LD SP, HL POP HL LD SP, HL This version uses a similar table, but eat for 30 taktov.Finalny bar in this procedure: INC H RRCA JR NC, $ +6 SET 7, H LD SP, HL POP HL LD SP, HL Now uses only 28 3 / 8 stroke (A is set in a register one bit, so central part is called a time out of 8). If you replace the JR to JP, a total of 28 cycles. The program is closed on itself. How did it cause? The plant in the main program (Manager) counter, which indicates some line of 192, which displays the program. Make an breakpoint, ie, JP USE, and jump into a program to bypass the modification procedure SP (which I just mentioned). It looks 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 the 1-th row of the 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), the code inc h LD DE, 4 * 16 9 ADD HL, DE BIT 7, (HL) JR Z, $ +5 LD HL, PROG; if you've reached the end JR BEGIN To insert a HALT, must have another one meter (eg, HL '), which would indicate a 96 rows below the first, but instead breakpoint'a put JP (IX), where IX = IMER IMER LD SP, 0 EXX HALT LD (HL), code rrca DEC L LD (HL), the code inc h PUSH HL EXX RET How to display the letters? According to one line: in that line, which is released after changing the counter N 1, the parameters of the LD must be write the corresponding line bukv.Ne me you write about it: you yourself know how this is done, and if you do not know, so more interesting to discover it for themselves. The program, which depicts the effect of shift upwards with a yardstick of letters, there is a Appendix. It's called PUSHROLL.H. PS: one of the demonstrations FUNTOP '98Displays the screen in an interrupt, but it seems to be some other effect, because it is the epilogue to the shift occurs As always, the classic - for two
Similar articles:
В этот день... 21 November