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
302 ;-----------------------------
303 ;--------- game over ---------
304 ;-----------------------------
315 ld (worm1+score+1),hl
316 ;+score2=0 \ +delay=1
317 ld (worm2+score+1),hl
318 ld (worm3+score+1),hl
319 ld (worm4+score+1),hl
324 call _MOV5B ;9xld(de),(hl)
407 ld bc,(worm2-worm1)-5
412 ;-------- draw level ---------
531 ;-----------------------------
533 push hl ; >> levelp new
548 ld hl,4+(txtposReady*256)
558 jr z,SwapPos ;no link
564 SwapPos: ;$18 xx -> $F6 xx
585 ;-----------------------------
586 ;----------- LOOP ------------
587 ;-----------------------------
606 jr nz,screeninvertloop
630 ;-----------------------------
631 ;---------- keys -------------
632 ;-----------------------------
678 jr nz,safewormsizedone
712 ret nz ;HandleWorm done
780 call _ldHLind ;ld hl,(hl)
781 call showHL ;worm+score
787 djnz displayWormStats
798 ;x123456789012345678901
799 ;1----- GAME OVER -----
818 rst 20h ;_ABS_MOV10TOOP1
820 call _swapt_ ;_ex_ahl_bde
824 call _SET_ABS_DEST_ADDR
828 call _SET_ABS_SRC_ADDR
830 call _SET_MM_NUM_BYTES
839 ;-----------------------------
840 ;----------- worm ------------
841 ;-----------------------------
863 inkeys: ;use jp not call!
881 ;------- handle worm ---------
903 ;-------- move worm ----------
938 pop hl ; << pos (old)
963 ;--------- worm hit ----------
972 call nz,checkhitotherworm
998 jr nz,still_alive_not_dead
1001 jr z,still_alive_not_dead
1007 pop de ; << levelp new
1015 ;-----------------------------
1018 .db $dd,$7d ;ld a,lx
1021 ThisIsJustASillyUselessLabel:
1035 jr c,otherwormHIT ;yes
1040 jr nz,nextotherwormbit
1072 still_alive_not_dead:
1074 ;-------- draw worm ----------
1079 call nz,HuntingTimeScore
1086 call nz,checkhitlapline
1132 ;-----------------------------
1133 ;----------- procs -----------
1134 ;-----------------------------
1142 ld bc,1000h+(7921/256)
1152 ld (Seed),hl ;seed=(seed*7921+1) MOD 65536
1193 jr z,DrawPeaPixel ;d=0:draw
1196 ld d,1 ;d=1:yes 2:no
1199 xor (hl) ;change pixel
1203 ;-------- pixelprocs ---------
1218 CheckPixel: ;at bc in d
1225 ;------------------------------------------------------
1229 ; 131 cycles 28 bytes (b,c) to hl:a destroyes: none
1230 ;------------------------------------------------------
1237 ld l,a ;hl=$3f00+4*y
1242 add hl,hl ;hl=$fc00+16*y
1259 ;FindPixel: ;bc to ahl + de gone
1264 add a,offsets_table & 255
1266 ld d,offsets_table/256
1288 ;----------- score -----------
1291 .db $dd,$7d ;ld a,lx
1443 ;-----------------------------
1446 .db 128,64,32,16,8,4,2,1
1562 ld (ShiftRightCounter),a
1564 ld (ShiftRightChunk),a
1578 ShiftRightCounter = $-1
1600 ld (ShiftLeftCounter),a
1602 ld (ShiftLeftChunk),a
1604 jr nc,ShiftLeftSameByte
1623 ShiftLeftCounter = $-1
1634 jr nz,ShiftRowsRight
1668 ;----------- draw ------------
1679 Line: ;draw line from de to hl (d<h)
1786 ; jr nc,makefirstbyte
1809 ;-----------------------------
1810 ;----------- link ------------
1811 ;-----------------------------
1830 set 2,(iy+$12) ;cursorblink
1896 jr nz,waitacknowledge
1907 .db $f6 ;first byte of "or n"
1911 res 2,(iy+$12) ;noblink
1939 ;-----------------------------
1940 ;---------- levels -----------
1941 ;-----------------------------
1946 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
1953 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
1957 .db 4,19,16,14 ;xsize,ysize,xpos,ypos
1964 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
1974 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
1987 .db 5,4,15 ;peas,speed,begin_size
1989 .db 128,57 ;field width, height
1990 .db 0 ;no additional lines
1997 .db 28,28,100,28 ;line coords: x1,y1,x2,y2
2078 ;-----------------------------
2079 ;---------- data -------------
2080 ;-----------------------------
2083 .db 0, 3, 6, 9, 12, 15, 18, 21
2084 .db 24, 27, 30, 33, 36, 39, 42, 45
2085 .db 48, 51, 54, 57, 59, 62, 65, 67
2086 .db 70, 73, 75, 78, 80, 82, 85, 87
2087 .db 89, 91, 94, 96, 98,100,102,103
2088 .db 105,107,108,110,112,113,114,116
2089 .db 117,118,119,120,121,122,123,123
2090 .db 124,125,125,126,126,126,126,126
2093 txtWelcome: .db "Welcome to Worm!! ",
2095 txtOptions: .db "Options",0
2096 txtGame: .db "Singleplayer",0 ;0
2097 txtGame2: .db "Deathmatch ",0 ;1
2098 .db "Foodmatch ",0 ;2
2099 .db "LinkMatch",0 ;3 (>options)
2103 .db "Domination",0 ;7
2104 txtWaiting: .db "Waiting...",0
2105 txtReceive: .db "Receiving...",0
2108 WormMsg: .db "WORM by SHIAR -- test version",0
2109 txtLevel: .db "Level ",0
2110 txtWorms: .db "Worms: 0",0 ;follows txtLevel
2111 txtDied: .db "Died ",0
2112 txtScore: .db "Score",0 ;follows txtDied
2113 txtLeft: .db " left",0 ;follows txtScore
2114 txtReady: .db "Prepare!",0
2116 txtGO: .db "----- GAME OVER -----",0
2121 _datalink = %00000001
2122 _datalivel = %00000010 ;ix+lives=0 limit
2123 _datafoodl = %00000100 ;left=0 limit
2124 _datanextl = %00001000 ;next level if left=0
2125 _datafood = %00010000 ;food present
2126 _datahunt = %00100000
2127 _datalaps = %01000000 ;give lap score
2128 _datascore = %10000000 ;score>=100 limit
2130 datasingle: .db %00011110
2132 datadeathm: .db %00000010
2134 datafoodm: .db %10010000
2136 datalinkm: .db %00000011
2138 datahuntin: .db %00110100
2140 datarace: .db %11000000
2142 datactf: .db %00000000
2144 datadomin: .db %00000000
2149 resbit = 2 ;and%11111011
2150 worm1set: .dw $B000,$B000 ;%10110000
2151 .db 3,0,%01111110,%10,%100 ;< >
2153 worm2set: .dw $B800,$B800 ;%10111000
2154 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2156 worm3set: .dw $E800,$E800 ;%11101000 ;$D748+$1000+
2157 .db 3,0,%01011111,%10,%100 ;sto ,
2159 worm4set: .dw $F000,$F000 ;%11110000
2160 .db 3,0,%01111101,%10,%1 ;enter +
2188 DispBuffer =$+2 ;912 bytes
2190 ScrBuffer = $8000 ;-$A1FF (32x256)
2191 SinCosTable = $A200 ;-$A300 (4x64)
2193 ;-----------------------------
2194 ;----------- end -------------
2195 ;-----------------------------