Strings to hold more ...
Navernoe many of you have experienced
lack of space in a string for output
information: in the line fit 32 characters
standard font (8 * 8). No problema this
relatively easily solvable. In principle,
You can withdraw up to 80 characters per line.
Peculiar standards, whether in
this area are 64 and 42 characters in
line (80 characters per line are used
rarely used because even on a good monitor
parse the text becomes
difficult). So, let us start with
64 characters. In the derivation of 64 characters in
line in each byte is placed on two
64-th symbol font (as against a single byte
32-second), hence a symbol of the 64 th font
must have dimensions of 4 * 8, as in height, he
the same as its thirty-second cousin (actually
the same character given by the matrix 3 * 7, because
right and bottom edges must be free
place, or instead of the text we will see
abstract painting). You can set the font
standard: one character - 8 bytes, ie
the whole font (all 256 characters) will take 2,048
bytes, but can reduce its size in
twice when to use a blank space.
Then, the font will look like this: 2 characters
8 bytes, and the font it only takes 1024 bytes
However, the conclusion it will be difficult. Thus,
count up: we must bring character to the screen
in line length of 64 characters and uzhatom
fonts (ie Fonte in 1024 bytes).
To do this:
1. Compute the address of the symbol in Fonte
2. Compute the output address
3. Print a character
1. Address is quite simple:
define the character code for two, we address
dual matrix, then check for
parity of the character code (which was to
division) - if even then the left half
byte if odd - right.
2. Address output taken from the table
3. This stage is divided into appropriate
two parts, depending on the direction in which
half a byte on the screen, we
output symbol:
a) For the left half.
Odd characters - will not move,
take a byte at the output combine to
logical "and" (AND with a mask% 00001111 -
is that right, we should not change. Take
bytes from the matrix of characters combine to
AND with% 11110000, we combine the logical
"Or" (OR) so that they had received before, and
"GOLD" on the screen.
Even the symbol - it is necessary to combine AND with
% 00001111, shifted left by 4, do
However, with the byte address the conclusion that for
even join in with the previous OR
result, and "put" on the screen.
b) To the right halves.
Same for the left, but it will be necessary
move the left side to right, and mask
display area is% 11110000.
Well, the "Download" I confuse you
theory, it is time to back up her practice.
An example would be protsedurka
that displays the 64th bold text.
0RG # 61A8
LD HL, TABLE; fill the table
LD DE, 0
LD B, 24
CALL ZAPTAB
LD HL, TEXT, and the address of the text in the HL
LD BC, 0; B - Y, C - X koordinta
; In text values
WR_64 PUSH IX; he gave us more useful
WR_64R PUSH BC
LD A, B; offset table
ADD A, A
ADD A, A
ADD A, A
LD E, A
LD D, 0
LD IX, TABLE; find the address on to
; Toromu address is
; Output.
ADD IX, DE
ADD IX, DE
WR_641 LD A, (HL); take the symbol
INC HL
AND A; Zero - the end of the text
JR Z, OUTBTEN
CP 22; AT command
JR Z, WR_6471
CP # 0D; newline
JR Z, WR_64OL
CALL PS_64; conclusion left halves
WR_64N LD A, (HL); take the next character
INC HL
AND A; similarly
JR Z, OUTBTEN
CP 1922
JR Z, WR_6471
CP # 0D
JR Z, WR_64OL
CALL PR_64; withdrawal right halves
INC C; transition into the next byte
; In a row on the screen
JR WR_641; and all the new
WR_64OL POP BC; the following line
INC B
JR WR_64R
OUTBTEN POP BC; end of output
POP IX
RET
WR_6471 POP BC; the transition to an arbitrary
, Position output
LD B, (HL)
INC HL
LD C, (HL)
INC HL
JR WR_64R
; OUT IN LEFT Half BYTE
; A - Character code
; IX - Addresses table OUTPUT
PS_64 PUSH HL; what we need - save
PUSH IX
LD L, A; / 2 * 8 =* 4
SRL L
LD H, 0
ADD HL, HL
ADD HL, HL
ADD HL, HL
LD DE, FONT
ADD HL, DE
EX DE, HL; in DE address of the matrix symbol
SRL A; parity check
LD B, 8, 8 bytes output
JR C, PS_642; odd
LD A, (IX); address display
LD H, (IX +1)
PUSH BC
ADD A, C
LD L, A
PS_641 LD A, (HL); torments of bytes from the screen
AND # 0F
LD C, A
LD A, (DE); torments of bytes
AND # F0
OR C; combine them
LD (HL), A; put on the screen
INC DE
INC H
DJNZ PS_641; repeat
POP BC
POP IX
POP HL
RET
PS_642 LD A, (IX); take the address of the output
LD H, (IX +1)
ADD A, C
PUSH BC
LD L, A
PS_6422 LD A, (DE); select the right piece
AND # 0F
RLA; move to the left
RLA
RLA
RLA
LD C, A
LD A, (HL); but here all the old
AND # 0F
OR C
LD (HL), A
INC DE
INC H
DJNZ PS_6422
POP BC
POP IX
POP HL
RET
; PROCEDURE Output in the right Half of EC; RANNOGO BYTE
; The entrance to A - Character code
; In IX - Addresses table OUTPUT
PR_64 PUSH HL; ALL THE SAME PREDYUSCHEMU
; OCCASION
PUSH IX
PUSH BC
LD L, A
SRL L
LD H, 0
ADD HL, HL
ADD HL, HL
ADD HL, HL
LD DE, FONT
ADD HL, DE
EX DE, HL
SRL A
LD B, 8
JR C, PR_642
LD A, (IX)
LD H, (IX +1)
ADD A, C
LD L, A
PR_641 LD A, (HL); bytes from the screen will
AND # F0; torment
LD C, A
LD A, (DE); even have to move
SRL A
SRL A
SRL A
SRL A
OR C
LD (HL), A; and then it is clear
INC DE
INC H
DJNZ PR_641
POP BC
POP IX
POP HL
RET
PR_642 LD A, (IX)
LD H, (IX +1)
ADD A, C
LD L, A
PR_6422 LD A, (HL); here like everything is clear
AND # F0
LD C, A
LD A, (DE)
AND # 0F
OR C
LD (HL), A
INC DE
INC H
DJNZ PR_6422
POP BC
POP IX
POP HL
RET
; Procedure of filling plates
ZAPTAB LD A, D
LD C, A
AND A
DUP 3
RRCA
EDUP
AND # E0
ADD A, E
EX AF, AF '
LD A, C
AND # 18
OR # 40
EX AF, AF '
LD C, A
EX AF, AF '
DUP 8
LD (HL), C
INC HL
LD (HL), A
INC A
INC HL
EDUP
INC D
DJNZ ZAPTAB
EI
RET
; Output text
TEXT DEFB "Hi Everyone !!!",# 0D, # 0D
DEFB "HELLO TO ALL !!!", 0
And here is the font
FONT INCBIN "A: FONT48a.C"
, But here the table of addresses
TABLE
This procedure takes quite a display
a lot of time, it can significantly accelerate
if you make two sets of characters:
shifted to the left and shifted to the right,
This eliminates the need something somewhere
moving:
ORG # 61A8
CALL RAZPAC; transform one uzhaty
; Font in two decompressed
LD HL, TABLE; similar to the previous
LD DE, 0; case
LD B, 24
CALL ZAPTAB
LD HL, TEXT
LD BC, 0
LD IX, TABLE
WR_64 PUSH IX
WR_64R PUSH BC
LD E, B
LD D, 0
LD IX, TABLE
ADD IX, DE
ADD IX, DE
WR_641 LD A, (HL)
INC HL
AND A
JR Z, OUTBTEN
CP 1922
JR Z, WR_6471
CP # 0D
JR Z, WR_64OL
CALL PS_64
WR_64N LD A, (HL)
INC HL
AND A
JR Z, OUTBTEN
CP 1922
JR Z, WR_6471
CP # 0D
JR Z, WR_64OL
CALL PR_64
INC C
JR WR_641
WR_64OL POP BC
LD A, 8
ADD A, B
LD B, A
JR WR_64R
OUTBTEN POP BC
POP IX
RET
WR_6471 LD B, (HL)
INC HL
LD C, (HL)
INC HL
JR WR_64R
; OUT IN LEFT Half BYTE
; A - Character code
; IX - Addresses table OUTPUT
PS_64 PUSH HL
PUSH IX
LD L, A; divided by 2 is not necessary
LD H, 0
ADD HL, HL
ADD HL, HL
ADD HL, HL
LD DE, FONTL; left half -
; Left font
ADD HL, DE
EX DE, HL
LD A, (IX)
LD H, (IX +1)
PUSH BC
ADD A, C
LD L, A
LD B, 8
PS_641 LD A, (HL); sleight of hand and no
AND # 0F; RRCA
LD C, A
LD A, (DE)
OR C
LD (HL), A
INC DE
INC H
DJNZ PS_641
POP BC
POP IX
POP HL
RET
; PROCEDURE Output in the right Half of EC; RANNOGO BYTE
; The entrance to A - Character code
; In IX - Addresses table OUTPUT
PR_64 PUSH HL
PUSH IX
PUSH BC
LD L, A
LD H, 0
ADD HL, HL
ADD HL, HL
ADD HL, HL
LD DE, FONTR; right half -
ADD HL, DE; right font
EX DE, HL
LD B, 8
LD A, (IX)
LD H, (IX +1)
ADD A, C
LD L, A
PR_6422 LD A, (HL); and did not move
AND # F0
LD C, A
LD A, (DE)
OR C
LD (HL), A
INC DE
INC H
DJNZ PR_6422
POP BC
POP IX
POP HL
RET
, Uncompress FONT PROCEDURE
RAZPAC LD HL, FONT1; original font
LD DE, FONTL; left font
LD BC, # 8000; 128 characters in uzhatom
EXX; Fonte
LD HL, FONTR; right font
LD DE, FONTL +8; next character
LD BC, FONTR +8; next character
EXX
RAZPAC2 LD C, 8, and B is the symbol 8!
RAZPAC1 LD A, (HL); start-with
PUSH AF
AND # F0; left symbol
LD (DE), A
INC DE
EXX
AND A; move
DUP 4
RRCA
EDUP
LD (HL), A; in the right font
INC HL
POP AF
AND # F; right symbol
LD (BC), A; in the trail. symbol of the left
INC BC; font
DUP 4; move
RLCA
EDUP
LD (DE), A; in the trail. symbol of the right
INC DE; font
EXX
INC HL
DEC C
JP NZ, RAZPAC1; decompresses symbol
PUSH HL
LD HL, 8, go to the next
ADD HL, DE; uzhatogo character font
EX DE, HL
POP HL
EXX
LD HL, 8
ADD HL, DE
EX DE, HL
LD HL, 8
PUSH BC
AND A
ADC HL, BC
LD C, L
LD B, H
POP HL
EXX
DJNZ RAZPAC2
RET
; Procedure fills Output Table
ZAPTAB LD A, D
LD C, A
AND A
DUP 3
RRCA
EDUP
AND # E0
ADD A, E
EX AF, AF '
LD A, C
AND # 18
OR # 40
EX AF, AF '
LD C, A
EX AF, AF '
DUP 8
LD (HL), C
INC HL
LD (HL), A
INC A
INC HL
EDUP
INC D
DJNZ ZAPTAB
EI
RET
TEXT DEFB "Hi Everyone !!!",# 0D, # 0D
DEFB "HELLO TO ALL !!!", 0
TABLE
FONT1 INCBIN "A: FONT48a.C"
DEFS 1256
FONTL DEFS # 800
FONTR DEFS # 800
Way, of course, not economical, but
fast. Well, with the 64th fonts to understand, and
on the 42nd Fonte Tell next time.
(C) Trusov Ilya