3 ; Release Date : soon (I hope)
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 ; * hot pursuit/hunting/kodh: catch the other player and vv
30 ;1) * ctf: take enemy flag (right-bottom) and return to your flag (left-top)
31 ;1) * domination?: take control points by running over them and hold them
33 ;1)* sprites for picks instead of blocks
34 ; * fix linedraw procedure
37 ;1) Shiar: working on a new pickup-system allowing more than one "food" and different pickup-handling
41 ;-----------------------------
42 ;------- program start -------
43 ;-----------------------------
55 .db %10010111,%01101111
56 .db %10110101,%01001011
57 .db %11110111,%01001001
58 .db %00000011,%10000000
59 .db %00000001,%11100000
60 .db %00111000,%11111000
61 .db %01111110,%00111111
62 .db %11101111,%00001111
63 .db %11000011,%10000000
70 res 2,(iy+13) ;appAutoScroll
75 ;-----------------------------
76 ;----- build trig tables -----
77 ;-----------------------------
100 djnz NegativeSineWave
102 ;-----------------------------
103 ;---------- menu -------------
104 ;-----------------------------
115 call _puts ;txtOptions
237 ;-----------------------------
238 ;-------- start game ---------
239 ;-----------------------------
303 ;-----------------------------
304 ;--------- game over ---------
305 ;-----------------------------
328 call _MOV5B ;9xld(de),(hl)
404 ld bc,(worm2-worm1)-5
409 ;-------- draw level ---------
528 ;-----------------------------
530 push hl ; >> levelp new
545 ld hl,4+(txtposReady*256)
555 jr z,SwapPos ;no link
561 SwapPos: ;$18 xx -> $F6 xx
582 ;-----------------------------
583 ;----------- LOOP ------------
584 ;-----------------------------
611 ;-----------------------------
612 ;---------- keys -------------
613 ;-----------------------------
687 ret nz ;HandleWorm done
755 call _ldHLind ;ld hl,(hl)
756 call showHL ;worm+score
762 djnz displayWormStats
773 ;x123456789012345678901
774 ;1----- GAME OVER -----
793 rst 20h ;_ABS_MOV10TOOP1
795 call _swapt_ ;_ex_ahl_bde
799 call _SET_ABS_DEST_ADDR
803 call _SET_ABS_SRC_ADDR
805 call _SET_MM_NUM_BYTES
814 ;-----------------------------
815 ;----------- worm ------------
816 ;-----------------------------
838 inkeys: ;use jp not call!
856 ;------- handle worm ---------
878 ;-------- move worm ----------
913 pop hl ; << pos (old)
938 ;--------- worm hit ----------
947 call nz,checkhitotherworm
984 pop de ; << levelp new
985 ; pop hl ; << levelp old
993 ;-----------------------------
1013 jr c,otherwormHIT ;yes
1026 jr nz,nextotherwormbit
1056 ;-------- draw worm ----------
1064 call nz,checkhitlapline
1110 ;-----------------------------
1111 ;----------- procs -----------
1112 ;-----------------------------
1120 ld bc,1000h+(7921/256)
1130 ld (Seed),hl ;seed=(seed*7921+1) MOD 65536
1171 jr z,DrawPeaPixel ;d=0:draw
1174 ld d,1 ;d=1:yes 2:no
1177 xor (hl) ;change pixel
1181 ;-------- pixelprocs ---------
1196 CheckPixel: ;at bc in d
1203 FindPixel: ;bc to ahl + de gone
1208 add a,offsets_table & 255
1210 ld d,offsets_table/256
1232 ;----------- score -----------
1370 ;-----------------------------
1373 .db 128,64,32,16,8,4,2,1
1489 ld (ShiftRightCounter),a
1491 ld (ShiftRightChunk),a
1505 ShiftRightCounter = $-1
1527 ld (ShiftLeftCounter),a
1529 ld (ShiftLeftChunk),a
1531 jr nc,ShiftLeftSameByte
1550 ShiftLeftCounter = $-1
1561 jr nz,ShiftRowsRight
1595 ;----------- draw ------------
1606 Line: ;draw line from de to hl (d<h)
1713 ; jr nc,makefirstbyte
1736 ;-----------------------------
1737 ;----------- link ------------
1738 ;-----------------------------
1757 set 2,(iy+$12) ;cursorblink
1823 jr nz,waitacknowledge
1834 .db $f6 ;first byte of "or n"
1838 res 2,(iy+$12) ;noblink
1866 ;-----------------------------
1867 ;---------- levels -----------
1868 ;-----------------------------
1873 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
1880 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
1884 .db 4,19,16,14 ;xsize,ysize,xpos,ypos
1891 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
1901 .db 5,4,15 ;5 peas, speed 5
1903 .db 128,57 ;field width, height
1904 .db 0 ;no additional lines
1911 .db 28,28,100,28 ;line coords: x1,y1,x2,y2
1992 ;-----------------------------
1993 ;---------- data -------------
1994 ;-----------------------------
1997 .db 0, 3, 6, 9, 12, 15, 18, 21
1998 .db 24, 27, 30, 33, 36, 39, 42, 45
1999 .db 48, 51, 54, 57, 59, 62, 65, 67
2000 .db 70, 73, 75, 78, 80, 82, 85, 87
2001 .db 89, 91, 94, 96, 98,100,102,103
2002 .db 105,107,108,110,112,113,114,116
2003 .db 117,118,119,120,121,122,123,123
2004 .db 124,125,125,126,126,126,126,126
2007 txtWelcome: .db "Welcome to Worm!! ",
2009 txtOptions: .db "Options",0
2010 txtGame: .db "Singleplayer",0 ;0
2011 txtGame2: .db "Deathmatch ",0 ;1
2012 .db "Foodmatch ",0 ;2
2013 .db "LinkMatch",0 ;3 (>options)
2017 .db "Domination",0 ;7
2018 txtWaiting: .db "Waiting...",0
2019 txtReceive: .db "Receiving...",0
2022 WormMsg: .db "WORM by SHIAR -- test version",0
2023 txtLevel: .db "Level ",0
2024 txtWorms: .db "Worms: 0",0 ;follows txtLevel
2025 txtDied: .db "Died ",0
2026 txtScore: .db "Score",0 ;follows txtDied
2027 txtLeft: .db " left",0 ;follows txtScore
2028 txtReady: .db "Prepare!",0
2030 txtGO: .db "----- GAME OVER -----",0
2035 _datalink = %00000001
2036 _datalivel = %00000010 ;ix+lives=0 limit
2037 _datafoodl = %00000100 ;left=0 limit
2038 _datanextl = %00001000 ;next level if left=0
2039 _datafood = %00010000 ;food present
2040 _datahunt = %00100000
2041 _datalaps = %01000000 ;give lap score
2042 _datascore = %10000000 ;score>=100 limit
2044 datasingle: .db %00011110
2046 datadeathm: .db %00000010
2048 datafoodm: .db %10010000
2050 datalinkm: .db %00000011
2052 datahuntin: .db %00110100
2054 datarace: .db %11000000
2056 datactf: .db %00000000
2058 datadomin: .db %00000000
2063 resbit = 2 ;and%11111011
2064 worm1set: .dw $B000,$B000 ;10110000
2065 .db 3,0,%01111110,%10,%100 ;< >
2067 worm2set: .dw $B800,$B800 ;10111000
2068 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2070 worm3set: .dw $E800,$E800 ;11101000 ;$D748+$1000+
2071 .db 3,0,%01011111,%10,%100 ;sto ,
2073 worm4set: .dw $F000,$F000 ;11110000
2074 .db 3,0,%01111101,%10,%1 ;enter +
2101 DispBuffer =$+2 ;912 bytes
2103 ScrBuffer = $8200 ;32x256 bytes
2106 ;-----------------------------
2107 ;----------- end -------------
2108 ;-----------------------------