StartGame
JP SelectGamePlay
STARTGAME ;свой сервер
;jr $
CALL WaitAn
STGA ;подключение к чужому серверу
;jr $
CALL InitGame
LD IX,HeroMy
CALL Hero
LD A,(TimeLim)
LD (TimeCh2),A
HALTER
CALL sinhro ;Процедура синхронизации
LD A,(Key)
CALL Obmen
LD (HeroYouKey),A
CALL MiniSinhro
LD A,(HeroMy)
CALL Obmen
LD (HeroYou),A
CALL MiniSinhro
LD A,(HeroMy+1)
CALL Obmen
LD (HeroYou+1),A
LD B,0
NOP
NOP
NOP
NOP
DJNZ $-4
HALTER
HALTER
XOR A
LD (DecHer),A
GameCycle
;jr $
CALL KeyMe
HALTER
CALL sinhro ;Процедура синхронизации
LD A,(Key)
CALL Obmen
ifndef CLIENT
ld a,0xf7
in a,(0xfe) ;1..5
endif
LD (HeroYouKey),A
CALL MiniSinhro
LD A,(HeroMy)
CALL Obmen
LD (OldX),A
CALL MiniSinhro
LD A,(HeroMy+1)
CALL Obmen
LD (OldY),A
LD B,0
NOP
NOP
NOP
NOP
DJNZ $-4
HALTER
CALL Ustanow
CALL MagicPrnt
CALL MagicDecl
CALL PrintVariab
CALL BulletsXY
HALTER
CALL BulletsPrnt
LD IX,HeroMy
LD IY,HeroYou
CALL HeroMove
LD A,(IX+2)
ADD A,17
LD D,(IX)
LD E,(IX+1)
CALL BlcSpr
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD A,(IX+2)
ADD A,17
LD (HL),A
CALL HeroDec
CALL HeroTelp
LD A,(Key)
PUSH AF
LD A,(HeroYouKey)
BIT 6,A
;JP Z,Endecc
LD (Key),A
LD IX,HeroYou
LD IY,HeroMy
CALL OpoDel ;стираем с карты и экрана
CALL HeroMove
LD A,(IX+2)
ADD A,17
LD D,(IX)
LD E,(IX+1)
CALL BlcSpr
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD A,(IX+2)
ADD A,17
LD (HL),A
CALL HeroDec
CALL HeroTelp2
POP AF
LD (Key),A
CALL Dead
CALL Dead2
CALL Deler
LD A,(TimeCh)
INC A
LD (TimeCh),A
LD A,(FragLim)
CP 0
JR Z,Dalle
LD B,A
LD A,(HeroMy+3)
CP B
JR Z,Endecc
LD A,(HeroYou+3)
CP B
JR Z,Endecc
Dalle
LD A,(TimeCh2)
CP 0
JR Z,DaLLe
LD A,(TimeCh)
CP 0
JR NZ,DaLLe
LD A,(TimeLim)
CP 0
;JR Z,Endecc
DEC A
LD (TimeLim),A
DaLLe LD A,(Key)
BIT 6,A
;JP NZ,GameCycle
;JR Z,Endecc
JP GameCycle
Endecc
LD HL,#4000
LD DE,#4001
LD BC,6143
LD (HL),0
LDIR
LD HL,#5800
LD DE,#5801
LD BC,767
LD (HL),7
LDIR
LD BC,Winers
CALL PrintText
LD IX,HeroMy
LD A,(IX+2)
ADD A,17
LD D,12
LD E,10
CALL BlcSpr
LD IX,HeroYou
LD A,(IX+2)
ADD A,17
LD D,12
LD E,11
CALL BlcSpr
LD A,(HeroMy+3)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,10
LD (NumBuf+1),A
LD A,24+15
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroYou+3)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,11
LD (NumBuf+1),A
LD A,24+15
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD IX,MInfo1
CALL Menu
JP Start
RET
Winers DB 22,0,23,7,"Result Death Match"
DB 22,10,24," Your frag: "
DB 22,11,24," His frag: "
DB 22,23,24,16,7,"Press any key",0
Deler
LD IX,HeroMy
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD (HL),0
LD IX,HeroYou
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD (HL),0
LD A,(Key)
RET
Ustanow LD IX,HeroYou
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD A,(IX+2)
ADD A,17
LD (HL),A
LD IX,HeroMy
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD A,(IX+2)
ADD A,17
LD (HL),A
RET
Dead LD A,(HeroMy+5)
CP 0
RET NZ
LD A,(HeroMy+4)
CP 0
RET NZ
LD IX,HeroMy
CALL HeroS
LD A,100
LD (HeroMy+4),A
LD A,10
LD (HeroMy+6),A
LD A,5
LD (HeroMy+11),A
LD A,(HeroYou+3)
INC A
LD (HeroYou+3),A
RET
Dead2 LD A,(HeroYou+5)
CP 0
RET NZ
LD A,(HeroYou+4)
CP 0
RET NZ
LD A,100
LD (HeroYou+4),A
LD A,10
LD (HeroYou+6),A
LD A,5
LD (HeroYou+11),A
LD A,(HeroMy+3)
INC A
LD (HeroMy+3),A
LD IX,HeroYou
LD D,(IX)
LD E,(IX+1)
LD A,0
CALL BlcSpr
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD (HL),0
RET
BulletsXY
LD HL,Bullets
LD B,64
BulXY PUSH BC
LD A,(HL)
CP 255
CALL NZ,BullXY
INC HL
INC HL
INC HL
POP BC
DJNZ BulXY
RET
BullXY PUSH HL
LD D,(HL)
INC HL
LD E,(HL)
INC HL
LD A,0
CALL BlcSpr
POP HL
PUSH HL
INC HL
INC HL
LD A,(HL)
AND %11
CP 0
JR Z,BullLe
CP 1
JR Z,BullRi
CP 2
JR Z,BullUp
CP 3
JR Z,BullDo
POP HL
RET
BullLe
POP HL
PUSH HL
LD E,(HL)
INC HL
LD L,(HL)
LD A,E
CP 0
JR Z,BullNot
DEC E
CALL HeMap
CP 1
JR Z,BullNot
POP HL
PUSH AF
DEC (HL)
POP AF
CP 17
JP NC,BullYep
RET
BullRi
POP HL
PUSH HL
LD E,(HL)
INC HL
LD L,(HL)
LD A,E
CP 31
JR Z,BullNot
INC E
CALL HeMap
CP 1
JP Z,BullNot
POP HL
PUSH AF
INC (HL)
POP AF
CP 17
JP NC,BullYep
RET
BullUp
POP HL
PUSH HL
LD E,(HL)
INC HL
LD L,(HL)
LD A,L
CP 0
JR Z,BullNot
DEC L
CALL HeMap
CP 1
JR Z,BullNot
POP HL
INC HL
PUSH AF
DEC (HL)
DEC HL
POP AF
CP 17
JP NC,BullYep
RET
BullDo
POP HL
PUSH HL
LD E,(HL)
INC HL
LD L,(HL)
LD A,L
CP 22
JR Z,BullNot
INC L
CALL HeMap
CP 1
JR Z,BullNot
POP HL
PUSH AF
INC HL
INC (HL)
DEC HL
POP AF
CP 17
JP NC,BullYep
RET
BullNot
POP HL
LD (HL),255
RET
BullYep
LD D,(HL)
LD (HL),255
INC HL
LD E,(HL)
INC HL
LD B,(HL)
DEC HL
DEC HL
LD IX,HeroYou
LD A,(IX)
CP D
JR NZ,HA
LD A,(IX+1)
CP E
JP NZ,HA
JR HTw1
HA LD IX,HeroMy
HTw1
LD A,B
AND %100
CP %100
JP Z,Rocke
LD A,B
AND %1000
CP %1000
JP Z,PsiQuk
LD B,10
Psh1 LD A,(IX+5)
CP 0
JR Z,Psha2
DEC A
LD (IX+5),A
DJNZ Psh1
RET
Psha2 LD B,10
Psh2 LD A,(IX+4)
CP 0
RET Z
DEC A
LD (IX+4),A
DJNZ Psh2
RET
PsiQuk
LD B,30
psi1 LD A,(IX+5)
CP 0
JR Z,Psih2
DEC A
LD (IX+5),A
DJNZ psi1
RET
Psih2 LD B,30
psi2 LD A,(IX+4)
CP 0
RET Z
DEC A
LD (IX+4),A
DJNZ psi2
RET
RET
Rocke LD A,B
AND %1000
CP %1000
JP Z,RoKQuk
LD B,25
Roh1 LD A,(IX+5)
CP 0
JR Z,Roha2
DEC A
LD (IX+5),A
DJNZ Roh1
RET
Roha2 LD B,25
Roh2 LD A,(IX+4)
CP 0
RET Z
DEC A
LD (IX+4),A
DJNZ Roh2
RET
RoKQuk
LD B,50
Rok1 LD A,(IX+5)
CP 0
JR Z,Rokz2
DEC A
LD (IX+5),A
DJNZ Rok1
RET
Rokz2 LD B,50
Rok2 LD A,(IX+4)
CP 0
RET Z
DEC A
LD (IX+4),A
DJNZ Rok2
RET
BulletsPrnt
LD HL,Bullets
LD B,64
BulPrn PUSH BC
LD A,(HL)
CP 255
CALL NZ,BullPrnt
INC HL
INC HL
INC HL
POP BC
DJNZ BulPrn
RET
BullPrnt PUSH HL
LD D,(HL)
INC HL
LD E,(HL)
INC HL
LD A,(HL)
AND %100
RRCA
RRCA
ADD A,15
CALL BlcSpr
POP HL
RET
HeroTelp
LD A,(Key)
BIT 5,A
RET NZ
LD A,(Key)
BIT 4,A
RET NZ
LD A,(IX+10)
CP 0
RET Z
DEC A
LD (IX+10),A
CALL HeroS
RET
HeroTelp2
LD A,(Key)
BIT 5,A
JR NZ,Her1Z
LD A,(Key)
BIT 4,A
JR NZ,Her1Z
LD A,(IX+10)
CP 0
JR Z,Her1Z
DEC A
LD (IX+10),A
LD D,(IX)
LD E,(IX+1)
LD A,0
CALL BlcSpr
RET
Her1Z
RET
DecHer DB 0
HeroDec
LD A,(IX+8)
CP 0
JR Z,$+3
DEC A
LD (IX+8),A
LD A,(DecHer)
INC A
AND %111
LD (DecHer),A
LD A,(DecHer)
CP 1
RET NZ
LD A,(IX+13)
CP 0
JR Z,$+3
DEC A
LD (IX+13),A
LD A,(IX+9)
CP 0
RET Z
DEC A
LD (IX+9),A
LD A,(IX+4)
ADD A,5
LD (IX+4),A
CP 200
RET C
LD A,200
LD (IX+4),A
RET
HeroMove
LD D,(IX)
LD E,(IX+1)
LD A,0
CALL BlcSpr
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD (HL),0
LD A,(Key)
BIT 4,A
JP Z,HeFire
BIT 0,A
JP Z,HeLe
BIT 1,A
JP Z,HeRi
BIT 3,A
JP Z,HeUp
BIT 2,A
JP Z,HeDo
BIT 5,A
JP Z,PisRoc
RET
HeFire
BIT 0,A
JP Z,HeFLe
BIT 1,A
JP Z,HeFRi
BIT 3,A
JP Z,HeFUp
BIT 2,A
JP Z,HeFDo
RET
HeFLe LD A,(IX+8)
CP 0
RET NZ
LD A,(IX+6)
CP 0
RET Z
LD HL,Bullets
LD DE,3
LD A,(HL)
CP 255
JR Z,$+5
ADD HL,DE
JR $-6
PUSH HL
LD E,(IX+0)
LD L,(IX+1)
LD A,E
CP 0
jr z,popret;RET Z
DEC E
CALL HeMap
LD A,(HL)
POP HL
CP 1
RET Z
LD E,(IX+0);X
LD D,(IX+1);Y
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(IX+7)
CP 1
JR Z,HeFLeR
LD A,%000
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,4
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
popret
pop hl
ret
HeFLeR LD A,%100
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,10
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
HeFRi LD A,(IX+8)
CP 0
RET NZ
LD A,(IX+6)
CP 0
RET Z
LD HL,Bullets
LD DE,3
LD A,(HL)
CP 255
JR Z,$+5
ADD HL,DE
JR $-6
PUSH HL
LD E,(IX+0)
LD L,(IX+1)
LD A,E
CP 31
RET Z
INC E
CALL HeMap
LD A,(HL)
POP HL
CP 1
RET Z
LD E,(IX+0);X
LD D,(IX+1);Y
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(IX+7)
CP 1
JR Z,HeFRiR
LD A,%001
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,4
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
HeFRiR LD A,%101
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,10
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
HeFUp LD A,(IX+8)
CP 0
RET NZ
LD A,(IX+6)
CP 0
RET Z
LD HL,Bullets
LD DE,3
LD A,(HL)
CP 255
JR Z,$+5
ADD HL,DE
JR $-6
PUSH HL
LD E,(IX+0)
LD L,(IX+1)
LD A,L
CP 0
RET Z
DEC L
CALL HeMap
LD A,(HL)
POP HL
CP 1
RET Z
LD E,(IX+0);X
LD D,(IX+1);Y
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(IX+7)
CP 1
JR Z,HeFUpR
LD A,%010
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,4
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
HeFUpR LD A,%110
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,10
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
HeFDo LD A,(IX+8)
CP 0
RET NZ
LD A,(IX+6)
CP 0
RET Z
LD HL,Bullets
LD DE,3
LD A,(HL)
CP 255
JR Z,$+5
ADD HL,DE
JR $-6
PUSH HL
LD E,(IX+0)
LD L,(IX+1)
LD A,L
CP 23
RET Z
INC L
CALL HeMap
LD A,(HL)
POP HL
CP 1
RET Z
LD E,(IX+0);X
LD D,(IX+1);Y
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(IX+7)
CP 1
JR Z,HeFDoR
LD A,%011
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,4
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
HeFDoR LD A,%111
LD B,A
LD A,(IX+13)
CP 0
JR Z,$+6
LD A,%1000
JR $+3
LD A,%0
OR B
LD (HL),A
LD A,10
LD (IX+8),A
LD A,(IX+6)
DEC A
LD (IX+6),A
RET
;Bullets DS 64*3 ;X,Y,%0000SSMM Где SS-Тип пули,MM-двежение
;Если X больше чем 32 то пули нет
PisRoc LD A,(IX+12)
CP 1
RET NZ
LD A,(IX+7)
XOR 1
LD (IX+7),A
ADD A,13
LD DE,#0817
CALL BlcSpr
LD A,(IX+11)
LD B,(IX+6)
LD (IX+11),B
LD (IX+6),A
RET
HeLe LD A,(IX+0)
LD L,(IX+1)
DEC A
CP 255
RET Z
LD E,A
CALL HeMap
CP 1
RET Z
CALL Situcy
LD A,(IX+0)
DEC A
LD (IX+0),A
PUSH IX
CALL BulZXY
POP IX
RET
HeRi LD A,(IX+0)
LD L,(IX+1)
INC A
CP 32
RET Z
LD E,A
CALL HeMap
CP 1
RET Z
CALL Situcy
LD A,(IX+0)
INC A
LD (IX+0),A
PUSH IX
CALL BulZXY
POP IX
RET
HeUp LD E,(IX+0)
LD A,(IX+1)
DEC A
CP 255
RET Z
LD L,A
CALL HeMap
CP 1
RET Z
CALL Situcy
LD A,(IX+1)
DEC A
LD (IX+1),A
PUSH IX
CALL BulZXY
POP IX
RET
HeDo LD E,(IX+0)
LD A,(IX+1)
INC A
CP 23
RET Z
LD L,A
CALL HeMap
CP 1
RET Z
CALL Situcy
LD A,(IX+1)
INC A
LD (IX+1),A
PUSH IX
CALL BulZXY
POP IX
RET
Situcy
CP 2
JP Z,Lif_10
CP 3
JP Z,Lif_100
CP 4
JP Z,Arm_50
CP 5
JP Z,Arm_100
CP 6
JP Z,Bul_Meg
CP 7
JP Z,Bul_Qak
CP 8
JP Z,Bul_Tel
CP 9
JP Z,Bul_Nar
CP 10
JP Z,Bul_Box
CP 14
JP Z,Bul_Roc
CP 17
JP NC,Havens
RET
Situc
CP 2
JP Z,Lif_10
CP 3
JP Z,Lif_100
CP 4
JP Z,Arm_50
CP 5
JP Z,Arm_100
CP 6
JP Z,Bul_Meg
CP 7
JP Z,Bul_Qak
CP 8
JP Z,Bul_Tel
CP 9
JP Z,Bul_Nar
CP 10
JP Z,Bul_Box
CP 14
JP Z,Bul_Roc
RET
Havens
POP HL
LD A,(IX+13)
CP 0
JR NZ,HavQuk
LD A,(IY+5)
CP 0
JR Z,Have1
DEC A
LD (IY+5),A
RET
Have1 LD A,(IY+4)
CP 0
RET Z
DEC A
LD (IY+4),A
RET
HavQuk
LD B,10
Hav1 LD A,(IY+5)
CP 0
JR Z,Have2
DEC A
LD (IY+5),A
DJNZ Hav1
RET
Have2 LD B,10
Hav2 LD A,(IY+4)
CP 0
RET Z
DEC A
LD (IY+4),A
DJNZ Hav2
RET
Lif_10 LD A,(IX+4)
ADD A,10
CP 200
JR C,$+4
LD A,200
LD (IX+4),A
LD HL,Magic+(8*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Lif_100 LD A,(IX+4)
CP 100
JR NC,$+4
LD A,100
LD (IX+4),A
LD HL,Magic+(7*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Arm_50 LD A,(IX+5)
ADD A,50
CP 200
JR C,$+4
LD A,200
LD (IX+5),A
LD HL,Magic+(6*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Arm_100 LD A,(IX+5)
ADD A,100
JR C,$+6
CP 200
JR C,$+4
LD A,200
LD (IX+5),A
LD HL,Magic+(5*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_Meg LD A,(IX+4)
ADD A,100
JR C,$+6
CP 200
JR C,$+4
LD A,200
LD (IX+4),A
LD HL,Magic+(4*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_Qak LD A,(IX+13)
ADD A,30
LD (IX+13),A
LD HL,Magic+(3*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_Tel LD A,(IX+10)
ADD A,1
LD (IX+10),A
LD HL,Magic+(2*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_Nar LD A,(IX+9)
ADD A,30
LD (IX+9),A
LD HL,Magic+(1*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_Box LD A,(IX+7)
CP 1
JR Z,Bul_BOx
OR A
LD A,(IX+6)
ADC A,10
JR NC,$+4
LD A,255
LD (IX+6),A
LD HL,Magic+(0*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_BOx OR A
LD A,(IX+6)
ADC A,5
JR NC,$+4
LD A,255
LD (IX+6),A
LD HL,Magic+(0*2)+1
LD A,(HL)
DEC HL
LD (HL),A
RET
Bul_Roc
LD A,1
LD (IX+12),A
LD HL,Magic+(9*2)+1
LD A,(HL)
DEC HL
LD (HL),A
LD A,(IX+7)
CP 0
JR Z,BulRoc1
LD A,(IX+6)
ADD A,5
LD (IX+6),A
RET
BulRoc1
LD A,(IX+11)
ADD A,5
LD (IX+11),A
RET
HeMap LD H,0
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD D,0
ADD HL,DE
LD DE,Map
ADD HL,DE
LD A,(HL)
RET
MagicDecl
LD HL,Magic
LD B,10
MagDec LD A,(HL)
DEC A
CP 255
JR Z,$+3
LD (HL),A
INC HL
INC HL
DJNZ MagDec
RET
HeroS
LD D,(IX)
LD E,(IX+1)
LD A,0
CALL BlcSpr
LD D,(IX)
LD E,(IX+1)
LD A,0
CALL BlcSpr
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD (HL),0
Hero CALL Rnd
LD DE,(SEED)
LD A,D
AND %11111
CP 23
JR NC,Hero
LD L,A
LD H,0
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD D,0
LD A,E
AND %11111
LD E,A
ADD HL,DE
LD DE,Map
ADD HL,DE
LD A,(HL)
CP 1
JR Z,Hero
LD DE,(SEED)
LD A,D
AND %11111
LD D,A
LD (IX+1),A
LD A,E
AND %11111
LD E,A
LD (IX),A
LD A,(IX+2)
ADD A,17
LD B,D
LD D,E
LD E,B
CALL BlcSpr
RET
InitGame
LD HL,#4000
LD DE,#4001
LD BC,6143
LD (HL),L
LDIR
LD HL,#5800
LD DE,#5801
LD BC,767
LD (HL),7
LDIR
LD HL,Bullets
LD DE,Bullets+1
LD (HL),255
LD BC,64*3-1
LDIR
LD A,(HeroMy+2)
LD HL,HeroMy
LD DE,HeroMy+1
LD (HL),0
LD BC,13
LDIR
LD (HeroMy+2),A
LD A,(HeroYou+2)
LD HL,HeroYou
LD DE,HeroYou+1
LD (HL),0
LD BC,13
LDIR
LD (HeroYou+2),A
LD BC,Test
CALL PrintText
LD A,(HeroMy+2)
ADD A,17
LD DE,#0017 ;X Y
CALL BlcSpr
LD A,5
LD DE,#0417
CALL BlcSpr
LD A,7
LD DE,#0C17
CALL BlcSpr
LD A,9
LD DE,#0F17
CALL BlcSpr
LD A,8
LD DE,#1217
CALL BlcSpr
CALL VariabInit
CALL PrintVariab
CALL MapPrint
RET
MapPrint
LD A,(ChMap)
LD L,0
LD H,A
PUSH HL
ADD HL,HL
POP DE
ADD HL,DE ;*0x300
LD DE,Maps
ADD HL,DE
LD DE,Map
LD BC,768
LDIR
LD DE,#0000
LD HL,Map
LD B,23
MapPr1 PUSH BC
PUSH DE
LD B,32
MapPr2 PUSH BC
LD A,(HL)
PUSH HL
PUSH DE
CALL BlcSpr
POP DE
POP HL
INC HL
INC D
POP BC
DJNZ MapPr2
POP DE
INC E
POP BC
DJNZ MapPr1
CALL MagicPrnt
RET
MagicPrnt
LD HL,Magic
LD DE,Map+768-32
LD B,10
MagL1 PUSH BC
LD A,(HL)
CP 0
CALL Z,MagPrt
INC HL
INC HL
INC DE
INC DE
INC DE
POP BC
DJNZ MagL1
RET
MagPrt
PUSH HL
PUSH DE
EX DE,HL
LD D,(HL)
INC HL
LD E,(HL)
INC HL
LD A,(HL)
PUSH AF
CALL Sravnit
POP AF
INC HL
CALL BlcSpr
POP DE
POP HL
PUSH HL
PUSH DE
EX DE,HL
LD D,(HL)
INC HL
LD E,(HL)
INC HL
LD A,(HL)
INC HL
LD L,E
LD H,0
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD E,D
LD D,0
ADD HL,DE
LD DE,Map
ADD HL,DE
LD (HL),A
POP DE
POP HL
RET
Sravnit LD IX,HeroMy
LD B,A
LD A,(IX)
CP D
JR NZ,SrAv2
LD A,(IX+1)
CP E
JR NZ,SrAv2
LD A,B
CALL Situc
POP AF
POP DE
POP HL
POP BC
RET
SrAv2 LD IX,HeroYou
LD A,(IX)
CP D
RET NZ
LD A,(IX+1)
CP E
RET NZ
LD A,B
CALL Situc
POP AF
POP DE
POP HL
POP BC
RET
VariabInit
LD A,100
LD (HeroMy+4),A
LD A,10
LD (HeroMy+6),A
LD A,5
LD (HeroMy+11),A
LD A,100
LD (HeroYou+4),A
LD A,10
LD (HeroYou+6),A
LD A,5
LD (HeroYou+11),A
RET
PrintVariab
LD A,(HeroMy+3)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,47
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(TimeLim)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,56
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+4)
LD DE,NumBuf+3
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,2
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+5)
LD DE,NumBuf+3
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,10
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+6)
LD DE,NumBuf+3
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,18
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+13)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,26
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+9)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,32
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+10)
LD DE,NumBuf+2
CALL PRNUM
LD A,22
LD (NumBuf),A
LD A,23
LD (NumBuf+1),A
LD A,38
LD (NumBuf+2),A
LD BC,NumBuf
CALL PrintText
LD A,(HeroMy+7)
ADD A,13
LD DE,#0817
CALL BlcSpr
RET
Test DB 22,23,0," % % "
DB " Frag: Time: HDS",0
BlcSpr
LD L,A
RLCA
RLCA
RLCA
ADD A,L
LD L,A
LD H,Sprites/256
LD A,E ;DE - Координата X-D Y-E
AND 7 ; A - Используется в своих целях
RRCA
RRCA ;DE - Адрес экрана
RRCA
ADD A,D
LD D,E
LD E,A
LD A,D
AND #18
OR #40
LD D,A
DUP 7
LD A,(HL)
LD (DE),A
INC L
INC D
EDUP
LD A,(HL)
LD (DE),A
INC L
SRL D
SRL D
SRL D
LD A,D
OR #50
LD D,A
LD A,(HL)
LD (DE),A
RET
;--------------------------
SelectGamePlay
LD HL,#4000
LD DE,#4001
LD BC,6143
LD (HL),L
LDIR
LD HL,#5800
LD DE,#5801
LD BC,767
LD (HL),7
LDIR
LD BC,GamePlayTXT
CALL PrintText
CALL SHero
CALL Box
Selcyc
LD A,(ChMap)
CALL BoxMap
LD IX,GameS
CALL MenuLR
CP 0
JP Z,PrevMap
CP 1
JP Z,NextMap
CP 254
JR Z,SMenR
JP Selcyc
SMenR
LD IX,GameS2
CALL MenuLR
CP 0
CALL Z,HeroSkin
CP 255
JR Z,Selcyc
CP 254
JR Z,Limited
JR SMenR
HeroSkin
LD A,(HeroMy+2)
INC A
CP 6
JR NZ,$+3
XOR A
LD (HeroMy+2),A
CALL SHero
RET
Limited
LD IX,GameS3
CALL MenuLR
CP 0
CALL Z,LimFrag
CP 1
CALL Z,LimTime
CP 255
JP Z,SMenR
CP 254
JR Z,Gmp
JR Limited
LimFrag LD A,(FragLim)
INC A
CP 100
JR NZ,$+3
XOR A
LD (FragLim),A
LD DE,NumBuf+2
CALL PRNUM
LD BC,NumBuf
LD A,22
LD (BC),A
INC BC
LD A,6
LD (BC),A
INC BC
LD A,40
LD (BC),A
LD BC,NumBuf
CALL PrintText
XOR A
RET
LimTime LD A,(TimeLim)
INC A
CP 100
JR NZ,$+3
XOR A
LD (TimeLim),A
LD DE,NumBuf+2
CALL PRNUM
LD BC,NumBuf
LD A,22
LD (BC),A
INC BC
LD A,7
LD (BC),A
INC BC
LD A,40
LD (BC),A
LD BC,NumBuf
CALL PrintText
XOR A
RET
PrevMap LD A,(ChMap)
CP 0
JP Z,Selcyc
DEC A
LD (ChMap),A
JP Selcyc
NextMap LD A,(MapMax)
LD B,A
LD A,(ChMap)
CP B
JP Z,Selcyc
INC A
LD (ChMap),A
JP Selcyc
Gmp
LD IX,GameS4
CALL MenuLR
CP 0
JP Z,Meka
CP 1
JP Z,Start
CP 255
JP Z,Limited
JR Gmp
Meka
LD L,IRAs
LD H,IRBl
LD BC,#FFFD
LD DE,#FFBF
LD B,D
OUT (C),H
IN A,(C)
RLCA
AND %1 ;TODO
ld a,1
CP 1
JP Z,JOiner
JP STARTGAME
NeedHelp
LD L,IRAs
LD H,IRBl
LD BC,#FFFD
LD DE,#FFBF
LD B,D
OUT (C),H
IN A,(C)
RLCA
AND %1 ;TODO
ld a,1
CP 1
JR Z,Ned1
LD BC,TXT2
CALL PrintText
RET
Ned1 LD BC,TXT1
CALL PrintText
RET
MenuLR
LD A,(IX+5)
LD (MenuY),A
MenuCiLR HALTER
CALL MenuPrint
CALL NeedHelp
HALTER
CALL MenuPrint
LD A,(MenuY)
LD (IX+5),A
CALL KeyMe
LD A,(Key)
BIT 0,A
JP Z,MenuCL
LD A,(Key)
BIT 1,A
JP Z,MenuCR
LD A,(Key)
BIT 3,A
CALL Z,MenuCQ
LD A,(Key)
BIT 2,A
CALL Z,MenuCA
LD A,(Key)
BIT 4,A
JR NZ,MenuCiLR
LD A,(MenuY)
LD (IX+5),A
RET
MenuCL LD A,255
RET
MenuCR LD A,254
RET
GameS DB 6,2,4,2,1,0 ;Y,X,LEN,кол-во,STEP,Стрый Y
GameS2 DB 6,9,5,1,1,0 ;Y,X,LEN,кол-во,STEP,Стрый Y
GameS3 DB 6,17,5,2,1,0 ;Y,X,LEN,кол-во,STEP,Стрый Y
GameS4 DB 6,25,4,2,1,0 ;Y,X,LEN,кол-во,STEP,Стрый Y
SHero LD A,(HeroMy+2)
ADD A,17
LD DE,#0906
CALL BlcSpr
RET
BoxMap LD L,0
LD H,A
PUSH HL
ADD HL,HL
POP DE
ADD HL,DE
LD DE,Maps
ADD HL,DE
LD DE,#4820+2
LD B,23
BoxMap1 PUSH BC
PUSH DE
LD B,4
PUSH BC
LD B,8
LD A,(HL)
SLA C
OR C
LD C,A
INC HL
DJNZ $-6
LD A,C
LD (DE),A
INC E
POP BC
DJNZ $-15
POP DE
CALL DE_Down
POP BC
DJNZ BoxMap1
RET
Box LD HL,#4F00+1
LD (HL),1
INC L
LD (HL),255
INC L
LD (HL),255
INC L
LD (HL),255
INC L
LD (HL),255
INC L
LD (HL),#80
INC L
LD HL,#4F00+64+32+1
LD (HL),1
INC L
LD (HL),255
INC L
LD (HL),255
INC L
LD (HL),255
INC L
LD (HL),255
INC L
LD (HL),#80
INC L
LD HL,#4F00+1
LD B,8*3
LD (HL),1
CALL HL_Down
DJNZ $-5
LD HL,#4F00+5+1
LD B,8*3
LD (HL),#80
CALL HL_Down
DJNZ $-5
RET
HL_Down INC H
LD A,H
AND 7
RET NZ
LD A,L
ADD A,32
LD L,A
RET C
LD A,H
SUB 8
LD H,A
RET
DE_Down INC D
LD A,D
AND 7
RET NZ
LD A,E
ADD A,32
LD E,A
RET C
LD A,D
SUB 8
LD D,A
RET
PRNUM
LD (K3),A
CALL DELENIE;число:10
LD (K2),A
CALL DELENIE;число:100
LD (K1),A
INC DE
INC DE
INC DE
LD A,0
LD (DE),A
DEC DE
LD A,(K2) ;┐
CALL UMNA ;│
LD A,(K3) ;├число-10*INT(число/10)+48
SUB C ;│
ADD A,48 ;│
LD (DE),A ;┘
DEC DE
LD A,(K1) ;┐
CALL UMNA ;│
LD A,(K2) ;├INT(число/10)-10*INT(число/100)+48
SUB C ;│
ADD A,48 ;│
LD (DE),A ;┘
DEC DE
LD A,(K1) ;┐
ADD A,48 ;├INT(число/100)+48
LD (DE),A ;┘
RET
UMNA LD C,A ;умножение аккумулятора на 10
LD B,9
UM1 ADD A,C
DJNZ UM1
LD C,A
RET
DELENIE LD B,0
DEL1 CP 10
JR C,DEL2
SUB 10
INC B
JR DEL1
DEL2 LD A,B
RET
K1 DB 0
K2 DB 0
K3 DB 0
Rnd
LD HL,(SEED)
CALL RND
RND LD A,H
ADD HL,HL
XOR H
ADD HL,HL
ADD HL,HL
ADD HL,HL
XOR H
ADD HL,HL
ADD HL,HL
XOR H
ADD HL,HL
ADD HL,HL
LD L,A
LD (SEED),HL
RET
SEED DW #381A ; НЕ НОЛЬ!
NumBuf DB "0000000",0
GamePlayTXT DB 22,5,4,7,"Map:"
DB 22,6,4,7," Prev."
DB 22,7,4,7," Next"
DB 22,5,19," Skins:"
DB 22,6,19," You"
DB 22,5,35,"Limits:"
DB 22,6,35,"Frag:00"
DB 22,7,35,"Time:00"
DB 22,5,51,"Game:"
TXT DB 22,6,51,"Create"
DB 22,7,51," Exit",0
TXT1 DB 22,6,51," Join ",0
TXT2 DB 22,6,51,"Create",0
;--------------------------
ChMap DB 0
MapMax DB 2
;--------------------------
Magic DB 100,100;Bullets Box 1
DB 250,250;Narkot
DB 250,250;Teleport
DB 250,250;Quake Damage
DB 250,250;Mega Heath
DB 150,150;Armor 2
DB 150,150;Armor 1
DB 0,80;2 Больничка
DB 0,80;0-Выводить,Сколько ждать 1 Больничка
DB 120,120;0-Рокетница
;--------------------------
Map DS 32*23
DS 32
;--------------------------
FragLim DB 0 ;Frag Limit
TimeCh2 DB 0 ;Time Limit
TimeLim DB 0 ;Time Limit
TimeCh DB 0 ;Time Limit
;--------------------------
Bullets DS 64*3 ;X,Y,%0000SSMM Где SS-Тип пули,MM-двежение
;Если X больше чем 32 то пули нет
;--------------------------
HeroMy DB 0;X
DB 0;Y
DB 0;Скин
DB 0;Фраги
DB 0;Здоровье
DB 0;Броня
DB 0;Потроны
DB 0;Оружие
DB 0;Перезарядка оружия
DB 0;Hevet Pack
DB 0;Teloprt
DB 0;Потроны рокетницы (при переключении меняется)
DB 0;Собрал рокетницу-1 нет-0
DB 0;Quake Damage
HeroMyKey DB 0;Кнопки
;--------------------------
HeroYou DB 0;X
DB 0;Y
DB 0;Скин
DB 0;Фраги
DB 0;Здоровье
DB 0;Броня
DB 0;Патроны
DB 0;Оружие
DB 0;Перезарядка оружия
DB 0;Hevet Pack
DB 0;Teloprt
DB 0;Потроны рокетницы (при переключении меняется)
DB 0;Собрал рокетницу-1 нет-0
DB 0;Quake Damed
HeroYouKey DB 0;Кнопки
WaitTXT DB 22,10,10,7,"Wait another player",0
WaitAn LD HL,#4000
LD DE,#4001
LD (HL),0
LD BC,6143
LDIR
LD HL,#5800
LD DE,#5801
LD BC,767
LD (HL),7
LDIR
LD BC,WaitTXT
CALL PrintText
LD L,IRAs
LD H,IRBl
LD BC,#FFFD
LD DE,#FFBF
OUT (C),L
LD B,E
OUT (C),D
LD B,D
OUT (C),H
Sinhrz
IN A,(C)
RLA
JR NC,Sinhrz
LD BC,#FFFD
LD DE,#FFBF
LD B,D
LD A,IRAs
OUT (C),A
LD B,E
XOR A
OUT (C),A
HALTER
CALL Sinhro ;Процедура синхронизации
LD A,(ChMap)
CALL Obmen ;
CALL MiniSinhro
LD A,(TimeLim)
CALL Obmen ;
CALL MiniSinhro
LD A,(FragLim)
CALL Obmen ;
CALL MiniSinhro
LD A,(HeroMy+2)
CALL Obmen ;
LD (HeroYou+2),A
CALL MiniSinhro
RET
JOiner
LD L,IRAs
LD H,IRBl
LD BC,#FFFD
LD DE,#FFBF
LD B,D
OUT (C),H
IN A,(C)
AND %10000000 ;TODO
ld a,%10000000
CP %10000000
RET NZ
;POP HL ;???
LD L,IRAs
LD H,IRBl
LD BC,#FFFD
LD DE,#FFBF
OUT (C),L
LD B,E
OUT (C),D
LD B,D
OUT (C),H
Sinhrzx
IN A,(C)
RLA
;JR NC,Sinhrzx
LD BC,#FFFD
LD DE,#FFBF
LD B,D
LD A,IRAs
OUT (C),A
LD B,E
XOR A
OUT (C),A
HALTER
HALTER
CALL Sinhro
CALL Obmen
LD (ChMap),A
CALL MiniSinhro
CALL Obmen
LD (TimeLim),A
CALL MiniSinhro
CALL Obmen
LD (FragLim),A
CALL MiniSinhro
LD A,(HeroMy+2)
CALL Obmen
LD (HeroYou+2),A
CALL MiniSinhro
JP STGA
sinhro
ret
LD L,IRAs
LD H,IRBl
LD BC,#FFFD
LD DE,#FFBF
OUT (C),L
LD B,E
OUT (C),D
LD B,D
OUT (C),H
sinhro1
IN A,(C)
RLA
JR NC,sinhro1
OUT (C),L
LD B,E
XOR A
OUT (C),A
LD B,D
OUT (C),H
sinhro2
IN A,(C)
RLA
JR C,sinhro2
OUT (C),L
LD B,E
OUT (C),D
LD B,D
OUT (C),H
sinhro3
IN A,(C)
RLA
JR NC,sinhro3
RET
BulZXY
LD HL,Bullets
LD B,64
BuZXY PUSH BC
LD A,(HL)
CP 255
CALL NZ,Buzz
INC HL
INC HL
INC HL
POP BC
DJNZ BuZXY
RET
Buzz
PUSH HL
LD D,(HL)
INC HL
LD E,(HL)
POP HL
LD A,(IX)
CP D
RET NZ
LD A,(IX+1)
CP E
RET NZ
CALL BullYep
RET
OpoDel
LD D,(IX)
LD E,(IX+1)
LD A,0
CALL BlcSpr
LD E,(IX)
LD L,(IX+1)
CALL HeMap
LD (HL),0
ifdef CLIENT
LD A,(OldX)
LD (IX),A
LD A,(OldY)
LD (IX+1),A
endif
RET
OldX DB 0
OldY DB 0