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
35 #include "ti86asm.inc"
36 #include "ti86abs.inc"
45 _MOV4B = $429B ;4x ld (de),(hl)
46 _MOV5B = $4297 ;5x ld (de),(hl)
47 _mov9b = $4283 ;9x ld (de),(hl)
48 _ldHLind = $4010 ;ld hl,(hl)
49 _swapt_ = $45F3 ;ex_ahl_bde
51 ;-----------------------------
52 ;------- program start -------
53 ;-----------------------------
65 .db %10010111,%01101111
66 .db %10110101,%01001011
67 .db %11110111,%01001001
68 .db %00000011,%10000000
69 .db %00000001,%11100000
70 .db %00111000,%11111000
71 .db %01111110,%00111111
72 .db %11101111,%00001111
73 .db %11000011,%10000000
80 res 2,(iy+13) ;appAutoScroll
85 ;-----------------------------
86 ;----- build trig tables -----
87 ;-----------------------------
110 djnz NegativeSineWave
112 ;-----------------------------
113 ;---------- menu -------------
114 ;-----------------------------
125 call _puts ;txtOptions
139 jp LetsGetThisPartyOn
247 ;-----------------------------
248 ;-------- start game ---------
249 ;-----------------------------
278 ld de,$FF64 ;virt.infinate
321 ;-----------------------------
322 ;--------- game over ---------
323 ;-----------------------------
334 ld (worm1+score+1),hl
335 ;+score2=0 \ +delay=1
336 ld (worm2+score+1),hl
337 ld (worm3+score+1),hl
338 ld (worm4+score+1),hl
343 call _MOV5B ;9xld(de),(hl)
431 ld bc,(worm2-worm1)-5
436 ;-------- draw level ---------
555 ;-----------------------------
557 push hl ; >> levelp new
572 ld hl,4+(txtposReady*256)
582 jr z,SwapPos ;no link
588 SwapPos: ;$18 xx -> $F6 xx
609 ;-----------------------------
610 ;----------- LOOP ------------
611 ;-----------------------------
630 jr nz,screeninvertloop
643 call handlethatneatlittleball
656 ;-----------------------------
657 ;---------- keys -------------
658 ;-----------------------------
685 jr DoesWormTailEqualsWormHead ;chk4 size=0
696 DoesWormTailEqualsWormHead:
702 jr nz,safewormsizedone
731 ret nz ;HandleWorm done
799 call _ldHLind ;ld hl,(hl)
800 call showHL ;worm+score
806 djnz displayWormStats
810 jr z,hiscorecheckdone
822 ex de,hl ;disp.new hiscore
842 ;x123456789012345678901
843 ;1----- GAME OVER -----
854 rst 20h ;_ABS_MOV10TOOP1
856 call _swapt_ ;_ex_ahl_bde
860 call _SET_ABS_DEST_ADDR
864 call _SET_ABS_SRC_ADDR
866 call _SET_MM_NUM_BYTES
875 ;-----------------------------
876 ;----------- worm ------------
877 ;-----------------------------
899 inkeys: ;use jp not call!
917 ;------- handle worm ---------
939 ;-------- move worm ----------
974 pop hl ; << pos (old)
992 ;--------- worm hit ----------
1001 call nz,checkhitotherworm
1027 jr nz,still_alive_not_dead
1030 jr z,still_alive_not_dead
1036 pop de ; << levelp new
1044 ;-----------------------------
1047 .db $dd,$7d ;ld a,lx
1050 ThisIsJustASillyUselessLabel:
1064 jr c,otherwormHIT ;yes
1069 jr nz,nextotherwormbit
1101 still_alive_not_dead:
1103 ;-------- draw worm ----------
1108 call nz,HuntingTimeScore
1115 call nz,checkhitlapline
1160 ;-----------------------------
1161 ;---------- ball -------------
1162 ;-----------------------------
1164 handlethatneatlittleball:
1175 inc b ;=%000100 dec=%000101
1180 call letsmovetheotherway
1184 inc c ;=%001100 dec=%001101
1189 call letsmovetheotherway
1194 letsmovetheotherway:
1207 ;-----------------------------
1208 ;----------- procs -----------
1209 ;-----------------------------
1217 ld bc,$1000+(7921/256)
1227 ld (Seed),hl ;seed=(seed*7921+1)\65536
1268 jr z,DrawPeaPixel ;d=0:draw
1271 ld d,1 ;d=1:yes 2:no
1274 xor (hl) ;change pixel
1278 ;-------- pixelprocs ---------
1303 CheckPixel: ;at bc in d
1310 ;CLEM's FIND_PIXEL (131+? cycles; 28+4 bytes)
1311 ; (b,c) to hl:a; destroyes: -)
1344 ;----------- score -----------
1347 .db $dd,$7d ;ld a,lx
1500 ;-----------------------------
1616 ld (ShiftRightCounter),a
1618 ld (ShiftRightChunk),a
1632 ShiftRightCounter = $-1
1654 ld (ShiftLeftCounter),a
1656 ld (ShiftLeftChunk),a
1658 jr nc,ShiftLeftSameByte
1677 ShiftLeftCounter = $-1
1688 jr nz,ShiftRowsRight
1722 ;----------- draw ------------
1733 Line: ;draw line from de to hl (d<h)
1840 ; jr nc,makefirstbyte
1863 ;-----------------------------
1864 ;----------- link ------------
1865 ;-----------------------------
1981 ;-----------------------------
1982 ;---------- levels -----------
1983 ;-----------------------------
1987 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
1993 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
1997 .db 4,19,16,14 ;xsize,ysize,xpos,ypos
2004 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
2010 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
2021 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
2034 .db 5,4,15,0 ;peas,speed,begin_size,balls
2035 .db 0,2,63 ;start d, y, x
2036 .db 128,57 ;field width (128-255), height (57-255)
2037 .db 0,0 ;no additional lines, boxes
2043 .db 28,28,100,28 ;line coords: x1,y1,x2,y2
2071 .db 4,3,10,1 \ .dw $20F
2132 ;-----------------------------
2133 ;---------- data -------------
2134 ;-----------------------------
2137 .db 0, 3, 6, 9, 12, 15, 18, 21
2138 .db 24, 27, 30, 33, 36, 39, 42, 45
2139 .db 48, 51, 54, 57, 59, 62, 65, 67
2140 .db 70, 73, 75, 78, 80, 82, 85, 87
2141 .db 89, 91, 94, 96, 98,100,102,103
2142 .db 105,107,108,110,112,113,114,116
2143 .db 117,118,119,120,121,122,123,123
2144 .db 124,125,125,126,126,126,126,126
2147 txtWelcome: .db "Welcome to Worm!! ",
2149 txtOptions: .db "Options",0
2150 txtGame: .db "Singleplayer",0 ;0
2151 txtGame2: .db "Peaworm ",0 ;1
2152 .db "Deathmatch",0 ;2
2153 .db "Foodmatch ",0 ;3
2154 .db "LinkMatch",0 ;4 (>options)
2158 .db "Domination",0 ;(>=8)
2159 txtWaiting: .db "Waiting...",0
2160 txtReceive: .db "Receiving...",0
2163 WormMsg: .db "WORM by SHIAR -- test version",0
2164 txtLevel: .db "Level ",0
2165 txtWorms: .db "Worms: 0",0 ;follows txtLevel
2166 txtDied: .db "Died ",0
2167 txtScore: .db "Score",0 ;follows txtDied
2168 txtLeft: .db " left",0 ;follows txtScore
2169 txthiscore:.db "HiScore:",0
2170 txtReady: .db "Prepare!",0
2172 txtGO: .db "----- GAME OVER -----",0
2176 _datalink = %00000001
2177 _datalivel = %00000010 ;ix+lives=0 limit
2178 _datafoodl = %00000100 ;left=0 limit
2179 _datanextl = %00001000 ;next level if left=0
2180 _datasingl = %00001000 ;singleplayer=1
2181 _datafood = %00010000 ;food present
2182 _datahunt = %00100000
2183 _datalaps = %01000000 ;give lap score
2184 _datascore = %10000000 ;score>=100 limit
2186 datasingle: .db %00011110
2188 datapeas: .db %00011010
2190 datadeathm: .db %00000010
2192 datafoodm: .db %10010000
2194 datalinkm: .db %00000011
2196 datahuntin: .db %10100000
2198 datarace: .db %11000000
2200 datactf: .db %00000000
2202 datadomin: .db %00000000
2206 resbit = 2 ;and%11111011
2207 worm1set: .dw $B000,$B000 ;%10110000
2208 .db 3,0,%01111110,%10,%100 ;< >
2210 worm2set: .dw $B800,$B800 ;%10111000
2211 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2213 worm3set: .dw $F000,$F000 ;$E800=%11101000 ;$D748+$1000+
2214 .db 3,0,%01011111,%10,%100 ;sto ,
2216 worm4set: .dw $A800,$A800 ;$F000=%11110000
2217 .db 3,0,%01111101,%10,%1 ;enter +
2245 DispBuffer =$+2 ;912 bytes
2247 ScrBuffer = $8100 ;-$A2FF (32x256) mod$800=0
2248 SinCosTable = $B500 ;size=$100 (4x64)
2250 ;-----------------------------
2251 ;----------- end -------------
2252 ;-----------------------------