X-Git-Url: http://git.shiar.nl/wormy.git/blobdiff_plain/c011841b4b245eb8f630736a4a2c7fb296cad774..7337dc93183d156ff1a6e1c771bf58b40fd9044a:/wormy.z80 diff --git a/wormy.z80 b/wormy.z80 index 0ff73a0..ad95960 100644 --- a/wormy.z80 +++ b/wormy.z80 @@ -1,5 +1,5 @@ ; Title : Wormy -; Version : 96% (0.96.C21) +; Version : 96% (0.96.C24) ; Release Date : UUHHhhh... soon?!? ; Filename : wormy.86p (5kb) ; Author(s) : Shiar @@ -17,16 +17,16 @@ ; 96% = DONE -; * complete readme -; 1% * misc (pollish, bugs, &&&) -; * mem at worm #4 (still 12 bytes or so.....) -; * fix line proc (+large circles) +; 1% * misc (bugs, &&&, pollish, &&, &) +; * mem at worm #4 (still 12 bytes or so.. or more? or less?) +; * look at init-z in line routine again ; * LINK -; 1% * fix transmit game/level data +; 1% * fix transmit game/level data (?) +; * >Somehow do a lot of testing with 2 calcs< *sigh* ;100% = bugs fixed + levels done -;>110%: sound, startpos +;>110%: sound, startpos (?) ;>120%: coop (DON'T COUNT ON IT) ;----------------------------- @@ -35,6 +35,17 @@ ;----------------------------- ;----------------------------- +;NOTES: +;* Use for LEARNING practises ONLY! +; Don't ever release altered code w/o permission! +;* Code was originally by Scabby (Matthew Shepcar), +; a few lines by Jonah Cohen, +; and everything else by me - Shiar (Mischa Poslawsky). +;* Although I've commented quite some stuff, I can't guarantee +; everybody will understand it. This is probably not the best source +; to learn z80 from. w00t the Shyer Way (tm). +;* Don't scroll down if you get scared easily. + #define buffer ;use display buffer (otherwise write directly to screen) #define readymask ;"greys" out the field before starting a level #define coolzgfx ;nice graphics for game over screen @@ -107,9 +118,9 @@ worm4p = $F000 ;-F3FF (400) %11110O00 leveldata = $F400 ;-FA70 (<=671) ;can you believe i actually left $269 bytes of memory unused?!? -;MEM|8---9---A---B---C---D---E---F---| -; |..[------]||[]|......[-----]|[].| -; | SCREEN 2* 13 PRGM 4LV | +;MEM|8---9---A---B---C---D---E---F---| ;there's something wrong +; |..[------]||[]|......[-----]|[].| ;if you still understand +; | SCREEN 2* 13 PRGM 4LV | ;after looking at this ;--- temporary @@ -127,8 +138,8 @@ DispBuffer = $FC70 .org %1101011101001000 -start: - nop +start: ;turn back NOW! + nop ;and so it begins... jp Start ld bc,42 .org $-1 ;3y3 M 1337! @@ -148,7 +159,7 @@ WormTxt: .db %1010010 jr nz,$+47 dec l - .db " 96% C21",0 + .db " 96% C24",0 WormIcon: .db 8,2 .db %00000000,%00111100 @@ -251,7 +262,7 @@ stringfound: inc ix _searchnext: cal _RAM_PAGE_7 - jr searchnext + jr searchnext loadgametype: psh de @@ -278,8 +289,12 @@ searchcomplete: #else ld ix,templevels-3 #endif -levelselectmenu: + cp (ix+3) ;1st=255 + jp z,ExitNoStats ;->no lvls psh ix ;offset + cp (ix+6) ;2nd=255 + jr z,loadlevel1 ;->1 lvl +levelselectmenu: ;load next page ld a,-2 ld (availevels),a cal _clrWindow @@ -295,7 +310,9 @@ levelselectmenu: ld hl,$0601 ;x=1 ld (_penCol),hl dispnextlevel: - ld a,(ix+3) + ld de,3 + add ix,de + ld a,(ix) ld b,a inc a ;cp 255 jr z,__levselect @@ -308,8 +325,6 @@ displevel: ld (hl),a ;y+6 cp 49 ;bottom of screen jr nc,_levselect - ld de,3 - add ix,de ld hl,availevels inc (hl) ld a,b ;(ix+0) @@ -319,6 +334,11 @@ displevel: cal _vputs jr dispnextlevel +loadlevel1: + pop hl + ld b,-2 + jr loadlevel + readylevelfile: ;selected level at ahl ; ld hl,templevels-3/0 ld a,b @@ -463,11 +483,11 @@ setdeflevels: ;----- build trig tables ----- ;----------------------------- - ld hl,TrigPrecalc - ld de,SinCosTable - psh de - ld bc,65 - ldir + ld hl,TrigPrecalc ;I believe this + ld de,SinCosTable ;is one of the few + psh de ;pieces of original + ld bc,65 ;Peaworm code still + ldir ;left intact.. dec hl ld b,63 MirrorSineWave: @@ -3280,9 +3300,9 @@ savestr: ;----------------------------- -DisplayField: - ld a,c - sub 29 +DisplayField: ;all done by Jonah Cohen iirc. (-scrolling is scary-) + ld a,c ;not the fastest routine outthere, but it does get the job done. + sub 29 ;if something doesn't work, I probably _did_ alter it ;) jr nc,NotMinYScroll xor a NotMinYScroll: @@ -3551,7 +3571,7 @@ FindPixel: ;(b,c) to hl:a FP_Bit =$+1 set 0,a - psh de ;&&& + psh de ;&&& C`MON! THIS IS UGLY! *hit myself* ld de,ScrBuffer add hl,de pop de @@ -3589,6 +3609,12 @@ drawsmtn: ; dec a ;4 = circle ; jp z,drawcircle +;IMHO, one weery nice routine. Oh lemme be proud just *once*. +;Not perfect since it uses a screwy lineroutine to draw stuff +;but, just _look_ at it. Ain't it grand? Z80 at its best. +;Nice comments, also. So here we go: Shiar's Circle Routine: +;(using the Bresenham method) + drawcircle: ;(d,e),h ;de=x,y; h=z ld c,h ;c=yy=z ld a,h @@ -3652,7 +3678,7 @@ circledraw: ;destr:de ld b,c ld c,a ;ex b,c pop hl - ret + ret ;thats it drawbox: ;(d,e)-(h,l) ld b,l ;Delta-y @@ -3676,8 +3702,10 @@ drawfatline: dec h ; jp drawline -;LINE (d,e)-(h,l) -;destroyes a +;A lot like Scabby's line routine in Wonderworm (dunno whether he wrote it +;himself.) I did make a few optimizations and commented the thing. +;A nice routine (also Bresenham), but for Wormy not perfect since really +;large lines (>128 pixels in length or something) won't be flawless. drawline: ;(d,e)-(h,l) psh bc ;destr: a