In conclusion - a couple of procedures.
The first procedure is designed to convert a number in
decimal form suitable for printing. At the entrance: the
register HL - the original number. Output: Labeled TABLE memory
has 5 B - tens of thousands, thousands,
hundreds, tens and ones.
To print these cells must be increased to 48. This can be
Request procedure, removing signs
";".
140.
ORG 40000
; Written by Max from 'Cyberax Software'.
DECIMAL LD BC, TABLE
LD DE, 10000
CALL COUNT
LD DE, 1000
CALL COUNT
LD DE, 100
CALL COUNT
LD DE, 10
CALL COUNT
LD A, L
; ADD A, 48
LD (BC), A
RET
COUNT XOR A
LP PUSH HL
SBC HL, DE
JR C, ENDC
INC A
INC SP
INC SP
JP LP
ENDC POP HL
; ADD A, 48
LD (BC), A
INC BC
RET
TABLE DEFS 5
2
The second procedure - the scanner password. You can call it
50 times second, for example, IM 2. On
output if the password is typed, the flag "C".
Password is set with the tags and the PASS
has the following format: Senior
byte of the port, then the mask corresponding to the pressed
key. If the byte mask is set MSB, it means the end of the
password. In this example, the password is a string "ABC".
140.
ORG 40000
; Written by Max from 'CYBERAX SOFTWARE'.
PSW LD A, 0
LD E, 31
AND A
JR NZ, KBSC
CALL KBSC
RET Z
PSWADR LD HL, PASS
LD B, (HL)
INC HL
LD D, (HL)
INC HL
LD (PSWADR +1), HL
LD C, 254
IN A, (C)
AND D
AND E
JR NZ, PSW_INI
IN A, (C)
OR D
CPL
AND E
JR NZ, PSW_INI
BIT 7, D
RET Z
CALL PSW_INI
SCF
RET
KBSC XOR A
IN A, (254)
CPL
AND E
LD (PSW +1), A
RET
PSW_INI LD HL, PASS
LD (PSWADR +1), HL
XOR A
LD (PSW +1), A
RET
PASS DEFB # FD, 1, # 7F, 16, # FE, 8 128
2
Such a program can be implemented in, say, the game code and
use the fact of a set of passwords installation / removal of
immortality at any point in the game.
Appropriate venue for the introduction of a procedure poll
Keys to the game, or routine maintenance IM 2.
*