CREAKING LINE
The program you see
below is none other than herself
running line. The line runs along
one pixel is enough
smoothly and quite slowly,
even for those who are very bad
is literate, although
adjust scrolling speed
You can do it yourself.
In general, the program has been compiled
so that by changing a couple of lines, you
you can move it easily
line to any part of the screen,
We will look at a couple of special cases
below. You can also
use your own
A font, for example made in
graph editor, previously
setting system variables
23606, 23607. You can let in
YOUR CREAKING LINE IS THICK
Font, and if a little more
modify the program, you can
see running symbols double
height.
10 ORG 50000 ;Set the address
placement of object code
equal to 50000. That is, the program
will run from BASIC
operator RAND USR 5E4. A
In general, you can specify the address
any.
15 ADDR EQU 16415 ;Address in
screen area of the end of the running
lines, changing it you can
place a line in any part
screen. In this case the line
will run on the top line
screen.
20 ENT$
30 LD A,0
40 LD (23560),A
;Exit from the ticker
will be carried out when pressing
to anyKEY System
variable 23560 - contains code
the last key pressed and this
the variable in what follows will be
be used, therefore before
upon start of operation it is reset to zero.
50 LD DE,TEXT
;In register DE we enter the address
on which the text is located.
Have just been produced
some initial settings.
Now let's do it ourselves
program. Outer loop
repeats every time
bringing a new character to the end
lines, and it is executed until
for now as another
the symbol will not have a code
zero.
60 NEXT_CHAR
70 LD B,8 ;Quantity
pixel line shifts up to
prints the next character.
80 NEXT_PIXL
100 HALT
;The operator executes
delay while waiting for a call
another masked one
interruptions. If you
dissatisfied with what was offered to you
option: travel speed
lines are too small, or
turn she moves too
quickly, you can fix this
drawback or removing this
line, or by setting empty
cycles accordingly.
110 PUSH BC
;Save the counter
previous cycle.
120 LD HL,ADDR
;This register contains the address
screen area directly
related to line location
on the screen. The address was determined in
line number 15.
130 LD B,8;New cycle starts with
defining a new counter.
The number eight here means that
a line with a height of
eight lines.
140 NEXT_LINE
150 PUSH BC
;Save the counter again
cycle.
160 LD B,31;
Next cycle counter
contains the number of bytes in
one line that will
move.
170 NEXT_BYTE
180 RL (HL)
;Bitwise byte shift
contained at HL.
Each byte point occupies
position to the left. At the same time, the eldest
(leftmost) bit of a byte
goes to the carry flag, and
last flag value
carry goes to the least significant bit
byte. This is how communication is carried out
between bytes without loss
information.
190 DEC HL
;Go to the next byte.
The bytes are counted down
ok as the line moves
in the opposite direction from
counting bytes in screen
areas.
200 DJNZ NEXT_BYTE;
Completion of internal
cycle. And after the register
B will be equal to zero, that is, it will be
shifted 31 bytes or one line,
program execution will be
continue.
210 POP BC
; Counter restoration
cycle
220 INC H ;
230 LD A,31;
240ADD A,L;
250 LD L,A ;
;Thus in four
the previous lines occursadding a number to the HL register
287. In line 220, the most significant byte
register is increased by
unit. For register pair
this will mean an increase by
256, and the screen area address is
written in this register will be
point exactly on one line
below. And in order to get
we add the address of the end of the line
to register the number 31.
260 DJNZ NEXT_LINE ;
;The loop will end
then when by one pixel
all eight lines will advance.
270 POP BC; Recovery
counter,
280 DJNZ NEXT_PIXL ;and
completion of the next cycle,
exit will occur when
the line will move by eight
pixels.
;Here our line has moved
by eight pixels, familiarity in
the end of the line is left blank. And
that's exactly where we need to go
print the next character from
given text and then
continue program execution
already with a new symbol.
290 LD A,(DE) ;Loading in A
code of the next character from
text.
300 OR A
310 RET Z ;If the character is equal
zero, then the end of the text and the end
program execution.
320 PUSH DE; Register DE to us
will be needed in the subroutine
displaying a character on the screen, and in it
contains address information
current letter to be output.
330 LD HL,(23606) ;B HL
load the address of the current font
from the corresponding system
variable.
340 LD B,8 ;Forthcoming
withdrawcharacter eight long
bytes
350 LD D,0
360 LD E,A ;Letter code
written to register DE.
370 RL E
380 RL D
390 RL E
400 RL D
410 RL E
420 RL D
;In lines 370-420
register pair DE three times
multiplied by two, in other words
multiplied by eight. this is
is done so that in pairs
DE was the number denoting
from what byte Font
the given letter begins, and
each character occupies memory
eight bytes.
425 ADD HL,DE; Adding these
we will already receive registers in HL
real location address
character in the font.
430 LD DE,ADDR ; B DE
enter the address of the screen area
showing which place
symbol will be displayed on the screen.
440 NXTBYTCHR
450 LD A,(HL)
460 LD (DE),A ; Shipping
bytes from Font to Screen
area.
470 INC HL ;HL indicates
NEXT byte from Font.
480 INC D ; DE indicates
where the screen will be
output next byte
symbol.
490 DJNZ NXTBYTCHR
;After output is completed
bytes to be checked, not
was any pressed?
KEY and if not, then
program execution
continues from the outer cycle.
500 POP DE ;Recovery
address pointing to the current
symbol from text.510 INC DE ;NEXT character
for printing.
520 LD A,(23560) ; Code
the last key pressed.
530 OR A ; Setting flags
depending on register A.
540 JR Z,NEXT_CHAR ; If
A=0, - none of them was pressed
KEY then go to the beginning
programs.
550 RET ;And the end, in
otherwise.
560 TEXT
570 DEFM "Any text any
output length."
580 DEFB 0 ; A sign of the end
text is code zero.
Now assemble
program and run it with R command
from assembler or RANDOMIZE USR
50000. The line will move to
top line of the screen. In order to
to move a line down
the screen just needs to be changed
line number 15.
15 ADDR EQU 20733
In order for the line
moved more smoothly
you need to do the right one
the string character is invisible, that is
enter the appropriate one there
attribute. From BASIC to
to do this just enter
operator:
PRINT AT N,31;INK 7;" "
N - here is a number
lines.
Now I will offer several
useful program modifications
to get some
effects.
Bold Font. To receive
bold font is enough
add two lines:
455 RLA
456 OR (HL)
Condensed Font. Idea
of this font is
NEXT: The font is compressed behind
accountreducing the distance between
letters.
70 LD B,7
In this case the following
character is printed after
seven pixel scroll
(The width of a regular familiar space is
eight pixels). Thus
You won't achieve much
effect, and for a more compressed
You will have to draw the font
The font itself is smaller and
Decrease the value of register B.
And now some
additions to the program for
doubling the height of the running line.
Next will be the line number
in the program, after which
changes are needed and then
lines without numbers that you
you will have to enter after
the specified line and before
the next line after it.
20
LD HL,23232
LD BC,31
LD DE,23233
LD (HL),7
LDIR
LD HL,23264
LD BC,31
LD DE,23265
LD (HL),5
LDIR
30
LD (23295),A ;Installation
start and end attributes
lines to zero so that
remove visibility
printable character.
LD (23263),A
LD (23232),A
LD (23264),A
120 LD HL,20735
160 LD B,64
230LD A,64
340 LD B,7
430 LD DE,20703
450
RL A
OR(HL)
480
LD A,#57
CP D
JR NZ,CONTLD A,#DF
CP E
JR NZ,CONT
LD DE,20735
JR NXTBYTCHR
CONT INC D
This line runs in characters
double height on black background
in light letters, with the top and
The bottom of the letters have different colors.
Symbols are drawn intermittently
lines, but if you don’t
I liked making the symbols
continuous you can add one
Tstroku:
480
LD(DE),A
In a high ticker
difficult to change coordinates
and colors, so it is recommended
leave the offer
program configuration.
Everything you see before the line
120 is the attribute setting
two bottom lines of the screen. Color
the background will be black and change it
not recommended, but color
top and bottom symbols
halves are different - respectively
7 and 5. You can change them
very simple.
Share your thoughts about the article