(C) Kobyakov M., Nakhodka
Offered in the section "Studies"
its program to clean the windows of the specified screen.
Coordinates X, Y, as well as the width and height are specified
in pixels. The only restriction - the X coordinate should
always be> = 8! To clear the entire screen to set the width = 0
height = 176.
But now offer readers
improve my program
in particular, to reduce the length and
improve performance. Who
do better?
A bit of criticism in your address.
Where are the hexadecimal
dumps programs in "Etudes"? Of course, I understand -
space-saving, expensive paper and etc., but that is not for
everyone Like typing program
assembler, and the lesson is quite time consuming. And typing
hex dump of keystrokes decreases (as you calculated)
5-6 times! What time-saving and nerve end-user! However, in the
letter, I do not dump cite, as if you write by hand a bunch of
numbers, you can ponadelat no less a bunch of errors.
Is it possible to return an indication of
length and start address after
subroutines, or at least the length of
(As in ZX REVIEW N1-2 for this
year).
Finally a small request: Is it possible to increase
magazine well, at least on 5-6 pages?
140.
; Window clearer
; By Lazy Max
LD D, 0
; X-coord. upper left corner
LD E, 175
; Y-coord. upper left corner
LD A, 175
SUB E
LD E, A
AND A
RRA
SCF
RRA
AND A
RRA
XOR E
AND 248
XOR E
LD H, A
LD A, D
RLCA
RLCA
RLCA
XOR E
AND 199
XOR E
RLCA
RLCA
LD L, A
LD A, D
AND 7
LD E, A
LD A, 8
SUB E
LD E, A
LD B, A
LD A, 255
GO1 AND A
RLA
DJNZ GO1
LD D, A
PUSH HL
LD HL, BUFF
LD C, (HL)
INC HL
LD B, (HL)
POP HL
REP PUSH HL
PUSH BC
LD A, D
AND (HL)
LD (HL), A
PUSH DE
PUSH BC
LD A, B
SUB E
CP 8
JR C, CNT
AND 248
RRA
RRA
RRA
LD B, A
SUB A
L1 INC HL
LD (HL), A
DJNZ L1
CNT POP BC
LD A, B
SUB E
AND 248
ADD A, E
LD D, A
LD A, B
SUB D
JR Z, PASS
LD B, A
LD A, 255
L2 AND A
RRA
DJNZ L2
INC HL
AND (HL)
LD (HL), A
PASS POP DE
POP BC
POP HL
CALL DLINE
DEC C
LD A, C
AND A
JR NZ, REP
RET
DLINE INC H
LD A, H
AND 7
RET NZ
LD A, L
ADD A, 32
LD L, A
RET C
LD A, H
SUB 8
LD H, A
RET
BUFF DEFB 30,53
, Height, width
Code length: 128.
2
Ed.: Some thoughts on the criticism. In our opinion, the
need for the dump is absolutely no. You've written yourself, do
not you write a core dump, because let us make a lot of
mistakes. Believe me, typing errors will dump less. And on
their search will be spent even more time
than a set of source code. In addition, since these
procedure, you will include in their programs, then, as the
source. A If you do not like the starting address of the code?
So, in our opinion, problems with dumps much more. Now about
the starting address and length. Length will now be possible to
specify, as in the starting address is not necessary - all the
same each proassembliruet under the address that it more
comfortable. I would like to add one more wish to those who
will undertake at the suggestion of Maxim optimize the
procedure. Eliminate the restriction on the coordinate X.
*