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)
25 ; * make linkplay available for all gametypes (not just deathmatch)
26 ; * two worms collide with heads -> both should die
28 ;1) * ctf: take enemy flag (right-bottom) and return to your flag (left-top)
29 ;1) * domination?: take control points by running over them and hold them
30 ;1)* sprites for picks instead of blocks
32 ;1) Working on a new pickup-system allowing more than one "food" and different pickup-handling
36 ;-----------------------------
37 ;------- program start -------
38 ;-----------------------------
50 .db %10010111,%01101111
51 .db %10110101,%01001011
52 .db %11110111,%01001001
53 .db %00000011,%10000000
54 .db %00000001,%11100000
55 .db %00111000,%11111000
56 .db %01111110,%00111111
57 .db %11101111,%00001111
58 .db %11000011,%10000000
65 res 2,(iy+13) ;appAutoScroll
70 ;-----------------------------
71 ;----- build trig tables -----
72 ;-----------------------------
97 ;-----------------------------
98 ;---------- menu -------------
99 ;-----------------------------
110 call _puts ;txtOptions
124 jp LetsGetThisPartyOn
232 ;-----------------------------
233 ;-------- start game ---------
234 ;-----------------------------
258 ld de,$FF64 ;virt.infinate
306 ;-----------------------------
307 ;--------- game over ---------
308 ;-----------------------------
319 ld (worm1+score+1),hl
320 ;+score2=0 \ +delay=1
321 ld (worm2+score+1),hl
322 ld (worm3+score+1),hl
323 ld (worm4+score+1),hl
328 call _MOV5B ;9xld(de),(hl)
424 ld bc,(worm2-worm1)-5
429 ;-------- draw level ---------
548 ;-----------------------------
550 push hl ; >> levelp new
565 ld hl,4+(txtposReady*256)
575 jr z,SwapPos ;no link
581 SwapPos: ;$18 xx -> $F6 xx
602 ;-----------------------------
603 ;----------- LOOP ------------
604 ;-----------------------------
623 jr nz,screeninvertloop
636 call handlethatneatlittleball
649 ;-----------------------------
650 ;---------- keys -------------
651 ;-----------------------------
678 jr DoesWormTailEqualsWormHead ;chk4 size=0
689 DoesWormTailEqualsWormHead:
695 jr nz,safewormsizedone
724 ret nz ;HandleWorm done
792 call _ldHLind ;ld hl,(hl)
793 call showHL ;worm+score
799 djnz displayWormStats
803 jr z,hiscorecheckdone
815 ex de,hl ;disp.new hiscore
833 ;x123456789012345678901
834 ;1----- GAME OVER -----
845 rst 20h ;_ABS_MOV10TOOP1
847 call _swapt_ ;_ex_ahl_bde
851 call _SET_ABS_DEST_ADDR
855 call _SET_ABS_SRC_ADDR
857 call _SET_MM_NUM_BYTES
866 ;-----------------------------
867 ;----------- worm ------------
868 ;-----------------------------
890 inkeys: ;use jp not call!
908 ;------- handle worm ---------
930 ;-------- move worm ----------
965 pop hl ; << pos (old)
983 ;--------- worm hit ----------
992 call nz,checkhitotherworm
1018 jr nz,still_alive_not_dead
1021 jr z,still_alive_not_dead
1027 pop de ; << levelp new
1035 ;-----------------------------
1038 .db $dd,$7d ;ld a,lx
1041 ThisIsJustASillyUselessLabel:
1055 jr c,otherwormHIT ;yes
1060 jr nz,nextotherwormbit
1092 still_alive_not_dead:
1094 ;-------- draw worm ----------
1099 call nz,HuntingTimeScore
1106 call nz,checkhitlapline
1151 ;-----------------------------
1152 ;---------- ball -------------
1153 ;-----------------------------
1155 handlethatneatlittleball:
1166 inc b ;=%000100 dec=%000101
1171 call letsmovetheotherway
1175 inc c ;=%001100 dec=%001101
1180 call letsmovetheotherway
1185 letsmovetheotherway:
1198 ;-----------------------------
1199 ;----------- procs -----------
1200 ;-----------------------------
1208 ld bc,$1000+(7921/256)
1218 ld (Seed),hl ;seed=(seed*7921+1)\65536
1259 jr z,DrawPeaPixel ;d=0:draw
1262 ld d,1 ;d=1:yes 2:no
1265 xor (hl) ;change pixel
1269 ;-------- pixelprocs ---------
1294 CheckPixel: ;at bc in d
1301 ;CLEM's FIND_PIXEL (131 cycles; 28 bytes)
1302 ; (b,c) to hl:a; destroyes: -)
1309 ld l,a ;hl=4*y + offset/8
1315 add hl,hl ;hl=32*y + offset
1331 ;----------- score -----------
1334 .db $dd,$7d ;ld a,lx
1487 ;-----------------------------
1603 ld (ShiftRightCounter),a
1605 ld (ShiftRightChunk),a
1619 ShiftRightCounter = $-1
1641 ld (ShiftLeftCounter),a
1643 ld (ShiftLeftChunk),a
1645 jr nc,ShiftLeftSameByte
1664 ShiftLeftCounter = $-1
1675 jr nz,ShiftRowsRight
1709 ;----------- draw ------------
1720 Line: ;draw line from de to hl (d<h)
1827 ; jr nc,makefirstbyte
1850 ;-----------------------------
1851 ;----------- link ------------
1852 ;-----------------------------
1873 set 2,(iy+$12) ;cursorblink
1942 jr nz,waitacknowledge
1954 .db $f6 ;first byte of "or n"
1958 res 2,(iy+$12) ;noblink
2083 ;-----------------------------
2084 ;---------- levels -----------
2085 ;-----------------------------
2089 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
2095 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
2099 .db 4,19,16,14 ;xsize,ysize,xpos,ypos
2106 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
2117 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
2130 .db 4,5,10,1 \ .dw $20F
2138 .db 5,4,15,0 ;peas,speed,begin_size,balls
2140 .db 128,57 ;field width, height
2141 .db 0 ;no additional lines
2148 .db 28,28,100,28 ;line coords: x1,y1,x2,y2
2229 ;-----------------------------
2230 ;---------- data -------------
2231 ;-----------------------------
2234 .db 0, 3, 6, 9, 12, 15, 18, 21
2235 .db 24, 27, 30, 33, 36, 39, 42, 45
2236 .db 48, 51, 54, 57, 59, 62, 65, 67
2237 .db 70, 73, 75, 78, 80, 82, 85, 87
2238 .db 89, 91, 94, 96, 98,100,102,103
2239 .db 105,107,108,110,112,113,114,116
2240 .db 117,118,119,120,121,122,123,123
2241 .db 124,125,125,126,126,126,126,126
2244 txtWelcome: .db "Welcome to Worm!! ",
2246 txtOptions: .db "Options",0
2247 txtGame: .db "Singleplayer",0 ;0
2248 txtGame2: .db "Peaworm ",0 ;1
2249 .db "Deathmatch",0 ;2
2250 .db "Foodmatch ",0 ;3
2251 .db "LinkMatch",0 ;4 (>options)
2255 .db "Domination",0 ;(>=8)
2256 txtWaiting: .db "Waiting...",0
2257 txtReceive: .db "Receiving...",0
2260 WormMsg: .db "WORM by SHIAR -- test version",0
2261 txtLevel: .db "Level ",0
2262 txtWorms: .db "Worms: 0",0 ;follows txtLevel
2263 txtDied: .db "Died ",0
2264 txtScore: .db "Score",0 ;follows txtDied
2265 txtLeft: .db " left",0 ;follows txtScore
2266 txthiscore:.db "HiScore:",0
2267 txtReady: .db "Prepare!",0
2269 txtGO: .db "----- GAME OVER -----",0
2273 _datalink = %00000001
2274 _datasingl = %00001000 ;singleplayer=1
2275 _datalivel = %00000010 ;ix+lives=0 limit
2276 _datafoodl = %00000100 ;left=0 limit
2277 _datanextl = %00001000 ;next level if left=0
2278 _datafood = %00010000 ;food present
2279 _datahunt = %00100000
2280 _datalaps = %01000000 ;give lap score
2281 _datascore = %10000000 ;score>=100 limit
2283 datasingle: .db %00011110
2285 datapeas: .db %00011010
2287 datadeathm: .db %00000010
2289 datafoodm: .db %10010000
2291 datalinkm: .db %00000011
2293 datahuntin: .db %10100000
2295 datarace: .db %11000000
2297 datactf: .db %00000000
2299 datadomin: .db %00000000
2304 resbit = 2 ;and%11111011
2305 worm1set: .dw $B000,$B000 ;%10110000
2306 .db 3,0,%01111110,%10,%100 ;< >
2308 worm2set: .dw $B800,$B800 ;%10111000
2309 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2311 worm3set: .dw $E800,$E800 ;%11101000 ;$D748+$1000+
2312 .db 3,0,%01011111,%10,%100 ;sto ,
2314 worm4set: .dw $F000,$F000 ;%11110000
2315 .db 3,0,%01111101,%10,%1 ;enter +
2343 DispBuffer =$+2 ;912 bytes
2345 ScrBuffer = $8000 ;-$A1FF (32x256)
2346 SinCosTable = $A200 ;-$A300 (4x64)
2348 ;-----------------------------
2349 ;----------- end -------------
2350 ;-----------------------------