3 ; Release Date : soon (I hope)
4 ; Filename : worm.86p (3404)
6 ; Email Address : shiar@mailroom.com
8 ; Web Page : www.games3.net/shiar
9 ; Description : ruling multiplayer game for 86 (most like Nibbles)
10 ; Where to get this game : games3.net/shiar (home of Worm)
11 ; Other games by author(s) : Shiar: Nemesis beta
12 ; Additional Credits to : Matthew Shepcar (wrote original Peaworm, end'98)
13 ; Jonah Cohen (wrote some parts of worm)
15 ;-----------------------------
16 ;----------- TO-DO -----------
17 ;-----------------------------
21 ;Feel like doing something? (name indicates who's working on it)
22 ; * linkplay TESTING! (+faster)
25 ; * make linkplay available for all gametypes (not just deathmatch)
26 ; * two worms collide with heads -> both should die
29 ;1) * ctf: take enemy flag (right-bottom) and return to your flag (left-top)
30 ;1) * domination?: take control points by running over them and hold them
32 ;1)* sprites for picks instead of blocks
33 ; * fix linedraw procedure
36 ;1) Working on a new pickup-system allowing more than one "food" and different pickup-handling
40 ;-----------------------------
41 ;------- program start -------
42 ;-----------------------------
54 .db %10010111,%01101111
55 .db %10110101,%01001011
56 .db %11110111,%01001001
57 .db %00000011,%10000000
58 .db %00000001,%11100000
59 .db %00111000,%11111000
60 .db %01111110,%00111111
61 .db %11101111,%00001111
62 .db %11000011,%10000000
69 res 2,(iy+13) ;appAutoScroll
74 ;-----------------------------
75 ;----- build trig tables -----
76 ;-----------------------------
101 ;-----------------------------
102 ;---------- menu -------------
103 ;-----------------------------
114 call _puts ;txtOptions
128 jp LetsGetThisPartyOn
236 ;-----------------------------
237 ;-------- start game ---------
238 ;-----------------------------
260 ld de,$FF64 ;virt.infinate
308 ;-----------------------------
309 ;--------- game over ---------
310 ;-----------------------------
321 ld (worm1+score+1),hl
322 ;+score2=0 \ +delay=1
323 ld (worm2+score+1),hl
324 ld (worm3+score+1),hl
325 ld (worm4+score+1),hl
330 call _MOV5B ;9xld(de),(hl)
413 ld bc,(worm2-worm1)-5
418 ;-------- draw level ---------
537 ;-----------------------------
539 push hl ; >> levelp new
554 ld hl,4+(txtposReady*256)
564 jr z,SwapPos ;no link
570 SwapPos: ;$18 xx -> $F6 xx
591 ;-----------------------------
592 ;----------- LOOP ------------
593 ;-----------------------------
612 jr nz,screeninvertloop
636 ;-----------------------------
637 ;---------- keys -------------
638 ;-----------------------------
684 jr nz,safewormsizedone
718 ret nz ;HandleWorm done
786 call _ldHLind ;ld hl,(hl)
787 call showHL ;worm+score
793 djnz displayWormStats
804 ;x123456789012345678901
805 ;1----- GAME OVER -----
824 rst 20h ;_ABS_MOV10TOOP1
826 call _swapt_ ;_ex_ahl_bde
830 call _SET_ABS_DEST_ADDR
834 call _SET_ABS_SRC_ADDR
836 call _SET_MM_NUM_BYTES
845 ;-----------------------------
846 ;----------- worm ------------
847 ;-----------------------------
869 inkeys: ;use jp not call!
887 ;------- handle worm ---------
909 ;-------- move worm ----------
944 pop hl ; << pos (old)
969 ;--------- worm hit ----------
978 call nz,checkhitotherworm
1004 jr nz,still_alive_not_dead
1007 jr z,still_alive_not_dead
1013 pop de ; << levelp new
1021 ;-----------------------------
1024 .db $dd,$7d ;ld a,lx
1027 ThisIsJustASillyUselessLabel:
1041 jr c,otherwormHIT ;yes
1046 jr nz,nextotherwormbit
1078 still_alive_not_dead:
1080 ;-------- draw worm ----------
1085 call nz,HuntingTimeScore
1092 call nz,checkhitlapline
1138 ;-----------------------------
1139 ;----------- procs -----------
1140 ;-----------------------------
1148 ld bc,1000h+(7921/256)
1158 ld (Seed),hl ;seed=(seed*7921+1) MOD 65536
1199 jr z,DrawPeaPixel ;d=0:draw
1202 ld d,1 ;d=1:yes 2:no
1205 xor (hl) ;change pixel
1209 ;-------- pixelprocs ---------
1224 CheckPixel: ;at bc in d
1231 ;------------------------------------------------------
1235 ; 131 cycles 28 bytes (b,c) to hl:a destroyes: none
1236 ;------------------------------------------------------
1243 ld l,a ;hl=$3f00+4*y
1248 add hl,hl ;hl=$fc00+16*y
1265 ;FindPixel: ;bc to ahl + de gone
1270 add a,offsets_table & 255
1272 ld d,offsets_table/256
1294 ;----------- score -----------
1297 .db $dd,$7d ;ld a,lx
1449 ;-----------------------------
1452 .db 128,64,32,16,8,4,2,1
1568 ld (ShiftRightCounter),a
1570 ld (ShiftRightChunk),a
1584 ShiftRightCounter = $-1
1606 ld (ShiftLeftCounter),a
1608 ld (ShiftLeftChunk),a
1610 jr nc,ShiftLeftSameByte
1629 ShiftLeftCounter = $-1
1640 jr nz,ShiftRowsRight
1674 ;----------- draw ------------
1685 Line: ;draw line from de to hl (d<h)
1792 ; jr nc,makefirstbyte
1815 ;-----------------------------
1816 ;----------- link ------------
1817 ;-----------------------------
1838 set 2,(iy+$12) ;cursorblink
1907 jr nz,waitacknowledge
1919 .db $f6 ;first byte of "or n"
1923 res 2,(iy+$12) ;noblink
2048 ;-----------------------------
2049 ;---------- levels -----------
2050 ;-----------------------------
2055 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
2062 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
2066 .db 4,19,16,14 ;xsize,ysize,xpos,ypos
2073 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
2083 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
2096 .db 5,4,15 ;peas,speed,begin_size
2098 .db 128,57 ;field width, height
2099 .db 0 ;no additional lines
2106 .db 28,28,100,28 ;line coords: x1,y1,x2,y2
2187 ;-----------------------------
2188 ;---------- data -------------
2189 ;-----------------------------
2192 .db 0, 3, 6, 9, 12, 15, 18, 21
2193 .db 24, 27, 30, 33, 36, 39, 42, 45
2194 .db 48, 51, 54, 57, 59, 62, 65, 67
2195 .db 70, 73, 75, 78, 80, 82, 85, 87
2196 .db 89, 91, 94, 96, 98,100,102,103
2197 .db 105,107,108,110,112,113,114,116
2198 .db 117,118,119,120,121,122,123,123
2199 .db 124,125,125,126,126,126,126,126
2202 txtWelcome: .db "Welcome to Worm!! ",
2204 txtOptions: .db "Options",0
2205 txtGame: .db "Singleplayer",0 ;0
2206 txtGame2: .db "Deathmatch ",0 ;1
2207 .db "Foodmatch ",0 ;2
2208 .db "LinkMatch",0 ;3 (>options)
2212 .db "Domination",0 ;7
2213 txtWaiting: .db "Waiting...",0
2214 txtReceive: .db "Receiving...",0
2217 WormMsg: .db "WORM by SHIAR -- test version",0
2218 txtLevel: .db "Level ",0
2219 txtWorms: .db "Worms: 0",0 ;follows txtLevel
2220 txtDied: .db "Died ",0
2221 txtScore: .db "Score",0 ;follows txtDied
2222 txtLeft: .db " left",0 ;follows txtScore
2223 txtReady: .db "Prepare!",0
2225 txtGO: .db "----- GAME OVER -----",0
2230 _datalink = %00000001
2231 _datamulti = %00000010
2232 _datalivel = %00000010 ;ix+lives=0 limit
2233 _datafoodl = %00000100 ;left=0 limit
2234 _datanextl = %00001000 ;next level if left=0
2235 _datafood = %00010000 ;food present
2236 _datahunt = %00100000
2237 _datalaps = %01000000 ;give lap score
2238 _datascore = %10000000 ;score>=100 limit
2240 datasingle: .db %00011110
2242 datadeathm: .db %00000010
2244 datafoodm: .db %10010000
2246 datalinkm: .db %00000011
2248 datahuntin: .db %00110100
2250 datarace: .db %11000000
2252 datactf: .db %00000000
2254 datadomin: .db %00000000
2259 resbit = 2 ;and%11111011
2260 worm1set: .dw $B000,$B000 ;%10110000
2261 .db 3,0,%01111110,%10,%100 ;< >
2263 worm2set: .dw $B800,$B800 ;%10111000
2264 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2266 worm3set: .dw $E800,$E800 ;%11101000 ;$D748+$1000+
2267 .db 3,0,%01011111,%10,%100 ;sto ,
2269 worm4set: .dw $F000,$F000 ;%11110000
2270 .db 3,0,%01111101,%10,%1 ;enter +
2298 DispBuffer =$+2 ;912 bytes
2300 ScrBuffer = $8000 ;-$A1FF (32x256)
2301 SinCosTable = $A200 ;-$A300 (4x64)
2303 ;-----------------------------
2304 ;----------- end -------------
2305 ;-----------------------------