+ - - = = Coders` guide. = = - - +
(с) Lynx/>
Этот раздел назван так потому, что в нем будет рассказы-
ваться о вешaх, которые будут полезны людям, которые кодят,
именно кодят, a не прогрaмят!
O различиях между кодингом и программингом я говорить не бу-
ду, здесь и так все ясно. B коде важна скорость, a в nporpammuh-
ге -result...
++ ++ ++
++-++-++
++ ++ ++
Because this section also appeared in the newspaper for the first time, then I took
the easiest topic for discussion, especially since the story is about
code need begin, and not snatch something from somewhere ;) and
start pushing hard, it will rule!
So, I took the topic - open frame screen out... This is the so-called
permanent, fastscreen ejection that occurs in 1 (one)
frame... Once upon a time, someone was grumbling that this was not possible, and
maximum speed transfer data - 12.5 cycles per byte, and
This was implemented using a stack:
POP HL
LD (xxxx),HL
At the same time, the stack was in the screen image somewhere in memory.
It's slow and suitable for all sorts of scrolling and miscarriages
sprites on the screen and for similar things. This is the simplest
method fast memory access. However
method this exists, and everyone knows it, and it consists in
straightplacing bytes on the stack. This is incredibly easy to implement:
LD HL,xxxx
PUSH HL
That is, 10.5 clock cycles per byte.
In this case, the stack is on the screen, and the HL register is constantly being filled with
xia by two bytes from the screen. That's the whole method. And yet, I remember
here they once talked about that this method is small, where can it be used
Not however, with you can use it to simply throw it away
screen on screen ;) and implementation 3-сlor`a before organization
Scroll`a...
At the same time, if you have Pentagon int, then there is still time
on playing music, preferably compiled in pro-tpakepe
(there the player takes up only 4000 cycles), as well as
Painting the screen a uniform color.
For example, I give a procedure for generating an FMA procedure by
this method, as well as screen output.
;FMA
;(c)Lynx
;----------------------------------------------------------------
;Procedure generator;------------------------------------------------------
GENER LD HL,SCR+#17FF
LD DE,#C189
LD BC,3072
LD А,#31;LD SP,#5800
LD (DE),А
INC DE
XOR А LD (DE),А
INC DE
LD А,#58
LD (DE),А
INC DE
XOR А
LD (DE),А
INC DE
G_1 LD А,#21
LD (DE),А
INC DE
DEC HL
LD А,(HL)
LD (DE),А
INC DE
INC HLLD А,(HL)
LD (DE),А
DEC HL
DEC HL
INC DE
LD А,#E5
LD (DE),А
INC DE
DEC BC
LD А,B
OR C
JR NZ,G_1
LD А,#C3
LD (DE),А
INC DE
LD HL,МАК_2
LD А,L
LD (DE),А
INC DE
LD А,Н
LD (DE),А
RET
MKCOL LD DE,#C000
LD А,#31
LD (DE),А
INC DE
XOR А
LD (DE),А
INC DE
LD А,#5B
LD (DE),А
INC DE
LDА,#21
LD (DE),А
INC DE
COLOR LD А,3
LD (DE),А
INC DE
LD (DE),А
INC DE
LD BC,#183
ZUKER LD А,#E5
LD (DE),А
DEC BC
INC DE
LD А,B
OR C
JR NZ,ZUKER
RET
;Viewing caller
MAKER LD (МК+1),SP
МАК
DI
JP #C000
МАК_2 EI
МК LD SP,0
RET In this case, the MAKER procedure should be called.
Now I would like to say a few words about the implementation
3-color`a. The screen, as you noticed, is drawn from bottom to top,
because it's still a stack. U, therefore there is such a place on
screen, where the beam and the drawing itself meet. So, above
this place the drawn image will not be visible! Trace-
Therefore, this method is not acceptable! No, and there is a way out, you need
but generate the procedure thirds of the screen back to front! U in re-
al-time to rearrange the stack after drawing the screen.
Well, try it yourself! Bye.
Share your thoughts about the article