.org $F3E3-10 ;$F3E3-[name size]
;^^ <-MUST EQUAL NAME SIZE BELOW!!! If not, Worm will crash!
- .db 'w',90 ;wormLevel header (version .90)
+ .db 'w',91 ;wormLevel header (version .91)
.db 10,"Example #1" ;name size (UPDATE .ORG!!!); level name
.dw hiscore-single ;leveldata size
;note: use <.dw 0> if no levels present (empty level will be used).
- .db 2,3,4,2 ;max. choosable level+1 for each gametype
- .db 2,2,2,2 ;so: 2 = level 1 only; 4 = level 1 to 3 available
+ .db 1,2,3,1 ;max. choosable level for each gametype
+ .db 1,1,1,1 ;so: 1 = level 1 only; 3 = level 1 to 3 available
;again .db 0 indicates no levels present.
; .db 4 ; begin-x
; .db %00 ; direction (%00=right+down, %11=left+up)
; .db 2,7,%00 ;BALL #2: y,x,direction
-; .db 0 ;your start direction (0=up,$40=right,$80=down,$C0=left)
+; .db 0 ;your start direction (0=down,$40=right,$80=up,$C0=left)
; .db 2 ;your y-position (2=at top)
; .db 63 ;your x-position (63=center)
; ;IN MULTIPLAYER LEVELS also set positions for worm 2-4:
;
; .db 128,57 ;field size: width (128-255), height (57-255)
; ; screen will SCROLL if size is more than 128,57
+; ;IN CTF LEVELS also set flag-positions:
+;(.db 10,117 ) ;flag #1 y-position, x-position
+;(.db 46,10 ) ;flag #2 y-pos, x-pos.
+;
; .db 2 ;number of lines:
; .db 28,14,100,41 ;LINE #1 coordinates: (x1,y1)-(x2,y2)
; .db 28,41,100,14 ;LINE #2: the same
foodmatch:
-ctf:
domination:
.db 8,5,18,15,0,0
.db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
.db 52,10,74,37
+ctf:
+ .db 8,5,18,15,0,0
+ .db $20,2,2,$A0,54,125, $20,2,7,$A0,54,120
+ .db 128,57
+ .db 10,117,46,10
+ .db 0,0
+
+
+
hiscore: ;space reserved to store hi-scores
.dw 0 ;singleplayer hiscore will be saved here
.dw 0,0 ;peaworm hiscore for each peaworm-level
_load_ram_ahl = $462F ;ahl->page+hl
_writeb_inc_ahl = $5567 ;ld (ahl),c
_jforce = $409C ;TI-OS stack restored
+_EXLP = $4493 ;swap (hl),(de) b times
;-----------------------------
;------- data storage -------
jp nz,linkiniterror
cal send
- jr multiplayer
+; cal sendname
+; cal receivename
+
+ ld a,$18
+ jr nc,multiplayer
linkiniterror:
pop hl
jp DisplayMenu
+sendname:
+ ld hl,worm1+name
+ ld b,maxnamelength
+sendnameloop:
+ ld a,(hl)
+ inc hl
+ psh bc
+ psh hl
+ cal send
+ pop hl
+ pop bc
+ dnz sendnameloop
+ ret
+receivename:
+ ld hl,worm2+name
+ ld b,maxnamelength
+recvnameloop:
+ psh bc
+ psh hl
+ cal receive
+ pop hl
+ pop bc
+ ld (hl),a
+ inc hl
+ dnz recvnameloop
+ ret
+
client:
ld hl,txtReceive
cal _puts
cp WormVersion
jp nz,linkiniterror
- ld hl,SwapPos
- ld (hl),$f6
+; cal receivename
+; cal sendname
+
+ ld a,$f6
multiplayer:
+ ld (SwapPos),a
ld a,2
ld (nrworms),a
GameOver:
cal _clrLCD
- ld hl,0
- ld (worm1+died),hl
-;+died=0 \ +score1=0
- ld (worm2+died),hl
- ld (worm3+died),hl
- ld (worm4+died),hl
- inc h
- ld (worm1+score+1),hl
-;+score2=0 \ +delay=1
- ld (worm2+score+1),hl
- ld (worm3+score+1),hl
- ld (worm4+score+1),hl
ld hl,worm1set
- ld de,worm1+head
+ ld de,worm1
ld a,4 ;4x (all worms)
createwormsloop:
- ld bc,19
- ldir ;copy 19 bytes
ex de,hl
- ld bc,head
+ ld bc,died
add hl,bc
- ex de,hl ;de=wormX+head
- dec a ;loop
+ ld (hl),0 ;died=0
+ inc hl
+ ld (hl),0 ;score=0
+ inc hl
+ ld (hl),0 ;score+1=0
+ inc hl
+ ld (hl),2 ;delay=2
+ inc hl
+ ex de,hl ;de=wormX+head
+ ld bc,19
+ ldir ;copy 19 bytes
+ dec a ;loop
jr nz,createwormsloop
ld a,(Gametype)
jp nz,nextlevel
psh hl
- ld b,150
-waitsomemore:
- halt
- dnz waitsomemore
+ cal releasekeys
cal _clrWindow
pop hl
;show end msg or smtn
ld a,0
gameCar =$-1
and _datalink
- jr z,SwapPos ;no link
+ jr z,initfinished ;no link
+
xor a
- ld (worm2+input),a
+ ld (worm2+input),a ;worm 2 via link
ld (worm2+left),a
- ld (Speed),a
-
+ ld (Speed),a ;max.speed
SwapPos: ;$18 xx -> $F6 xx
+ ; jr xx -> or xx
jr initfinished
inc a
- ld (worm2+left),a
- ld hl,(worm1+pos)
- ld de,(worm2+pos)
- ld (worm2+pos),hl
- ld (worm1+pos),de
- ld a,(worm1+heading)
- ld b,a
- ld a,(worm2+heading)
- ld (worm1+heading),a
- ld a,b
- ld (worm2+heading),a
+ ld (worm2+left),a ;1
+ ld hl,worm1
+ ld de,worm2
+ ld b,4 ;+heading +pos
+ cal _EXLP ;swap positions
+;&&& over link
+ ld hl,worm1+name
+ ld de,worm2+name
+ ld b,maxnamelength
+ cal _EXLP ;swap positions
initfinished:
ld b,startdelay
xor a
cp (hl) ;input=0 = link
jr nz,NoLinkIndic
- ld b,7
+ ld b,7 ;{DOWN}
inc hl ;+left
cp (hl)
jr z,hostLinkIndic
- dec b
+ dec b ;{UP}
hostLinkIndic:
ld a,8
ld (_curCol),a
;de=ix+head
ld (ix+tail+1),d
ld (ix+tail),e ;head=tail/size=0
- jr norespawn
ret
unnamedlabel:
respawndue:
ld l,a
cal inputcall
+ ld (sendbyte),a
ld a,h ;previous
cp l ;changed?
ret z
+ ld (ix+delay),a ;=0
+ ret
saverespawncounter:
ld (ix+delay),a
-norespawn:
- ld a,(gameCar)
- and _datalink
- jr nz,inlink
- ret
+ jr inputcall
+; ld a,(ix+input)
+; or a
+; jr z,inlink
+; ret
inkeys: ;use jp not call!
out (1),a ;nop\nop
ld b,(ix+left)
dec b
jr z,receivefirst
+ psh hl
cal send
cal receive
+ pop hl
ld l,a
ret
receivefirst:
psh af
+ psh hl
cal receive
+ pop hl
ld l,a
pop af
psh hl
pop hl ; << call
pop hl ; << call
pop hl ; << levelp new
+ ld (ix+delay),2
jp StartLevel
chkpeahit: ;hl=peapos
TIMEOUT = $1000
-LinkBreak:
- pop hl
- ld a,D0HD1H
- out (7),a
- jp Exit
-
-
receive:
cal GET_KEY
cp K_EXIT
jp z,LinkBreak
in a,(7)
and %11
- cp %11
- jr z,receive
- in a,(7)
- and %11
+; jr z,LinkBreak
cp %11
jr z,receive
ld b,8
ReceiveCont:
sub %10
ld a,%10
- ld d,D0LD1H
+ ld d,D0LD1H ;01
jr c,ReceiveLow
- rra
- ld d,D0HD1L
+ rra ;ld a,%01
+ ld d,D0HD1L ;10
ReceiveLow:
rr c
ld (AckBit),a
cp 0
AckBit =$-1
jr nz,WaitAckRec
- ld a,D0HD1H
+ ld a,D0HD1H ;11
out (7),a
ld d,4
WaitReadyRec:
ld a,c
ret
+LinkBreak:
+ ld a,D0HD1L
+ out (7),a
+ jp Exit
+
send:
ld c,a
ld b,8+1
jr SendAcked
-
sendloop:
rr c
- ld a,D0LD1H
+ ld a,D0LD1H ;%01
jr nc,SendLow
- ld a,D0HD1L
+ ld a,D0HD1L ;%10
SendLow:
out (7),a
ld de,TIMEOUT
cal CheckLink
jr nz,WaitAckSend
SendAcked:
- ld a,D0HD1H
+ ld a,D0HD1H ;%11
out (7),a
ld de,TIMEOUT
WaitReadySend:
cp %11
jr nz,WaitReadySend
dnz sendloop
+ ld a,c
+ ret
+
LinkSuccess:
.db $F6 ;or NN (skip scf)
LinkFailed:
CheckLink:
pop hl
dec de
- ld a,d
- or e
- jr z,LinkFailed
+ ld a,d
+ or e
+ jr z,LinkFailed
ld a,$BF
out (1),a
out (1),a
pop af
bit 6,a
- jr z,LinkFailed
+ jr z,LinkBreak
in a,(7)
and %11
.dw domination
.db 1,2,3,1
- .db 1,1,2,1
+ .db 6,1,2,1
;---------- LEVELS ----------
.db 0,0
+linkmatch:
+ .db 8,0,15,15,0,0
+ .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
+ .db 228,157
+ .db 0,0
+
+
deathmatch:
.db 8,5,15,31,0,0
.db $40,28,2 ;begin stats for each player
.db 0,0
-linkmatch:
- .db 8,0,15,15,0,0
- .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
- .db 228,157
- .db 0,0
-
-
race:
.db 8,4,15,10,0,0
.db $40,3,2,$40,6,2, $40,9,2,$40,12,2
ctf:
.db 8,5,18,15,0,0
- .db $20,2,2,$A0,54,125, $20,2,7,$A0,54,120
+ .db $00,2,62,$00,2,64, $20,2,7,$A0,54,120
.db 128,57
- .db 9,117,46,10
+ .db 46,117,46,10
.db 0,0
.db 8,5,18,15,0,0