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 ;-----------------------------
706 ret nz ;HandleWorm done
774 call _ldHLind ;ld hl,(hl)
775 call showHL ;worm+score
781 djnz displayWormStats
792 ;x123456789012345678901
793 ;1----- GAME OVER -----
812 rst 20h ;_ABS_MOV10TOOP1
814 call _swapt_ ;_ex_ahl_bde
818 call _SET_ABS_DEST_ADDR
822 call _SET_ABS_SRC_ADDR
824 call _SET_MM_NUM_BYTES
833 ;-----------------------------
834 ;----------- worm ------------
835 ;-----------------------------
857 inkeys: ;use jp not call!
875 ;------- handle worm ---------
897 ;-------- move worm ----------
932 pop hl ; << pos (old)
957 ;--------- worm hit ----------
966 call nz,checkhitotherworm
992 jr nz,still_alive_not_dead
995 jr z,still_alive_not_dead
1001 pop de ; << levelp new
1009 ;-----------------------------
1012 .db $dd,$7d ;ld a,lx
1015 ThisIsJustASillyUselessLabel:
1029 jr c,otherwormHIT ;yes
1034 jr nz,nextotherwormbit
1066 still_alive_not_dead:
1068 ;-------- draw worm ----------
1073 call nz,HuntingTimeScore
1080 call nz,checkhitlapline
1126 ;-----------------------------
1127 ;----------- procs -----------
1128 ;-----------------------------
1136 ld bc,1000h+(7921/256)
1146 ld (Seed),hl ;seed=(seed*7921+1) MOD 65536
1187 jr z,DrawPeaPixel ;d=0:draw
1190 ld d,1 ;d=1:yes 2:no
1193 xor (hl) ;change pixel
1197 ;-------- pixelprocs ---------
1212 CheckPixel: ;at bc in d
1219 FindPixel: ;bc to ahl + de gone
1224 add a,offsets_table & 255
1226 ld d,offsets_table/256
1248 ;----------- score -----------
1251 .db $dd,$7d ;ld a,lx
1403 ;-----------------------------
1406 .db 128,64,32,16,8,4,2,1
1522 ld (ShiftRightCounter),a
1524 ld (ShiftRightChunk),a
1538 ShiftRightCounter = $-1
1560 ld (ShiftLeftCounter),a
1562 ld (ShiftLeftChunk),a
1564 jr nc,ShiftLeftSameByte
1583 ShiftLeftCounter = $-1
1594 jr nz,ShiftRowsRight
1628 ;----------- draw ------------
1639 Line: ;draw line from de to hl (d<h)
1746 ; jr nc,makefirstbyte
1769 ;-----------------------------
1770 ;----------- link ------------
1771 ;-----------------------------
1790 set 2,(iy+$12) ;cursorblink
1856 jr nz,waitacknowledge
1867 .db $f6 ;first byte of "or n"
1871 res 2,(iy+$12) ;noblink
1899 ;-----------------------------
1900 ;---------- levels -----------
1901 ;-----------------------------
1906 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
1913 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
1917 .db 4,19,16,14 ;xsize,ysize,xpos,ypos
1924 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
1934 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
1947 .db 5,4,15 ;peas,speed,begin_size
1949 .db 128,57 ;field width, height
1950 .db 0 ;no additional lines
1957 .db 28,28,100,28 ;line coords: x1,y1,x2,y2
2038 ;-----------------------------
2039 ;---------- data -------------
2040 ;-----------------------------
2043 .db 0, 3, 6, 9, 12, 15, 18, 21
2044 .db 24, 27, 30, 33, 36, 39, 42, 45
2045 .db 48, 51, 54, 57, 59, 62, 65, 67
2046 .db 70, 73, 75, 78, 80, 82, 85, 87
2047 .db 89, 91, 94, 96, 98,100,102,103
2048 .db 105,107,108,110,112,113,114,116
2049 .db 117,118,119,120,121,122,123,123
2050 .db 124,125,125,126,126,126,126,126
2053 txtWelcome: .db "Welcome to Worm!! ",
2055 txtOptions: .db "Options",0
2056 txtGame: .db "Singleplayer",0 ;0
2057 txtGame2: .db "Deathmatch ",0 ;1
2058 .db "Foodmatch ",0 ;2
2059 .db "LinkMatch",0 ;3 (>options)
2063 .db "Domination",0 ;7
2064 txtWaiting: .db "Waiting...",0
2065 txtReceive: .db "Receiving...",0
2068 WormMsg: .db "WORM by SHIAR -- test version",0
2069 txtLevel: .db "Level ",0
2070 txtWorms: .db "Worms: 0",0 ;follows txtLevel
2071 txtDied: .db "Died ",0
2072 txtScore: .db "Score",0 ;follows txtDied
2073 txtLeft: .db " left",0 ;follows txtScore
2074 txtReady: .db "Prepare!",0
2076 txtGO: .db "----- GAME OVER -----",0
2081 _datalink = %00000001
2082 _datalivel = %00000010 ;ix+lives=0 limit
2083 _datafoodl = %00000100 ;left=0 limit
2084 _datanextl = %00001000 ;next level if left=0
2085 _datafood = %00010000 ;food present
2086 _datahunt = %00100000
2087 _datalaps = %01000000 ;give lap score
2088 _datascore = %10000000 ;score>=100 limit
2090 datasingle: .db %00011110
2092 datadeathm: .db %00000010
2094 datafoodm: .db %10010000
2096 datalinkm: .db %00000011
2098 datahuntin: .db %00110100
2100 datarace: .db %11000000
2102 datactf: .db %00000000
2104 datadomin: .db %00000000
2109 resbit = 2 ;and%11111011
2110 worm1set: .dw $B000,$B000 ;%10110000
2111 .db 3,0,%01111110,%10,%100 ;< >
2113 worm2set: .dw $B800,$B800 ;%10111000
2114 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2116 worm3set: .dw $E800,$E800 ;%11101000 ;$D748+$1000+
2117 .db 3,0,%01011111,%10,%100 ;sto ,
2119 worm4set: .dw $F000,$F000 ;%11110000
2120 .db 3,0,%01111101,%10,%1 ;enter +
2148 DispBuffer =$+2 ;912 bytes
2150 ScrBuffer = $8200 ;-$A1FF (32x256)
2151 SinCosTable = $A200 ;-$A300 (4x64)
2153 ;-----------------------------
2154 ;----------- end -------------
2155 ;-----------------------------