PSQQ DEFB #FF,#80,#80,#80,#80,#80,#95,#AA
DEFB #FF,0,0,0,0,0,#55,#AA
DEFB #FF,0,1,2,1,2,#55,#AA
PSS DEFB 0,1,1,2
PSS2 DEFB 0,2
CRC1 DEFW 0 ;[] - crc1
NEWHER LD (HER_N),A ;нов.герой
CALL GET_AD
LD (HER_AD),HL
RET
if 0
GET_AD RLCA ;Взять описатель(MAN+A*32) ->HL
RLCA
RLCA
LD L,A
LD H,0
ADD HL,HL
ADD HL,HL
LD A,MAN/256
ADD A,H
LD H,A
RET
GET_IX CALL GET_AD;То же для IX
PUSH HL
POP IX
RET
endif
GET_DE LD HL,(HER_AD);коорд ->DE
GT_DE_ LD E,(HL)
INC HL
LD D,(HL)
INC HL
RET
;0-x,1-y,2-ЭТАЖ,3-направление,4-Paca,5-наш/не наш,6-VISION,7-N спрайта внизу
;8-имя,9-ранг,10-защита,11-TU,12-EN,13-HEALTH,14-WOUND,15-MORAL,16-Меткость
;(17-20)-ОРУЖИЕ 1-4, (21-24)-патроны 1-4
;25-текущ.оружие, 26-FREEZE
;27-TUold, 28-ENold, 29-HEALTHold, 30-peзерв, 31-MORALold
COMBAT ;****************************** Бой **
; 0-Победа,1-Поражение/Эвакуация
DI
LD SP,COMBATSTACK;#8F7E ;чтобы не было переполн ;TODO проверить
XOR A
LD (PVIS),A
LD (FIRTYP),A
LD (WAREND),A
DEC A
LD HL,#151E
LD (BX),HL
CALL BNEW
CALL PANEL1
CALL LCOUNT
CALL INIHER
CALL isILL
CALL INILOK
;jr $
CALL INIALI
CALL L_ON ;hack
CALL HER1st
CALL CENTR
CALL ALLSPF
CALL PANELM
CALL CLRSET
CALL OUTDSC
; CALL VZLOM
; CALL ENDBAT
CALL C_SAVE ;----
COMB_ CALL BOUT
CALL P_IMG
CALL PNTR
CALL CURHER
CALL OUTDSC
CALL CURHER
CALL POFF
CALL ROTATE
;;;;; CALL EDITOR ;
CALL BMOV
JR C,COMB_1
CALL LOOKER
CALL FIRER
CALL LOOPER
COMB_1 CALL GETZON
CALL ACTION
CALL LOOPER
PANEL1 ;Неизм.изобр.панели
CALL OFFD
CALL STD
LD BC,PSQQ
LD HL,PSS
PUSH HL
LD DE,1
LD A,4
CALL PRINT
POP HL
LD E,25
LD A,4
CALL PRINT
LD DE,#110D
LD HL,PSS2
LD A,2
CALL PRINT
LD L,0
LD A,1
LD DE,#1701
CALL SYMBOL
LD L,1
LD A,26
CALL SYMBOL
LD L,2
LD A,1
CALL SYMBOL
Ms 3+#80
LD HL,0
LD BC,#2018
LD A,#68
CALL ATRBAR
INC H
INC L
LD BC,#1C10
LD A,(COLOR)
CALL ATRBAR
LD HL,29
LD BC,#318
LD A,#72
CALL ATRBAR
LD DE,xPARAM
LD B,6
PN0 PUSH BC
LD BC,#302
CALL PUTSIM
INC H
INC H
LD C,1
LD A,#60
CALL ATRBAR
INC H
EX DE,HL
LD BC,48
ADD HL,BC
EX DE,HL
POP BC
DJNZ PN0
LD BC,#306
LD A,#78
CALL ATRBAR
LD DE,xKEY
LD BC,#C06
LD HL,#1101
CALL PUTSIM
;очистка кнопок
LD DE,23*32+xLABEL
LD HL,#110F
LD B,7
PN4 PUSH BC
LD BC,#202
CALL PUTSIM
POP BC
INC L
INC L
DJNZ PN4
; LD HL,141*256+125 ;цифры на кнопках
; LD DE,FONT+8
; CHN$ XOR_
; LD B,7
;PN4A PUSH BC
; LD BC,#108
; CALL PUTSPR
; LD A,16
; ADD A,L
; LD L,A
; LD A,8
; ADD A,E
; LD E,A
; LD A,0
; ADC A,D
; LD D,A
; POP BC
; DJNZ PN4A
; CALL STD
LD DE,xWBUTTN
LD HL,#130D
LD B,4
PN5 PUSH BC
LD BC,#403
CALL PUTSIM
POP BC
INC L
INC L
INC L
INC L
DJNZ PN5
LD HL,#160D
LD BC,#1001
LD A,#70
CALL ATRBAR
LD A,#FF
CALL SIMBAR
LD HL,#7878
LD (#12*32+#D+DATR),HL
CALL MEM7
CALL COPYAT
JP PT128
SPLDIR Ms 3
LD DE,DSCR ;перенесение спрайта
PUSH DE
LD BC,96
LDIR
POP DE
JP MEM7
INIHER ;иниц.героев
LD HL,MAN ;парам.людей
LD DE,MAN+1
LD BC,#3FF
LD (HL),0
LDIR
LD B,10
LD HL,AQNAVT
LD DE,MAN+8
INH0 PUSH BC
LD BC,3
LDIR
PUSH HL
LD C,10
LDIR
INC HL
INC HL
INC HL
EX (SP),HL
LD A,E
ADD A,6
LD E,A
LD C,5
LDIR
LD A,E
ADD A,8
LD E,A
POP HL
POP BC
DJNZ INH0
LD HL,MAN+17 ;оружие
LD C,10
INH2 LD B,4
INH3 LD A,(HL)
INC HL
PUSH HL
CP 15
JR C,INH41
XOR A
JR INH4
INH41 EXX
LD HL,WEAPON+6
RLCA
CALL DD
EXX
INH4 INC HL
INC HL
INC HL
LD (HL),A
POP HL
DJNZ INH3
LD DE,28
ADD HL,DE
DEC C
JR NZ,INH2
;поз.людей
LD IX,32*9+MAN
XOR A
LD H,A
LD L,A
LD (TX),HL
CALL FLOOR
LD B,10
INL0 LD A,(IX+14) ;болен?
OR A
JR Z,INL0_
LD (IX+8),0 ;мёртв
INL0_ LD A,(IX+8) ;cуществует?
OR A
JR Z,INL1
INL2 CALL NEXTSP
AND #7F
CP 2
JR NZ,INL2
LD (IX+7),2
LD HL,(TX)
LD (IX),L
LD (IX+1),H
LD A,(FLR)
LD (IX+2),A
LD (IX+3),6
LD A,#5F
ADD A,B
CALL PSP
INL1 PUSH DE
LD DE,-32
ADD IX,DE
POP DE
DJNZ INL0
RET
if 0
HERLIV LD A,(IX+8) ;IX-жив? Z-нет
OR A
RET Z
LD A,(IX+13)
OR A
RET Z
CP (IX+26)
RET NC
XOR A
RET
endif
HER1st LD IX,MAN ;взять первого
LD B,0
HS0 CALL HERLIV
JR Z,HS1
LD A,(IX+5)
OR (IX+4)
JR NZ,HS1
LD A,B
JP NEWHER
HS1 LD DE,32
ADD IX,DE
INC B
LD A,B
CP 10
JR C,HS0
XOR A
JP BATRET
NEXTSP EXX
LD HL,(TX);взять след.поле
INC L
LD A,(XMAX)
CP L
JR NC,Nxs
LD L,0
INC H
LD A,(YMAX)
CP H
JR NC,Nxs
LD H,0
LD A,(FLR)
XOR 1
CALL FLOOR
Nxs LD (TX),HL
JP GSP+1
PANELM ;При смене героя(HER_AD-описатель)
LD HL,(HER_AD)
PUSH HL
LD HL,DSCR+#400
LD DE,DSCR+#1400
LD BC,#400
LDIR
CALL STS
CALL MEM7
CALL GUNOUT
LD HL,#5
LD BC,#1401 ;имя
LD A,#71
CALL ATRBAR
CALL STD
LD A,#FF
CALL SIMBAR
POP HL
INC L
INC L
INC L
INC L
LD A,(HL)
INC L
INC L
INC L
INC L
OR A
JR Z,LM78
ADD A,20
JR LM79
LM78 LD A,(HL)
DEC A
LD BC,NAMES
LD (_words),BC
LM79 PUSH HL
LD HL,6
LD (SX),HL
CALL NWRDM
LD HL,WORDS
LD (_words),HL
CALL STS
LD HL,DSCR+6
LD DE,SCR+6
LD B,8
LM77 PUSHs;$
LD BC,19
LDIR
POPs;$
INC H
INC D
DJNZ LM77
POP HL
INC HL
LD E,(HL) ;звание
INC HL
PUSH HL
LD L,72
CALL MULB
LD HL,xSIGN
ADD HL,DE
CALL SPLDIR
LD HL,#121D
LD BC,#303
CALL PUTSIM
POP HL
LD E,(HL) ;защита
INC HL
PUSH HL
LD L,72
CALL MULB
LD HL,xSIGN+576
ADD HL,DE
CALL SPLDIR
LD HL,#151D
LD BC,#303
CALL PUTSIM
LD A,#71
CALL ATRBAR
LD B,6
LD HL,#21D ;парам
LM2 LD (SX),HL
EX (SP),HL
LD A,(HL)
INC HL
EX (SP),HL
CALL WB
INC H
INC H
INC H
DJNZ LM2
POP HL
EXX ;оружие
LD HL,256*156+13
LD B,4
LM3 PUSH BC
EXX
LD A,(HL)
INC HL
EXX
PUSH HL
CP 15
LD HL,xWBUTTN+16
JR NC,LM4
LD E,A
LD L,64
CALL MULB
LD HL,xWEAPON
ADD HL,DE
LM4 CALL SPLDIR
POP HL
LD BC,#410
CALL PUTSCR
LD A,4
ADD A,L
LD L,A
POP BC
DJNZ LM3
EXX
PANG_ PUSH HL
CALL STS ;к-во патронов
LD HL,#160D
LD BC,#401
LM02 LD (SX),HL
EX (SP),HL
LD A,(HL)
INC HL
EX (SP),HL
OR A
JR NZ,LM03
PUSH BC
LD B,3
LD A,#FF
CALL SIMBAR
POP BC
JR LM04
LM03 CALL WB
LM04 INC L
INC L
INC L
INC L
DJNZ LM02
ATRs #130D,#1003,#68;текущ.оружие
EX (SP),HL
LD A,(HL)
AND 3
LD (HL),A
RLCA
RLCA
POP HL
ADD A,L
LD L,A
LD B,4
LD A,#79
CALL ATRBAR
LD DE,DSCR+#400
LD HL,DSCR+#1400
LD BC,#400
LDIR
ATRs #1304,#602,#68
LD A,(FIRTYP) ;тип стрельбы
OR A
JR NZ,LM17
LD L,7
LM17 LD B,3
LD A,#7A
CALL ATRBAR
LD A,14
CALL HER_BA ;F.Wound>0?
OR A
LD L,#60
JR Z,LM18
LD L,#78
LM18 LD H,L
LD (ATR+382),HL
JP LA_OUT ;вокруг враги?
PANELG ;вывод К-ва патронов
LD A,21
CALL HER_BA
CALL MEM7
JP PANG_
BX DEFB 5
BY DEFB 7
BXOLD DEFW 0
BHL DEFW 0
AHL DEFW 0
BIBU DEFS 9
BZON DEFB 0
BCAP DEFB 0
BVIS DEFB 0;0-GR/1-TXT
BIN DEFB #55,#81,1,#81,1,#81,1,#FF
;killablecursorbuf
; ds 9
BOFF ;выкл.курсор
LD HL,(BHL)
inc h
dec h
jr z,BOFF_SKIP
LD DE,BIBU
LD B,8
BO4 LD A,(DE)
LD (HL),A
INC DE
INC H
DJNZ BO4
BOFF_SKIP
LD A,(BIBU+8);(DE)
LD HL,(AHL)
inc h
dec h
jr z,BNEW
LD (HL),A
BNEW XOR A ;предуст.курсора
LD (BHL+1),A
LD (AHL+1),A
DEC A
LD (BXOLD),A
;ld hl,killablecursorbuf
;ld (BHL),hl
;ld (AHL),hl
RET
BOUT CALL MEM7
LD A,#FF
LD (BVIS),A
LD A,(BX)
OR A
JR Z,BO1
CP 29
JR NC,BO1
LD A,(BY)
OR A
JR Z,BO1
CP 17
JR NC,BO1
CALL BOFF
LD HL,#8080
LD (BXOLD),HL
LD BC,(X0) ;gr mrk
LD A,(SH)
OR A
JR NZ,BO8
INC B
BO8 LD A,(BX)
DEC A
SRL A
JR NC,BO2
INC C
BO2 LD E,A
ADD A,C
LD C,A
LD A,B
SUB E
LD D,A
LD A,(BY)
DEC A
LD E,A
ADD A,D
LD (PPY),A
LD A,E
ADD A,C
LD (PPX),A
XOR A
LD (BVIS),A
JP PT128
BO1 CALL STS
LD DE,(BX)
LD HL,(BXOLD)
XOR A
SBC HL,DE
RET Z
PUSH DE
PUSH DE
CALL BOFF
POP DE
LD (BXOLD),DE
CALL SCOORD
LD (BHL),HL
LD DE,BIBU
LD BC,BIN
LD A,8
BO3 EX AF,AF
LD A,(HL)
LD (DE),A
LD A,(BC)
LD (HL),A
INC BC
INC DE
INC H
EX AF,AF
DEC A
JR NZ,BO3
POP HL
LD A,H
RRCA
RRCA
RRCA
LD H,A
AND #E0
ADD A,L
LD L,A
LD A,H
AND 3
ADD A,ATR/256
LD H,A
LD (AHL),HL
LD A,(HL)
LD (BIBU+8),A
LD (HL),#60
LD A,2
CALL DELAY
JP PT128
BSLOW DEFB 2
BMOV ;Перемещ: C-FIRE
LD HL,BSLOW
DEC (HL)
LD BC,#BFFE ;Enter?
IN A,(C)
CPL
AND %1111
JR Z,BMOV_
LD A,(HL)
AND 3
OR A
RET NZ
BMOV_ LD HL,#101
LD (MWINX),HL
CALL CONTR
AND #20 ;Caps || R.butt?
LD E,A
LD BC,#FEFE
IN A,(C)
AND 1
OR E
LD (BCAP),A
LD B,4
BVL PUSH BC
LD A,(CONTRB)
CALL MMOV_
POP BC
DJNZ BVL
PUSH AF
LD A,(MX)
AND %11111000
RRCA
RRCA
RRCA
LD L,A
LD A,(MY)
AND %11111000
RRCA
RRCA
RRCA
LD H,A
LD (BX),HL
POP AF
RET
ROTATE ;скролл поля
LD A,(BX)
OR A
JR NZ,RA1
LD HL,LRT
LD C,%10
CALL MROTAT
JR RA2
RA1 CP 31
LD HL,RRT
LD C,%1
CALL NC,MROTAT
RA2 LD A,(BY)
OR A
LD HL,URT
LD C,%1000
JR Z,MROTAT
CP 23
LD HL,DRT
LD C,%100
CALL NC,MROTAT
RET
MROTAT ;учёт мыши
LD A,(PMOUSE)
OR A
JR NZ,MRO1
LD A,(CONTRB)
AND C
RET Z
MRO1 JP (HL)
LOOPER LD HL,COMB_ ;цикл
EX (SP),HL
RET
GETZON LD HL,(BX) ;НОМЕР ЗОНЫ
LD A,#FF
LD DE,BZON
LD (DE),A
LD A,L
OR A
RET Z
CP 29
RET NC
LD A,H
OR A
RET Z
CP 23
RET NC
CP 17
JR NC,GZ1
XOR A
LD (DE),A
RET
GZ1 LD A,L
CP 13
JR C,GZ2
LD A,H
CP 19
LD A,1
JR C,GZ3
INC A
GZ3 LD (DE),A
RET
GZ2 DEC L
LD A,H
SUB 17
AND #FE
RLCA
LD B,A
LD E,L
LD L,3
CALL DIVB
LD A,E
ADD A,B
ADD A,3
LD (BZON),A
RET
PPX DEFB #80
PPY DEFB #80
PIMG DEFW xMARKER
PVIS DEFB 0
P_AD DEFW 0
P_IMG ;вид 3D курс
LD HL,(PPX)
CALL LIFTYP
CP #FF
JR Z,P_IM0
LD HL,xMARKER+256
P_IMr LD (PIMG),HL
RET
P_IM0 LD A,11
CALL HER_BA
LD HL,(G_TIME)
CP L
JR C,P_IM1
CALL CURGUN
JR NC,P_IM1
LD HL,xMARKER+384
CP 11
JR Z,P_IMr
CP 13
JR NC,P_IMr
CP 5
JR C,P_IM2
CP 7
JR C,P_IMr
P_IM2 LD HL,xMARKER+128
JR P_IMr
P_IM1 LD HL,xMARKER
JR P_IMr
POFF LD HL,PVIS ;Гашен. 3D курс.
LD A,(HL)
OR A
RET Z
DEC (HL)
LD HL,DSCR
LD DE,(P_AD)
LD BC,#40FD
PF0 LDI
LDI
LD A,30
ADD A,E
LD E,A
JR NC,PF1
INC D
PF1 DJNZ PF0
RET
flashP DEFB 0 ;мигать,если чел.
PNTR LD A,(BVIS) ;выв.3D курс
OR A
RET NZ
CALL CANFIR ;возм. стрельбы
CALL CANF_V
LD HL,(PPX)
LD (TX),HL
CALL GSP60
JR C,PNT5
SUB #60
CALL GET_AD
LD A,6
ADD A,L
LD L,A
LD A,(HL)
OR A
JR NZ,PNT5
LD HL,flashP
INC (HL)
BIT 2,(HL)
RET Z
PNT5 CALL INFR
RET NC
LD A,1
LD (PVIS),A
CALL XYHL
LD BC,DSCR+129
ADD HL,BC
LD (P_AD),HL
LD DE,DSCR
LD BC,#40FD
PTN0 LDI
LDI
LD A,30
ADD A,L
LD L,A
JR NC,PTN1
INC H
PTN1 DJNZ PTN0
LD A,(FLR)
OR A
JR NZ,PNTR_
INC A
CALL FLOOR
LD HL,(PIMG)
PUSH HL
LD HL,xMARKER
LD (PIMG),HL
CALL PNTR_
XOR A
CALL FLOOR
LD HL,(PPX)
INC H
INC H
INC H
INC L
INC L
INC L
LD (TX),HL
CALL PXY
POP HL
LD (PIMG),HL
PNTR_ CALL NORM_V
LD HL,(PPX)
LD (TX),HL
CALL INFR
RET NC
Ms 3
CALL XYHL
LD BC,DSCR+129
ADD HL,BC
LD (TXT),HL
LD DE,(PIMG)
LD B,#20
PUSH HL
CALL BSP
LD HL,TY
INC (HL)
POP HL
LD A,L
SUB 16
LD L,A
CALL PT128
JP PNE_
INFR LD HL,(X0)
LD A,(TX)
SUB L
LD L,A
LD A,(TY)
SUB H
LD H,A
ADD A,L
LD E,A
CP 39
RET NC
LD A,(SH)
OR A
LD A,L
JR NZ,IF2
INC A
IF2 SUB H
LD D,A
CP 29
RET
XYHL XOR A
LD H,E
SRL H
RRA
ADD A,D
LD L,A
RET
RELAX CALL INFR;вывод изобр. перед 3D спр.
RET NC
CALL XYHL
LD DE,DSCR+129
ADD HL,DE
LD (TXT),HL
CALL ASP
CALL MSP
LD HL,TY
INC (HL)
JP PNE_
PXYF LD A,(FLR) ;в 2 этажа
OR A
JR NZ,PXY
INC A
CALL FLOOR
LD HL,(TX)
PUSH HL
DEC H
DEC H
DEC H
DEC L
DEC L
DEC L
LD (TX),HL
CALL PXY
XOR A
CALL FLOOR
POP HL
LD (TX),HL
PXY CALL INFR ;выв. 3D спр.(TX,TY)
RET NC
CALL XYHL
LD DE,DSCR+129
ADD HL,DE
LD (TXT),HL
LD A,(TX)
SUB 4
LD (TX),A
LD A,(TY)
SUB 3
LD (TY),A
LD HL,112
LD BC,#404
PX1 PUSH HL
CALL ASP
ADD HL,DE
EX DE,HL
LD HL,(TXT)
CALL RSPB
LD HL,TX
INC (HL)
INC HL
DEC (HL)
CALL ASP
POP HL
PUSH HL
ADD HL,DE
EX DE,HL
LD HL,(TXT)
INC L
CALL LSPB
LD HL,TY
INC (HL)
INC B
INC B
INC B
INC B
CALL ASP
POP HL
LD A,L
SUB 16
LD L,A
PUSH HL
ADD HL,DE
EX DE,HL
LD HL,(TXT)
PNE CALL BSP
LD HL,TY
INC (HL)
POP HL
INC B
INC B
INC B
INC B
LD A,L
SUB 16
LD L,A
DEC C
JR NZ,PX1
PNE_ LD B,28
PX2 LD HL,(TXT)
LD DE,128
ADD HL,DE
LD (TXT),HL
CALL ASP
CALL RSPB
LD HL,TX
INC (HL)
INC HL
DEC (HL)
LD HL,(TXT)
INC L
CALL ASP
CALL LSPB
LD HL,TY
INC (HL)
DEC B
DEC B
DEC B
DEC B
RET Z
LD HL,(TXT)
LD DE,128
ADD HL,DE
LD (TXT),HL
CALL ASP
CALL BSP
LD HL,TY
INC (HL)
DEC B
DEC B
DEC B
DEC B
RET Z
JR PX2
CENTR CALL GET_DE
CENTR_ LD A,(HL)
CALL FLOOR
CENTRg LD A,D
SUB 2
LD D,A
LD A,E
SUB 16;15
LD E,A
LD (X0),DE
RET
C_MRK DEFB #70,#07,#40,#01,#40,#01
DEFB #40,#01,#40,#01,#70,#07
flashC DEFB #FF
CURHER ;указат.тек.героя
LD HL,flashC
INC (HL)
BIT 1,(HL)
RET NZ
CALL GET_DE
LD A,(FLR)
CP (HL)
RET NZ
LD (TX),DE
CALL INFR
RET NC
CALL XYHL
LD BC,DSCR+193
ADD HL,BC
LD DE,C_MRK
CALL CMR_
LD BC,704
ADD HL,BC
LD DE,C_MRK+6
CMR_ LD BC,#203
CMR1 PUSH BC
CMR0 LD A,(DE)
XOR (HL)
LD (HL),A
INC HL
INC DE
DJNZ CMR0
LD BC,30
ADD HL,BC
POP BC
DEC C
JR NZ,CMR1
RET
XW DEFB 0 ;угол окна трасс.
YW DEFB 0
WSTART DEFW 0 ;нач
WSTOP DEFW 0 ;кон
TSTART DEFW 0
WSTEP DEFB 0 ;N итер
XY2TRC ;преобр.коорд
LD DE,(XW)
LD A,H
SUB D
LD H,A
LD A,L
SUB E
RLA
RLA
RLA
SRL H
RRA
SRL H
RRA
SRL H
RRA
LD L,A
LD DE,DSCR
ADD HL,DE
RET
TRACE1 ;волновой трассировщик (oт DE до HL)
;253-X(непрох.),254-O(проходимо),0-start,255/<250>-end
LD (WSTART),DE
LD (WSTOP),HL
LD A,L ;опр. угла поля тр.
ADD A,30
SUB E
CP 60 ;не дальше 30 шагов
JR NC,CWBD1
SRL A
SUB 31
ADD A,E
LD L,A
LD A,H ;опр. угла поля тр.
ADD A,30
SUB D
CP 60 ;не дальше 30 шагов
CWBD1 JP NC,CWBD
SRL A
SUB 31
ADD A,D
LD H,A
LD (XW),HL
LD HL,DSCR ;очст
LD DE,DSCR+1
LD BC,#3FF
LD (HL),253
LDIR
LD HL,DSCR+33;cост.карты
LD DE,(XW)
INC E
INC D
LD C,30
TW1 LD B,30
PUSH DE
TW2 PUSH HL
LD (TX),DE
CALL GSP
AND #7F
;; CP #60
;; JR NC,TW5
LD L,A
LD H,xATR/256
LD A,254
BIT 5,(HL)
JR NZ,TW4
DEC A
;; JR TW4
;TW5 SUB #60
;; CALL GET_IX
;; CALL HERLIV
;; LD A,254
;; JR Z,TW4
;; DEC A
TW4 POP HL
LD (HL),A
INC HL
INC E
DJNZ TW2
POP DE
INC D
INC HL
INC HL
DEC C
JR NZ,TW1
LD HL,(WSTOP)
CALL XY2TRC
XOR A
LD (HL),A
LD (WSTEP),A
LD HL,(WSTART)
CALL XY2TRC
LD (TSTART),HL
LD (HL),255
;волна
LD D,0
CW0 LD E,28
LD HL,DSCR+66
CW1 LD BC,28
CW2 ;CALL HH
LD A,D
CPIR
JR NZ,CW4
PUSH AF
PUSH HL
PUSH BC
CALL CW254
DEC HL
DEC HL
CALL CW254
LD BC,-31
ADD HL,BC
CALL CW254
LD BC,64
ADD HL,BC
CALL CW254
POP BC
POP HL
POP AF
CW4 JP PE,CW2
LD BC,4
ADD HL,BC
DEC E
JR NZ,CW1
INC D
LD A,64 ;К-во итер
CP D
JR NC,CW0
CWBD SCF ;BAD-C
RET
CW254 LD A,(HL) ;Cлед.волна
CP 254
JR Z,CW254_
RET C
POP HL ;OK-NC
POP HL
POP HL
POP HL ;бывший af!!!
;LD (HL),250
RET
CW254_ LD A,D ;фаза волны 0..64
INC A
LD (HL),A
RET
TD0 EQU DATR
TRACE2 ;нахожд. маршрута
LD HL,(TSTART)
LD DE,DATR+765
PUSH DE
TR2B ;назад на шаг
PUSH DE
PUSH HL
LD DE,-33
ADD HL,DE
LD DE,TD0
LD B,3
RBT1 PUSH BC
LD BC,3
LDIR
LD BC,29
ADD HL,BC
POP BC
DJNZ RBT1
POP HL
LD E,#F0;E-мин.знач,D-напр
RB7 LD A,(TD0+1)
CP 253
JR Z,RB3
LD A,(TD0+3)
CP 253
JR Z,RB5
LD A,(TD0+0)
CP E
JR NC,RB5
LD E,A
LD D,3
LD BC,-33
RB5 LD A,(TD0+5)
CP 253
JR Z,RB1
LD A,(TD0+2)
CP E
JR NC,RB3
LD E,A
LD D,1
LD BC,-31
RB3 LD A,(TD0+7)
CP 253
JR Z,RB6
LD A,(TD0+5)
CP 253
JR Z,RB1
LD A,(TD0+8)
CP E
JR NC,RB1
LD E,A
LD D,7
LD BC,33
RB1 LD A,(TD0+3)
CP 253
JR Z,RB6
LD A,(TD0+6)
CP E
JR NC,RB6
LD E,A
LD D,5
LD BC,31
RB6 LD A,(TD0+1)
CP E
JR NC,RB0
LD E,A
LD D,2
LD BC,-32
RB0 LD A,(TD0+3)
CP E
JR NC,RB4
LD E,A
LD D,4
LD BC,-1
RB4 LD A,(TD0+5)
CP E
JR NC,RB2
LD E,A
LD D,0
LD BC,1
RB2 LD A,(TD0+7)
CP E
JR NC,RBN
LD E,A
LD D,6
LD BC,32
RBN ADD HL,BC
LD A,D
LD C,E
POP DE
LD (DE),A
DEC DE
LD A,C
OR A
JP NZ,TR2B
CPL
LD (DE),A
POP DE
RET
VBYT EQU DSCR+512
isLOOK DEFB 0;1-были изм. из LOOK
;+X(#85) -X(#95)
;+Y(#84) -Y(#94)
LOOKT DEFW #8584,#9584,#9485,#9495,#9594,#8594,#8495,#8485
LOOKSH DEFB #24,#25,#2C,#2D,#25,#24,#2D,#2C
LOOK ;просмотр
CALL GET_DE
LD A,(HL)
PUSH AF
CALL FLOOR
POP AF
INC HL
OR A
LD A,(HL)
LOOK_ JR Z,LOOKF ;DE-pos A-dir Z/NZ-floor 2/1
PUSH DE
PUSH AF
XOR A
CALL FLOOR
LD (TX),DE
CALL GSP
AND #7F
JR NZ,LOOKf
POP AF
PUSH AF
CALL LOOKF
LOOKf LD A,1
CALL FLOOR
POP AF
POP DE
LOOKF PUSH AF
CALL LOOK1
POP AF
INC A
AND 7
LOOK1 PUSH AF
LD HL,LOOKSH
CALL BA
LD (LOMSH),A
POP AF
LD HL,LOOKT
CALL WT
LD A,L
LD (LOMX),A
LD A,H
LD (LOMY),A
;просмотр 1 сект
PUSH DE
LD HL,VBYT
LD (HL),1
INC HL
LD (HL),0
LD DE,VBYT+2
LD BC,110
LDIR
POP DE
LD BC,VBYT+1
LD HL,VTAB+2
LOM1 PUSH BC
LD A,(HL)
INC HL
LD C,(HL)
INC HL
PUSH HL
LD HL,VBYT
CALL BA
OR A
JR Z,LOM2
LD A,C
AND #F
LD L,A
LD A,C
RLCA
RLCA
RLCA
RLCA
AND #F
LD H,A
LD A,D
LOMY ADD A,H
LD C,A
LD A,E
LOMX ADD A,L
LD L,A
LD H,C
LD (TX),HL
CALL GSP
CP #80
JR C,LOM7
LD (isLOOK),A
AND #7F
LOM7 CP 2
JR C,LOMSH
EXX
LD (HL),A
CP #60
CALL NC,LOKMAN
LD L,A
LD H,xATR/256
LD A,(HL)
EXX
RLA
JR NC,LOM2
LOMSH INC L
LD (TX),HL
CALL GSP
CP #80
JR C,LOM8
LD (isLOOK),A
AND #7F
LOM8 CP 2
JR C,LOM2_
EXX
LD (HL),A
CP #60
CALL NC,LOKMAN
EXX
LOM2_ POP HL
POP BC
LD A,1
LD (BC),A
JR LOM4
LOM2 POP HL
POP BC
LOM4 INC C
LD A,104
CP C
JR NC,LOM1
RET
LOKMAN ;очистка поля, если персонаж
SUB #60
CALL GET_AD
LD A,7
CALL BA
RES 7,(HL)
LD A,#60
RET
if 0
NORM_V LD A,#AA ;вкл.норм.отобр
LD (Ainv1),A
LD (Ainv2),A
LD (Ainv3),A
LD (Ainv4),A
RET
endif
HT DEFW DSP0,DSP2,DSP4,DSP6
HERO PUSH HL;Выв.героя со сдвигом-A:0-3
LD HL,HT
CALL WT
LD (HE1+1),HL
LD (HE1+4),HL
Ms 4+#C0
POP HL
CALL GBU
LD B,24
HE1 CALL 15635
CALL 1010
LD A,30
ADD A,L
LD L,A
JR NC,HE2
INC H
HE2 DJNZ HE1
JP PT128
DSP4 LD A,(DE)
INC DE
RLCA
RLCA
RLCA
RLCA
LD C,A
AND %1111
OR (HL)
LD (HL),A
LD A,C
AND #F0
INC HL
OR (HL)
LD (HL),A
DEC HL
LD A,(DE)
INC DE
RRCA
RRCA
RRCA
RRCA
LD C,A
AND #F
XOR (HL)
LD (HL),A
LD A,C
AND #F0
INC HL
XOR (HL)
LD (HL),A
RET
DSP2 LD A,(DE)
INC DE
RRCA
RRCA
LD C,A
AND #3F
OR (HL)
LD (HL),A
LD A,C
AND #C0
INC HL
OR (HL)
LD (HL),A
DEC HL
LD A,(DE)
INC DE
RRCA
RRCA
LD C,A
AND #3F
XOR (HL)
LD (HL),A
LD A,C
AND #C0
INC HL
XOR (HL)
LD (HL),A
RET
DSP6 LD A,(DE)
INC DE
RLCA
RLCA
LD C,A
AND %11
OR (HL)
LD (HL),A
LD A,C
AND #FC
INC HL
OR (HL)
LD (HL),A
DEC HL
LD A,(DE)
INC DE
RLCA
RLCA
LD C,A
AND #3
XOR (HL)
LD (HL),A
LD A,C
AND #FC
INC HL
XOR (HL)
LD (HL),A
RET
DSP0 LD A,(DE)
INC DE
OR (HL)
LD (HL),A
LD A,(DE)
INC DE
XOR (HL)
LD (HL),A
INC HL
RET
GET_XY LD L,(IX) ;текущ.коорд
LD H,(IX+1)
RET
NXtXY DEFW #2C00,#2C25,#0025,#2D25,#2D00,#2D24,#0024,#2C24
;+X(#2C) -X(#2D) +Y(#24) -Y(#25)
NEXTXY LD A,(IX+3) ;след.коорд
LD HL,NXtXY
CALL WT
LD (NEXXY),HL
CALL GET_XY
NEXXY DEC L
DEC H
RET
PHASE DEFB 0
HERMOV LD C,A ;передв. акв. (С-поворот)
LD A,(PHASE)
OR A
JR NZ,MOV4
LD IX,(HER_AD)
LD A,(IX+3)
LD D,A
CP C
JR Z,MOV1
SUB C
AND 7
CP 4
LD A,D
JR NC,MOV2
DEC A
JR MOV3
MOV2 INC A
MOV3 AND 7
LD (IX+3),A
MOV6 CALL GET_XY
LD (TX),HL
CALL PXYF
SCF
RET
MOV1 CALL GET_XY ;чел вых
PUSH HL
CALL NEXTXY
CALL DOOR
LD (IX),L
LD (IX+1),H
POP HL
LD A,(IX+7)
AND #7F
LD (TX),HL
CALL PSP
CALL PXYF
LD A,4
LD (PHASE),A
MOV4 CALL GET_XY
LD (TX),HL
LD HL,PHASE
DEC (HL)
LD A,(HL)
OR A
JR NZ,MOV7
CALL GSP
LD (IX+7),A
LD A,(HER_N)
ADD A,#60
CALL PSP
CALL PXYF
XOR A
RET
MOV7 CALL INFR
CCF
RET C
CALL XYHL
LD (TXT),HL
LD A,(PHASE)
AND 1
LD C,(IX+3)
ADD A,C
ADD A,C
CALL M96
LD A,(IX+4)
RLCA
LD C,A
RLCA
ADD A,C
ADD A,H
LD H,A
LD DE,xHERO
ADD HL,DE
EX DE,HL
LD A,(IX+3)
LD C,A
RLCA
ADD A,C
LD C,A
LD A,(PHASE)
DEC A
ADD A,C
PUSH AF
LD HL,xROT
CALL BA
EX AF,AF
POP AF
LD HL,xDHL
CALL WT
LD BC,DSCR+257
ADD HL,BC
LD BC,(TXT)
ADD HL,BC
EX AF,AF
CALL HERO
LD A,(IX+3)
LD HL,xRELT
CALL WT
LD (CREL+1),HL
CALL GET_XY
CREL CALL #3D13
SCF
RET
xDHL DEFW -33,-65,-97,-1,-1,-2,31,63,95,64,128,192
DEFW 32,64,96,0,1,1,-32,-64,-96,-64,-128,-192
xROT DEFB 3,2,1,2,0,2,3,2,1,0,0,0,1,2,3,2,0,2,1,2,3,0,0,0
xRELT DEFW XR1,XR3A,XR2A,XR2B,XR1A,XR3,XR2,XR1
XR1A INC L
XR1 INC L
CALL RELA
DEC L
INC H
CALL RELA
DEC L
JR RELA
XR2B INC L
XR2A INC H
XR2 INC H
CALL RELA
DEC H
INC L
CALL RELA
DEC H
RELA LD (TX),HL
PUSH HL
CALL RELAX
POP HL
RET
XR3A INC H
DEC L
XR3 INC H
CALL RELA
DEC H
INC L
CALL RELA
DEC H
INC L
JR RELA
GB_AD DEFW 0
GBU PUSH HL
PUSH DE
LD (GB_AD),HL ;сохр.изобр.при передвиж
LD DE,DATR+128
LD A,24
GBU1 LDI
LDI
LDI
LD BC,29
ADD HL,BC
DEC A
JR NZ,GBU1
POP DE
POP HL
RET
PBU LD DE,(GB_AD) ;восст
LD A,D
OR A
RET Z
XOR A
LD (GB_AD+1),A
LD HL,DATR+128
LD A,24
PBU1 LDI
LDI
LDI
EX DE,HL
LD BC,29
ADD HL,BC
EX DE,HL
DEC A
JR NZ,PBU1
RET
DECPAR ;уменьшить время(D) и энергию(E);C-нехватает
; XOR A
; RET
CALL MEM7
LD IX,(HER_AD)
BIT 0,(IX+5)
EX AF,AF
LD A,(IX+11)
SUB D
JR C,NOTU
LD D,A
LD A,(IX+12)
SUB E
JR C,NOEN
LD (IX+12),A
LD (IX+11),D
EX AF,AF
JR NZ,DCP2
EX AF,AF
LD HL,#51D
LD (SX),HL
CALL WB
LD A,D
LD HL,#21D
LD (SX),HL
CALL WB
DCP2 CALL PT128
XOR A
RET
NOTU EX AF,AF
JR NZ,DCP0
LD HL,#1D
JR DCP3
NOEN EX AF,AF
JR NZ,DCP0
LD HL,#31D
DCP3 LD B,6
LD C,#55
DCPL PUSH BC
LD B,3
DCPP CALL E_I
DJNZ DCPP
LD A,C
LD BC,#302
CALL ATRBAR
POP BC
LD A,C
XOR #27
LD C,A
DJNZ DCPL
DCP0 CALL PT128
SCF
RET
DOOR ;LD A,1
;LD (isMVIS),A
DOOR_ PUSH HL
LD (TX),HL ;откр дверь
CALL ATSP
AND %11100
CP %100
JR NZ,door2
CALL GSP60
PUSH AF
door3 CALL GSP
PUSH AF
AND #7F
LD HL,xCONV
CALL BA
LD L,A
POP AF
AND #80
OR L
CALL PSP
CALL PXYF
;LD A,(isMVIS)
;OR A
;JR Z,doorN
LD A,7
CALL DELAY
CALL OUTDSA
doorN POP AF
POP HL
PUSH HL
PUSH AF
LD (TX),HL ;откр дверь
CALL ATSP
AND %11100
CP %100
JR Z,door3
CALL SET_AD ;зап поз дв
LD DE,(TX)
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(FLR)
LD (HL),A
INC HL
CALL GSP60
LD (HL),A
INC HL
POP AF
LD (HL),A
door2 POP HL
RET
;(C) 1995 MEDNONOGOV
;таблица просмотра сектора (45гр.,R=16) (N_PRED,#dYdX)
VTAB DEFB 0,0 ;0
DEFB 0,#10
DEFB 0,#11
DEFB 1,#20
DEFB 2,#21
DEFB 2,#22
DEFB 3,#30
DEFB 3,#31
DEFB 6,#40
DEFB 6,#41
DEFB 4,#32
DEFB 5,#33
DEFB 8,#50
DEFB 9,#51
DEFB 7,#42
DEFB 10,#43
DEFB 11,#44
DEFB 12,#60
DEFB 13,#61
DEFB 14,#52
DEFB 15,#53
DEFB 16,#54
DEFB 17,#70
DEFB 18,#71
DEFB 19,#62
DEFB 19,#63
DEFB 20,#64
DEFB 16,#55
DEFB 22,#80
DEFB 23,#81
DEFB 24,#72
DEFB 25,#73
DEFB 26,#74
DEFB 21,#65
DEFB 27,#66
DEFB 28,#90 ;35
DEFB 29,#91
DEFB 30,#82
DEFB 31,#83
DEFB 32,#84
DEFB 26,#75
DEFB 33,#76
DEFB 34,#77
DEFB 35,#A0
DEFB 35,#A1
DEFB 36,#A2
DEFB 37,#92
DEFB 38,#93
DEFB 39,#94
DEFB 39,#95
DEFB 40,#85
DEFB 41,#86
DEFB 42,#87
DEFB 42,#88
DEFB 43,#B0
DEFB 44,#B1
DEFB 45,#B2
DEFB 46,#A3
DEFB 47,#A4
DEFB 48,#A5
DEFB 49,#A6
DEFB 50,#96
DEFB 51,#97
DEFB 52,#98
DEFB 53,#99
DEFB 54,#C0
DEFB 55,#C1
DEFB 56,#C2
DEFB 57,#B3
DEFB 58,#B4
DEFB 59,#B5 ;70
DEFB 60,#B6
DEFB 61,#A7
DEFB 62,#A8
DEFB 63,#A9
DEFB 65,#D0
DEFB 66,#D1
DEFB 67,#D2
DEFB 68,#C3
DEFB 69,#C4
DEFB 70,#C5
DEFB 72,#B7
DEFB 72,#B8
DEFB 73,#B9
DEFB 64,#AA
DEFB 75,#E0
DEFB 76,#E1
DEFB 77,#E2
DEFB 78,#D3
DEFB 79,#D4
DEFB 79,#D5
DEFB 71,#C6
DEFB 71,#C7
DEFB 81,#C8
DEFB 74,#BA
DEFB 85,#F0
DEFB 86,#F1
DEFB 87,#F2
DEFB 77,#E3
DEFB 88,#E4
DEFB 89,#E5
DEFB 80,#D6
DEFB 91,#D7
DEFB 82,#C9 ;103
INILOK LD B,32 ;просмотр перед новым ходом
ILL1 PUSH BC
LD A,B
DEC A
CALL NEWHER
LD IX,(HER_AD)
CALL HERLIV
JR Z,ILL2
CALL MANALI
JR NZ,ILL2
CALL GET_DE
LD A,(HL)
CALL FLOOR
CALL LOOKS
ILL2 POP BC
DJNZ ILL1
RET
;=============================================
cBOOM DEFB 00,#00 ;распространение взрыва (2/20,3/36,4/56,6/120)
DEFB 00,#10 ;(C)1996 Медноногов В.С.
DEFB 00,#01
DEFB 00,#F0
DEFB 00,#0F
DEFB 00,#11
DEFB 00,#F1
DEFB 00,#FF
DEFB 00,#1F
DEFB 01,#20
DEFB 02,#02
DEFB 03,#E0
DEFB 04,#0E
DEFB 05,#21
DEFB 06,#F2
DEFB 07,#EF
DEFB 08,#1E
DEFB 05,#12
DEFB 06,#E1
DEFB 07,#FE
DEFB 08,#2F
DEFB 10,#03
DEFB 11,#D0
DEFB 12,#0D
DEFB 09,#30
DEFB 10,#F3
DEFB 11,#DF
DEFB 12,#1D
DEFB 09,#31
DEFB 11,#D1
DEFB 12,#FD ;30
DEFB 09,#3F
DEFB 10,#13
DEFB 06,#E2
DEFB 07,#EE
DEFB 08,#2E
DEFB 05,#22
DEFB 22,#C0
DEFB 23,#0C
DEFB 24,#40
DEFB 21,#04
DEFB 25,#F4
DEFB 14,#E3
DEFB 18,#D2
DEFB 29,#C1
DEFB 26,#CF
DEFB 15,#DE
DEFB 19,#ED
DEFB 30,#FC
DEFB 27,#1C
DEFB 16,#2D
DEFB 20,#3E
DEFB 31,#4F
DEFB 28,#41
DEFB 13,#32
DEFB 17,#23
DEFB 32,#14
DEFB 40,#05
DEFB 41,#F5
DEFB 42,#E4
DEFB 33,#D3 ;60
DEFB 43,#C2
DEFB 44,#B1
DEFB 37,#B0
DEFB 45,#BF
DEFB 46,#CE
DEFB 34,#DD
DEFB 47,#EC
DEFB 48,#FB
DEFB 38,#0B
DEFB 49,#1B
DEFB 50,#2C
DEFB 35,#3D
DEFB 51,#4E
DEFB 52,#5F
DEFB 39,#50
DEFB 53,#51
DEFB 54,#42
DEFB 36,#33
DEFB 55,#24
DEFB 56,#15
DEFB 57,#06
DEFB 58,#F6
DEFB 41,#E5
DEFB 59,#D5
DEFB 42,#D4
DEFB 60,#C4
DEFB 43,#C3
DEFB 61,#B3
DEFB 44,#B2
DEFB 62,#A1 ;90
DEFB 63,#A0
DEFB 64,#AF
DEFB 45,#BE
DEFB 65,#BD
DEFB 46,#CD
DEFB 66,#CC
DEFB 47,#DC
DEFB 67,#DB
DEFB 48,#EB
DEFB 68,#FA
DEFB 69,#0A
DEFB 70,#1A
DEFB 49,#2B
DEFB 71,#3B
DEFB 50,#3C
DEFB 72,#4C
DEFB 51,#4D
DEFB 73,#5D
DEFB 52,#5E
DEFB 74,#6F
DEFB 75,#60
DEFB 76,#61
DEFB 53,#52
DEFB 77,#53
DEFB 54,#43
DEFB 78,#44
DEFB 55,#34
DEFB 79,#35
DEFB 56,#25
DEFB 80,#16 ;120
DEFB 0,0
isILL ;больные
LD B,10
LD IX,MAN
LD DE,32
WSI LD A,(IX+14)
OR A
JR Z,WSJ
LD (IX+8),0
WSJ ADD IX,DE
DJNZ WSI
RET
TO_INT ;поcадка в истр
LD IX,MAN
LD IY,AQNAVT
LD B,10
NI1 LD A,(IY+6) ;не был в бою
OR A
JR NZ,NI7
LD A,(IX+4) ;жив?
OR A
JR NZ,N_dead
LD A,(IX+8)
OR A
JR Z,N_dead
LD A,(IX+13)
OR A
JR NZ,NI2
N_dead LD A,(IY)
OR A
JR Z,NI2
LD (IY),0
LD HL,AQU
DEC (HL)
NI2 LD A,(IX+14) ;F.Wound
LD (IY+6),A
LD A,(IX+26) ;Freez
OR A
JR Z,NI3
INC (IY+6)
INC (IY+6)
NI3 LD C,(IX+17) ;Guns
LD (IY+9),C
LD C,(IX+18)
LD (IY+10),C
LD C,(IX+19)
LD (IY+11),C
LD C,(IX+20)
LD (IY+12),C
LD A,(BATRES)
CP 2
JR C,NI7
LD A,7
SUB (IX+9)
RLCA
RLCA
RLCA ;(56/256..8/256)
LD C,A
CALL RND ;уменьш вр до зв в случ победы
CP C
JR NC,NI7
CALL RND
AND 1
INC A
LD (IY+13),A
NI7 LD DE,16
ADD IY,DE
LD E,32
ADD IX,DE
DJNZ NI1
RET
CRC4 DEFB 0;[]
PICK ;сбор артеф во времен хран
LD IX,ALIEN
LD DE,32
LD B,22
PIK1 LD A,(IX+8)
OR A
JR Z,PIKK
;оружие
LD C,17
PIK0 LD A,C
LD (PIKX+2),A
PIKX LD A,(IX+17)
CP 15
JR NC,PIK2
LD HL,U_GUN
CALL BA
INC (HL)
PIK2 INC C
LD A,C
CP 21
JR C,PIK0
;тела/живьём
LD A,(IX+13)
OR A
JR NZ,PIKLI
PIKDI LD HL,U_ART+9
JR PIK3
PIKLI LD A,(IX+4)
CP 2
JR NZ,PIK4
LD A,(RS+22) ;дайп?
OR A
JR NZ,PIKDI
LD A,2
PIK4 LD HL,U_LIV-1
CALL BA
PIK3 INC (HL)
PIKK ADD IX,DE
DJNZ PIK1
;корпуса
LD A,(L_LAND)
PUSH AF
OR A
JR NZ,PIK6
LD HL,U_ART+8
INC (HL)
PIK6 POP AF;зербайт
OR A
JR Z,PIKz
CP 5
RET C
CP 10
RET NC
CP 7
RET Z
LD A,30
PIKz ADD A,30
LD C,A
CALL RND
CPL
AND 7
JR NZ,PIK7
LD A,C
LD (U_ART+7),A
PIK7 ;артефакты
LD C,16
LD HL,U_ART
PIKAA LD DE,#E000
PIKA LD A,(DE)
INC DE
AND #7F
CP C
JP NZ,PIK8
INC (HL)
PIK8 LD A,E
OR D
JP NZ,PIKA
INC HL
INC C
LD A,C
CP 22
JR C,PIKAA
;пси-контр
LD A,(L_LAND)
CP 9
RET NZ
LD A,(WAREND)
OR A
RET NZ
LD HL,U_ART+6
LD DE,#E000
PIK22 LD A,(DE)
AND #7F
CP 22
JR Z,PIK9
INC DE
LD A,E
OR D
JR NZ,PIK22
RET
PIK9 LD (HL),1
RET
if PROTECT
;4 - пров свопперов []
CHK_4 LD A,(PERIOD)
CP 3
RET C
LD HL,(CRC4)
PUSH HL
LD DE,LQWE-MAN
LD BC,+(B_LOOP-LQWE) *256 +8
LD IX,MAN
ADD IX,DE
prt4 LD A,(IX+2)
OR A
JR Z,prt44
ADD A,C
LD C,A
prt44 INC IX
DJNZ prt4
POP HL
CP L
RET Z
CALL NZ,SWPBAT
JP BEEP
endif