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 leveldata = $EA00 ;size<$400
53 ;-----------------------------
54 ;------- program start -------
55 ;-----------------------------
67 .db %10010111,%01101111
68 .db %10110101,%01001011
69 .db %11110111,%01001001
70 .db %00000011,%10000000
71 .db %00000001,%11100000
72 .db %00111000,%11111000
73 .db %01111110,%00111111
74 .db %11101111,%00001111
75 .db %11000011,%10000000
87 rst 20h ;_ABS_MOV10TOOP1
91 ld a,b ;call _ex_ahl_bde
92 call _SET_ABS_SRC_ADDR
95 ld hl,leveldata ;datalevels
96 call _SET_ABS_DEST_ADDR
99 call _SET_MM_NUM_BYTES
104 call _SET_ABS_DEST_ADDR
107 call _SET_MM_NUM_BYTES
112 call _SET_ABS_DEST_ADDR
115 call _SET_MM_NUM_BYTES
120 res 2,(iy+13) ;appAutoScroll
124 ;-----------------------------
125 ;----- build trig tables -----
126 ;-----------------------------
149 djnz NegativeSineWave
151 ;-----------------------------
152 ;---------- menu -------------
153 ;-----------------------------
164 call _puts ;txtOptions
178 jp LetsGetThisPartyOn
286 ;-----------------------------
287 ;-------- start game ---------
288 ;-----------------------------
318 ld de,$FF64 ;virt.infinate
324 call _ldHLind ;ld hl,(hl)
359 ;-----------------------------
360 ;--------- game over ---------
361 ;-----------------------------
372 ld (worm1+score+1),hl
373 ;+score2=0 \ +delay=1
374 ld (worm2+score+1),hl
375 ld (worm3+score+1),hl
376 ld (worm4+score+1),hl
381 call _MOV5B ;9xld(de),(hl)
468 ld bc,(worm2-worm1)-5
473 ;-------- draw level ---------
592 ;-----------------------------
594 push hl ; >> levelp new
609 ld hl,4+(txtposReady*256)
619 jr z,SwapPos ;no link
625 SwapPos: ;$18 xx -> $F6 xx
646 ;-----------------------------
647 ;----------- LOOP ------------
648 ;-----------------------------
667 jr nz,screeninvertloop
680 call handlethatneatlittleball
693 ;-----------------------------
694 ;---------- keys -------------
695 ;-----------------------------
722 jr DoesWormTailEqualsWormHead ;chk4 size=0
733 DoesWormTailEqualsWormHead:
739 jr nz,safewormsizedone
768 ret nz ;HandleWorm done
836 call _ldHLind ;ld hl,(hl)
837 call showHL ;worm+score
843 djnz displayWormStats
847 jr z,hiscorecheckdone
859 ex de,hl ;disp.new hiscore
879 ;x123456789012345678901
880 ;1----- GAME OVER -----
891 rst 20h ;_ABS_MOV10TOOP1
893 call _swapt_ ;_ex_ahl_bde
897 call _SET_ABS_DEST_ADDR
901 call _SET_ABS_SRC_ADDR
903 call _SET_MM_NUM_BYTES
912 ;-----------------------------
913 ;----------- worm ------------
914 ;-----------------------------
936 inkeys: ;use jp not call!
954 ;------- handle worm ---------
976 ;-------- move worm ----------
1004 notmoveY: ;bc=newpos
1011 pop hl ; << pos (old)
1029 ;--------- worm hit ----------
1038 call nz,checkhitotherworm
1064 jr nz,still_alive_not_dead
1067 jr z,still_alive_not_dead
1073 pop hl ; << levelp new
1081 ;-----------------------------
1084 .db $dd,$7d ;ld a,lx
1087 ThisIsJustASillyUselessLabel:
1101 jr c,otherwormHIT ;yes
1106 jr nz,nextotherwormbit
1138 still_alive_not_dead:
1140 ;-------- draw worm ----------
1145 call nz,HuntingTimeScore
1152 call nz,checkhitlapline
1197 ;-----------------------------
1198 ;---------- ball -------------
1199 ;-----------------------------
1201 handlethatneatlittleball:
1212 inc b ;=%000100 dec=%000101
1217 call letsmovetheotherway
1221 inc c ;=%001100 dec=%001101
1226 call letsmovetheotherway
1231 letsmovetheotherway:
1244 ;-----------------------------
1245 ;----------- procs -----------
1246 ;-----------------------------
1254 ld bc,$1000+(7921/256)
1264 ld (Seed),hl ;seed=(seed*7921+1)\65536
1305 jr z,DrawPeaPixel ;d=0:draw
1308 ld d,1 ;d=1:yes 2:no
1311 xor (hl) ;change pixel
1315 ;-------- pixelprocs ---------
1340 CheckPixel: ;at bc in d
1347 ;CLEM's FIND_PIXEL (131+? cycles; 28+4 bytes)
1348 ; (b,c) to hl:a; destroyes: -)
1381 ;----------- score -----------
1384 .db $dd,$7d ;ld a,lx
1537 ;-----------------------------
1653 ld (ShiftRightCounter),a
1655 ld (ShiftRightChunk),a
1669 ShiftRightCounter = $-1
1691 ld (ShiftLeftCounter),a
1693 ld (ShiftLeftChunk),a
1695 jr nc,ShiftLeftSameByte
1714 ShiftLeftCounter = $-1
1725 jr nz,ShiftRowsRight
1759 ;----------- draw ------------
1770 Line: ;draw line from de to hl (d<h)
1877 ; jr nc,makefirstbyte
1900 ;-----------------------------
1901 ;----------- link ------------
1902 ;-----------------------------
2018 ;-----------------------------
2019 ;---------- levels -----------
2020 ;-----------------------------
2025 .db 5,4,15,0 ;peas,speed,begin_size,balls
2026 .db 0,2,63 ;start d, y, x
2027 .db 128,57 ;field width (128-255), height (57-255)
2028 .db 0,0 ;no additional lines, boxes
2032 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
2037 ;-----------------------------
2038 ;---------- data -------------
2039 ;-----------------------------
2042 .db 0, 3, 6, 9, 12, 15, 18, 21
2043 .db 24, 27, 30, 33, 36, 39, 42, 45
2044 .db 48, 51, 54, 57, 59, 62, 65, 67
2045 .db 70, 73, 75, 78, 80, 82, 85, 87
2046 .db 89, 91, 94, 96, 98,100,102,103
2047 .db 105,107,108,110,112,113,114,116
2048 .db 117,118,119,120,121,122,123,123
2049 .db 124,125,125,126,126,126,126,126
2052 txtWelcome: .db "Welcome to Worm!! ",
2054 txtOptions: .db "Options",0
2055 txtGame: .db "Singleplayer",0 ;0
2056 txtGame2: .db "Peaworm ",0 ;1
2057 .db "Deathmatch",0 ;2
2058 .db "Foodmatch ",0 ;3
2059 .db "LinkMatch",0 ;4 (>options)
2063 .db "Domination",0 ;(>=8)
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 txthiscore:.db "HiScore:",0
2075 txtReady: .db "Prepare!",0
2077 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 _datasingl = %00001000 ;singleplayer=1
2086 _datafood = %00010000 ;food present
2087 _datahunt = %00100000
2088 _datalaps = %01000000 ;give lap score
2089 _datascore = %10000000 ;score>=100 limit
2091 datasingle: .db %00011110
2092 datapeas: .db %00011010
2093 datadeathm: .db %00000010
2094 datafoodm: .db %10010000
2095 datalinkm: .db %00000011
2096 datahuntin: .db %10100000
2097 datarace: .db %11000000
2098 datactf: .db %00000000 ;==(8 modes)
2099 ;datadomin: .db %00000000
2100 datalevels: .dw LevelDef, LevelDef
2101 .dw LevelDefM,LevelDefM
2102 .dw LevelDefM,LevelDefM
2103 .dw LevelDefM,LevelDefM
2105 resbit = 2 ;and%11111011
2106 worm1set: .dw $B000,$B000 ;%10110000
2107 .db 3,0,%01111110,%10,%100 ;< >
2109 worm2set: .dw $B800,$B800 ;%10111000
2110 .db 3,0,%00111111,%10000,%1000 ;f1 f2
2112 worm3set: .dw $F000,$F000 ;$E800=%11101000 ;$D748+$1000+
2113 .db 3,0,%01011111,%10,%100 ;sto ,
2115 worm4set: .dw $A800,$A800 ;$F000=%11110000
2116 .db 3,0,%01111101,%10,%1 ;enter +
2144 DispBuffer =$+2 ;912 bytes
2146 ScrBuffer = $8100 ;-$A2FF (32x256) mod$800=0
2147 SinCosTable = $B500 ;size=$100 (4x64)
2149 ;-----------------------------
2150 ;----------- end -------------
2151 ;-----------------------------