Coding - Section for beginner coders.
+===------------=========-----------====+
| CODING... |
+===------======---------======-----====+
X-treamer/Infotek
Section for beginners
encoders.
So, here we are again in our newspaper
this section... And it is intended for those who
I just sat down at the assembler and is trying
write something...
Let's move on to something more complex: using
use of interruptions of the second type. how
known, every 20 milliseconds processor
interrupts the execution of instructions and jumps
refers to a special - “shadow” procedure.
When IM 1(IM 0) is turned on, this will
Procedure at 0038h - polling the keyboard -
ry. But the Z80 allows you to repurpose it.
That is you can write another shadow
procedure, for example, ST player mu-
zone. This can be done in the following way:
zom:
1.Procedureinterrupt reassignment:
DI ;disable interrupts
LD A,DD
LD I,A ;reassign the vector
interrupts (reg. I)
IM 2 ;start interrupts second
;kind.
EI ;enable interrupts
RET
2.At the address DDFF-DEOO (see above reg. A) for-
address of the interruption handling procedure
vaniya. And at this address there will be a problem
A procedure that saves all registers on
stack and calls the op-int procedure, and then
After this, it restores the registers in the
in military order. It looks like this
way:
PUSH BC ;save all registers
PUSH DE ;on stack
PUSH AF
PUSH HL
PUSH IX
PUSH IY
CALL play ;call the player
[CALL...]
[CALL...]
POP IY ;restore all reg.
POP IX ;in reverse order
POP HL ;from stack
POP AF
POP DEROR Sun
JP 0038h ;go to keypad polling
Vasik's nature :).
This is what the program looks like
reassigning interrupts. And now on-
Lastly, the procedure for the double screen effect is
to:
to the address, for example 42240, we load one
screen, and under the address C000h the second screen and
type the following procedure:
LD HL,42240
LD DE,16384
LD VS,6912
LDIR ;Transfer the screen from the buffer.
L1: LD Sun,7FFDh
LD A,23; turn on the first screen
OUT (C), A ;at address 4000h
HALT ;give a delay until int
LD A,31
OUT (C), A; turn on the second screen
HALT
JP L1
END
The dual screen is ready. Now for already
For experienced coders, I suggest the two-equipment effect
rania+pseudo multicolor:
DIL1: LD Sun,7FFDh
LD A,23
OUT (C),A
NOP
: } 7 zeros
NOP
LD A,31
OUT (C),A
NOP
NOP
JP L1
END
And what do you see?! One screen viewing
rushes through the other without blinking!!!
The only thing I couldn't do was
synchronize this effect - lines
slightly oblique. And now the same effect for
border:
D.I.
L1: LD BC,FEH
LD A,1
OUT (C),A
.... - 7 times
LD A,2
OUT (C),A
NOP
NOP
JP L1
ENDThe bands are also poorly synchronized, but
At least they're not going!!!
Well, you've had enough for this number, come on...
let's move on to the next section...
Share your thoughts about the article