DEFS 35,#1
;-------Энциклопедия
UPLEN EQU 60
UP1st EQU 54
USF DEFB 55 ;файл
USN DEFB 59 ;ЗАПРОС
UST DEFB 0 ;0-Изобр.
;Цвета уфопедии 60*2
UCOL DEFB #30,#78,#68,#38,#70,#38,#68,#78,#28,#68,#38,#60
DEFB #58,#68,#78
DEFB #69,#60,#72
DEFB #38,#71,#78
DEFB #60,#29,#72,#68,#78,#7A,#30,#58,#78,#69,#58,#68
DEFS 6,#68
DEFB #70,#70,#78
DEFB #71,#70,#78,#38,#68,#58,#78,#70,#60
DEFB #6A,#58,#78,#69,#60,#30,#38,#68,#72
UCOL2 DEFB #28,#60,#70,#50,#78,#58,#60,#70,#50,#30,#68,#78
DEFB #68,#78,#70
DEFB #69,#60,#71
DEFB #38,#71,#78
DEFB #68,#58,#78,#79,#60,#70,#60,#58,#79,#72,#71,#78
uCOPY LD A,192
LD HL,DSCR
LD DE,SCR
Ux7 LD BC,28
LDIR
LD BC,4
ADD HL,BC
EX DE,HL
ADD HL,BC
EX DE,HL
DEC A
JR NZ,Ux7
CALL E_I
LD HL,0
uh LD BC,#1C03
uHI EQU uh+1
LD A,(COLOR)
CALL ATRBAR
LD H,C
LD C,#15
LD A,3
LD (uHI),A
LD A,(COLOR+1)
JP ATRBAR
;копирование экрана из буфера(A:0..2)
UX LD BC,5376
LD HL,SCR+5376
CP 1
JR Z,Ux1
JR C,Ux2
ADD HL,BC
JR Ux1
Ux2 AND A
SBC HL,BC
Ux1 EX DE,HL
CALL STD
LD BC,#1C18
LD HL,0
CALL PUTSIM
EXX
CALL MEM7
EXX
CALL STS
XOR A
CALL ATRBAR
JR uCOPY
;Уфопедиа (файлы 1-20)
USA CALL LDASM3
USA_ CALL PT128
LD DE,(USN)
LD L,3
CALL DIVB
LD A,(USF)
CP E
LD A,D
JR Z,US1
LD A,E
LD (USF),A
ADD A,UP1st
LD HL,SCR
CALL READ
if 0
LD BC,(SCR)
LD HL,SCR+2
ADD HL,BC
DEC HL
LD DE,#FFFE
LDDR
EX DE,HL
INC HL
LD DE,SCR
CALL DELPC
endif
JR USA_
US1 PUSH DE
CALL LDASM2
CALL PT128
POP DE
LD A,(USN)
PUSH AF
LD HL,UCOL
CALL BA
LD H,A
LD L,A
LD (COLOR),HL
POP AF
CP 33
JR NC,US11
PUSH AF
LD HL,UCOL2
CALL BA
LD (COLOR),A
POP AF
CP 13
JR NC,US11
LD A,7
LD (uHI),A
US11 LD A,(C_ONOF)
OR A
JR Z,US111
LD HL,#3838
LD (COLOR),HL
US111 LD A,D
CALL UX
JP ARRINI
UTA CALL STD
BYTs 0,#1C18,#FF
LD HL,#2028;Цвет заголовка UP +Цвет текта UP
LD (COLOR),HL
LD A,9
LD (HIGH),A
LD HL,4
LD (SX),HL
LD A,1+#80 ;M$
CALL MEMX
LD A,(USN)
CALL NWRD
XOR A
LD (HIGH),A
LD HL,#300
LD (SX),HL
LD HL,PEDIA
LD A,(USN)
AND A
JR Z,UQ
LD B,A
UJ LD A,(HL)
INC HL
CP 127
JR NZ,UJ
DJNZ UJ
UQ CALL TEXT
CALL UPARAM
CALL UPUFO
CALL STS
CALL MEM7
JP uCOPY
UP CALL INIMNU
LD HL,#FFFF
LD (MOLD),HL
LD (MBEG),HL
LD A,98
LD (USF),A
LD (UST),A
CALL DTBAR
UP_ LD A,(UST)
OR A
PUSH AF
CALL NZ,UTA
POP AF
CALL Z,USA
UPM_ CALL MARK_
JR NC,UPM_
UPD_ CALL MARK_
JR C,UPD_
LD A,(MX)
CP 226
JR C,UPM_
LD A,(MY)
CP 16
JR C,UPM_
CP 48
JR C,UPU
CP 80
JR C,UPS
CP 112
JR C,UPT
CP 144
JR C,UPD
CP 176
JR NC,UPM_
RET C
UPS XOR A
LD (UST),A
JR UP_
UPU LD A,(USN)
DEC A
CP 255
JR NZ,Mr4
LD A,UPLEN-1
Mr4 LD (USN),A
LD HL,RS
CALL BT
OR A
JR Z,UP_
JR UPU
UPD LD A,(USN)
INC A
CP UPLEN
JR C,Mr5
XOR A
Mr5 LD (USN),A
LD HL,RS
CALL BT
OR A
JR Z,UP_
JR UPD
UPT LD (UST),A
JR UP_
DTBAR Ms 3+#80
CALL OFFD
CALL STD
LD HL,28
LD BC,#418
LD A,#30 ;цвет кнопок UP
CALL ATRBAR
LD H,2
LD BC,#504
LD DE,xLABEL
DXT PUSH BC
PUSH DE
LD B,4
LD DE,xBUTTON
CALL PUTSIM
POP DE
INC H
INC L
LD BC,#202
CALL PUTSIM
DEC L
INC H
INC H
INC H
LD A,32
ADD A,E
LD E,A
JR NC,DXQ
INC D
DXQ POP BC
DJNZ DXT
CALL OFFS
JP COPYAT
TXMN DEFW XM1,XM2,XM3,XM4,XM5,XM6,XM7,XMopt,XMR
XMENUS ;Гл.меню
CALL SAVMON
XMENU CALL OFFD
CALL STD
ATRs 0,#2018,#70
CALL NAL
LD IX,MU14
CALL SELM
JP NC,XMR
LD HL,TXMN
CALL WT
LD (XMS+1),HL
XMS CALL #3D2E
JR XMENU
XM1U CP 255
RET Z
LD HL,#160B
LD (SX),HL
LD HL,MXDM
CALL BA
LD (SOLDAT),A
ADD A,A
ADD A,A
ADD A,A
ADD A,A
LD HL,AQNAVT
CALL BA
LD (SOLD_D),HL
INC HL
LD A,(HL)
ADD A,80
JP NWRDM
MU14 DEFW #502,#E1A,T+97
DEFB 9
MU41 DEFW #804,#2916
MU34 DEFW #403,#2218,DSDAT,#0A,DSDAT
XM1 LD A,(AQU) ;ЭКИПАЖ
OR A
JR NZ,PR1
LD IX,MU41
JP MNU
PR1 LD DE,DSDAT
LD B,10
LD HL,AQNAVT
PR11 PUSH BC
LD A,(HL)
LD (DE),A
INC DE
LD BC,16
ADD HL,BC
POP BC
DJNZ PR11
CALL STD
BYTs #1400,#2004,255
WRDs #1601,158
LD IX,MU34
LD HL,XM1U
CALL SELTX
RET NC
X1OK CALL DRAW_P
CALL COPYAT
CALL SAVE_6
X1EN LD HL,#FFFF
LD (MBEG),HL
LD (MOLD),HL
P141 CALL MARK_
JR C,P141
P15 CALL MARK_
JR NC,P15
LD IX,AQUWIN-4
LD HL,(MX)
CALL INSW
JP C,W_GUN
CALL INSW
JR C,W_PAR
CALL INSW
JP C,W_NXT
CALL INSW
JR NC,P15
P151 LD HL,S_ARM ;защита
LD (W_XXX),HL
LD IX,MU37
XOR A
LD (TTY),A
LD HL,XM1S
CALL SELTX
JR NC,X1NXT
LD A,(W_TYP)
CP 3
JR NC,P156
LD HL,W_NUM
LD A,(HL)
INC HL
OR (HL)
JR Z,X1NXT
P156 LD IX,(SOLD_D)
LD A,(IX+2)
OR A
JR Z,P152
DEC A
LD HL,(W_XXX)
CALL WA
CALL INCW
P152 LD A,(W_TYP)
INC A
CP 4
JR NC,P153
LD (IX+2),A
LD HL,(W_ADR)
CALL DECW
P154 JP X1OK
P153 LD (IX+2),0
JR P154
X1NXT CALL LOAD_6
CALL COPYAT
JP X1EN
W_PAR LD A,H
SUB (IX+1)
RRA
RRA
RRA
RRA
AND 7
ADD A,162
LD (MU35+4),A
LD IX,MU35
CALL MENUC
W_PW CALL MARK_
JR C,W_PW
JR X1NXT
W_NXT LD A,H
RLCA
RLCA
RLCA
AND 7
JR Z,WND
CP 2
RET C
JR Z,WOUT
WNU LD A,(SOLDAT)
INC A
CP 10
JR C,WU1
XOR A
WU1 LD (SOLDAT),A
CALL E_AQ
JR Z,WNU
JP X1OK
WND LD HL,SOLDAT
LD A,(HL)
DEC (HL)
OR A
JR NZ,W1D
LD A,9
LD (HL),A
W1D LD A,(HL)
CALL E_AQ
JR Z,WND
JP X1OK
WOUT LD IX,MU38
CALL SELM
JR NC,X1NXT
OR A
JR NZ,X1NXT
LD HL,(SOLD_D)
LD (HL),0
LD HL,AQU
DEC (HL)
RET
MU38 DEFW #508,#2610,T+157,2
MU40 DEFW #405,#2813
DEFB 0
DEFW T+157,2
E_AQ LD HL,AQNAVT ;проверка: есть акв. (A)?
RLCA
RLCA
CALL DD
LD A,(HL)
LD (SOLD_D),HL
OR A
RET ;Z-нет
W_GUN LD A,H
SUB (IX+1)
LD E,A
LD L,24
CALL DIVB
LD A,8
ADD A,E
LD E,A
LD D,0
LD HL,(SOLD_D)
INC HL
LD A,(HL)
LD (W_MC_R),A
ADD HL,DE
LD A,(HL)
CP 255
JR Z,WG1
PUSH HL
LD IX,MU40
INC A
LD (MU40+4),A
CALL SELM
POP HL
JP NC,X1NXT
OR A
JP NZ ,X1NXT
LD A,(HL)
LD B,255
LD (HL),B
LD HL,S_GUN
CALL WA
CALL INCW
JP X1OK
W_MC_R DEFB 1;ранг для МС
WG1 LD (DSDAT),HL
WG01 XOR A
LD (TTY),A
LD HL,S_GUN
LD (W_XXX),HL
LD IX,MU36
LD HL,XM1S
CALL SELTX
JP NC,X1NXT
LD HL,W_NUM
LD A,(HL)
INC HL
OR (HL)
JP Z,X1NXT
LD A,(W_TYP)
CP 12
JR NZ,WG12
LD A,(W_MC_R)
CP 7
JR NC,WG12
LD IX,MU45
CALL MNU
JP X1NXT
WG12 LD HL,(SOLD_D) ;massa
LD DE,9
ADD HL,DE
EX DE,HL
LD BC,#400
WG16 LD A,(DE)
CP 255
JR Z,WG17
LD HL,MASSA
CALL BA
ADD A,C
LD C,A
WG17 INC DE
DJNZ WG16
LD A,(W_MC_R)
INC A
SRL A
ADD A,4
SUB C
LD C,A
LD A,(W_TYP)
LD HL,MASSA
CALL BA
CP C
JR C,WG18
LD IX,MU47
CALL MNU
JR WG01
WG18 LD HL,(W_ADR)
CALL DECW
LD HL,(DSDAT)
LD A,(W_TYP)
LD (HL),A
JP X1OK
MU47 DEFW #106,#2F14
MU45 DEFW #407,#2D16
DEFB 13
MASSA DEFB 2,3,5,4,2,1,2,4,3,3,0,1,3,0,0
W_XXX DEFW 0;нач таб
W_ADR DEFW 0;тек адр
W_NUM DEFW 0;К-во
W_TYP DEFB 0;тип
T16 DEFB 16,17,18,158
MU37 DEFW #507,#2511,T16,4,RS+15
MU36 DEFW #005,#2416,T+1,15,RS
MU35 DEFW #1104,#230f
DEFB 0
DECW LD A,(HL)
DEC (HL)
OR A
RET NZ
INC HL
DEC (HL)
RET
INCW INC (HL)
RET NZ
INC HL
INC (HL)
RET
XM1S CP 255
RET Z
LD HL,MXDM
CALL BA
LD (W_TYP),A
PUSH AF
LD HL,TTY
LD A,(HL)
OR A
JR NZ,xm1S
DEC (HL)
WRDs #1610,128
xm1S POP AF
LD HL,#161A
LD (SX),HL
LD HL,(W_XXX)
CALL WA
LD (W_ADR),HL
PUSH HL
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
LD (W_NUM),HL
POP HL
JP WW
if PROTECT
CHK_3 ;3 проверка сrc3 []
LD HL,#FF02
LD (TX),HL
XOR A
CALL MEM
XOR A
LD C,A
ADD A,#3D
LD B,A
prt3 LD DE,TY
LD A,(DE)
EXX
LD HL,TX
SUB (HL)
LD (HL),A
EXX
LDD
JP PE,prt3
RET
endif
AQUWIN DEFW #400*8,#1004*8
DEFW #406*8,#1009*8
DEFW #1C*8,#101F*8+6
DEFW #110F*8,#1412*8
INSW LD DE,4
ADD IX,DE
JP INS
MU2 DEFW #202,#21A
M20U DEFB 1
DEFW RSN
M21U DEFB 0
DEFW T+121
DEFB 2
MU9 DEFW #806,#912
MU4 DEFW #001,#41C
DEFB 1
DEFW T+1,#FE50,RS
XM2 ;Исследования
LD B,80
PRT20 LD C,0
LD HL,RS
P21 LD A,(HL)
OR A
JR Z,P22
CP 254
JR C,P23
JR NZ,P22
INC C
P22 INC HL
DJNZ P21
LD A,C
CP 12
LD IX,MU4
LD A,6
JR C,P24
XOR A
P24 LD (IX+1),A
LD (IX+4),123
CALL SELM
RET NC
PUSH AF
LD HL,RS
CALL BA
POP AF ;вычисл.времени
LD B,18
CP 12
JR C,P2T
LD B,30
CP 18
JR C,P2T
LD B,90
CP 21
JR C,P2T
LD B,28
CP 33
JR C,P2T
LD B,16
CP 39
JR C,P2T
LD B,35
CP 60
JR C,P2T
LD B,24
P2T LD (HL),B
LD A,B
LD (R_TM),A
JR XM2
P23 LD A,81 ;Текущее
SUB B
LD (M20U),A
LD A,(R_TM)
SRL A
SRL A
LD E,A
LD C,127
LD B,3
P26 CP (HL)
JR NC,P25
ADD A,E
DEC C
DJNZ P26
P25 LD A,C
LD (M21U),A
LD IX,MU2
CALL SELM
RET NC
OR A
JR NZ,P28
LD A,(M20U)
LD HL,RS-1
CALL BA
LD (HL),254
LD IX,MU9
JR P27
P28 LD IX,MU4
LD (IX+1),0
LD (IX+4),122
P27 JP MNU
PRICEs DEFW 700,3000,1500,985,48000,56000,62500
PRICE DEFW 0;текущ.табл. цен
MT11 DEFB 1,2,5,51,19,20,21
MT11R DEFB 1,2,5,30,19,20,21
MU11 DEFW #405,#B14,MT11,7,MXDM+11
price DEFW 2;текущ.цена
S_new DEFW 2;К-во. в сделке
S_old DEFW 2;текущ.к-во
S_adr DEFW 2;адр.текущ.к-ва
SUMM DEFS 4,2
XM4 ;Покупка
LD B,7
LD HL,MT11R
LD DE,MXDM+11
P40 LD A,(HL)
INC HL
PUSH HL
LD HL,RS-1
CALL BA
POP HL
LD (DE),A
INC DE
DJNZ P40
CALL TITNAL
LD IX,MU11
LD HL,PRICEs
LD (PRICE),HL
LD HL,XM4OU
CALL SELTX
RET NC
CP 4
JR C,P41
SUB 4
LD B,A
LD A,(T_INTR)
RLA
JR C,P42
LD IX,MU16
JP MNU
P42 LD HL,(price)
LD E,(HL)
INC HL
LD H,(HL)
LD L,E
CALL DECM
JR NC,P43
LD IX,MU15
JP MNU
P43 LD A,B
LD (T_INTR),A
LD HL,INT_MX
CALL BA
LD (P43u2+1),A
LD BC,#AFF
LD IX,AQNAVT ;уволить лишних
P43u LD A,(IX)
OR A
JR Z,P43u1
INC C
LD A,C
P43u2 CP 0
JR C,P43u1
LD (IX),0
LD HL,AQU
DEC (HL)
P43u1 LD DE,16
ADD IX,DE
DJNZ P43u
JP XM4
P41 LD DE,130*256+153
CALL SELEC1
P45 CALL SELEC2
CALL SELPM
CP 1
JP Z,PM47 ;OK
JR NC,P47
LD HL,(DSDAT) ;CANCEL
LD (MONEY),HL
LD HL,(DSDAT+2)
LD (MONEY+2),HL
LD DE,(S_old)
LD HL,(S_adr)
LD (HL),E
INC HL
LD (HL),D
PM47 JP XM4
P47 CP 2
LD HL,(price)
LD E,(HL)
INC HL
LD D,(HL)
LD HL,S_new
LD A,(HL)
JR Z,P46
CP 250
JR NC,P45
EX DE,HL
CALL DECM ;<+>
JR C,P45
EX DE,HL
LD IX,SUMM
CALL INCR
LD HL,S_new
INC (HL)
LD HL,(S_adr)
INC (HL)
JR NZ,P45
INC HL
INC (HL)
JR P45
P46 OR A;<->
JR Z,P45
DEC (HL)
LD IX,(S_adr)
LD A,(IX)
OR (IX+1)
JR Z,P45
LD A,(IX)
DEC (IX)
OR A
JR NZ,P466
DEC (IX+1)
P466 EX DE,HL
CALL INCM
EX DE,HL
LD IX,SUMM
CALL DECR
JP P45
COPY3 LD BC,2048
LD HL,DSCR+4096
LD DE,SCR+4096
LDIR
RET
MU15 DEFW #306,#0F15
MU16 DEFW #201,#1016
MU17 DEFW #302,#1118
XM4OU CP 255
RET Z
LD HL,MXDM
CALL BA
PUSH AF
LD HL,#1613
LD (SX),HL
LD HL,(PRICE)
CALL WA
LD (price),HL
CALL WW
CALL WORD
LD HL,#1513
LD (SX),HL
POP AF
CP 3
JR NZ,XO40
LD HL,S_ART+14
JR XO44
XO40 JR NC,XO41
CP 2
JR NZ,XO42
INC A
INC A
XO42 LD HL,S_GUN
CALL WA
XO44 LD (S_adr),HL
LD E,(HL)
INC HL
LD D,(HL)
DEC HL
LD (S_old),DE
JP WW
XO41 LD HL,0
SUB 4
LD B,A
LD A,(T_INTR)
CP B
JR NZ,XO45
INC HL
XO45 LD (S_adr),HL
LD HL,S_adr
JP WW
TITNAL CALL NAL
BYTs #1300,#2002,#FF
WRDs #1600,127
WRDs #1500,128
RET
MT12 DEFB 111,89,91,90,92
MT_111 DEFB 44,45,46,47,48,49,50,51,112,113
P_ART DEFW 12000,8900,4700,6200,5500,10500,62000,250,7400,4100
P_GUN DEFW 450,2250,8200,4600,1200,1800
DEFW 2770,3300,2100,3520,910,680
P_EQU DEFW 5000,1300,1550
P_ARM DEFW 2400,3700,4990
P_INTR DEFW 20000,22500,25700
MU12 DEFW #807,#C12,MT12,5
MU27 DEFW #100,#1B1E
MU29 DEFW #206,#1D10
DEFB 0
DEFW T+155,2
MU13 DEFW #103,#D13;ДЛЯ ВСЕХ ТИПОВ
DEFB 111
DEFW 0,0
DEFW DSDAT
S_XXX DEFW 0
SAVE_6 CALL PT128 ;сохр/восст DSCR в Page6
LD BC,6912
CALL CY_
JP MEM7
LOAD_6 CALL PT128
LD DE,DSCR
LD HL,SCR
LD BC,6912
LDIR
JP MEM7
XM5 LD IX,MU12 ;Продажа
CALL SELM
RET NC
PUSH AF
CALL SAVE_6
POP AF
LD B,A
LD HL,MT12
CALL BT
LD (MU13+4),A
LD A,B
CP 3
JR C,P50
JR Z,P51
LD A,(T_INTR)
CP 3
LD IX,MU27
JP NC,MNU
P52 LD B,A
ADD A,19
LD (MU29+4),A
LD A,B
LD HL,P_INTR
CALL WT
LD (price),HL
CALL NAL
WRDs #1500,127
LD A,#13
LD (SX),A
LD HL,price
CALL WW
CALL WORD
LD IX,MU29
CALL SELM
RET NC
OR A
RET NZ
LD A,255
LD (T_INTR),A
LD HL,(price)
JP INCM
P51 LD HL,S_EQU
LD DE,T+13
LD BC,P_EQU
JR P53_
P50 CP 1
JR Z,P54
JR C,P55
LD HL,S_ARM
LD BC,P_ARM
LD DE,T+16
P53_ LD A,3
JR P53
P54 LD HL,S_GUN
LD BC,P_GUN
LD DE,T+1
LD A,12
JR P53
P55 LD HL,S_ART
LD BC,P_ART
LD DE,MT_111
LD A,10
P53 LD (MU13+5),DE
LD (MU13+7),A
LD (PRICE),BC
LD (S_XXX),HL
P577 LD A,(MU13+7)
LD B,A
LD DE,DSDAT
LD HL,(S_XXX)
P533 LD A,(HL)
INC HL
OR (HL)
INC HL
LD (DE),A
INC DE
DJNZ P533
P57 CALL TITNAL
LD IX,MU13
LD HL,XM5OU
CALL SELTX
PUSH AF
JP NC,P58
P501 LD DE,129*256+131
CALL SELEC1
P505 CALL SELEC2
CALL SELPM
CP 1
JP Z,P58 ;OK
JR NC,P507
LD HL,(DSDAT) ;CANCEL
LD (MONEY),HL
LD HL,(DSDAT+2)
LD (MONEY+2),HL
LD DE,(S_old)
LD HL,(S_adr)
LD (HL),E
INC HL
LD (HL),D
JR P58
P507 CP 2
LD HL,(price)
LD E,(HL)
INC HL
LD D,(HL)
LD HL,S_new
LD A,(HL)
JR Z,P506
CP 250
JR NC,P505
LD IX,(S_adr)
LD A,(IX)
OR (IX+1)
JR Z,P505
LD A,(IX)
DEC (IX)
OR A
JR NZ,P5051
DEC (IX+1)
P5051 EX DE,HL
CALL INCM ;<+>
EX DE,HL
LD IX,SUMM
CALL INCR
LD HL,S_new
INC (HL)
JR P505
P506 OR A;<->
JR Z,P505
DEC (HL)
LD HL,(S_adr)
INC (HL)
JR NZ,P511
INC HL
INC (HL)
P511 EX DE,HL
CALL DECM
EX DE,HL
LD IX,SUMM
CALL DECR
JR P505
P58 CALL LOAD_6
CALL NAL
POP AF
JP C,P577
JP XM5
SELEC1 LD HL,#1300
LD (SX),HL
LD A,E
PUSH DE
CALL NWRDM
POP DE
LD HL,#1400
LD (SX),HL
LD A,D
CALL NWRDM
SELEC6 CALL INIPM
LD HL,(MONEY)
LD (DSDAT),HL
LD HL,(MONEY+2)
LD (DSDAT+2),HL
XOR A
LD L,A
LD H,A
LD (S_new),A
LD (SUMM),HL
LD (SUMM+2),HL
RET
SELEC2 CALL NAL
LD HL,#130E
LD (SX),HL
LD HL,SUMM
CALL WD
CALL WORD
LD HL,#1413
LD (SX),HL
LD HL,S_new
CALL WW
LD HL,#1513
LD (SX),HL
LD HL,(S_adr)
CALL WW
CALL COPY3
JP E_I
XM5OU CP 255
RET Z
LD HL,MXDM
CALL BA
PUSH AF
LD HL,#1613
LD (SX),HL
LD HL,(PRICE)
CALL WA
LD (price),HL
CALL WW
CALL WORD
LD HL,#1513
LD (SX),HL
POP AF
LD HL,(S_XXX)
CALL WA
LD (S_adr),HL
LD E,(HL)
INC HL
LD D,(HL)
LD (S_old),DE
DEC HL
JP WW
MU32 DEFW #A04,#2016,T+108,3
MU33 DEFW #B04,#2116,T+108,2
ZP DEFW 15000,7000,25000
XXX DEFB 0 ;(0-RSN...2-AQU)
OLD_6 DEFB 0
OLD_AD DEFW 0
OLD_AQU DEFB 0
MAXXX DEFB 0
INT_MX DEFB 7,8,10;вместимость истр.
XM6 LD A,(AQU) ;Найм
LD (OLD_AQU),A
LD IX,MU32
LD HL,XM6OU
CALL SELTX
RET NC
CP 2
LD B,100
JR C,PR6
LD A,(T_INTR)
CP 3
LD B,6
JR NC,PR6
LD HL,INT_MX
CALL BA
LD B,A
PR6 LD HL,MAXXX
LD (HL),B
LD HL,(OLD_AD)
LD A,(HL)
LD (OLD_6),A
CALL SELEC6
PR60 CALL NAL
LD A,(XXX)
CALL XM6E
CALL COPY3
CALL SELPM
CP 4
JR NC,PR60
CP 1
JP Z,XM6NAN
JR NC,PR61
LD HL,DSDAT
LD DE,MONEY
LD BC,4
LDIR
LD A,(OLD_6)
LD HL,(OLD_AD)
LD (HL),A
CALL NAL
LD A,(XXX)
CALL XM6E
JR XM6
PR61 CP 2
JR NZ,PR62;<->
LD HL,(OLD_AD)
LD A,(OLD_6)
CP (HL)
JR Z,PR60
DEC (HL)
LD HL,(price)
CALL INCM
JR PR60
PR62 LD HL,(OLD_AD);<+>
LD A,(MAXXX)
CP (HL)
JR C,PR60
JR Z,PR60
PUSH HL
LD HL,(price)
CALL DECM
POP HL
JR C,PR60
INC (HL)
JR PR60
XM6OU LD (XXX),A
CP 255
RET Z
XM6E PUSH AF
WRDs #1500,133
POP AF
PUSH AF
LD HL,RSN
CALL BA
LD (OLD_AD),HL
CALL WB
WRDs #1600,134
POP AF
LD B,A
LD HL,ZP
CALL WT
LD (price),HL
LD A,B
LD HL,ZP
CALL WA
CALL WW
JP WORD
XM6NAN LD A,(XXX)
CP 2
JP C,XM6 ;найм акванавтов
LD HL,OLD_AQU
LD A,(AQU)
SUB (HL)
LD (NRECR),A
JP Z,XM6
POP AF ;dec2 SP
JP MLOOP
NRECR DEFB 0 ;сколько нанять
RECRUT LD HL,NRECR ;найм акв
LD A,(HL)
OR A
RET Z
LD B,A
XOR A
LD (HL),A
PUSH BC
LD A,39
CALL DISPL
POP BC
RECR0 PUSH BC
LD HL,AQNAVT
LD DE,16
LD B,10
RER0 LD A,(HL)
OR A
JR Z,RER1
ADD HL,DE
DJNZ RER0
JP SMERT
RER1 PUSH HL
POP IX
INC HL
LD (HL),A
INC HL
LD (HL),A
LD (IX+6),A
LD (IX+14),A
DEC A
LD (IX+9),A
LD (IX+10),A
LD (IX+11),A
LD (IX+12),A
LD (IX+13),16
LD A,105-42-16 ;TU 6+
CALL RECRND
LD A,106-35-16 ;EN 5+
CALL RECRND
LD A,86-49-16 ;HEALTH 7+
CALL RECRND
INC HL
LD A,100-28-16 ;МОRAL 4+
CALL RECRND
LD A,105-35-16 ;PREC 5+
CALL RECRND
LD HL,N_AQU
LD A,(HL)
LD (IX),A
DEC A
LD (DSDAT),A
JR NZ,RER2
LD A,192
LD (IX+3),75
LD (IX+4),78
LD (IX+5),62
LD (IX+1),2
RER2 LD (HL),A
LD A,43
CALL DISPLX
POP BC
DJNZ RECR0
RET
RECRND ;случ.парам A+RND(16)
LD B,A
CALL RND
AND %1111
ADD A,B
INC HL
LD (HL),A
RET
XM7 ;Увольнение
LD HL,Pr_Q
LD A,(HL)
OR A
JR Z,X7M
LD A,(ENG)
OR A
JP Z,PRSTOP
X7M LD IX,MU33
LD HL,XM6OU
CALL SELTX
RET NC
LD HL,(OLD_AD)
LD A,(HL)
LD (OLD_6),A
CALL SELEC6
PR70 CALL NAL
LD A,(XXX)
CALL XM6E
CALL COPY3
CALL SELPM
CP 4
JR NC,PR70
CP 1
JR Z,XM7
JR NC,PR71
LD HL,DSDAT
LD DE,MONEY
LD BC,4
LDIR
LD A,(OLD_6)
LD HL,(OLD_AD)
LD (HL),A
CALL NAL
LD A,(XXX)
CALL XM6E
JR XM7
PR71 CP 3
JR NZ,PR72;<+>
LD HL,(OLD_AD)
LD A,(OLD_6)
CP (HL)
JR Z,PR70
INC (HL)
JR PR70
PR72 LD HL,(OLD_AD);<->
LD A,(HL)
OR A
JR Z,PR70
DEC (HL)
JR PR70
INFO ;инфо
LD IX,TTX
LD A,(T_INTR)
CP 3
JR C,INU0
LD A,27
JR INU9
INU0 ADD A,18
LD (TTX),A
LD A,26
INU9 CALL DISPL
LD B,8
LD HL,BASE+8
INU1 DEC HL
PUSH BC
PUSH HL
LD A,B
ADD A,191
LD (TTX),A
LD A,22
CALL DISPL
POP HL
PUSH HL
LD A,(HL)
CP 100
JR NC,INU2
OR A
LD A,23
JR Z,INU3
LD (TTX),HL
LD A,25
JR INU3
INU2 LD A,24
INU3 CALL DISPL
POP HL
POP BC
DJNZ INU1
JP LOOP
PMXY DEFW 0 ;коорд. пикс
PBXY DEFW 0 ;--"-- з/м
INIPM LD A,3+#40 ;иниц. плюс-минус
CALL MEMX ;M$
LD HL,#FFFF
LD (MBEG),HL
LD (MOLD),HL
LD HL,(MX)
LD A,H
SUB 24
AND #F8
LD H,A
LD A,L
LD L,56
CP 128
JR C,IPc
LD L,104
IPc LD (PMXY),HL
SRL H
SRL H
SRL H
SRL L
SRL L
SRL L
LD (PBXY),HL
LD BC,#C02
CALL STD
XOR A
CALL SIMBAR
LD DE,xPLUS
CHNs OR_
CALL PUTSIM
LD A,#38
CALL ATRBAR
CALL MEM7
CALL COPYAT
INPM CALL MARK_
JR C,INPM
RET
SELPM CALL MARK_ ;выбор(0-CANCEL,1-OK,2-<->,3-<+>)
PUSH AF
LD HL,(PMXY)
LD E,L
LD A,(MY)
SUB H
JR C,SPR_
CP 16
JR NC,SPR_
LD A,(MX)
SUB L
JR C,SPR_
CP 95
JR NC,SPR_
LD E,1
CP 48
JR NC,SP2_
CP 24
JR NC,SPR_
DEC E
SPR_ LD HL,(PBXY)
CALL STS
LD BC,#302
XOR A
SP0_ PUSH AF
CP E
LD A,#38
JR NZ,SP1_
LD A,#6A
SP1_ CALL ATRBAR
POP AF
INC A
INC HL
INC HL
INC HL
CP 4
JR NZ,SP0_
POP AF
JR NC,SELPM
LD A,E
CP 4
JR NC,SELPM
OR A
RET
SP2_ INC E
CP 72
JR C,SPR_
INC E
JR SPR_
SCROLL CALL MEM7 ;скролл на строку
LD B,8
MY90 PUSH BC
LD DE,SCR+#9E0
LD HL,SCR+#AE0
LD B,70
MY93 PUSH BC
PUSH HL
LD BC,24
LDIR
POP DE
LD H,D
LD L,E
INC H
LD A,H
AND %111
JR NZ,MY94
LD A,H
SUB 8
LD H,A
LD A,L
ADD A,32
LD L,A
JR NC,MY94
LD A,8
ADD A,H
LD H,A
MY94 POP BC
DJNZ MY93
LD H,D
LD L,E
INC E
LD (HL),255
LD BC,24
LDIR
CALL INT00
POP BC
DJNZ MY90
LD DE,SCR+#10E0
LD HL,DSCR+#10E0
LD B,8
MY95 PUSH BC
PUSH DE
PUSH HL
LD BC,24
LDIR
POP HL
PUSH HL
LD D,H ;*BLNK*
LD E,L
INC E
LD C,23
LD (HL),255
LDIR
POP HL
POP DE
POP BC
INC D
INC H
DJNZ MY95
INT00 PUSH IX
CALL INT0
POP IX
JP E_I
DSDAT DEFS 12,#DD;врем. данные дисплея
DISPLX LD IX,DSDAT
DISPL PUSH IX
PUSH AF ;;выв.сообщ (A-No)
Ms 1+#40
POP AF
LD HL,MENUS
OR A
JR Z,JFD
LD B,A
JHD LD A,(HL)
INC HL
CP #7F
JR NZ,JHD
DJNZ JHD
JFD LD (TXM),HL
LD HL,MTXTD
LD (MTXT+1),HL
LD HL,MTX0D
LD (MTX0+1),HL
LD HL,#FFFF
LD (MBEG),HL
LD HL,WORDS
LD (_words),HL
LD HL,#1800
LD (MXSH),HL
CALL MEM7
JR MW
MTXTD CALL MEM7
CALL SCROLL
MW CALL CONTR
BIT 4,A
JR Z,MW1
CALL INT00
JR MW
MW1 CALL STD
LD HL,#1700
LD (SX),HL
MTX0D LD A,1+#40 ;M$
CALL MEMX
XOR A
LD (HIGH),A
LD HL,(TXM)
LD A,(HL)
INC HL
LD (TXM),HL
CP 127
JR Z,DIRET
LD HL,ZT
CALL WT
JP (HL)
DIRET POP IX
JP MEM7
Range ;новое звание
LD HL,AQNAVT
LD B,10
RNG0 PUSH BC
PUSH HL
LD A,(HL)
LD (DSDAT),A
OR A
JR Z,RNG1
INC HL
LD A,(HL)
CP 7
JR NC,RNG1
PUSH HL
LD BC,12
ADD HL,BC
LD A,(HL)
DEC (HL)
OR A
JR NZ,RNG2
LD (HL),33
RNG2 POP HL
JR NZ,RNG1
INC (HL)
LD A,(HL)
ADD A,81
LD (DSDAT+1),A
INC HL
INC HL
LD A,6
ADD A,(HL)
LD (HL),A
INC HL
LD A,5
ADD A,(HL)
LD (HL),A
INC HL
LD A,7
ADD A,(HL)
LD (HL),A
INC HL
INC HL
INC (HL)
INC (HL)
INC (HL)
INC (HL)
INC HL
LD A,5
ADD A,(HL)
LD (HL),A
LD A,44
CALL DISPLX
CALL STOP_T
RNG1 POP HL
LD BC,16
ADD HL,BC
POP BC
DJNZ RNG0
RET
ACTH ;действия каждый час
CALL PROH
LD HL,(TIM)
LD A,L
CP 1
RET NZ
LD A,H
OR A
JP Z,Range
CP 2
JP Z,RSDAY
CP 5
JP Z,DEMBEL
RET
PERCs DEFB 100,15,15,126
WRP PUSH DE
LD HL,PERCs
LD (TXT),HL
CALL WORD
POP DE
RET
UPUFO ;вывод к-ва экипажа НЛО
LD A,(USN)
SUB 33
CP 9
RET NC
LD HL,AN_UFO
CALL BA
PUSH AF
LD HL,SX
LD (HL),2
INC HL
INC (HL)
LD A,200
CALL NWRDM
POP AF
JP WB
UPARAM ;вывод парам.оружия
LD A,(USN)
CP 15
RET NC
RLCA
LD HL,WEAPON
CALL DD
PUSH HL
Ms 3+#C0
LD HL,#C02
LD BC,#30C
LD DE,48*4+xPARAM
CALL PUTSIM
LD DE,xPARAM
LD C,2
CALL PUTSIM
LD B,5
POP DE
INC H
LD L,7
UY1 pushs
LD (SX),HL
LD A,(DE)
OR A
JR NZ,UY5
CALL URG
UY4 INC DE
JR UY2
UY5 CALL WB
LD A,B
CP 4
JR C,UY4
UY3 CALL WRP
LD A,(DE)
LD B,A
INC DE
LD A,(DE)
INC DE
CP B
JR Z,UY2
CALL WB
CALL WRP
UY2 pops
INC H
INC H
DJNZ UY1
DEC L
DEC L
LD (SX),HL
LD A,(USN)
LD HL,WP_PRC
CALL WA
OR A
JP Z,URG1
CALL WW
JP WORD
URG1 LD HL,(SX)
URG DEC H ;гашен
LD L,2
LD BC,#302
LD A,255
JP SIMBAR
MU8 DEFW #105,#816,T+3,16,RS+2
ZERT DEFB 0,0,10,7,0,1,5,10,3,6,1,0,20,0,0,0,12,25 ;к-во Зербайта
Pr_PRI ;цена пр-ва
DEFW 0,0,4800,3300,0,1400
DEFW 1900,2450,1700,2700,395,325
DEFW 3000,700,835
DEFW 1750,2950,3550
pN DEFB 0;N пр-ва
pZ DEFB 0;К-во зерб
pPR DEFW 0;цена
pE DEFW 0;имеется шт
XM3U CP 255
RET Z
LD HL,MXDM
CALL BA
INC A
INC A
LD (pN),A
LD B,A
LD HL,ZERT
CALL BA
LD (pZ),A
LD A,B
LD HL,Pr_PRI
CALL WT
LD (pPR),HL
LD A,B
LD HL,S_GUN
CALL WT
LD (pE),HL
LD HL,#1717
LD (SX),HL
LD HL,pPR
CALL WW
CALL WORD
LD HL,#1609
LD (SX),HL
LD HL,pE
JP WW
MU48 DEFW #1000,#301E,Pr_Z
MU7 DEFW #000,#71E
M7P DEFB 0
DEFW Pr_Q,Pr_PRC,Pr_HWR,Pr_DAY,ENG,T+168,4
MU49 DEFW #805,#3114
XM3 ;Производство
LD A,(ENG)
OR A
JR NZ,X3M
LD IX,MU49
JP MNU
X3M LD A,(Pr_Q)
OR A
JR NZ,P30
DEC A
LD (RS+4),A
WRDs #1700,135
WRDs #1600,128
LD HL,XM3U
LD IX,MU8
CALL SELTX
EX AF,AF
XOR A
LD (RS+4),A
EX AF,AF
RET NC
LD A,1
LD (Pr_Q),A
LD HL,pN
LD DE,Pr_N
LD BC,4
LDIR
LD A,(Pr_Z)
OR A
JR Z,P30
LD IX,MU48
CALL MNU
P30 CALL CALC
LD A,(Pr_N)
INC A
LD (M7P),A
LD IX,MU7
CALL MENUC
P301 CALL MARK_
JR C,P301
P30E LD A,80
CALL mark_0
JR NC,P30E
CP 3
LD HL,Pr_Q
JR C,PR33
P35 LD A,(HL)
OR A
RET NZ
JR PRSTOP
PR33 CP 1
LD A,(HL)
JR Z,P32
JR C,P31
PRSTOP XOR A
LD (HL),A
LD HL,0
LD (Pr_H_),HL
LD IX,MU10
JP MNU
P32 OR A
JR Z,P30E
DEC (HL)
JR P37
P31 CP 200
JR NC,P30E
INC (HL)
P37 CALL CALC
CALL X3U1
LD A,8
CALL DELAY
JR P30E
MU10 DEFW #805,#A14
X3U1 CALL STD
LD A,(Pr_Q)
LD HL,#80C
LD (SX),HL
CALL WB
LD HL,#E12
LD (SX),HL
LD HL,Pr_DAY
CALL WW
LD DE,SCR
LD HL,DSCR
LD BC,#1000
LDIR
RET
Pr_ONE ; время пр-ва 1ого вида пр. 1им техником (ч) 100<t<250
DEFB 101,101,240,185,101,125
DEFB 145,177,110,205,102,110
DEFB 222,114,133,150,202,250
CALC ;расчЁт времени пр-ва
LD A,(Pr_N)
LD HL,Pr_ONE
CALL BA
LD L,A
LD H,0
LD DE,(ENG)
XOR A
LD D,A
CP E
JR NZ,CAC1
INC E
CAC1 SBC HL,DE
JR C,CAC2
INC A
JR CAC1
CAC2 LD (Pr_HWR),A
LD E,A
LD HL,(Pr_Q)
LD H,0
CALL MULB2
LD HL,24
EX DE,HL
LD BC,0
CAC3 XOR A
SBC HL,DE
JR C,CAC4
INC BC
JR CAC3
CAC4 LD (Pr_DAY),BC
RET
PROH LD A,(Pr_Q)
OR A
RET Z
LD HL,(Pr_H_)
INC HL
LD (Pr_H_),HL
LD DE,(Pr_HWR)
OR A
SBC HL,DE
RET C
LD HL,0
LD (Pr_H_),HL
LD HL,(14+S_ART)
LD DE,(Pr_Z)
LD D,0
SBC HL,DE
LD A,46
JR C,PH_E1
PUSH HL
LD HL,(Pr_PRC)
CALL DECM
POP HL
LD A,15
JR C,PH_E1
LD (14+S_ART),HL
LD A,(Pr_N)
LD HL,S_GUN
CALL WA
CALL INCW
LD HL,Pr_Q
DEC (HL)
LD A,(HL)
OR A
RET NZ
CALL STOP_T
LD A,50
JP DISPL
PH_E1 CALL DISPL
CALL STOP_T
XOR A
LD (Pr_Q),A
LD A,10
JP DISPL
MEMX ;OR %10011000
;LD BC,#7FFD
;OUT (C),A
call MEM
ld e,1
OS_SETSCREEN
RET