From f28fc4783bc8d8a2038e5fa4c10406ba11a79290 Mon Sep 17 00:00:00 2001 From: Jonah Cohen Date: Sat, 20 Nov 1999 15:04:52 +0100 Subject: [PATCH] jonah: ambidirectional scrolling, 9 levels --- m.bat | 14 -- worm.asm | 438 +++++++++++++++++++++++++++++++++++++------------------ worm.txt | 33 ----- 3 files changed, 296 insertions(+), 189 deletions(-) delete mode 100644 m.bat delete mode 100644 worm.txt diff --git a/m.bat b/m.bat deleted file mode 100644 index 4205220..0000000 --- a/m.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -copy *.asm ..\asm86 -cd..\asm86 -tasm -80 -b worm.asm worm -if errorlevel 1 goto asmerr -prgm86 worm -copy worm.86p ..\worm -cd..\ti8xemu2 -copy blank.86 default.86 -addvar86 ..\worm\worm.86p -copy default.86 worm.bin -ti8xemu 86 /grey /speed 10 -:asmerr -cd..\worm diff --git a/worm.asm b/worm.asm index 0abad60..66d3549 100644 --- a/worm.asm +++ b/worm.asm @@ -1,42 +1,23 @@ - ; -WonderWorm--v0.9- ; by Matthew Shepcar ; 30th December 1998 -#include asm86.h -#include ti86asm.inc -#include ti86abs.inc +; modified by Jonah Cohen 11-14-99 + +#include "TI86.inc" .org _asm_exec_ram - + nop jp Start .dw 0,WormMsg Start: - - call _runindicoff + ld (SpSave),sp + call _runIndicOff call _clrLCD call BuildTrigTables - ld hl,0FC00h - ld de,GreyBuf - ld bc,400h - ldir - - ld hl,IHandler - ld bc,IHandlerEnd-IHandler - ld de,0BCBCh - ldir - ld hl,0BD00h - ld (hl),d - ld de,0BD01h - ld a,d - ld bc,256 - ldir - ld i,a - im 2 - ld a,r ld (Seed),a @@ -139,11 +120,6 @@ DrawLines: NoLines: push hl - ld hl,ScrBuffer - ld de,ScrBuffer+BufSize - ld bc,BufSize - ldir - ld hl,0 ld (_penCol),hl ld hl,LivesMsg @@ -189,7 +165,6 @@ ReadyDelay: ld de,0 GameLoop: - ld a,c sub 29 jr nc,NotMinScroll @@ -202,7 +177,7 @@ FieldHeight =$-1 NotMaxScroll: call DisplayField - ld a,5 + ld a,9 Speed =$-1 Delay: halt @@ -227,10 +202,11 @@ Heading =$-2 rra rra jr c,NotRight + push af ld a,l add a,8 ld l,a - inc a + pop af NotRight: rra jr c,NotLeft @@ -306,7 +282,7 @@ PeaX =$-1 sub l inc a cp 4 - jr nc,WormDead + jp nc,WormDead push bc call DrawPea ld a,0 @@ -322,12 +298,15 @@ GrowAmt =$-1 dec (hl) jr nz,NotNextLevel ld hl,Level + ld a,(hl) inc (hl) pop bc pop de pop hl pop de - jp StartLevel + cp NUM_LEVELS + jp nz,StartLevel + jr Exit NotNextLevel: ld a,(hl) @@ -377,19 +356,18 @@ GrowWorm: in a,(1) rla jr c,NotPaused - call _getky -WaitUnpause: + ld bc,$0103 + out (c),b halt - call _getky - or a - jr z,WaitUnpause - ld a,128 + ld b,11 + out (c),b NotPaused: pop bc pop de rla jp c,GameLoop - push hl + jr Exit +; push hl WormDead: pop de pop hl @@ -403,6 +381,7 @@ WormDead: dec (hl) pop hl jp nz,NextLife +Exit: #if 0 ld a,(Eaten) @@ -410,7 +389,7 @@ WormDead: cp (hl) jr c,NotNewHigh ld (hl),a - ld hl,Varname-1 + ld hl,_asapvar rst 20h rst 10h call 460Bh @@ -422,15 +401,11 @@ WormDead: ld (hl),a NotNewHigh: #endif + ld sp,0 +SpSave = $-2 + jp _clrWindow - im 1 - ld a,03Ch - out (0),a - call _clrScrn - call _homeup - jp _getky - -NewPea: +NewPea: ;------------------------------procs call Random ld a,h and 7Fh @@ -502,66 +477,29 @@ noadd16: ld a,h ret -ResPixel: +ResPixel: ;at bc call FindPixel cpl - ld d,a and (hl) - ld (hl),a - ld a,d - ld de,BufSize - add hl,de - and (hl) - ld (hl),a + ld (hl),a ret -SetPixel: - push bc - push af - push af +SetPixel: ;at bc call FindPixel - pop de - ld e,a - rr d - jr c,SetGrey1 - cpl - and (hl) - ld (hl),a -SetGrey1: - or (hl) - ld (hl),a - ld bc,BufSize - add hl,bc - ld a,e - rr d - jr c,SetGrey2 - cpl - and (hl) - ld (hl),a -SetGrey2: - or (hl) - ld (hl),a - pop af - pop bc + or (hl) + ld (hl),a ret -CheckPixel: +CheckPixel: ;at bc in d push de call FindPixel - push af and (hl) - ld de,BufSize - add hl,de - ld e,a - pop af - and (hl) - or e pop de ret z dec d ret -FindPixel: +FindPixel: ;bc to ahl + de gone push bc ld a,b and 7 @@ -616,7 +554,7 @@ NotZeroDigit: PutNum: ld l,a ld h,0 - call UNPACK_HL + call _divHLby10 push af ld a,l call PutDigit @@ -628,45 +566,19 @@ PutDigit: offsets_table: .db 128,64,32,16,8,4,2,1 -IHandler: - exx - ex af,af' - in a,(3) - bit 1,a - jr z,notvbl - ld hl,GreyCounter - inc (hl) - ld a,(hl) - cp 3 - ld a,3Ch - jr nz,notpage1 - ld (hl),0 - ld a,(GreyBuf/256)-0C0h -notpage1: - out (0),a -notvbl: - jp 3Ah -IHandlerEnd: -GreyCounter .db 0 - DisplayField: - ld l,a - ld h,0 + ld l,a + ld h,0 add hl,hl add hl,hl add hl,hl add hl,hl push bc push de - ld de,ScrBuffer - add hl,de - ld de,0FC70h - ld bc,00390h - ldir - ld de,BufSize-390h + ld de,ScrBuffer add hl,de - ld de,GreyBuf+70h - ld bc,00390h + ld de,$FC00+$70 + ld bc,$0390 ldir pop de pop bc @@ -678,7 +590,7 @@ DispMsg: ld l,4 ld (_curRow),hl ld hl,0FDE0h - ld de,0FDE1h + ld de,0FDE1h ld (hl),-1 ld bc,0BFh ldir @@ -687,27 +599,94 @@ DispMsg: jp _puts +NUM_LEVELS = 9 + Levels: - .db 5,7 ;5 peas, speed 7 + .db 5,9 ;5 peas, speed 7 .db 64,4,0 ;x,y,d .db 57 ;field height .db 0 ;no additional lines - .db 8,6 - .db 4,14,40h + .db 8,9 + .db 4,14,$40 .db 57 .db 1 .db 28,28,100,28 - .db 99,5 - .db 4,14,40h - .db 100 + .db 9,8 + .db 4,8,$40 + .db 57 .db 2 - .db 28,28,28,72 - .db 100,28,100,72 + .db 28,14,100,14 + .db 28,41,100,41 -#include trigtab.asm -#include line.asm + .db 9,8 + .db 4,8,$40 + .db 80 + .db 2 + .db 64,14,64,66 + .db 20,40,108,40 + + .db 10,7 + .db 4,8,$40 + .db 90 + .db 3 + .db 18,20,18,70 + .db 110,20,110,70 + .db 18,45,110,45 + + .db 7,7 + .db 64,4,0 + .db 86 + .db 6 + .db 34,13,56,35 + .db 34,71,56,49 + .db 72,35,94,13 + .db 72,49,94,71 + .db 16,20,16,64 + .db 110,20,110,64 + + .db 9,7 + .db 4,10,$40 + .db 82 + .db 3 + .db 0,20,74,20 + .db 54,40,128,40 + .db 0,60,74,60 + + .db 12,7 + .db 64,4,0 + .db 90 + .db 6 + .db 20,16,54,16 + .db 74,16,110,16 + .db 20,16,20,72 + .db 110,16,110,72 + .db 20,72,54,72 + .db 74,72,110,72 + + .db 8,7 + .db 72,52,$c0 + .db 128 + .db 13 + .db 34,56,56,34 + .db 34,72,56,94 + .db 72,34,94,56 + .db 72,94,94,72 + .db 46,64,80,64 + .db 22,11,22,33 + .db 11,22,33,22 + .db 22,95,22,117 + .db 11,106,33,106 + .db 103,11,103,33 + .db 91,22,115,22 + .db 103,95,103,117 + .db 91,106,115,106 + + + +#include "trigtab.asm" +#include "line.asm" WormMsg .db "Wonderworm!",0 LevelMsg .db "Level ",0 @@ -715,7 +694,6 @@ LivesMsg .db "Lives: ",0 ScoreMsg .db "Score: ",0 LeftMsg .db "Food: ",0 HiScore .db 0 -Varname .db 4,"worm" Left =$ Lives =$+1 @@ -723,8 +701,184 @@ Level =$+2 Score =$+3 SinCosTable =09E00h -ScrBuffer =8200h -BufSize =0A00h -GreyBuf =0F400h +ScrBuffer =8200h ;size $1400 (at least) + +.end +eft: + dec hl + rl (hl) + djnz ShiftRowLeft + pop hl + dec c + jr nz,ShiftRowsLeft + ld bc,-16 + add hl,bc + ex de,hl + pop bc + djnz ShiftLeftLoop + ld a,(ShiftBitsLeft) + jr NoShift +ShiftRight: + dec hl + ex de,hl + ld c,16 + sbc hl,bc + ex de,hl + ld b,57 + cpl + add a,9 + ld (ShiftBitsRight),a +ShiftRightLoop: + push bc + ld bc,-32 + add hl,bc + ex de,hl + ld a,(de) + ld c,0 +ShiftBitsRight = $-1 +ShiftRowsRight: + push hl + rra + ld b,16 +ShiftRowRight: + rr (hl) + inc hl + djnz ShiftRowRight + pop hl + dec c + jr nz,ShiftRowsRight + ld bc,-16 + add hl,bc + ex de,hl + pop bc + djnz ShiftRightLoop + ld a,(ShiftBitsRight) +NoShift: + ld hl,DispBuffer + ld de,$fc00+$70 + ld bc,1024-$70 + ldir + cpl + add a,8 + jr z,NoShiftDelay +ShiftDelay: + ld bc,$0005 +ShiftDelayLoop = $-1 + djnz ShiftDelayLoop + dec c + jr nz,ShiftDelayLoop + dec a + jr nz,ShiftDelay +NoShiftDelay: + pop de + pop bc + ret + + +NUM_LEVELS = 9 + +Levels: + .db 5,2 ;5 peas, speed 9 + .db 64,4,0 ;x,y,d + .db 0,0 ;field width, height + .db 0 ;no additional lines + + .db 8,2 + .db 4,14,$40 + .db 128,57 + .db 1 + .db 28,28,100,28 + + .db 9,2 + .db 4,8,$40 + .db 128,57 + .db 2 + .db 28,14,100,14 + .db 28,41,100,41 + + .db 9,1 + .db 4,8,$40 + .db 128,80 + .db 2 + .db 64,14,64,66 + .db 20,40,108,40 + + .db 10,1 + .db 4,8,$40 + .db 128,90 + .db 3 + .db 18,20,18,70 + .db 110,20,110,70 + .db 18,45,110,45 + + .db 7,1 + .db 64,4,0 + .db 128,86 + .db 6 + .db 34,13,56,35 + .db 34,71,56,49 + .db 72,35,94,13 + .db 72,49,94,71 + .db 16,20,16,64 + .db 110,20,110,64 + + .db 9,0 + .db 4,10,$40 + .db 128,82 + .db 3 + .db 0,20,74,20 + .db 54,40,128,40 + .db 0,60,74,60 + + .db 12,0 + .db 64,4,0 + .db 128,90 + .db 6 + .db 20,16,54,16 + .db 74,16,110,16 + .db 20,16,20,72 + .db 110,16,110,72 + .db 20,72,54,72 + .db 74,72,110,72 + + .db 8,0 + .db 72,52,$c0 + .db 128,128 + .db 13 + .db 34,56,56,34 + .db 34,72,56,94 + .db 72,34,94,56 + .db 72,94,94,72 + .db 46,64,80,64 + .db 22,11,22,33 + .db 11,22,33,22 + .db 22,95,22,117 + .db 11,106,33,106 + .db 103,11,103,33 + .db 91,22,115,22 + .db 103,95,103,117 + .db 91,106,115,106 + + + +#include "trigtab.asm" +#include "line.asm" + +WormMsg .db "Wonderworm!",0 +LevelMsg .db "Level ",0 +LivesMsg .db "Lives: ",0 +ScoreMsg .db "Score: ",0 +LeftMsg .db "Food: ",0 +HiScore .db 0 + +Left =$ +Lives =$+1 +Level =$+2 +Score =$+3 +DispBuffer =$+5 + +ScrBuffer =$8200 ;32x256 bytes +SinCosTable =$a200 +WormPos = $b000 .end diff --git a/worm.txt b/worm.txt deleted file mode 100644 index d632777..0000000 --- a/worm.txt +++ /dev/null @@ -1,33 +0,0 @@ - - - - P E A W O R M - - version 0.9 - 28th December 1998 - - - (C) Matthew Shepcar - - - - Introduction -------------------------------------------------------- - - This is just a quick prog I whipped up this morning in a fit of - boredom. You must guide a worm to peas which appear on the screen - which cause the worm to grow longer each time. The idea is to eat - as many peas as you can before you crash into the edge of the screen - or your own tail. - - Controls ------------------------------------------------------------ - - Arrows - Turn worm left or right - MORE - Pause game - EXIT - Exit game - - Contact Information ------------------------------------------------- - - Home Email: M@Shepcar.force9.co.uk - University Email: pmysmps@nott.ac.uk - ICQ: UIN 1553355 \ I'm online late - IRC: scabby on EFNET's #ti & #ti-files / at night (GMT) -- 2.30.0