From 8dcbed707c51a18497a464a3a383b82263c76f71 Mon Sep 17 00:00:00 2001 From: Mischa Poslawsky Date: Mon, 17 Apr 2000 19:50:34 +0200 Subject: [PATCH] worm 0.86.0417: sprites, names, various improvements - code polish - abbreviate common 4-character instructions for alignment - inline (documented) declaration of ti86abs.inc constants - document memory usage - plan version roadmap - worms' names can be altered from main menu - worm growth can vary per level - both worms die when they run into each other - peas can be any sprite upto 8x8, changable per level - use line routine to draw boxes easily and reliably --- makelvl.bat | 10 + worm.txt | 19 +- worm.z80 | 1344 +++++++++++++++++++++++++++++---------------------- wormlvl.z80 | 131 +++-- 4 files changed, 864 insertions(+), 640 deletions(-) create mode 100644 makelvl.bat diff --git a/makelvl.bat b/makelvl.bat new file mode 100644 index 0000000..4982435 --- /dev/null +++ b/makelvl.bat @@ -0,0 +1,10 @@ +@echo off +echo Use MAKELVL to compile your Worm levelfile. +echo Format for LEVEL.Z80 is: (always leave .z80) +echo MAKELVL LEVEL +echo Needs TASM86.EXE and BIN2STR.EXE to compile. +echo. +tasm86 -80 -b %1.z80 +bin2str %1.obj 86 Levelfile for Worm .86 by Shiar +del %1.obj +del %1.lst diff --git a/worm.txt b/worm.txt index 5d13c9b..ca5fe1f 100644 --- a/worm.txt +++ b/worm.txt @@ -1,14 +1,16 @@ ############### Title : ### W O R M ### ############### - Version : 0.84% + Version : 86% Release Date : hopefully before may 2000 - File(s) : worm.86p (4kb) + worm.txt + File(s) : worm.86p (4kB) + wormlvl.86s (1kB) + worm.txt Author : Shiar Email Address : shiar@mailroom.com ICQ UIN : #43840958 Web Page : www.games3.net/shiar - Description : Nibbles-like game + Description : singleplayer/multiplayer Nibbles-like game Where to get this game : games3.net/shiar (home of Worm) Other games by author : Nemesis (beta) Additional Credits to : Matthew Shepcar (wrote original Peaworm) @@ -43,7 +45,7 @@ with 2-4 humans. *** FOODMATCH Like deathmatch, with the difference that your objective is to score 100 -points. You'll get 10 points for taking a pea, if you die however, you +points. You'll get 10 points for taking a pea. If you die however, you lose 10. *** HUNTING @@ -64,7 +66,10 @@ There are several control points which you have to control. Every ten turns each player is given one point for each control point he/she controls. The first one scoring 100 points wins. -*** LEVELS +*** LEVELS &&& +The file WORMLVL.Z80 can be altered to create your own levels. Compile this +file by running WORMLVL.BAT. Levels may be distributed freely, but I would +appreciate it if you send me a copy of your levels. *** CREDITS This game was made by SHIAR. Please contact me at shiar@mailroom.com, or @@ -72,6 +77,10 @@ ICQ UIN #43840958. Also visit the home of Worm at www.games3.net/shiar (come.to/shiar) for the latest news about Worm and other games by me. +You may not release an altered version of this program, and all files must +be included with any distribution. + +*** TNX2 Matthew Shepcar - for writing the original Peaworm Jonah Cohen - wrote some parts of Worm diff --git a/worm.z80 b/worm.z80 index d50545f..fef817c 100644 --- a/worm.z80 +++ b/worm.z80 @@ -1,7 +1,7 @@ ; Title : Worm -; Version : 0.92 -; Release Date : soon (I hope) -; Filename : worm.86p (3404) +; Version : 0.986 +; Release Date : april 2000??? +; Filename : worm.86p (4kb) ; Author(s) : Shiar ; Email Address : shiar@mailroom.com ; ICQ UIN : #43840958 @@ -16,45 +16,88 @@ ;----------- TO-DO ----------- ;----------------------------- -; Shiar 3.III.00 +; 86% = DONE -;Feel like doing something? (name indicates who's working on it) -; * linkplay -; * singleplay ending -; * titlescreen -; * make linkplay available for all gametypes (not just deathmatch) -; * two worms collide with heads -> both should die -; * game types: -;1) * ctf: take enemy flag (right-bottom) and return to your flag (left-top) -;1) * domination?: take control points by running over them and hold them -;1)* sprites for picks instead of blocks +; 1% * levelfile select +; 3% * linkplay +; 1% * titlescreen +; 2% * make linkplay available for all gametypes (not just deathmatch) +; 1% * two worms collide with heads -> both should die +; * game types: +; 1% * ctf: take enemy flag (right-bottom) and return to your flag (left-top) +; 1% * domination?: take control points by running over them and hold them +; 1% * name change + other options +; * complete readme (+custom level info) +; 2% * ... (pollish, &&&) -;1) Working on a new pickup-system allowing more than one "food" and different pickup-handling +; 99% = beta release + +;100% = bugs fixed + levels done + +;----------------------------- +;----------------------------- +;--------- W O R M --------- +;----------------------------- +;----------------------------- + +#define cal call +#define psh push +#define dnz djnz #include "asm86.h" #include "ti86asm.inc" -#include "ti86abs.inc" - -_SHRACC = $4383 -_SHLACC = $438B -_divHLby10 = $4044 -_divAby10 = $4DAF -_cphlde = $403C -_clrWindow = $4A86 -_asapvar = $D6FC -_MOV4B = $429B ;4x ld (de),(hl) -_MOV5B = $4297 ;5x ld (de),(hl) -_mov9b = $4283 ;9x ld (de),(hl) -_ldHLind = $4010 ;ld hl,(hl) -_swapt_ = $45F3 ;ex_ahl_bde - -leveldata = $EA00 ;size<$400 + +_SHRACC = $4383 +_SHLACC = $438B +_divHLby10 = $4044 +_divAby10 = $4DAF +_cphlde = $403C +_clrWindow = $4A86 ;clear screen +_asapvar = $D6FC ;own name (worm) +_MOV4B = $429B ;4x ld (de),(hl) +_MOV5B = $4297 ;5x ld (de),(hl) +_mov9b = $4283 ;9x ld (de),(hl) +_ldHLind = $4010 ;ld hl,(hl) +_swapt_ = $45F3 ;ex_ahl_bde +_Get_Word_ahl = $521D ;ld de,(ahl) +_Set_Word_ahl = $5221 ;ld (ahl),de +_AHL_PLUS_2_PG3 = $4C3F ;ahl=ahl+2 +_SET_ABS_SRC_ADDR = $4647 ;set source for mm.ldir =ahl +_LOAD_ABS_SRC_ADDR = $5209 ;ahl = mm.ldir source +_SET_ABS_DEST_ADDR = $5285 ;set destination for mm.ldir = ahl +_SET_MM_NUM_BYTES = $464F ;number of bytes for mm.ldir = ahl +_mm_ldir = $52ED ;24bit ldir +_RAM_PAGE_1 = $47E3 ;set $8000+ to page 1 + +;----------------------------- +;------- data storage ------- +;----------------------------- + +leveldata = $EA00 ;size< $400 +ScrBuffer = $8100 ;size=$2000 (32x256) + ;->mod$800 +DispBuffer = $BC00 ;size= $390 (16x57) +SinCosTable = $B500 ;size= $100 (4x64) + +worm1 = $B400 +worm2 = $B42A +worm3 = $B454 +worm4 = $B47E ;-B4A8 + +resbit = 2 ;and%11111011 +worm1p = $B000 ;%10110000 -$B3FF +worm2p = $B800 ;%10111000 -$BBFF +worm3p = $F000 ;%11110000 -$F3FF +worm4p = $A800 ;$E800=%11101000 ;$D748+$1000+ + +WormVersion = 086 ;----------------------------- ;------- program start ------- ;----------------------------- .org _asm_exec_ram + start: nop jp Start @@ -62,11 +105,13 @@ start: .dw WormMsg .dw WormIcon +WormMsg: + .db "WORM by SHIAR -- pre-beta 86%",0 WormIcon: .db 9,2 - .db %10010111,%01101111 + .db %10010110,%01101111 .db %10110101,%01001011 - .db %11110111,%01001001 + .db %01110011,%01001001 .db %00000011,%10000000 .db %00000001,%11100000 .db %00111000,%11111000 @@ -76,46 +121,68 @@ WormIcon: levelfile: .db 7,"wormlvl" +levelhead = 'T' Start: ld (SpSave),sp - call _runindicoff - call _flushallmenus - call _clrLCD + cal _runindicoff + cal _flushallmenus + cal _clrLCD ld hl,levelfile-1 rst 20h ;_ABS_MOV10TOOP1 rst 10h ;_FINDSYM ret c ;not found ex de,hl - ld a,b ;call _ex_ahl_bde - call _SET_ABS_SRC_ADDR - - xor a - ld hl,leveldata ;datalevels - call _SET_ABS_DEST_ADDR - xor a - ld hl,2 - call _SET_MM_NUM_BYTES - call _mm_ldir + ld a,b ;cal _ex_ahl_bde + cal _AHL_PLUS_2_PG3 + + cal _Get_Word_ahl + ld b,a ;psh af + ld a,levelhead + cp e ;1st byte = w? + ret nz ;not worm level + ld a,b ;pop af + cal _Get_Word_ahl + ld (leveldataSize),de + + ld d,8 ;counter + ld bc,datalevels-2 +loadgametype: + psh de + inc bc + inc bc + cal _Get_Word_ahl ;ld de,(ahl++) + psh af + ld a,d + or e + jr z,defaultlevels + ld a,e ;set new level + ld (bc),a + inc bc + ld a,d + ld (bc),a + dec bc +defaultlevels: + pop af + pop de ;counter + dec d ;8x + jr nz,loadgametype + cal _SET_ABS_SRC_ADDR xor a - ld hl,datalevels - call _SET_ABS_DEST_ADDR - xor a - ld hl,16 - call _SET_MM_NUM_BYTES - call _mm_ldir - - xor a ld hl,leveldata - call _SET_ABS_DEST_ADDR + cal _SET_ABS_DEST_ADDR xor a - ld hl,400 - call _SET_MM_NUM_BYTES - call _mm_ldir + ld hl,0 +leveldataSize =$-2 + cal _SET_MM_NUM_BYTES + cal _mm_ldir - call _RAM_PAGE_1 + cal _LOAD_ABS_SRC_ADDR ;->ahl + ld (hisaveposa),a + ld (hisaveposhl),hl + cal _RAM_PAGE_1 ;&&& res 2,(iy+13) ;appAutoScroll ld a,r @@ -127,7 +194,7 @@ Start: ld hl,TrigPrecalc ld de,SinCosTable - push de ; >> 1 + psh de ; >> 1 ld bc,65 ldir dec hl @@ -137,7 +204,7 @@ MirrorSineWave: ld a,(hl) ld (de),a inc de - djnz MirrorSineWave + dnz MirrorSineWave pop hl ; << 0k ld b,128+64 NegativeSineWave: @@ -146,7 +213,7 @@ NegativeSineWave: ld (de),a inc hl inc de - djnz NegativeSineWave + dnz NegativeSineWave ;----------------------------- ;---------- menu ------------- @@ -156,20 +223,20 @@ DisplayMenu: ld a,2 ld (nrworms),a gomainMenu: - call _clrWindow + cal _clrWindow ld hl,txtWelcome - call _puts + cal _puts ld de,$0205 ld (_curRow),de - call _puts ;txtOptions + cal _puts ;txtOptions dec e ;$0204 ld (_curRow),de ld hl,(CURtxtGame) - call _puts + cal _puts xor a mainMenu: - call menucall + cal menucall jr nz,notselect select: ld a,b @@ -186,22 +253,22 @@ notselect jr z,Variation gooptionsMenu: - call _clrWindow + cal _clrWindow ld hl,txtWelcome - call _puts + cal _puts ld hl,txtLevel ld de,$0205 ld (_curRow),de - call _puts ;txtLevel + cal _puts ;txtLevel dec e ;$0204 ld (_curRow),de - call _puts ;txtWorms + cal _puts ;txtWorms ld a,(nrworms) add a,'0' - call _putc + cal _putc xor a optionsMenu: - call menucall + cal menucall jr nz,notopselect opselect: ld a,b @@ -217,7 +284,6 @@ changeworms: jr gooptionsMenu changelevel: jr optionsMenu - notopselect: cp K_EXIT jr z,gomainMenu @@ -238,35 +304,34 @@ okilydokily: ld de,$0204 ld (_curRow),de ld (CURtxtGame),hl - call _puts + cal _puts ld (NEXTtxtGame),hl ld a,b jp mainMenu menucall: - push af + psh af ld hl,$0004 ld (_curRow),hl ld a,' ' - call _putc + cal _putc ld hl,$0005 ld (_curRow),hl - call _putc + cal _putc pop af - push af + psh af ld h,0 add a,4 ld l,a ld (_curRow),hl ld a,'*' - call _putc - pop af - ld b,a + cal _putc menukeys: halt \ halt - call GET_KEY + cal GET_KEY or a jr z,menukeys + pop bc ;pop a as b cp K_UP jr nz,notup updown: @@ -300,20 +365,13 @@ LetsGetThisPartyOn: ld e,8 ;=de add hl,de - ld d,a ;push af + ld b,a ;psh af and _datasingl jr z,notsingle ld a,1 ld (nrworms),a - ld a,d - and _datafoodl - jr nz,notsingle - ld a,1 - ld (worm1+lives),a notsingle: - ld a,d - push af ;&&&b? - + ld a,b ;pop af \push and _datascore ld de,$FF64 ;virt.infinate jr z,setscorelimit @@ -321,25 +379,25 @@ notsingle: setscorelimit: ld (scorelimit),de - call _ldHLind ;ld hl,(hl) - pop af - push hl + cal _ldHLind ;ld hl,(hl) + psh hl + ld a,b ;pop af and _datalink jr z,GameOver linkmatch: - call _clrWindow + cal _clrWindow ld a,WormVersion - call send + cal send jr c,client ;2nd host: ld hl,txtWaiting - call _puts - call receive + cal _puts + cal receive cp WormVersion jp nz,LinkBreak - call send + cal send ld hl,SwapPos ld (hl),$f6 @@ -347,8 +405,8 @@ host: client: ld hl,txtReceive - call _puts - call receive + cal _puts + cal receive cp WormVersion jp nz,LinkBreak @@ -361,7 +419,7 @@ multiplayer: ;----------------------------- GameOver: - call _clrLCD + cal _clrLCD ld hl,0 ld (worm1+died),hl ;+died=0 \ +score1=0 @@ -378,27 +436,53 @@ GameOver: ld (Level),a ld hl,worm1set+4 ld de,worm1+lives - call _MOV5B ;9xld(de),(hl) - call _mov9b +;&&&>* + cal _MOV5B ;9xld(de),(hl) + cal _mov9b ld hl,worm2set+4 ld de,worm2+lives - call _MOV5B - call _mov9b + cal _MOV5B + cal _mov9b ld hl,worm3set+4 ld de,worm3+lives - call _MOV5B - call _mov9b + cal _MOV5B + cal _mov9b ld hl,worm4set+4 ld de,worm4+lives - call _MOV5B - call _mov9b + cal _MOV5B + cal _mov9b + + ld a,(Gametype) + cp 1 ;=peaworm + jr nz,worminitdone + ld (worm1+lives),a ;&&&<* +worminitdone: pop hl StartLevel: ld de,Left + ld a,(hl) + inc a ;=255? + jp nz,nextlevel + + psh hl + ld b,150 +waitsomemore: + halt + dnz waitsomemore + cal _clrWindow + pop hl +;show end msg or smtn + ld bc,Exit + psh bc ;where to go afterwards + inc hl ;location of ending-code + jp (hl) ;go there ("call") +nextlevel: ldi ld de,Speed ldi + ld de,peagrowth + ldi ld a,(hl) ld (worm1+grow),a ld (worm2+grow),a @@ -407,6 +491,22 @@ StartLevel: ld (beginsize),a inc hl + ld a,(hl) + inc hl + or a + jr z,defaultsprite + ld (sprsize),a + ld d,h + ld e,l ;ld de,hl + ld c,a + ld b,0 ;bc=sprite size + add hl,bc ;hl=behind sprite + jr setsprite +defaultsprite: + ld de,peasprite +setsprite: + ld (spritepos),de + ld a,(hl) inc hl ld (nrballs),a @@ -428,19 +528,19 @@ nohunter: ex de,hl ld (thislevel),de - push de + psh de ld hl,worm1set ld de,worm1+head - call _MOV4B + cal _MOV4B ld hl,worm2set ld de,worm2+head - call _MOV4B + cal _MOV4B ld hl,worm3set ld de,worm3+head - call _MOV4B + cal _MOV4B ld hl,worm4set ld de,worm4+head - call _MOV4B + cal _MOV4B pop de ld hl,worm1 @@ -450,7 +550,7 @@ nohunter: jr nz,worminit ld b,4 worminit: - push bc ; >> 1 + psh bc ; >> 1 ex de,hl ldi ;d ld a,SinCosTable/256 @@ -468,7 +568,7 @@ worminit: ld bc,(worm2-worm1)-5 add hl,bc pop bc ; << 0k - djnz worminit + dnz worminit ;-------- draw level --------- @@ -481,7 +581,7 @@ worminit: sub 57 ld (FieldHeight),a add a,57-5 - push de ; >> levelp + psh de ; >> levelp ld l,a ld h,0 add hl,hl @@ -492,8 +592,8 @@ worminit: ex de,hl ld hl,ScrBuffer - push hl ; >> 1 - push de ; >> 2 + psh hl ; >> 1 + psh de ; >> 2 ld de,ScrBuffer+1 ld bc,63 ld (hl),%11111111 @@ -505,12 +605,12 @@ worminit: ClearLine: ld (hl),c inc hl - djnz ClearLine - push hl ; >> 3 + dnz ClearLine + psh hl ; >> 3 ld a,(FieldWidth) add a,126 - push af ; >> 4 + psh af ; >> 4 and %11111000 rra rra @@ -527,7 +627,7 @@ ClearLine: VertShift: rra rr c - djnz VertShift + dnz VertShift NoVertShift: ld (hl),a inc hl @@ -549,21 +649,21 @@ NoVertShift: or a jr z,NoLines DrawLines: - push af ; >> 1 - call loaddrawdata - push hl ; >> 2 + psh af ; >> 1 + cal loaddrawdata + psh hl ; >> 2 ld l,(hl) ld h,a - call Line + cal Line inc d inc h - call Line + cal Line inc e inc l - call Line + cal Line dec d dec h - call Line + cal Line pop hl ; << 1 inc hl pop af ; << 0k @@ -576,12 +676,12 @@ NoLines: or a jr z,noboxes drawboxes: - push af - call loaddrawdata - push hl + psh af + cal loaddrawdata + psh hl ld l,(hl) ld h,a - call drawbox + cal drawbox pop hl inc hl pop af @@ -591,16 +691,15 @@ noboxes: ;----------------------------- - push hl ; >> levelp new - call showstats + psh hl ; >> levelp new + cal showstats ld a,(gameCar) and _datafood jr z,nofood - call NewPea - call DrawPea + cal NewPea nofood: ld bc,(worm1+pos) - call DisplayField + cal DisplayField ld hl,$FDE0 ld de,$FDE1 ld (hl),%11111111 @@ -610,7 +709,7 @@ nofood: ld (_curRow),hl set 3,(iy+5) ld hl,txtReady - call _puts + cal _puts res 3,(iy+5) ld a,0 @@ -641,7 +740,7 @@ initfinished: ld b,0 ReadyDelay: halt - djnz ReadyDelay + dnz ReadyDelay ;----------------------------- ;----------- LOOP ------------ @@ -649,7 +748,7 @@ ReadyDelay: GameLoop: ld bc,(worm1+pos) - call DisplayField + cal DisplayField ld a,1 flashtime =$-1 @@ -677,18 +776,18 @@ Delay: jr nz,Delay NoDelay: - call handlethatneatlittleball + cal handlethatneatlittleball ld ix,worm1 ld a,(nrworms) ld b,a handleworms: - push bc - call HandleWorm + psh bc + cal HandleWorm ld bc,worm2-worm1 add ix,bc pop bc - djnz handleworms + dnz handleworms ;----------------------------- ;---------- keys ------------- @@ -698,18 +797,18 @@ HandleKeys: ld a,%10111111 out (1),a in a,(1) - rla + rla ;[MORE]? jr c,NotPaused ld bc,$0103 out (c),b - halt + halt ;pause/off ld b,11 out (c),b NotPaused: - rla + rla ;[EXIT]? jp c,GameLoop - jr Exit ;&& + jr Exit WormDead: ld a,2 @@ -726,12 +825,12 @@ removewormloop: ld b,(hl) inc hl res resbit,h - push hl - call res4pixels + psh hl + cal res4pixels pop hl inc (ix+grow) DoesWormTailEqualsWormHead: - call _cphlde + cal _cphlde jr nz,removewormloop ld a,(gameCar) @@ -761,9 +860,9 @@ thislevel =$+1 inc (ix+died) dec (ix+lives) - push af + psh af ld de,10 - call DecScore + cal DecScore pop af ret nz ;HandleWorm done ld a,(gameCar) @@ -773,20 +872,20 @@ thislevel =$+1 Exit: ld sp,0 ;pop all SpSave = $-2 - call _clrWindow + cal _clrWindow ld hl,txtGO - call _puts + cal _puts ld hl,txtGame CURtxtGame =$-2 - call _puts + cal _puts ld de,0002 ld (_curRow),de - call showLevel + cal showLevel ld de,$0B03 ld (_curRow),de ld hl,txtDied - call _puts - call _puts ;txtScore + cal _puts + cal _puts ;txtScore xor a ld (_curCol),a @@ -794,8 +893,8 @@ CURtxtGame =$-2 nrworms =$-1 ld hl,worm1+died displayWormStats: - push bc - push hl + psh bc + psh hl ld bc,input-died add hl,bc ;+input @@ -811,7 +910,7 @@ hostLinkIndic: ld a,8 ld (_curCol),a ld a,b - call _putc + cal _putc xor a ld (_curCol),a dec hl @@ -819,58 +918,68 @@ NoLinkIndic: inc hl inc hl inc hl ;+name - call _puts + cal _puts pop hl - push hl + psh hl ld a,13 ld (_curCol),a ld a,(hl) ;worm+died - push hl - call showA + psh hl + cal showA pop hl ld a,16 ld (_curCol),a inc hl ;worm+score - call _ldHLind ;ld hl,(hl) - call showHL ;worm+score + cal _ldHLind ;ld hl,(hl) + cal showHL ;worm+score pop hl ld bc,worm2-worm1 add hl,bc pop bc - djnz displayWormStats + dnz displayWormStats ld a,(gameCar) and _datasingl jr z,hiscorecheckdone checkhiscore: - ld de,(worm1+score) -HiScore =$+1 - ld hl,0 - ld a,d - cp h - jr c,NotNewHigh - ld a,e - cp l - jr c,NotNewHigh - ld (HiScore),de - ex de,hl ;disp.new hiscore -NotNewHigh: - ex de,hl ;push + cal loadhiscoreposinahl + cal _Get_Word_ahl ;de=old_hi + psh de + cal _RAM_PAGE_1 ;&& + pop de + ld hl,(worm1+score) + + ld a,h ;New + cp d ;Old + jr c,NotNewHigh ;NewOld + + ld a,e ;old + cp l ;new + jr nc,NotNewHigh ;new=Old + ex de,hl + cal loadhiscoreposinahl + cal _Set_Word_ahl ;de->(ahl) + cal _RAM_PAGE_1 + +NotNewHigh: ;de=current hiscore ld hl,$0807 ld (_curRow),hl ld hl,txthiscore - call _puts + cal _puts ex de,hl ;pop - call showHL + cal showHL hiscorecheckdone: waitkey: halt halt - call GET_KEY + cal GET_KEY cp K_ENTER jp z,DisplayMenu ; cp K_EXIT @@ -890,25 +999,37 @@ ExitNoStats: ld hl,_asapvar rst 20h ;_ABS_MOV10TOOP1 rst 10h ;_FINDSYM - call _swapt_ ;_ex_ahl_bde - ld de,4 + ld hl,4 + xor a add hl,de - adc a,0 - call _SET_ABS_DEST_ADDR + adc a,b ;ahl=bde+4 + cal _SET_ABS_DEST_ADDR xor a - ld hl,start - call _SET_ABS_SRC_ADDR - ld hl,end-start - call _SET_MM_NUM_BYTES - call _mm_ldir - -; xor a -; ld (_asapvar+1),a + ld hl,_asm_exec_ram + cal _SET_ABS_SRC_ADDR + ld hl,end-_asm_exec_ram + cal _SET_MM_NUM_BYTES + cal _mm_ldir + res 4,(iy+9) set 2,(iy+13) jp _clrWindow +loadhiscoreposinahl: + ld a,(Gametype) + dec a + jr nz,externalhiscoresavepos + ld a,0 + ld hl,hipeaworm + ret +externalhiscoresavepos: + ld a,0 +hisaveposa =$-1 + ld hl,0 +hisaveposhl =$-2 + ret + ;----------------------------- ;----------- worm ------------ ;----------------------------- @@ -919,22 +1040,22 @@ sendbyte =$-1 ld b,(ix+left) dec b jr z,receivefirst - call send - call receive + cal send + cal receive ld l,a ret receivefirst: - push af - call receive + psh af + cal receive ld l,a pop af - push hl - call send + psh hl + cal send pop hl ret inkeys: ;use jp not call! - out (1),a + out (1),a ;nop\nop in a,(1) ld b,a and (ix+right) @@ -945,23 +1066,44 @@ inkeys: ;use jp not call! notright: ld a,b and (ix+left) - jr z,donediddelydone + ret z ld a,l sub 8 ld l,a - jr donediddelydone + ret + +chkinput: + ld bc,donediddelydone + psh bc ;ret-dest. +inputcall: + ld a,(ix+input) + or a + jr nz,inkeys + jr inlink + +respawncheck: + cp 1 + ld h,a + jr nz,saverespawncounter +respawndue: + ld l,a + cal inputcall + ld a,h ;previous + cp l ;changed? + ret z +saverespawncounter: + ld (ix+delay),h + ret ;------- handle worm --------- HandleWorm: - dec (ix+delay) - ret nz - inc (ix+delay) + ld a,(ix+delay) + dec a + jr nz,respawncheck + ld l,(ix+heading) - ld a,(ix+input) - or a - jr nz,inkeys - call inlink + jr chkinput donediddelydone: ld a,l ld (sendbyte),a @@ -976,7 +1118,7 @@ donediddelydone: ;-------- move worm ---------- Wormmove: - push bc ; >> pos + psh bc ; >> pos ld a,(hl) add a,a add a,d @@ -1022,7 +1164,7 @@ notmoveY: ;bc=newpos xor 3 ld d,a GotFour: - call chk4pixels + cal chk4pixels rl d jp nc,Drawworm @@ -1035,31 +1177,35 @@ Hitworm: jp z,WormDead ld a,h and _datahunt - call nz,checkhitotherworm + cal nz,checkhitotherworm ld hl,0 PeaY =$-2 PeaX =$-1 + ld a,(sprsize) + inc a + ld d,a ld a,b sub h inc a - cp 4 + cp d ;=(sprsize)+1 jp nc,WormDead ld a,c sub l inc a - cp 4 + cp d jp nc,WormDead - call DrawPea + cal DrawPea ;remove pea ld a,(ix+grow) add a,15 +peagrowth =$-1 ld (ix+grow),a - call NewPea + cal NewPea ld hl,Left dec (hl) - push af + psh af ld de,10 - call IncScore + cal IncScore pop af jr nz,still_alive_not_dead ld a,(gameCar) @@ -1071,8 +1217,6 @@ PeaX =$-1 pop hl ; << call pop hl ; << call pop hl ; << levelp new - cp NUM_LEVELS - jp z,Exit ld a,(gameCar) and _datanextl jp nz,StartLevel @@ -1102,7 +1246,7 @@ nextotherwormbit: nothit1: inc hl res resbit,h - call _cphlde + cal _cphlde jr nz,nextotherwormbit ret @@ -1118,9 +1262,9 @@ nextlaphalf: jr nz,nolap cp (ix+reserv) jr z,nolap - push bc + psh bc ld de,20 - call IncScore + cal IncScore pop bc xor a nolap: @@ -1128,11 +1272,11 @@ nolap: ret otherwormHIT: - push ix + psh ix ld de,10 - call IncScore + cal IncScore ld ix,worm1 - call WormDead + cal WormDead pop ix pop bc still_alive_not_dead: @@ -1142,14 +1286,14 @@ still_alive_not_dead: Drawworm: ld a,(gameCar) and _datahunt - call nz,HuntingTimeScore + cal nz,HuntingTimeScore ld c,(ix+pos) ld b,(ix+pos+1) ld a,(gameCar) and _datalaps - call nz,checkhitlapline + cal nz,checkhitlapline ld l,(ix+head) ld h,(ix+head+1) @@ -1161,7 +1305,7 @@ Drawworm: ld (ix+head),l ld (ix+head+1),h - call set4pixels + cal set4pixels ld a,(ix+grow) dec a @@ -1181,14 +1325,14 @@ removetail: ld (ix+tail+1),h res4pixels: - call ResPixel + cal ResPixel inc b - call ResPixel + cal ResPixel inc c - call ResPixel + cal ResPixel dec b ResPixel: - call FindPixel + cal FindPixel cpl and (hl) ld (hl),a @@ -1205,28 +1349,40 @@ nrballs =$-1 ret z ballpos =$+1 ld bc,$0503 - call res4pixels + cal res4pixels dec c ld e,b ballxmove: inc b ;=%000100 dec=%000101 - call checkballhit + cal checkballhit jr z,ballxdone ld b,e ld hl,ballxmove - call letsmovetheotherway + cal letsmovetheotherway ballxdone: ld e,c ballymove: inc c ;=%001100 dec=%001101 - call checkballhit + cal checkballhit jr z,balldone ld c,e ld hl,ballymove - call letsmovetheotherway + cal letsmovetheotherway balldone: ld (ballpos),bc - jp set4pixels + +set4pixels: ;@(b,c) + cal SetPixel + inc b + cal SetPixel + inc c + cal SetPixel + dec b +SetPixel: ;at bc + cal FindPixel + or (hl) + ld (hl),a + ret letsmovetheotherway: ld a,1 @@ -1236,7 +1392,7 @@ letsmovetheotherway: checkballhit: ld d,0 - call chk4pixels + cal chk4pixels xor a cp d ret @@ -1245,137 +1401,58 @@ checkballhit: ;----------- procs ----------- ;----------------------------- -NewPea: -;random routine - ld hl,0 - ld de,12345 -Seed =$-2 - ld a,7921&255 - ld bc,$1000+(7921/256) -domult16: - add hl,hl - rla - rl c - jr nc,noadd16 - add hl,de -noadd16: - djnz domult16 - inc hl - ld (Seed),hl ;seed=(seed*7921+1)\65536 +randompos: + ld b,a +Random: ;(2..b+2) + ld a,r +Seed =$+1 + add a,0 + ld (Seed),a + and %01111110 + cp b + jr nc,Random + add a,2 + ret +NewPea: ld a,(FieldWidth) - add a,123 - cp h - jr c,NewPea - inc h - inc h - ld a,(FieldHeight) - add a,51 - cp l - jr c,NewPea - inc l - inc l + add a,127-4 + cal randompos + ld h,a + ld a,(FieldHeight) + add a,56-4 + cal randompos + ld l,a ld (PeaY),hl - ld d,2 ;don't draw - push hl - call CheckPea - pop hl - dec d - jr z,NewPea -DrawPea: ;hl=(PeaY) - ld d,0 ;draw CheckPea: - ld b,h ld c,l - call PeaPixel - inc c - call PeaPixel - inc b - call PeaPixel - dec c -PeaPixel: - push de - call FindPixel - pop de - ld e,a ;>> - ld a,d - or a - ld a,e ;<< - jr z,DrawPeaPixel ;d=0:draw - and (hl) ;pixel? - ret z - ld d,1 ;d=1:yes 2:no - ret -DrawPeaPixel: - xor (hl) ;change pixel - ld (hl),a - ret - -;-------- pixelprocs --------- - -set4pixels: - call SetPixel - inc b - call SetPixel - inc c - call SetPixel - dec b -SetPixel: ;at bc - call FindPixel - or (hl) - ld (hl),a - ret - -chk4pixels: ;&& - call CheckPixel - inc b - call CheckPixel - inc c - call CheckPixel - dec b - call CheckPixel - dec c - ret -CheckPixel: ;at bc in d - call FindPixel + ld a,(sprsize) + ld e,a +chkloopy: + ld b,h + ld a,(sprsize) + ld d,a +chkloopx: + psh hl + cal FindPixel and (hl) - ret z + pop hl + jr nz,NewPea ;pixel found + inc b dec d - ret - -;CLEM's FIND_PIXEL (131+? cycles; 28+4 bytes) -; (b,c) to hl:a; destroyes: -) - -FindPixel: - ld h,0 - ld l,c ;hl=y - add hl,hl - add hl,hl - ld a,b ;a=x - rra - add hl,hl - rra - add hl,hl - add hl,hl ;hl=32*y - rra ;a=x/8 - or l - ld l,a - ld a,b - and 7 - cpl - rlca - rlca - rlca - ld (FP_Bit),a - xor a -FP_Bit =$+1 - set 0,a + jr nz,chkloopx + inc c + dec e + jr nz,chkloopy +;all ok; empty space - push de - ld de,ScrBuffer - add hl,de - pop de +DrawPea: ;hl=(PeaY) + ld b,h + ld c,l + ld de,peasprite +spritepos =$-2 + cal PutSprite ;||-ed ret ;----------- score ----------- @@ -1404,11 +1481,11 @@ scorecommon: ld (ix+score),l ld de,0 scorelimit =$-2 - call _cphlde + cal _cphlde jp nc,Exit showstats: - push ix + psh ix ld h,0 ld l,h ld (_penCol),hl @@ -1419,8 +1496,8 @@ showstats: and _datanextl jr nz,showstatsS showstatloop: - push bc - call showstat + psh bc + cal showstat ld de,worm2-worm1 add ix,de ld hl,_penCol @@ -1428,7 +1505,7 @@ showstatloop: add a,10 ld (hl),a pop bc - djnz showstatloop + dnz showstatloop pop ix ret @@ -1439,41 +1516,42 @@ showstat: showscore: ld h,(ix+score+1) ld l,(ix+score) - call _D_HL_DECI + cal _D_HL_DECI jr __vputs showlives: ld a,(ix+lives) add a,'0' __vputmap: - push ix - call _vputmap + psh ix + cal _vputmap pop ix ret showstatsS: ld hl,txtLevel - call __vputs - ld a,(Level) + cal __vputs + ld a,0 +Level =$-1 cp 10 jr c,tilllevel9 ld l,a ld h,0 - call _divHLby10 - push af + cal _divHLby10 + psh af ld a,l add a,'0' - call __vputmap + cal __vputmap pop af tilllevel9: add a,'0' - call __vputmap + cal __vputmap ld a,98 ld (_penCol),a - call showscore + cal showscore ld a,123 ld (_penCol),a - call showlives + cal showlives ld a,(gameCar) and _datafoodl pop ix @@ -1483,52 +1561,53 @@ showleft: ld (_penCol),a ld a,0 Left =$-1 - push af - call _divAby10 + ld l,a + ld h,0 + cal _divHLby10 + psh af + ld a,l add a,'0' - call __vputmap + cal __vputmap pop af add a,'0' - call __vputmap + cal __vputmap + ld hl,txtLeft __vputs: - push ix - call _vputs + psh ix + cal _vputs pop ix ret showLevel: ld hl,txtLevel - call _puts + cal _puts ld a,(Level) showA: - cp 10 - jr c,LevelBelowTen ld l,a ld h,0 - call _divHLby10 - push af + cal _divHLby10 + psh af ld a,l add a,'0' - call _putc + cal _putc pop af -LevelBelowTen: add a,'0' jp _putc showHL: - call _D_HL_DECI + cal _D_HL_DECI jp _puts _D_HL_DECI: ld de,savestr+4 ld b,5 ldhld: - call _divHLby10 + cal _divHLby10 add a,'0' ld (de),a dec de - djnz ldhld + dnz ldhld ld hl,savestr ret savestr: @@ -1554,8 +1633,8 @@ NotMaxYScroll: add hl,hl add hl,hl add hl,hl - push bc ; >> 1 - push de ; >> 2 + psh bc ; >> 1 + psh de ; >> 2 ld de,ScrBuffer add hl,de ld a,b @@ -1568,7 +1647,7 @@ FieldWidth = $-1 jr c,NotMaxXScroll ld a,(FieldWidth) NotMaxXScroll: - push af ; >> 3 + psh af ; >> 3 and %11111000 rra rra @@ -1578,7 +1657,7 @@ NotMaxXScroll: ld de,DispBuffer pop af ; << 2 and %00000111 - push af ; >> 3 + psh af ; >> 3 cp 6 jr c,CopyScreen inc c @@ -1586,13 +1665,13 @@ CopyScreen: add hl,bc ld b,57 CopyScreenLoop: - push bc ; >> 4 - ld bc,16 + psh bc ; >> 4 + ld bc,16 ldir - ld c,16 + ld c,16 add hl,bc pop bc ; << 3 - djnz CopyScreenLoop + dnz CopyScreenLoop pop af ; << 2 ld c,$b7 ;or a Bit0: @@ -1602,155 +1681,155 @@ Bit0: jr AfterShiftDelay Bit1: dec a - jr nz,Bit2 - call ShiftRight1 - jr AfterShiftDelay + jr nz,Bit2 + cal ShiftRight1 + jr AfterShiftDelay Bit2: dec a - jr nz,Bit3 - ld a,2 - call ShiftRight - jr AfterShiftDelay + jr nz,Bit3 + ld a,2 + cal ShiftRight + jr AfterShiftDelay Bit3: dec a - jr nz,Bit4 - call Chunk - call ShiftLeft1 - jr AfterShift + jr nz,Bit4 + cal Chunk + cal ShiftLeft1 + jr AfterShift Bit4: dec a - jr nz,Bit5 - call Chunk - jr AfterShiftDelay + jr nz,Bit5 + cal Chunk + jr AfterShiftDelay Bit5: dec a - jr nz,Bit6 - call Chunk - call ShiftRight1 - jr AfterShift + jr nz,Bit6 + cal Chunk + cal ShiftRight1 + jr AfterShift Bit6: dec a - jr nz,Bit7 - ld a,2 - call ShiftLeft - jr AfterShift + jr nz,Bit7 + ld a,2 + cal ShiftLeft + jr AfterShift Bit7: - call ShiftLeft + cal ShiftLeft AfterShiftDelay: halt AfterShift: - ld hl,DispBuffer - ld de,$fc00+$70 - ld bc,1024-$70 + ld hl,DispBuffer + ld de,$fc00+$70 + ld bc,1024-$70 ldir pop de ; << 1 pop bc ; << 0k ret ShiftRight1: - ld a,1 + ld a,1 ShiftRight: - ld (ShiftRightCounter),a - ld a,c - ld (ShiftRightChunk),a - ld c,16 + ld (ShiftRightCounter),a + ld a,c + ld (ShiftRightChunk),a + ld c,16 add hl,bc - ld b,57 + ld b,57 ShiftRightLoop: - push bc - ld bc,-32 + psh bc + ld bc,-32 add hl,bc - ex de,hl - ld a,(de) + ex de,hl + ld a,(de) ShiftRightChunk: - or a - call c,_SHLACC - ld c,0 + or a + cal c,_SHLACC + ld c,0 ShiftRightCounter = $-1 ShiftRowsLeft: - push hl + psh hl rla - ld b,16 + ld b,16 ShiftRowLeft: dec hl - rl (hl) - djnz ShiftRowLeft + rl (hl) + dnz ShiftRowLeft pop hl dec c - jr nz,ShiftRowsLeft - ld bc,-16 + jr nz,ShiftRowsLeft + ld bc,-16 add hl,bc - ex de,hl + ex de,hl pop bc - djnz ShiftRightLoop + dnz ShiftRightLoop ret ShiftLeft1: - ld a,1 + ld a,1 ShiftLeft: - ld (ShiftLeftCounter),a - ld a,c - ld (ShiftLeftChunk),a + ld (ShiftLeftCounter),a + ld a,c + ld (ShiftLeftChunk),a rla - jr nc,ShiftLeftSameByte + jr nc,ShiftLeftSameByte dec hl ShiftLeftSameByte: - ex de,hl - ld bc,-16 + ex de,hl + ld bc,-16 add hl,bc NewSprite: - ex de,hl - ld b,57 + ex de,hl + ld b,57 ShiftLeftLoop: - push bc ; >> 1 - ld bc,-32 + psh bc ; >> 1 + ld bc,-32 add hl,bc - ex de,hl - ld a,(de) + ex de,hl + ld a,(de) ShiftLeftChunk: - or a - call c,_SHRACC - ld c,0 + or a + cal c,_SHRACC + ld c,0 ShiftLeftCounter = $-1 ShiftRowsRight: - push hl ; >> 2 + psh hl ; >> 2 rra - ld b,16 + ld b,16 ShiftRowRight: - rr (hl) + rr (hl) inc hl - djnz ShiftRowRight + dnz ShiftRowRight pop hl ; << 1 dec c - jr nz,ShiftRowsRight - ld bc,-16 + jr nz,ShiftRowsRight + ld bc,-16 add hl,bc - ex de,hl + ex de,hl pop bc ; << 0k - djnz ShiftLeftLoop + dnz ShiftLeftLoop ret Chunk: - push hl ; >> 1 - push de ; >> 2 + psh hl ; >> 1 + psh de ; >> 2 ld c,16 add hl,bc ld b,57 ChunkScreen: - push bc ; >> 3 + psh bc ; >> 3 ld bc,-32 add hl,bc ex de,hl ld a,(de) - call _SHRACC + cal _SHRACC ld b,16 ChunkRow: dec hl rld - djnz ChunkRow + dnz ChunkRow ex de,hl pop bc ; << 2 - djnz ChunkScreen + dnz ChunkScreen pop de ; << 1 pop hl ; << 0k ld c,$37 ;scf @@ -1758,6 +1837,101 @@ ChunkRow: ;----------- draw ------------ +;--- pixel --- + +chk4pixels: ;&& + cal CheckPixel + inc b + cal CheckPixel + inc c + cal CheckPixel + dec b + cal CheckPixel + dec c + ret +CheckPixel: ;at bc in d + cal FindPixel + and (hl) + ret z + dec d + ret + +;CLEM's FIND_PIXEL (131+? cycles; 28+4 bytes) +;(b,c) to hl:a; "destroyes" ahl + +FindPixel: ;(b,c) to hl:a + ld h,0 + ld l,c ;hl=y + add hl,hl + add hl,hl + ld a,b ;a=x + rra + add hl,hl + rra + add hl,hl + add hl,hl ;hl=32*y + rra ;a=x/8 + or l + ld l,a + ld a,b + and 7 + cpl + rlca + rlca + rlca + ld (FP_Bit),a + xor a +FP_Bit =$+1 + set 0,a + + psh de ;&&& + ld de,ScrBuffer + add hl,de + pop de + ret + +;--- sprite --- + +PutSprite: ;||@(b,c) + ;by SHIAR only ix saved + cal FindPixel +putspr: + ld (beginbit),a + ld a,(sprsize) + ld b,a ;rows +sprloopy: + psh bc ;rows + psh hl + ld a,(de) + ld c,a + inc de + ld a,(sprsize) + ld b,a ;width +beginbit =$+1 + ld a,1 +sprloopx: + sla c ;draw? + jr nc,sprnodraw + psh af + xor (hl) + ld (hl),a + pop af +sprnodraw: + rrca ;next bit + jp nc,nextbitok + inc hl ;next byte +nextbitok: + dnz sprloopx + + pop hl + ld bc,32 ;next line + add hl,bc + pop bc + dnz sprloopy + ret + +;--- line --- + loaddrawdata: ld d,(hl) inc hl @@ -1767,23 +1941,27 @@ loaddrawdata: inc hl ret -Line: ;draw line from de to hl (d - .db "Worm #1",0 -worm2set: .dw $B800,$B800 ;%10111000 +worm1name: .db "Worm #1 ",0 +worm2set: .dw worm2p,worm2p .db 3,0,%00111111,%10000,%1000 ;f1 f2 - .db "Worm #2",0 -worm3set: .dw $F000,$F000 ;$E800=%11101000 ;$D748+$1000+ +worm2name: .db "Worm #2 ",0 +worm3set: .dw worm3p,worm3p .db 3,0,%01011111,%10,%100 ;sto , - .db "Worm #3",0 -worm4set: .dw $A800,$A800 ;$F000=%11110000 +worm3name: .db "Worm #3 ",0 +worm4set: .dw worm4p,worm4p .db 3,0,%01111101,%10,%1 ;enter + - .db "Worm #4",0 -worm1 = $B400 -worm2 = $B42A -worm3 = $B454 -worm4 = $B47E ;-A8 +worm4name: .db "Worm #4 ",0 + +hipeaworm: .dw 0 end: + +;sprsize = 7 +;peasprite: .db %00111000 +; .db %01110100 +; .db %11111010 +; .db %11111110 +; .db %11111110 +; .db %01111100 +; .db %00111000 + +sprsize: .db 5 +peasprite: .db %01110000 + .db %11101000 + .db %11111000 + .db %11111000 + .db %01110000 + ;set: heading = 0 ;level* pos = 2 ;level* @@ -2140,12 +2310,6 @@ left = 19 ;& right = 20 ;& name = 21 ;game -Level =$+1 -DispBuffer =$+2 ;912 bytes - -ScrBuffer = $8100 ;-$A2FF (32x256) mod$800=0 -SinCosTable = $B500 ;size=$100 (4x64) - ;----------------------------- ;----------- end ------------- ;----------------------------- diff --git a/wormlvl.z80 b/wormlvl.z80 index 00c4268..fd1c51a 100644 --- a/wormlvl.z80 +++ b/wormlvl.z80 @@ -1,30 +1,46 @@ -.org $EA00-16 +#include "asm86.h" +#include "ti86asm.inc" -.dw single,peaworm,deathmatch,foodmatch -.dw linkmatch,hunting,race,ctf + .org $EA00-20 -;----------------------------- -;---------- levels ----------- -;----------------------------- + .db 'T',0 ;worm header (Test version) + .dw hiscore-single ;leveldata size -NUM_LEVELS = 10 -single: -peaworm: +levelsdata: + + .dw single ;points to singleplayer levels + .dw 0 ;...peaworm level (0 = no levels/empty level) + .dw deathmatch ;...deathmatch + .dw foodmatch ;...foodmatch + .dw linkmatch ;...linkmatch + .dw hunting ;...hunting + .dw race ;...race + .dw ctf ;...capture the flag - .db 5,4,15,0 ;peas,speed,begin_size,balls - .db 0,2,63 ;start d, y, x - .db 128,57 ;field width (128-255), height (57-255) - .db 0,0 ;no additional lines, boxes - .db 8,4,15,0 +single: + + .db 5,4,15 ;peas in level, delay (0=fastest), pea-growth + .db 15,5 ;begin_size, sprite size (0=use default sprite) + .db %01110000 ;sprite + .db %10001000 + .db %10001000 + .db %10001000 + .db %01110000 + .db 0 ;balls (0 or 1) + .db 0,2,63 ;your start d (0=down,$80=up), y, x + .db 128,57 ;field width (128-255), height (57-255) + .db 0,0 ;no additional lines, boxes + + .db 8,4,15,15,0,0 .db $40,14,2 .db 128,57 - .db 1 - .db 28,28,100,28 ;line coords: x1,y1,x2,y2 + .db 1 ;one line: + .db 28,28,100,28 ;line coords: x1,y1,x2,y2 .db 0 - .db 9,4,15,0 + .db 9,4,15,15,0,0 .db $40,8,2 .db 128,57 .db 2 @@ -32,7 +48,16 @@ peaworm: .db 28,41,100,41 .db 0 - .db 9,3,15,0 + .db 4,3,15,10,0,1 ;...bouncing ball + .dw $20F ;ball begin position + .db 0,2,63 + .db 128,57 + .db 2 + .db 28,14,100,41 + .db 28,41,100,14 + .db 0 + + .db 9,3,15,15,0,0 .db $40,8,2 .db 128,80 .db 2 @@ -40,7 +65,7 @@ peaworm: .db 20,40,108,40 .db 0 - .db 10,3,15,0 + .db 10,3,15,15,0,0 .db 2,8,$40 .db 128,90 .db 3 @@ -49,15 +74,7 @@ peaworm: .db 18,45,110,45 .db 0 - .db 4,3,10,1 \ .dw $20F - .db 0,2,63 - .db 128,57 - .db 2 - .db 28,14,100,41 - .db 28,41,100,14 - .db 0 - - .db 7,3,15,0 + .db 7,3,15,15,0,0 .db 64,4,0 .db 128,86 .db 6 @@ -69,7 +86,7 @@ peaworm: .db 110,20,110,64 .db 0 - .db 9,3,15,0 + .db 9,3,15,15,0,0 .db $40,4,10 .db 128,82 .db 3 @@ -78,7 +95,7 @@ peaworm: .db 0,60,74,60 .db 0 - .db 12,3,15,0 + .db 12,3,15,15,0,0 .db $40,4,0 .db 128,90 .db 6 @@ -90,7 +107,7 @@ peaworm: .db 74,72,110,72 .db 0 - .db 8,2,15,0 + .db 8,2,15,15,0,0 .db $C0,72,48 .db 128,128 .db 13 @@ -109,35 +126,53 @@ peaworm: .db 91,106,115,106 .db 0 + .db 255 ;end marker + +;Code to run when all levels are done: +;Worm waits a second, then screen is cleared and this code will be run. +;End with (stats-screen will then be displayed.) +;If you don't want an ending, simply put . + + ld hl,endtext + call _puts ;display text + jp _getkey ;wait for a key + ;jp ? = call ? + ret +endtext: + .db " Congratulations!!",0 + + deathmatch: - .db 8,5,31,0 - .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63 + .db 8,5,15,31,0,0 + .db $40,28,2 ;begin stats for each player + .db $C0,28,125 ;player 2 moves left + .db $00,2,63 ;player 3 moves down + .db $80,54,63 ;player 4 moves up .db 128,57 .db 0 - .db 4 ;4 boxes - .db 4,19,16,14 ;xsize,ysize,xpos,ypos - .db 4,19,80,14 - .db 4,19,16,34 - .db 4,19,80,34 + .db 4 ;4 boxes: + .db 16,12,48,12 ;x1,y1,x2,ysize(y2-y1) + .db 80,12,112,12 ;... + .db 16,34,48,12 + .db 80,34,112,12 + foodmatch: ctf: - .db 8,5,15,0 + .db 8,5,18,15,0,0 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64 .db 128,57 .db 0,0 + linkmatch: - .db 8,0,15,0 + .db 8,0,15,15,0,0 .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64 .db 228,157 .db 0,0 + hunting: - .db 8,7,17,0 -#ifdef 0 -huntersize = 31 -#endif + .db 8,7,15,17,0,0 .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63 .db 128,57 .db 0 @@ -147,13 +182,19 @@ huntersize = 31 .db 4,19,16,34 .db 4,19,80,34 + race: - .db 8,2,10,0 + .db 8,2,15,10,0,0 .db $40,3,2,$40,6,2, $40,9,2,$40,12,2 .db 128,57 .db 0 .db 1 .db 8,29,32,20 + +hiscore: + .dw 0 ;singleplayer hiscore will be saved here + + .end .end \ No newline at end of file -- 2.30.0