ZX Review #7-8-9-10
08 ноября 1997 |
|
Studies - scrolling lines of text in the specified window. Attribute scroller. Diagonal scrolling.
(C) Komandin IG, Kaluga I would like to propose for your consideration its programs from over I've worked with recently time. 1. This program performs scrolling in the specified window as much as lines of text (word, as in the credits for movies). 144. 1910; UP-SCROLLER 1920; (C) ZX-MANIACS 30 ORG 40000 40 ENT 50 INIT LD HL, TEXT 60 LD (TEXTP), HL 70 SCROLL LD HL, (TEXTP) 80 XOR A 90 LD (LINE), A 100 LD A, (HL) 110 OR A 120 JR Z, INIT 130 LD B, 8 140 M1 PUSH BC 150 PUSH HL 160 LD DE, 22506 170 LD B, 12 180 M2 PUSH HL 190 LD A, (HL) 200 LD H, 0 210 LD L, A 220 ADD HL, HL 230 ADD HL, HL 240 ADD HL, HL 250 PUSH DE 260 LD DE, (23606) 270 ADD HL, DE 280 LD A, (LINE) 290 LD D, 0 300 LD E, A 310 ADD HL, DE 320 POP DE 330 LD A, HL 340 LD (DE), A 350 INC DE 360 POP HL 370 INC HL 380 DJNZ M2 390 CALL SRL_UP 400 POP HL 410 POP BC 420 LD A, (LINE) 430 INC A 440 LD (LINE), A 450 DJNZ M1 460 LD HL, (TEXTP) 470 LD DE, 12 480 ADD HL, DE 490 LD (TEXTP), HL 500 RET 510SRL_UP LD DE, # 400A 520 LD H, D 530 LD L, E 540 INC H 550 LD BC, # 0CBF 560 UPS1 PUSH BC 570 PUSH HL 580 UPS2 LD A, (HL) 590 LD (DE), A 600 INC HL 610 INC DE 620 DJNZ UPS2 630 POP DE 640 LD H, D 650 LD L, E 660 INC H 670 LD A, H 680 AND 7 690 JR NZ, NXT_U 700 LD BC, # 00E0 710 SBC HL, BC 720 LD A, H 730 AND 7 740 JR Z, NXT_U 750 LD BC, # 0700 760 SBC HL, BC 770 NXT_U POP BC 780 DEC C 790 RET Z 800 JR UPS1 810 LINE DEFB 0 820 TEXTP DEFW TEXT 830 TEXT DEFM "**** UP ****" 840 DEFM "* SCROLLER *" 850 DEFM "* IS WRITTEN *" 860 DEFM "**** BY ****" 870 DEFM "* KOMANDIN *" 880 DEFM "*** ILYA ***" 890 DEFM "* ZX-MANIACS *" 900 DEFM "***** *****" 910 DEFM "" 920 DEFM "" 930 DEFM "" 940 DEFB 0 2 Now we'll talk about how change the output window. In line 160 is given the address of the lower-left corner of the window, in line 510 - upper left. Window width is defined in lines 170 and 480 (in familiarity). On line 550 in the register B is stored width of the window (in familiarity), while in case C - height of the box-1 (in pixels). The text of the program reads from memory by rows, equal to the width windows, so that should bring him back the same way. The program is almost no change procedure is used Kulikov Vadim SRL_UP (line 510 800 ZX-REVIEW N3'96, P.34). By course of events in the above procedure was found a Oshibochka. Line 60 should look like this: LD BC, # 20BF otherwise the screen is stretched the first line of the field attributes. 2. The next program - a few extravagant an attribute scroller ("put on pop "). 140. INIT LD HL, TEXT LD (TEXTP), HL LD HL, BUFF LD DE, BUFF +1 LD BC, 7 LD (HL), 0 LDIR XOR A LD (COL), A LD A, 48 LD (COLOUR), A SCROLL LD A, (COL) OR A JR Z, LDIRB LD HL, 22528;! LD DE, 22529;! LD BC, 7 LD (HL), 0 LDIR LD B, 8 LD DE, 22528;! LD HL, BUFF L1 AND A SLA (HL) JR NC, NEXT LD A, (COLOUR) LD (DE), A NEXT INC HL INC DE DJNZ L1 LD B, 23 ;!!!!! LD HL, 23232 ;!!!! LD DE, 23264;! L2 PUSH BC PUSH HL PUSH DE LD BC, 8 LDIR POP DE POP HL LD D, H LD E, L LD BC, 32 SBC HL, BC POP BC DJNZ L2 LD A, (COL) DEC A LD (COL), A RET LDIRB LD A, 8 LD (COL), A LD HL, (TEXTP) LD A, (HL) OR A JR Z, INIT INC HL LD (TEXTP), HL CP 1916 JR NZ, PASS LD A, (HL) LD (COLOUR), A INC HL LD (TEXTP), HL JR LDIRB PASS LD H, 0 LD L, A ADD HL, HL ADD HL, HL ADD HL, HL LD DE, (23606) ADD HL, DE LD DE, BUFF LD BC, 8 LDIR JR SCROLL BUFF DEFS 8 COL DEFB 0 COLOUR DEFB 48 TEXTP DEFW TEXT TEXT DEFB 16,120,127,32,16,16 DEFM "ZX-MANIACS" DEFB 16,32 DEFM "(KALUGA '" DEFB 16,48 3 DEFM "1996" DEFB 16,32 DEFM ")" DEFB 0 2 As always, on how to change Output window scroller. In line marked with an exclamation point, has to enter the address of the attributes corresponding upper-left corner of the window. In line with two exclamation signs need to put the address on the one greater. In line with the three characters - the address of the lower-left corner of the window, in line with the four characters - the address of 32 is less than the previous one. In line with the same five exclamation marks recorded height of the window (in the familiarity). You can go on line to change the color output attributes. To this end, the text is inserted code 16, followed by the value of the required attribute. The value of this As is known, is calculated by formula FLASH * 128 + BRIGHT * 64 + PAPER * 8 + INK Just do not forget that in this scrolling color of the letters - is PAPER, and Background Color - INK. 3. This program - diagonal scrolling. More precisely - psevdodiagonalny (not as a IWAMOTO in STEG'e), but looks good too. True, I advise specifically to make SCROLL'a decoder with an elongated upper part (where the character takes in the height of seven pixels, and empty in familiarity is only the bottom line). 140. INIT LD HL, TEXT LD (TEXTP), HL XOR A LD (COL), A LD HL, BUFF LD DE, BUFF +1 LD BC, 7 LD (HL), 0 LDIR SCROLL LD A, (COL) OR A JR NZ, LDIRB XOR A LD HL, BUFF LD DE, 22523 LD B, 8 M1 SLA (HL) RRA INC HL DJNZ M1 LD (DE), A LD HL, 16389 LD B, 24 M2 PUSH BC LD B, 8 M3 LD D, H LD E, L CALL DOWN PUSH HL PUSH DE LD A, (HL) SLA A LD (DE), A DEC HL DEC DE LD A, (HL) RLA LD (DE), A DEC HL DEC DE LD A, (HL) RLA LD (DE), A POP DE POP HL DJNZ M3 POP BC INC HL DJNZ M2 LD A, (COL) DEC A LD (COL), A LD HL, 22522 LD DE, 22523 LD BC, Feb. LD (HL), 0 LDIR RET LDIRB LD HL, (TEXTP) LD A, (HL) OR A JR Z, INIT INC HL LD (TEXTP), HL LD H, 0 LD L, A ADD HL, HL ADD HL, HL ADD HL, HL LD DE, (23606) ADD HL, DE LD DE, BUFF LD BC, 8 LDIR LD A, 8 LD (COL), A JR SCROLL COL DEFB 0 BUFF DEFS 8 TEXTP DEFW TEXT TEXT DEFM "45 - ANGLE SCROLL" DEFM "IS WRITTEN BY" DEFM "KOMANDIN ILYA" DEFM "(ZX-MANIACS)" 3 DEFM "KALUGA '1996" DEFM "" DEFM "" DEFB 0 2 This program is quite zamorochena and makes no checks, so it is better to do It does not change. Incidentally, it is necessary to leave the sides of the traveling line width of the void in familiarity, as scrolled band width of a three-familiarity. And finally, how run these programs. In principle, all three approaches is the same procedure: 140. CALL INIT LOOP HALT CALL SCROLL LD A, 127 IN A, (254) RRA JR C, LOOP RET2 *
Other articles:
Similar articles:
В этот день... 21 November