3 ; Release Date : summer 2001
4 ; Filename : wormy.86p (5kb)
6 ; Email Address : shiar0@hotmail.com
8 ; Web Page : www.shiar.org
9 ; Description : ruling Nibbles-like game 1-4 players
10 ; Where to get this game : www.shiar.org (home of Wormy)
11 ; Other games by author(s) : Nemesis beta
12 ; Additional Credits to : Matthew Shepcar (wrote original Peaworm, end'98)
13 ; Jonah Cohen (helped writing worm)
15 ;-----------------------------
16 ;----------- TO-DO -----------
17 ;-----------------------------
21 ; [* internal levels ]
22 ; [ * check levels/gametype ]
23 ; [ * enough hiscore saves! ]
24 ; [* complete readme ]
25 ; 1% * misc (pollish, bugs, &&&)
27 ; * fix first packet loss
28 ; 1% * transmit game/level data
29 ; 1% * get g/o signal (l&l) working
30 ; 2% * send new peas' positions
32 ; 1% * fix pea XOR problem in ctf
33 ; 1% * fix wormstop in race
35 ;100% = bugs fixed + levels done
37 ;-----------------------------
38 ;-----------------------------
39 ;--------- W O R M ---------
40 ;-----------------------------
41 ;-----------------------------
43 #define buffer ;use display buffer (otherwise write directly to screen)
44 #define readymask ;"greys" out the field before starting a level
45 ;#define hlines ;horizontal-line routine for more speed drawing boxes
46 ;^^(doesn't work properly)^^
47 ;#define readytext ;displays "prepare" before level starts
48 ;#define invincible ;worms cannot die =)
49 ;#define optdie ;in race games worms don't die when they run into each other
56 #include "ti86asm.inc"
58 _SHRACC = $4383 ;4x srl a
59 _SHLACC = $438B ;4x sll a
60 _divHLby10 = $4044 ;hl=hl/10
61 _divAby10 = $4DAF ;a=a/10
62 _HLTIMES10 = $41BF ;hl=hl*10
63 _cphlde = $403C ;cp hl,de
64 _clrWindow = $4A86 ;clear screen
65 _asapvar = $D6FC ;own name (worm)
66 _MOV4B = $429B ;4x ld (de),(hl)
67 _MOV5B = $4297 ;5x ld (de),(hl)
68 _mov9b = $4283 ;9x ld (de),(hl)
69 _ldHLind = $4010 ;ld hl,(hl)
70 _swapt_ = $45F3 ;ex_ahl_bde
71 _Get_Word_ahl = $521D ;ld de,(ahl)
72 _Set_Word_ahl = $5221 ;ld (ahl),de
73 _INC_PTR_AHL = $4637 ;ahl=ahl+1
74 _AHL_PLUS_2_PG3 = $4C3F ;ahl=ahl+2
75 _SET_ABS_SRC_ADDR = $4647 ;set source for mm.ldir =ahl
76 _LOAD_ABS_SRC_ADDR = $5209 ;ahl = mm.ldir source
77 _SET_ABS_DEST_ADDR = $5285 ;set destination for mm.ldir = ahl
78 _SET_MM_NUM_BYTES = $464F ;number of bytes for mm.ldir = ahl
79 _mm_ldir = $52ED ;24bit ldir
80 _MM_LDIR_SET_SIZE = $524D ;_SET_MM_NUM_BYTES + _mm_ldir
81 _RAM_PAGE_1 = $47E3 ;set $8000+ to page 1
82 _RAM_PAGE_7 = $47F3 ;"""" 7
83 _PTEMP_END = $D29A ;end of VAT
84 _load_ram_ahl = $462F ;ahl->page+hl
85 _writeb_inc_ahl = $5567 ;ld (ahl++),c
86 _jforce = $409C ;TI-OS stack restored
87 _EXLP = $4493 ;swap (hl),(de) b times
88 _GETB_AHL = $46C3 ;a=(ahl) \ hl=ahl
90 ;-----------------------------
91 ;------- data storage -------
92 ;-----------------------------
96 ScrBuffer = $8820 ;-A7FF (20*FF=1FE0)
97 worm2p = $A800 ;-ABFF (400) %10101O00
98 worm1 = $AC00 ;-AC1D (31d)
99 worm2 = $AC1F ;-AC3B (1F)
100 worm3 = $AC3E ;-AC59 (1F)
101 worm4 = $AC5D ;-AC77 (1F)
102 balls = $AC7C ;-ACFF (3x43d)
103 SinCosTable = $AD00 ;-AE00 (4x40)
104 ;free $AE01 ;-AFFF (1FF)
105 worm1p = $B000 ;-B7FF (800) %1011O000
106 worm3p = $B800 ;-BBFF (400) %10111O00
107 ;free $BF91 ;-BFFF (6F)
109 ;program $D748 ;-E7FF (106D+4A)
110 ;free $E800 ;-EFFF (800)
111 worm4p = $F000 ;-F3FF (400) %11110O00
112 leveldata = $F400 ;-FA70 (<=671)
119 namelength = $BC00 ;(1) @menu
121 DispBuffer = $BC00 ;(10x57d) @game
126 ;-----------------------------
127 ;------- program start -------
128 ;-----------------------------
143 .db "WORMY by SHIAR -- beta 93%",0
146 .db %00110000,%00111100
147 .db %01110000,%00111110
148 .db %11100000,%00000111
149 .db %11000011,%11000011
150 .db %11000111,%11100011
151 .db %11101110,%01100111
152 .db %01111100,%01111110
153 .db %00111000,%00111100
156 levelhead2 = 94 ;wormy levels header = "93"
187 ld bc,int_end-int_handler
194 ld hl,$BFFF ;VAT start
197 ld de,(_PTEMP_END+1) ;VAT end
227 ex de,hl ;ld ahl,(hl)
228 cal _AHL_PLUS_2_PG3 ;string id
229 cal _Get_Word_ahl ;ld de,(ahl)
233 jr nz,_searchnext ;not worm
237 inc ix ;save level's ahl
250 cal _Get_Word_ahl ;ld de,(ahl++)
252 ld a,e ;set new level
274 cal _vputs ;"< Select levels: >"
290 ex de,hl ;ahl=ade=(hl)
291 cal _load_ram_ahl ;hl=ahl
292 ld b,(hl) ;b=title size
325 ld b,-3 ;level selected
331 pop bc ;GET_KEY destr. b
346 add a,3 ;sellev+3 (#0==-3)
355 or a ;levelfile on page 0 (=internal)
366 cal _GETB_AHL ;ld a,(ahl)
371 cal _INC_PTR_AHL ;ahl++
373 jr nz,skiptitle ;goto #0-terminator
376 ld (leveldataSize),de
381 ld (hilvlposa),a ;singleplayer levels
386 cal _SET_ABS_SRC_ADDR ;levelsstart
389 cal _SET_ABS_DEST_ADDR ;store in mem.
392 cal _MM_LDIR_SET_SIZE
394 cal _LOAD_ABS_SRC_ADDR ;->ahl
401 ldi ;(de),(hl)\inc hl
406 res 2,(iy+13) ;appAutoScroll
414 ld (hl),1 ;def=level#1
418 ;-----------------------------
419 ;----- build trig tables -----
420 ;-----------------------------
445 ;-----------------------------
446 ;---------- menu -------------
447 ;-----------------------------
449 DisplayMenu: ;---draw menu---
463 dec a ;will be inced @changegame
466 ld hl,changegame ;dispmenusets ;mainMenu
467 psh hl ;jump here after ret
470 ;Mode|Level|Limit|Worms|worm #|controls
471 ; jr dispmenucommon ;cal
474 ld de,$FD80 ;begin pos
498 hr: ;draw horizontal line at hl
507 ;Back|Lives|Limit|Speed|Rotation|Growth
522 inc hl \ inc hl \ inc hl
540 inc a ;-1=None; 0..98->1..99
555 cal cshowA ;turn speed
562 ld a,(hl) ;(scorelimit)
567 jr z,optionMenu ;do not display 0 behind 'None'
579 jp z,dispmainmenu ;mainMenu
623 cal loadgamecar ;a=(hl)
626 jr nc,optionMenu ;>99
630 jp dispomenusets ;optionMenu
633 sub 1 ;dec does not set cf
641 jr nc,optionMenu ;>99
644 jr _dispomenusets ;optionMenu
647 sub 1 ;dec does not set cf
654 ld a,(hl) ;(scorelimit)
661 jr nc,_optionMenu ;>98
665 jr _dispomenusets ;optionMenu
671 jr z,_optionMenu ;<-1
678 inc hl ;=saves 2 bytes :P
687 jr nc,_optionMenu ;>25
690 jr _dispomenusets ;optionMenu
705 jr nc,_optionMenu ;>98
708 jr _dispomenusets ;optionMenu
714 jr z,__optionMenu ;<-1
726 dec a ;2nd item: level
728 sub 3 ;5th item: wormname
732 jp LetsGetThisPartyOn ;otherwise
763 jr nc,mainMenu ;may not become >(nrworms)
767 jr _dispmenusets ;mainMenu
780 ; jr z,bchangecurworm
785 jr nz,changedcurworm ;save >0
790 ld a,(hl) ;hl=nrworms
793 jr nc,mainMenu ;may not be >4
797 jr _dispmenusets ;mainMenu
801 ld a,(hl) ;hl=nrworms
805 ld a,(hl) ;hl=nrworms
808 jr nc,changednrworms ;save >=2
817 jr _mainMenu ;don't change for singleplayer
822 dec hl ;inced earlier
824 ld a,1 ;change LS-bit (=link)
827 jr dispmenusets ;mainMenu
834 jr dispmenusets ;mainMenu
847 jr dispmenusets ;mainMenu
850 inc hl ;hl=loadgamecar+2
852 ld a,(hl) ;(curlevel)
854 cp (hl) ;max level for sel.game
860 jr dispmenusets ;mainMenu
863 ld a,(hl) ;(curlevel)
868 getnrlevels: ;for current gametype at hl
896 cal getcustomkey ;left
897 cal getcustomkey ;right
900 ;---display current settings---
910 add hl,de ;hl=posGame+(Gametype)
911 ld a,(hl) ;str.offset
915 ld (CURtxtGame),hl ;save for g/o
916 cal _vputs ;Singleplayer
938 pop hl ;loadgamecar; hl++
940 ld a,(hl) ;(curlevel)
955 ld hl,$363E ;controls
961 ;--- handle menukeys ---
970 pop bc ;GET_KEY destr. b
980 menupos: ;highlight #b
993 add hl,hl ;$FD20+item*96
1023 ;--- change name ---
1026 getwormname: ;of (curworm)
1054 ld hl,$FF07 ;begin pos
1088 dec (hl) ;(namelength)
1103 .db 0,".<>!",0,0,0,0 ;down,L,R,up
1104 .db 0,"XTOJE0",0 ;enter..clear
1105 .db " WSNID9",0 ;(-)..custom
1106 .db "ZVRMHC8",0 ;dot..del
1107 .db "YUQLGB7#" ;0..xvar
1108 .db $D9,"-PKFA6'" ;on..alpha
1109 .db "54321*",0,$D0 ;F5..more
1113 ld (ix+8),0 ;end mark
1119 ld hl,$FD97 ;begin pos
1120 ld a,35 ;nr of lines
1122 ld de,7 ;bytes to add
1124 ld c,9 ;bytes to clear
1129 jr nz,clroldsetsloop
1132 jr nz,clroldsettings
1135 skiplevel: ;@hl - destr:ab - alter:hl
1140 ld b,(hl) ;spritesize
1151 inc b ;multiplayer lvl
1153 inc b ;skip other 3 worms (9 bytes)
1187 ;build: c=(gameCar)=(hl-1)
1188 ; a=(wormbeglives)=(hl)
1194 add a,a ;8 bytes per mode
1206 ;-----------------------------
1207 ;-------- start game ---------
1208 ;-----------------------------
1212 ld (CheckExit),a ;set exit state
1230 ld (turnright),a ;more efficient
1234 cal _HLTIMES10 ;hl=10*(hl)
1239 ld a,(Gametype) ;8bytes -> 7bytes
1244 add a,24+1 ;go to datalevels
1246 sbc hl,de ;datalevels
1248 cal _ldHLind ;ld hl,(hl)
1249 pop de ;de=loadgamecar
1251 ld a,(de) ;(curlevel)
1255 dec d ;levels to skip
1279 jp DisplayMenu ;return to menu
1298 ;-----------------------------
1299 ;--------- game over ---------
1300 ;-----------------------------
1305 ld a,4 ;4x (all worms)
1315 ld (hl),b ;score+1=0
1322 ex de,hl ;de=wormX+head
1326 jr nz,createwormsloop
1330 pop hl ;begin of current level
1338 dec (hl) ;curlevel-- (not beyond last lvl)
1341 ;show end msg or smtn
1343 psh bc ;where to go afterwards
1344 inc hl ;location of ending-code
1345 jp (hl) ;go there ("call")
1353 ld (hl),a ;store new speed
1374 ld b,0 ;bc=sprite size
1375 add hl,bc ;hl=behind sprite
1382 setsprite: ;de=@sprite ;a=sprsize
1415 ld a,SinCosTable/256
1426 ld bc,(worm2-worm1)-5
1436 ;-------- draw level ---------
1462 add hl,hl ;32=scr.width
1530 ;-----------------------------
1532 psh hl ; >> levelp new
1567 ld hl,4+(txtposReady*256)
1578 jr nc,initfinished ;no link
1580 SwapPos: ;$18 xx -> $E6 xx
1584 ld (worm1+left),a ;worm 1...
1585 ld (worm3+left),a ;and worm 3 via link
1603 ld (worm2+left),a ;worm 2+4..
1604 ld (worm4+left),a ;..over link
1623 ;-----------------------------
1624 ;----------- LOOP ------------
1625 ;-----------------------------
1628 ld bc,(worm1+pos) ;camera worm #1
1630 or a ;if #1 not over link
1632 ld bc,(worm2+pos) ;otherwise view from #2
1634 cal DisplayField ;display piece of level
1649 jr nz,screeninvertloop
1662 ld (handledworm),a ;reset
1680 jr nz,nodispupdate ;just once every 10 turns
1681 ld (hl),10 ;reset counter
1682 cal forceshowstats ;update score
1701 cal nz,handlethoseneatlittleballs
1714 inc (hl) ;1..nrworms
1717 ;-----------------------------
1718 ;---------- keys -------------
1719 ;-----------------------------
1734 rla ;=$17 (c=EXIT-key)
1745 ld (ix+delay),respawndelay
1764 ld (ix+pos2+1),a ;x2
1772 ret nz ;HandleWorm done
1774 or a ;0=no live limit
1775 ret z ;don't end game
1778 jr z,anyworm ;quit at any worm's death
1779 ld a,(nrworms) ;livematch: all worms must've died
1781 ld hl,worm1+lives-(worm2-worm1)
1783 xor a ;check for 0 lives
1785 add hl,de ;next worm
1787 ret nz ;any >0: don't exit
1790 ld a,$A7 ;exit@end of turn
1791 ld (CheckExit),a ;set exit state
1800 out (7),a ;both wires low = game over signal
1806 cal menuinvloop ;invert
1808 cal hr ;menuinvloop w/ b=16
1829 cal _vputs ;Died Score
1844 jr c,nonewwinner ;h<d
1845 jr nz,newwinner ;h>d
1848 jr nc,nonewwinner ;l<e
1859 cpl ;high value (>$FB)
1864 ld a,(hl) ;less deaths
1871 ;---display worms---
1883 cp (hl) ;input=0 = link
1900 ld a,(hl) ;worm+died
1909 jr nz,nodmwinner ;deathmatch?
1910 ld a,0 ;winner's deaths
1912 cp (hl) ;equals this worm?
1916 jr c,notwinner ;no singleplayer winners
1918 cal _ldHLind ;ld hl,(hl)
1921 cal _cphlde ;==highest score..
1925 cal _putc ;..then put *
1939 dnz displayWormStats
1942 or a ;singleplayer (0) only
1943 jr nz,hilevelcheckdone
1948 jr c,hilevelcheckdone
1949 ld (hl),a ;save local
1954 hilvlposhl =$-2 ;save external
1955 cal _writeb_inc_ahl ;ld (ahl),c
1960 jr z,hiscorecheckdone ;no SP
1962 cal loadhiscoreposinahl
1963 cal _SET_ABS_SRC_ADDR ;from ahl (lvlfile)
1966 cal _SET_ABS_DEST_ADDR ;to local
1968 cal _MM_LDIR_SET_SIZE ;get old score+name
1971 ld de,(highsave) ;de=prev. hiscore
1972 ld hl,(worm1+score) ;hl=worm1's score
1973 cal _cphlde ;sub hl,de
1974 jr c,NotNewHigh ;new<old
1975 jr z,NotNewHigh ;new<=old
1977 ld (highsave),hl ;store new hiscore
1978 ld de,highsave+2 ;to
1979 ld hl,worm1+name ;from
1981 ldir ;store new hiname
1982 cal loadhiscoreposinahl
1983 cal _SET_ABS_DEST_ADDR ;to ahl
1986 cal _SET_ABS_SRC_ADDR ;from local
1988 cal _MM_LDIR_SET_SIZE ;save new
2015 ;x123456789012345678901
2016 ;>>>>>> GAME OVER <<<<<
2021 ;6Worm#02 @ 05 00120
2028 rst 20h ;_ABS_MOV10TOOP1
2030 ld hl,savestart-_asm_exec_ram+4
2034 cal _SET_ABS_DEST_ADDR
2038 cal _SET_ABS_SRC_ADDR
2039 ld hl,saveend-savestart
2040 cal _MM_LDIR_SET_SIZE
2048 loadhiscoreposinahl:
2049 ld hl,0 ;for peaworm and singleplayer
2055 ld a,(nrlevels+1) ;skip peaworm slots if tron mode
2059 ld b,a ;levels to skip (including 1 for singleplayer)
2062 inc hl ;add one word per level
2065 inc hl ;plus 3 bytes for name
2066 dnz addlevelposition
2073 adc a,0 ;ahl=saveloc
2078 ;-----------------------------
2079 ;----------- worm ------------
2080 ;-----------------------------
2085 cal saverespawncounter
2091 jr DoesWormTailEqualsWormHead ;chk4 size=0
2102 DoesWormTailEqualsWormHead:
2104 jr nz,removewormloop
2108 jr nz,safewormsizedone
2116 ld (ix+tail),e ;head=tail/size=0
2122 jr nz,saverespawncounter
2146 ld a,%01111111 ;default
2149 dnz bitmask ;a/8 times
2150 out (1),a ;send bitmask
2151 in a,(1) ;input keys
2156 dnz keybit ;check match (cf set)
2159 inkeys: ;use jp not call!
2178 jr z,inlink ;input by link
2179 cal inkeys ;input by keys
2183 ld c,l ;send our keys
2190 ;------- handle worm ---------
2241 ;-------- move worm ----------
2269 notmoveY: ;bc=newpos
2276 pop hl ; << pos (old)
2294 ;--------- worm hit ----------
2301 cal z,checkhitotherworm
2304 and _datamultpeas ;&&bit
2308 jp z,WormDead ;no food
2315 cal DrawPea ;remove pea
2327 jp nz,Drawworm ;continue
2333 jp nz,Exit ;stack restored
2344 cal IncScore ;score+(40*level)
2351 chkpeahit: ;bc=ownpos;hl=peapos (destr:ad)
2367 ld hl,(peaspos) ;1st pea
2370 and %01 ;ourpea (0|1)
2372 ld hl,(peaspos+2) ;2nd pea ;&&&ex de,hl?
2377 ld a,e ;peek a (that's x86asm for pop\push ;)
2378 bit 1,a ;%10 = carrying flag?
2379 jp z,WormDead ;if not just die
2384 pop af ;which flag? (=and %1)
2385 ld hl,drawctfpea1 ;restore #1
2386 jr z,nottheotherflag
2387 ld hl,drawctfpea2 ;restore #2
2392 hitflag: ;correct pea hit
2394 xor %11 ;invert flag taken + ownflag
2396 and %10 ;just returned?
2400 jr nz,Drawworm ;flag taken, continue game
2402 ld de,20 ;flag captured+returned
2406 ld (drawctfpea1),a ;redraw..
2407 ld (drawctfpea2),a ;..both flags
2416 ;-----------------------------
2435 jr nz,nextotherwormbit
2461 .db $dd,$7d ;ld a,lx
2464 jr nz,chkworm2 ; ret nz
2490 ;-------- draw worm ----------
2498 cal z,checkhitlapline
2504 ret z ;keep tail in "Tron"
2547 ;-----------------------------
2548 ;---------- ball -------------
2549 ;-----------------------------
2551 handlethoseneatlittleballs:
2597 bit 1,d ;1=up; 0=down
2627 letsmovetheotherway:
2642 ;-----------------------------
2643 ;----------- procs -----------
2644 ;-----------------------------
2648 ld a,%10000000 ;all key-masks
2651 inc a ;cp %11111111 (no keys pressed)
2652 jr nz,releasekeys ;keep waitin
2653 cal GET_KEY ;clear buffer
2675 CheckPea: ;@hl; destr:abcde
2688 ret nz ;nz=pixel found
2697 tryDrawPea: ;hl=peapos;bc=dopea
2725 PutSprite: ;||@(b,c)
2726 ;by SHIAR only ix saved
2763 ;----------- score -----------
2783 jr z,scorecommon ;hl/1000 not increased
2791 jr c,showstats ;<0=0
2799 jr z,showstats ;de=0=no limit
2806 ret nz ;no disp for timematches
2823 shownameloop: ;1st 3 chars
2852 showstat: ;(multiplayer)
2870 showstatsS: ;(singleplayer)
2964 ;-----------------------------
3082 ld (ShiftRightCounter),a
3084 ld (ShiftRightChunk),a
3098 ShiftRightCounter = $-1
3120 ld (ShiftLeftCounter),a
3122 ld (ShiftLeftChunk),a
3124 jr nc,ShiftLeftSameByte
3143 ShiftLeftCounter = $-1
3154 jr nz,ShiftRowsRight
3188 ;----------- draw ------------
3202 CheckPixel: ;at bc in d
3209 ;CLEM's FIND_PIXEL (131+? cycles; 28+4 bytes)
3210 ;(b,c) to hl:a; "destroyes" ahl
3212 FindPixel: ;(b,c) to hl:a
3281 drawbox: ;(d,e)-(h,l)
3289 drawhline: ;(d,e)-(h,e)
3295 ld c,a ;starting mask
3337 drawline: ;(d,e)-(h,l)
3438 drawcircle: ;(d,e),h ;de=x,y; h=z
3449 ex (sp),hl ;push zz \ pop x,y
3450 cal circledraw ;(x-xx,y+yy)-(x+xx,y+yy)
3451 ;(x-xx,y-yy)-(x+xx,y-yy)
3452 cal circledraw ;(x-yy,y+xx)-(x+yy,y+xx)
3453 ;(x-yy,y-xx)-(x+yy,y-xx)
3455 ex (sp),hl ;push x,y \ pop zz
3458 dec a ;-256<h<0 = $FF**
3460 jr z,circlenext ;jump if zz<0
3464 add a,a ;a=2yy-2 ;nc
3466 sbc hl,de ;zz=zz-2yy+2
3474 add hl,de ;zz=zz+2xx+3
3483 circledraw: ;destr:de
3488 add hl,bc ;h=x+xx; l=y+yy
3490 cal drawline ;(h-b,l+c)-(h+b,l+c)
3496 cal drawline ;(h-b,l-c)-(h+b,l-c)
3497 ld a,b ;swap xx and yy
3504 ;-----------------------------
3505 ;----------- link ------------
3506 ;-----------------------------
3510 out (7),a ;raise both wires = link ok
3516 checklink: ;load wires in A and check for timeout
3517 dec de ;decrease timer
3520 jr nz,linkfine ;ok if de>0
3523 ld a,0 ;losses so far
3525 inc a ;and this is another one
3527 pop de ;return from link
3528 cp lossout ;quit if too many errors
3529 ret c ;otherwise just continue
3550 Qsend: ;try to send 8 bits in C; CF=error --- destr:abcde
3553 and %11 ;both wires low = exit signal
3554 jr z,linkerr ;error otherwise
3555 ld b,8 ;bits to send
3558 rl c ;bit to send in cf
3559 ld a,D0LD1H ;0: lower white
3561 ld a,D0HD1L ;1: lower red
3563 out (7),a ;lower one (send bit)
3565 cal checklink ;other calc must lower other wire
3567 ld a,D0HD1H ;raise one, ok to raise other
3571 cp %11 ;both raised (by other calc)
3574 dnz sendloop ;repeat for all bits
3576 ld (linklosses),a ;reset number of losses
3583 Crecv: ;--- receive 8 bits into A/C --- destr:abcdehl ---
3585 ret nc ;return if all went ok
3586 jr Crecv ;and try again
3588 Qrecv: ;--- receive 8 bits into A/C; CF=error --- destr:abcde ---
3591 jr z,linkerr ;both low = error, quit
3592 ld b,8 ;bits to receive
3598 jr z,recvwait ;both high = nothing sent (yet)
3599 rra ;received bit in cf
3601 jr c,received ;lower white wire as well
3602 ld a,D0HD1L ;lower red
3605 out (7),a ;both wires low
3608 jr z,recvwaitack ;same wire will be raised again by other calc
3610 out (7),a ;raise both
3612 dnz recvloop ;repeat for all bits
3614 ld (linklosses),a ;reset number of losses
3618 ;-----------------------------
3619 ;---------- levels -----------
3620 ;-----------------------------
3623 .db 5,4,15,15,0,0 ;peas,speed,growth,begin_size,sprite,balls
3624 .db 0,2,63 ;start d, y, x
3625 .db 128,57 ;field width (128-255), height (57-255)
3626 .db 0 ;no additional lines, boxes
3632 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
3637 .db %1110000,%10001000,%10001000,%10001000,%1110000,0
3638 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
3643 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
3648 LevelDefT: ;tron=no delay
3650 .db %1110000,%10001000,%10001000,%10001000,%1110000,0
3651 .db $40,30,64,$C0,30,64, $00,30,64,$80,30,64
3657 .db %1110000,%10001000,%10001000,%10001000,%1110000,0
3658 .db $40,30,64,$C0,30,64, $00,30,64,$80,30,64
3663 ;-----------------------------
3664 ;---------- data -------------
3665 ;-----------------------------
3669 .db %00000000,%00000000,%00000111,%10000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01110000,%00000000,%00000000,%00000000,%00000000,%00000000
3670 .db %00000000,%00000000,%00001111,%10000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111000,%00000000,%00000000,%00000110,%01111011,%00100000
3671 .db %00000000,%00000000,%00011100,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00011100,%00001110,%00000000,%00001001,%00010011,%01000000
3672 .db %00000000,%00000000,%00011000,%00011111,%00000000,%01111111,%11000000,%00111100,%00011110,%01111000,%00001100,%00011111,%00000000,%10100111,%00110000,%10000000
3673 .db %00000000,%00000000,%00111000,%00111111,%10000000,%11111111,%11100000,%11111110,%00111111,%11111100,%00001100,%00111011,%00000000,%10100001,%00001001,%01100000
3674 .db %00000000,%00000000,%00110000,%01110001,%11000001,%11000000,%01110001,%11100110,%01110011,%11001110,%00001100,%00110001,%10000000,%01001110,%01110010,%01100000
3675 .db %00000000,%00000000,%00110000,%01100000,%11000001,%10000000,%00111001,%10000000,%01100111,%11100110,%00001110,%01110001,%10000000,%00000000,%00000000,%00000000
3676 .db %00000000,%00000000,%00110000,%01100000,%11000001,%10110000,%00011011,%10000000,%11101110,%01110111,%00001110,%01110001,%10000000,%00000000,%00000000,%00000000
3677 .db %00000000,%00000000,%00110000,%01110001,%11000001,%10110000,%00011011,%00000000,%11001100,%00110011,%00000111,%11100001,%10000000,%00000000,%00000000,%00000000
3678 .db %00000000,%00000000,%00110000,%00110001,%10000001,%10110000,%00011011,%00000000,%11001100,%00110011,%00000011,%11000011,%10000000,%00000000,%00000000,%00000000
3679 .db %00000000,%00000000,%00111000,%00111011,%10000011,%10110000,%00011011,%00000000,%11001110,%01110011,%00000000,%00000011,%00110101,%01001001,%10000000,%00000000
3680 .db %00000000,%00000000,%00011000,%00011111,%00000011,%00110000,%00011011,%00000000,%11000111,%11100011,%10000000,%00000011,%01000101,%00010101,%01000011,%01100011
3681 .db %00000000,%00000000,%00011100,%00001110,%00000111,%00111000,%00111011,%10000000,%11000011,%11000001,%10000000,%00000111,%01100101,%01010101,%01000101,%01010100
3682 .db %00000000,%00000000,%00001110,%00111111,%10001110,%00011100,%01110001,%10000000,%11100000,%00000001,%11100000,%00001110,%00110111,%01011101,%10010101,%01100101
3683 .db %00000000,%00000000,%00000111,%11111011,%11111100,%00001111,%11100001,%11000000,%01100000,%00000000,%11111111,%11111100,%00010101,%01010101,%01000101,%01010101
3684 .db %00000000,%00000000,%00000011,%11100000,%11111000,%00000111,%11000000,%11000000,%01100000,%00000000,%00111111,%11111000,%01100101,%01010101,%01000110,%01010011
3686 txtMenu: .db "Mode",0 ;1st menu item
3692 posMenu: .dw $2418,$231E,$2824,$1F2A,$1730,$1936
3693 txtMenuR: .db "controls",0
3694 txtoMenu: .db "Back",0 ;1st menu item
3700 posoMenu: .dw $2618,$251E,$2524,$222A,$1A30,$1C36
3701 txtGame: .db "Singleplayer",0
3702 txtGame1: .db "Peaworm",0
3703 txtGame2: .db "Tron",0
3704 txtGame3: .db "Deathmatch",0
3705 txtGame4: .db "Foodmatch",0
3706 txtGame5: .db "Timematch",0
3707 txtGame6: .db "Race",0
3708 txtGame7: .db "CTF" ;,0
3711 .db txtGame1-txtGame
3712 .db txtGame2-txtGame
3713 .db txtGame3-txtGame
3714 .db txtGame4-txtGame
3715 .db txtGame5-txtGame
3716 .db txtGame6-txtGame
3717 .db txtGame7-txtGame
3719 txtNone: .db "None",0
3720 txtDef: .db "Default",0
3723 txtKeyleft: .db ":left",0
3724 txtKeyright:.db "/right",0
3725 txtLevsel: .db $CF," Select levels ",5,0
3726 txtWaiting: .db "Waiting...",0
3727 txtReceive: .db "Receiving..." ;,0
3730 .db 0, 3, 6, 9, 12, 15, 18, 21
3731 .db 24, 27, 30, 33, 36, 39, 42, 45
3732 .db 48, 51, 54, 57, 59, 62, 65, 67
3733 .db 70, 73, 75, 78, 80, 82, 85, 87
3734 .db 89, 91, 94, 96, 98,100,102,103
3735 .db 105,107,108,110,112,113,114,116
3736 .db 117,118,119,120,121,122,123,123
3737 .db 124,125,125,126,126,126,126,126
3740 txtLevel: .db "Level ",0
3741 txtWorms: .db "Worms: 0",0 ;follows txtLevel
3742 txtName: .db "Name",0
3743 txtWinner: .db "Wins " ;follows txtName
3744 txtDied: .db "Died " ;follows txtWinner
3745 txtScore: .db "Score",0 ;follows txtDied
3746 txtLeft: .db " left",0 ;follows txtScore
3747 txthiscore:.db "HiScore:",0
3748 txtReady: .db "Prepare!",0
3750 txtGO: .db 5,5,5,5,5," GAME OVER ",$CF,$CF,$CF,$CF,$CF,0
3752 datalevels: .dw LevelDef, LevelDefM
3753 .dw LevelDefT,LevelDefM
3754 .dw LevelDefM,LevelDefM
3755 .dw LevelDefM,LevelDefC
3756 nrlevels: .db 1,3,1,3,3,3,3,1 ;=defaults
3758 _datalink = %0000001 ;linkplay
3759 _datafoodl = %0000010 ;left=0 limit
3760 _datasingl = %0000100 ;singleplayer=1 (=hiscore+keep_length+nextlevel)
3761 _datamultpeas = %0001000 ;multiple peas=1
3762 _datatime = %0010000 ;time incs score (timematch)
3763 _datafood = %0100000 ;food present
3764 _datadie = %1000000 ;worm dies on impact
3765 ;reserved %10000000 ;for future use
3767 savestart: ; �game info (see above)
3768 ; | �lives (0=unlimited)
3769 ; | | �nrworms (can be altered by user)
3770 ; | | | �level (reset to 1 at startup)
3771 ; | | | | �speed/delay (-1=def)
3772 ; | | | | | �grow speed (-1=none; 0=continuous)
3773 ; | | | | | | �turn speed (8=def)
3774 ; | | | | | | | �score limit (0=none)
3775 gamesingle = 0 ;used | | | | | | | |
3776 datasingle: .db %1100110,3,1,1,-1,-1, 8, 0 ;Singleplayer (SP; 3 lives)
3778 datapeas: .db %1100100,1,1,1,-1,-1, 8, 0 ;Peaworm (SP; 1 live)
3780 datatron: .db %1010100,1,1,1,-1, 0, 8, 0 ;Tron (SP; 1 live, cont.growth)
3781 gamedeathm = 3 ;used
3782 datadeathm: .db %1000000,3,2,1,-1,49, 8, 0 ;Deathmatch (3 lives, 50 growth)
3784 datafoodm: .db %1100000,0,2,1,-1,-1, 8,10 ;Foodmatch (100 score)
3786 datatimem: .db %1010000,1,2,1,-1, 0, 8, 0 ;Timematch (tron, 100 score)
3788 datarace: .db %0000000,0,2,1,-1,-1, 8,10 ;Race (100 score, no collision)
3790 datactf: .db %1001000,0,4,1,-1,-1, 8, 9 ;CTF (90 score)
3792 worm1set: .dw worm1p,worm1p
3793 .db %11110111,%00,-01,K_RIGHT,K_LEFT
3794 worm1name: .db "WORMY ",0
3795 worm2set: .dw worm2p,worm2p
3796 .db %11111011,%01,-01,K_F2,K_F1
3797 worm2name: .db "VIPER ",0
3798 worm3set: .dw worm3p,worm3p
3799 .db %11111011,%00,-01,K_COMMA,K_STO
3800 worm3name: .db "NIBBLER ",0
3801 worm4set: .dw worm4p,worm4p
3802 .db %11111011,%01,-01,K_PLUS,K_ENTER
3803 worm4name: .db "JIM ",0
3812 Gametype: .db 0 ;last gamemode
3826 head = 13 ;4B (head=tail)
3827 tail = 15 ;also@next level
3829 reserv = 18 ;loop (race:lap|ctf:pea)
3840 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3841 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3842 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3843 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3844 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3845 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3846 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3847 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3848 .db "WWW.SHIAR.ORG WWW.SHIAR.ORG "
3849 .db " shiar0@hotmail.com",0
3852 defspriteimg: .db %01100000
3858 .db "Internal Levels" ;,0
3860 .db 0,deflevels/256,deflevels&255
3863 ;-----------------------------
3864 ;----------- end -------------
3865 ;-----------------------------