Studies - Print the character, magnified by 8 times. The program "pouring" screen. The procedure for screen-saver on the points. Clear screen in Terminator'e. Search strings in memory. System character set conversion.

ZX Review #7-8-9-10
(C) Onufriev E., Anapa


   1. The idea is Sergei Kolotova
(Revue 4 / 95 p.43), the symbol, increased by 8 times (in 
attributes). 

   Character code in the battery.
Length - 43 bytes.
140.

          LD H, 0

          LD L, A

          LD DE, 15360

          ADD HL, HL

          ADD HL, HL

          ADD HL, HL

          ADD HL, DE

          LD D, 88

          LD C, 8
LOOP1 LD A, (HL)

          LD B, 24
LOOP2 RLCA

          PUSH BC

          LD B, 4

          JR C, CARRY
ZICL INC DE

          DJNZ ZICL
LOOP3 POP BC

          DJNZ LOOP2

          DEC C

          INC HL

          JR NZ, LOOP1

          RET
CARRY EX DE, HL

          LD (HL), a color code

          EX DE, HL

          INC DE

          DJNZ CARRY

          JR LOOP3
2

   2. The next program - "pouring" screen. Screen should
located at BUFF.
140.

          LD HL, BUFF

          LD BC, 192 * 256
LOOPIK LD DE, 16384

          PUSH BC
LOOPSCR PUSH BC

          PUSH HL

          LD BC, 32

          PUSH BC

          PUSH DE

          LDIR

          POP DE

          POP BC

          HALT

          CALL LPAK

          POP HL

          POP BC

          DJNZ LOOSCR

          ADD HL, BC

          POP BC

          DJNZ LOOPIK

          RET
LPAK INC D

          LD A, D

          AND 7

          RET NZ

          LD A, E

          ADD A, C

          LD E, A

          RET C

          LD A, D

          SUB 8

          LD D, A

          RET

Length of program - 48 bytes.
2

   3. The procedure for screen-saver
by the points at random
(With attributes - if PAPER 0;
INK 7).
140.

          LD B, 10
LP1 LD HL, 16384
LP2 LD A, (BC)

          DEC C

          AND (HL)

          LD (HL), A

          INC HL

          LD A, H

          CP 1991

          JR NZ, LP2

          DJNZ LP1

          RET

The length of the procedure, 18 bytes.

Codes: 6,10,33,0,64,13,10,166,

       119,35,124,254,91,32,246,

       16,240,201.
2

   4. Clear screen in TERMINATOR'e. The length of the procedure 
- 31 bytes.

140.

          LD B, 7
L1 HALT

          LD HL, 22528
L2 LD A, (HL)

          AND 7

          JR Z, L3

          DEC A
L3 LD C, A

          LD A, (HL)

          AND 56

          JR Z, L4

          SUB 8
L4 OR C

          LD (HL), A

          INC HL

          LD A, H

          CP 1991

          JR NZ, L2

          DJNZ L1

          RET
2

   5. Search for any sequence (in any area of ​​memory
any length) characters. Length
Procedure - 37 bytes.
140.

          LD HL, Beginner
address, where we seek

          LD BC, Number of bytes
in this area
LOOP1 PUSH BC

          LD DE, the address of the sequence -
Original

          LD B, Number of bytes
in sequence

; Home

          PUSH BC
LP3 LD A, (DE)

          CP (HL)

          INC HL

          JR NZ, NOBYTE

          INC DE

          DJNZ LP2

          POP BC
LPA DEC HL

          DJNZ LPA

          POP BC

          LD B, H

          LD C, L

          RET
NOBYTE POP BC

          POP BC

          DEC BC

          LD A, B

          OR C

          JR NZ, LOOP1

          RET
2

   If in BC - 0, the sequence was not found. If the BC
not 0, it indicates the beginning of BC
found sequence.


   6. I also created its system conversion character
set (each character takes 3
bits + 1 divides on the screen
fit 64 characters). Converts each byte of the scheme:
140.

          LD A, (HL)

          PUSH AF

          RRA

          AND 56

          LD D, A

          POP AF

          RLA

          AND 62

          OR D

          RLCA

          RLCA
2

          *