version 0.98 pre: clipped sprites, more enemy-specific properties
authorMischa Poslawsky <nemesis@shiar.org>
Mon, 26 Jun 2000 15:02:42 +0000 (17:02 +0200)
committerMischa Poslawsky <nemesis@shiar.org>
Wed, 18 Mar 2009 03:10:45 +0000 (04:10 +0100)
+ random enemy is chosen from any number of enemies per level
* time to first enemy fire defined per enemy, not per level
+ CLIPPED sprites!! no more in/out popping enemies! wow...
* bullets/enemies removed when _entirely_ off screen
# enemies would sometimes be hit by bullets going right below them
# size of the second bullet was too big (invisible hit)
* the frequency an enemy fires bullets is defined per enemy
+ wide clipped sprites implemented (width 1-16 pixels)
# bosses first move left until x=100, otherwise they'd be off-screen

nemesis.z80

index 9e8bcfa2db38c15a008e1995caa514bee757147d..6d958b217cfeb0613c871311c52e1c1ac72eca92 100644 (file)
@@ -57,7 +57,6 @@ nextevent     = eventleft+1           ; +6    ;time to next event
 level_enemy    = nextevent+1           ; +7    ;enemy type
 level_info     = level_enemy+1         ; +8    ;info (see below)
 level_move     = level_info+1          ; +9    ;=
-level_fire     = level_move+1          ;+10
                                        ;       ;--------OBJECTS
 spacespace     = storepos+19           ;+19
 groundinfo     = spacespace+1          ;+20
@@ -81,7 +80,7 @@ your_prevpos  = your_locpos+1         ;+88    ;save previous positions (32d)
 ;^-----------------------------------<1        ;-120=$78
 
 enemies                = storepos2             ;  +0   ;info about each enemy
-enemysize      = 7                             ;infobytes per enemy
+enemysize      = 8                             ;infobytes per enemy
 nrenemies      = 16                            ;max. nr of enemies
 
 ybullets       = enemies+(nrenemies*enemysize) ;60 bytes = 20(state,damg,x,y)
@@ -92,10 +91,10 @@ lvlenemies  = ebullets+(nrebuls*3)
 
 ;^-----------------------------------<2        ;-141=$8D
 ;level_info:
-;      [0000:damage 0:directfire 0:ground 0:ceiling 0:diagfire]
+;      [0000:damage 0:diagfire 0:ground 0:ceiling 0:-]
 ;enemies:
 ;      [HP64] [000000:HP left 00:(00=no enemy 01=exploding 10=normal 11=moving)]
-;      [ship type or explosion frame] [x] [y] [move] [fire]
+;      [ship type or explosion frame] [x] [y] [movecounter] [firecounter] [firefreq]
 
 ;---------------------- introduction ----------------------------------------
 
@@ -797,9 +796,7 @@ not_time:
 inv_flicker:
        ld  ix,spr_ship01i      ;display invulnerable ship
 disp_ship:
-       psh de                  ;save your position for multiples
-       cal putsprite           ;display your ship
-       pop de
+       cal safeputsprite       ;display your ship; save de
 
 ;----multiples----
 
@@ -1126,10 +1123,12 @@ curweapdamage =$-1
 ;------------------------ handle bullets ------------------------------------
 
 bullet_left:
-       ld  a,124
-       sub b
+       ld  c,a                 ;c=type
+       and %1111
+       ld  b,a                 ;b=0000type
 
-       cp  (hl)                ;off screen? (x>128-5)
+       ld  a,128
+       cp  (hl)                ;off screen? (x>=128)
        jr  c,remove_bullet
        ld  a,(hl)              ;a = X
        add a,b                 ;move b to the right
@@ -1190,10 +1189,6 @@ scan_bullets:
 
        or  a
        jp  z,next_ybullet      ;bulletType=0 >> no bullet
-
-       ld  c,a                 ;c=type
-       and %1111
-       ld  b,a                 ;b=0000type
        cal bullet_left         ;move bullet left
 
 display_bullet:
@@ -1218,9 +1213,7 @@ display_bullet:
        ld  a,(ix+1)            ;bullet y-size...
        ld  (bulletysize),a     ;...too
 
-       psh de                  ;but will be altered so save again
-       cal putsprite           ;display bullet
-       pop de                  ;position (used for check_bullethits)
+       cal safeputsprite       ;display bullet; DE used for check_bullethits
 
        cal check_bullethits
 
@@ -1275,6 +1268,7 @@ bulletysize =$-1
        jp  p,nohit             ;nope, missed it
        ld  a,b                 ;pop a
        add a,(ix+1)            ;add enemy height
+       dec a                   ;minus one
        jp  m,nohit             ;missed after all
 
                                ;---bullet hits enemy (auch-time!)---
@@ -1350,9 +1344,7 @@ Handle_torp:
        ld  e,a
 
        ld  ix,spr_bullett1
-       psh de
-       cal putsprite           ;display torpedo
-       pop de
+       cal safeputsprite       ;display torpedo
        jp  check_bullethits    ;check for hits with enemies
 
 remove_torp:
@@ -1398,9 +1390,6 @@ place_boss:
        dec hl                  ;points to level\boss\movement
        ld  a,(hl)              ;load
        ld  (level_move),a      ;set boss movement
-       dec hl                  ;@level\boss\firefreq
-       ld  a,(hl)              ;load in a
-       ld  (level_fire),a      ;set firefrequency
        jp  do_event            ;+ret
 
 standby_event:
@@ -1430,7 +1419,7 @@ chk_noenemy:
        jr  nz,chk_noenemy      ;jump if enemy present (non-0)
        ex  de,hl               ;de=hl=usable enemy
 
-place_enemy:
+place_enemy:                   ;de = enemy+1
        ld  bc,0                ;0..0
 nrlvlenemies =$-1              ;=nr of enemies minus 1
        cal Random              ;random enemy b..b+c = 0..nrenemies-1
@@ -1439,34 +1428,19 @@ nrlvlenemies =$-1               ;=nr of enemies minus 1
        ld  hl,lvlenemies
        add hl,bc               ;go to a random enemy
        ld  a,(hl)              ;load enemy nr of this mysterious random enemy
-       ld  hl,XLenemyinfos-4   ;enemy "0" specs (1 before enemy #1)
-       add a,a                 ;a=type*2
-       add a,a                 ;a=type*4
-       ld  c,a                 ;b=0; c=bc=type
-       add hl,bc               ;hl = enemy specs
-       ld  a,(hl)              ;load hitpoints+occ of this enemy class
-       ld  (de),a              ;save occ
+       cal findenemyspecs      ;hl = enemy #a specs
 
-       inc hl                  ;next enemyInfo byte
-       dec de                  ;goto hp
-       ld  a,(hl)              ;load hp64
-       ld  (de),a              ;save hp64
-       inc de                  ;next byte (or previous): occ again
+       dec de                  ;goto hp64 (before occ)
+       ldi                     ;set hp64
+       ldi                     ;set hitpoints+occ of enemy class
+       ldi                     ;set enemy class (nr)
 
-       inc hl                  ;next enemyInfo byte
-       inc de                  ;next byte of current enemy
-       ld  a,(hl)              ;load enemy class (nr)
-       ld  (de),a              ;save enemy type
-
-       inc de                  ;set x-pos
-       cal find_sprite
        ld  a,128               ;appear at right edge of screen
-       sub (ix)                ;minus the width of this enemy (not offscreen)
        ld  (de),a              ;= x-position (save)
+       inc de                  ;@y-pos
 
-       inc de                  ;set y-pos
-       inc hl                  ;where to place??
        ld  a,(hl)              ;load placeInfo
+       inc hl
        dec a                   ;is it 1?
        jr  z,random_enemy      ;yes: create random value <51 in a
        dec a                   ;is it 2?
@@ -1484,17 +1458,14 @@ random_enemy:
        cal Random
 ypos_OK:                       ;random value successfully created
        ld  (de),a              ;save y-position
+       inc de                  ;@movecounter
 
-       inc de                  ;set move
        ld  a,1                 ;movecounter = 1
-       ld  (de),a              ;&&&(hl),1 better?
+       ld  (de),a              ;set
+       inc de                  ;@firecounter
 
-       inc de                  ;set fire
-       ld  a,(level_info)
-       and %00000001           ;bit meaning directfire
-       jr  nz,ffireOK          ;(a=time-to-fire) = 1 frame (fires directly)
-       ld  a,(level_fire)      ;set ttf to normal nr of frames
-ffireOK:ld  (de),a             ;save fire
+       ldi                     ;set time-to-1st-fire
+       ldi                     ;set firefreq
        ret                     ;return
 
 ;--------------------------- enemy fires ------------------------------------
@@ -1570,15 +1541,15 @@ enemy_bullet:
        ld  b,a                 ;save type&%1111
        inc hl                  ;bullet x
        ld  a,(hl)              ;check if it has reached the left side of scrn
-       and %11111110           ;it is <2 (0 or 1)?
-       jr  z,remove_ebullet    ;yes, remove bullet
+       bit 7,a                 ;x<0?
+       jr  nz,remove_ebullet   ;yes, remove bullet
        dec (hl)                ;move one left
        dec (hl)                ;and another one
        ld  d,(hl)              ;d=x
        inc hl                  ;@y
 
        ld  a,b                 ;restore type
-       cp %1100                ;is it a normal bullet? (cp = faster than bit)
+       cp  %1100               ;is it a normal bullet? (cp = faster than bit)
        jr  z,ebullet_common    ;type %1100: normal bullet
        and %111                ;isolate important bits
        jr  z,ebullet_down      ;type %1000: moving down
@@ -1672,10 +1643,12 @@ normal_enemy:                   ;occ "normal" 2 or "moving" 3
        inc hl
        ld  a,(hl)              ;x
        dec a                   ;move left
-       jr  c,remove_enemy      ;off screen
-       jr  z,remove_enemy      ;"
        ld  d,a
-
+       bit 7,d                 ;x<0
+       jr  z,enemy_onscreen
+       cp  -7                  ;x<=-8
+       jr  c,remove_enemy      ;=off screen
+enemy_onscreen:
        inc hl
        ld  e,(hl)              ;y
        ld  a,b                 ;moving state was stored in b earlier
@@ -1696,17 +1669,18 @@ normal_enemy:                   ;occ "normal" 2 or "moving" 3
        jr  firing_done         ;continue
 
 check_enemyfire:
-       inc hl                  ;go to <y>
-       inc hl                  ;go to <move>
-       inc hl                  ;go to <fire>
+       inc hl                  ;@y
+       inc hl                  ;@movecount
+       inc hl                  ;@firecount
        dec (hl)                ;decrease counter till next blast
        ld  a,(hl)              ;&&&doesn't seem efficient to me
        or  a                   ;has it reached zero?
        jr  nz,firing_done      ;finished if not
 
-       ld  a,(level_fire)      ;re-set counter for next blast
-       ld  (hl),a              ;save time to fire
-       inc hl                  ;next byte = bullettype &&&
+       inc hl                  ;@firefreq
+       ld  a,(hl)
+       dec hl
+       ld  (hl),a              ;reset counter for next blast
        psh de                  ;save registers for firing-use
        cal Enemy_fires         ;fires bullet
        pop de                  ;restore (destroyed by Enemy_fires)
@@ -1776,7 +1750,10 @@ lure_left:
        ret
 
 movetype_stoplure:
-       inc d
+       ld  a,100
+       cp  d
+       jr  c,movetype_slowlure
+       inc d                   ;x<100: full stop
        jr  movetype_slowlure
 
 movetype_slowlure:
@@ -1991,7 +1968,7 @@ dostory:
        inc a                           ;set z-flag if a = $ff
        jr  nz,dostory                  ;otherwise loop
 
-       ld  bc,5                        ;story ends
+       ld  bc,3+1                      ;story ends
        add hl,bc                       ;set hl to beginning of the level
        ld  (levelp),hl                 ;set the level-pointer
        ret                             ;and return
@@ -2292,6 +2269,15 @@ releasekeys:
        cal GET_KEY             ;clear buffer
        ret
 
+findenemyspecs:                        ;enemy #a specs in (hl); in:b=0; out:ac=?
+       ld  hl,enemyspecs-8     ;enemy "0" specs (1 before enemy #1)
+       add a,a                 ;a=type*2
+       add a,a                 ;a=type*4
+       add a,a                 ;a=type*8
+       ld  c,a                 ;b=0; c=bc=type*8
+       add hl,bc               ;hl = enemy specs
+       ret
+
 ;--------------------------- game over / new game / death -------------------
 chartable:
        .db 0,".<>!",0,0,0,0  ;down,L,R,up
@@ -2514,10 +2500,10 @@ addok:
        cal scoreInc            ;update score
 
        ld  hl,(levelp)         ;level pointer
-       ld  c,0                 ;advance one level
-       ld  b,(hl)
+       ld  b,0                 ;advance one level
+       ld  c,(hl)
        add hl,bc               ;passed the enemies
-       ld  b,7+32+2
+       ld  c,1+6+32+4
        add hl,bc               ;update to point to next level
        ld  (levelp),hl         ;save
 
@@ -2548,9 +2534,6 @@ samelevel:
        inc hl
        ld  a,(hl)              ;movement of enemies in this level
        ld  (level_move),a      ;do it
-       inc hl
-       ld  a,(hl)              ;how frequent the enemies fire a bullet
-       ld  (level_fire),a      ;consider it done
 
        inc hl
        ld  de,spacespace
@@ -2661,134 +2644,149 @@ loadweapon:
         ld  (weapdaminc),a     ;damage increase
        ret
 
+;----------------------------------------------------------------------------
 ;--------------------------- putsprite --------------------------------------
-;--------------------------- de =(X,Y) --------------------------------------
+;----------------------------------------------------------------------------
+;in:  de=(x,y); ix=sprite
+;out: ix=behind sprite; hl:a=right below sprite; b=0; d=width; ce=?
 
-offsets_table:
-       .db $80,$40,$20,$10,8,4,2,1
 putsprite:
-       ld  a,d                 ;a = X
-       and %00000111           ;a = X mod 8 = bit nr. to mask
-       ld  hl,offsets_table    ;pixel mask table
-       ld  c,a                 ;bit nr.
-       ld  b,0                 ;word
-       add hl,bc               ;add to table
-       ld  a,(hl)              ;a = pixel mask
-       ld  (_smc1+1),a         ;alter pixel mask
-
-       ld  hl,GRAPH_MEM        ;save-location
-       ld  a,e                 ;y-coord
-       add a,a                 ;y*2
-       add a,a                 ;y*4
-       add a,a                 ;y*8
-       rl  b                   ;b (=0) =b*2+overflow (if y>32 then bc=bc+256)
-       add a,a                 ;y*16 (width of screen)
-       rl  b                   ;b=b*2+overflow (if y>64 then bc=bc+512)
-       srl d                   ;d/2
-       srl d                   ;d/4
-       srl d                   ;d/8 (8 bits in byte) ** c is set when overflow
-       add a,d                 ;a = (Y*16+X/8) mod 256
-       jr  nc,_n1              ;jump if no carry = no overflow = a<=255
-       inc b                   ;a>255 so increase bc by 256
-_n1:   ld  c,a                 ;c = (Y*16+X/8) mod 256
-       add hl,bc               ;bc = Y*16+X/8
-
-       ld  d,(ix)
-       ld  b,(ix+1)
-_oloop:        psh bc                  ;Save # of rows
-       psh hl                  ;Save screen address
-       ld  b,d                 ;Load width
-       ld  c,(ix+2)            ;Load one line of image
-       inc ix
-_smc1: ld  a,1                 ;Load pixel mask
-_iloop:        sla c                   ;Test leftmost pixel
-       jr  nc,_noplot          ;See if a plot is needed
-       ld  e,a                 ;OR pixel with screen
+       ld  c,(ix)              ;save width
+_putsprite:                    ;putsprite with custom width
+       ld  a,d                 ;a=X
+       bit 7,d                 ;check sign bit of X
+       jr  z,CSpositive        ;X>=0
+
+       neg                     ;a=|X|
+       cp  (ix)                ;off screen?
+       ret nc                  ;X<=-width: don't draw at all
+       ld  b,a                 ;b=|X|mod 8=1..7=bits to draw
+       ld  a,%11111111         ;all bits set (draw everything)
+CSclipleft:
+       srl a                   ;remove first bit in a for each b
+       dnz CSclipleft          ;b=1: a=%01111111
+                               ;b=2: a=%00111111
+                               ;b=3: a=%00011111
+                               ;b=4: a=%00001111
+                               ;b=5: a=%00000111
+                               ;b=6: a=%00000011
+                               ;b=7: a=%00000001
+       res 7,d                 ;subtract 128, if X was -1 (255) it is now 127
+       dec e                   ;Y--
+       jr  CSdisplay           ;done clipping
+
+CSpositive:
+       sub 129-8               ;minus (screen width - byte width)
+       ld  b,a
+       ld  a,%11111111         ;clipmask
+       jr  c,CSdisplay         ;x+width<128 then entire sprite is on screen
+       inc b                   ;b = number of pixels off screen
+CSclipright:
+       add a,a                 ;remove last bit in a for each b
+       dnz CSclipright         ;b=1: a=%11111110
+                               ;b=2: a=%11111100
+                               ;b=3: a=%11111000
+                               ;b=4: a=%11110000
+                               ;b=5: a=%11100000
+                               ;b=6: a=%11000000
+                               ;b=7: a=%10000000
+                               ;b>7: a=%00000000 = off screen
+
+CSdisplay:                     ;display the sprite ix at (d,e) masked
+       ld  (CSclipmask),a      ;set mask
+       cal findpixel           ;convert de to screen location hl:a
+       ld  (CSbitmask),a
+
+       ld  d,c                 ;width
+       ld  b,(ix+1)            ;height
+CSyloop:
+       psh bc                  ;save rows to go
+       psh hl                  ;screen
+       ld  b,d                 ;width
+       ld  a,(ix+2)            ;load image line
+       and 255                 ;mask
+CSclipmask =$-1
+       ld  c,a                 ;c=image
+       inc ix                  ;next
+CSbitmask =$+1
+       ld  a,1                 ;saved bitmask
+CSxloop:
+       sla c                   ;test leftmost pixel
+       jr  nc,CSnodraw         ;don't draw if it's 0
+       ld  e,a                 ;psh af: save bitmask
        or  (hl)
-       ld  (hl),a
-       ld  a,e
-_noplot:rrca
-       jr  nc,_notedge         ;Test if edge of byte reached
-       inc hl                  ;Go to next byte
-_notedge:
-       dnz _iloop
-       pop hl                  ;Restore address
-       ld  bc,16               ;Go to next line
-       add hl,bc
-       pop bc                  ;Restore data
-       dnz _oloop
-       ret                     ;<jp>s are used instead of <jr> = faster
+       ld  (hl),a              ;OR pixel with screen
+       ld  a,e                 ;pop af
+CSnodraw:
+       rrca                    ;next bit
+       jr  nc,CSbitdrawn       ;carry set if bit "jumped"
+       inc hl                  ;next byte
+CSbitdrawn:
+       dnz CSxloop
+       pop hl                  ;screen at x-offset=0
+       ld  bc,16
+       add hl,bc               ;next line
+       pop bc                  ;rows counter
+       dnz CSyloop
+CSdone:        ret
 
 ;--------------------------- putbigsprite -----------------------------------
 
 putwidesprite:
-       ld  a,d
-       and 7
-       ld  hl,offsets_table
-       ld  c,a
-       ld  b,0
-       add hl,bc
-       ld  a,(hl)
-       ld  (wsmc1+1),a
-       ld  (wsmc2+1),a
-       ld  hl,(PutWhere)
-
-       ld  a,e
-       add a,a
-       add a,a
-       add a,a
-
-       rl  b
-       add a,a
-       rl  b
-       srl d
-       srl d
-       srl d
-       add a,d
-       jr  nc,n1
-       inc b
-n1:    ld  c,a
-       add hl,bc
+       ld  a,(ix)              ;width
+       cp  9
+       jr  c,putsprite         ;width<=8: just draw the sprite
 
-       ld  d,(ix)
-       ld  b,(ix+1)
-woloop:        psh bc                  ;Save # of rows
-       psh hl                  ;Save screen address
-       ld  b,d                 ;Load width
-       ld  c,(ix+2)            ;Load one line of image
+       ld  a,(ix)
+       sub 8                   ;width>8
+       psh af
+       ld  c,8
+       psh de
+       cal _putsprite          ;otherwise draw one column (8 pixels wide)
+       pop de
        inc ix
-wsmc1: ld  a,1                 ;Load pixel mask
-wiloop:        sla c                   ;Test leftmost pixel
-       jr  nc,wnoplot          ;See if a plot is needed
-       ld  e,a                 ;OR pixel with screen
-       or  (hl)
-       ld  (hl),a
-       ld  a,e
-wnoplot:
-       rrca
-       jr  nc,wnotedge         ;Test if edge of byte reached
-       inc hl                  ;Go to next byte
-wnotedge:
-wsmc2: cp  1
-       jr  z,wover_1
+       ld  a,8                 ;next
+       add a,d                 ;8 pixels right
+       ld  d,a
+       pop bc                  ;then draw the remaining pixels (c=width-8)
+       jr  _putsprite
 
-       dnz wiloop
-       pop hl                  ;Restore address
-       ld  bc,16               ;Go to next line
-       add hl,bc
-       pop bc                  ;Restore data
-       dnz woloop
+safeputsprite:                 ;cal putsprite with de intact
+       psh de
+       cal putsprite
+       pop de
        ret
-wover_1:
-       ld  c,(ix+2)
-       inc ix
-       dnz wiloop
-       dec ix
-       pop hl
-       ld  bc,16
-       add hl,bc
-       pop bc
-       dnz woloop
+
+;------------------------------- findpixel ----------------------------------
+;based upon CLEM's fp | 131 cycles | 28 bytes | in:(d,e); out:hla; destr:de
+
+findpixel:
+       ld  a,e                 ;a=e=Y
+       add a,a
+       add a,a                 ;add a,a is 7 cycles faster than add hl,hl
+       ld  h,0                 ;switch to hl now (Y<64)
+       ld  l,a                 ;hl=4*Y
+       ld  a,d                 ;a=d=X
+       rra                     ;RRA: carry flag must be reset!
+       add hl,hl               ;that's what the adds are for :P
+       rra
+       add hl,hl               ;hl=16*Y
+       rra                     ;a=X/8
+       or  l
+       ld  l,a                 ;hl=hl+a
+       ld  a,d
+       and 7                   ;a=X\8
+       cpl
+       rlca
+       rlca
+       rlca
+       ld (FPbit),a
+       xor a
+FPbit =$+1
+       set 0,a
+       ld  de,GRAPH_MEM        ;screen base position (where x+y=0)
+PutWhere =$-2
+       add hl,de
        ret
 
 ;----------------------------------------------------------------------------
@@ -2961,7 +2959,7 @@ spr_bullet01:
        .db 2,1
        .db %11000000   ;▒██
 spr_bullet02:
-       .db 4,2
+       .db 4,1
        .db %11110000   ;▒████
 spr_bullet03:
        .db 2,2
@@ -3062,9 +3060,9 @@ XLbullettable:
 maxnrweapons = 8+1
 weapondata:
        .db 1,1,%11110000,0,%11110000,6,%00000000,0     ;LASER
-       .db 1,1,%00000010,2,%00000000,0,%00000000,0     ;single fire
-       .db 3,1,%00000011,2,%00000000,0,%00000000,0     ;fast single
-       .db 1,1,%00000010,0,%00000010,5,%00000000,0     ;double
+       .db 1,1,%00000010,3,%00000000,0,%00000000,0     ;single fire
+       .db 3,1,%00000011,3,%00000000,0,%00000000,0     ;fast single
+       .db 1,1,%00000010,0,%00000010,6,%00000000,0     ;double
        .db 1,1,%00010010,2,%00110010,2,%01000010,2     ;triple
        .db 3,2,%00010011,2,%00110011,2,%01000011,2
        .db 5,3,%00010011,2,%00110011,2,%01000100,2
@@ -3077,67 +3075,123 @@ collidedamage = 4
 
 spr_icon:
        .db 16,7        ;selected .......:.......:
-       .db %11111111,%11111111 ; ████████████████
-       .db %11000000,%00000001 ; ██             █
-       .db %11000000,%00000001 ; ██             █
-       .db %11000000,%00000001 ; ██             █
-       .db %11000000,%00000001 ; ██             █
-       .db %11000000,%00000001 ; ██             █
-       .db %11111111,%11111111 ; ████████████████
+       .db %11111111           ; ████████████████
+       .db %11000000           ; ██             █
+       .db %11000000           ; ██             █
+       .db %11000000           ; ██             █
+       .db %11000000           ; ██             █
+       .db %11000000           ; ██             █
+       .db %11111111           ; ████████████████
+       .db 7
+       .db %11111111
+       .db %00000001
+       .db %00000001
+       .db %00000001
+       .db %00000001
+       .db %00000001
+       .db %11111111
 spr_icon00:
        .db 16,7        ;unused   .......:.......:
-       .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
-       .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
-       .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
-       .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
-       .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
-       .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
-       .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
+       .db %10101010           ; █ █ █ █ █ █ █ █
+       .db %11010101           ; ██ █ █ █ █ █ █ █
+       .db %10101010           ; █ █ █ █ █ █ █ █
+       .db %11010101           ; ██ █ █ █ █ █ █ █
+       .db %10101010           ; █ █ █ █ █ █ █ █
+       .db %11010101           ; ██ █ █ █ █ █ █ █
+       .db %10101010           ; █ █ █ █ █ █ █ █
+       .db 7
+       .db %10101010
+       .db %01010101
+       .db %10101010
+       .db %01010101
+       .db %10101010
+       .db %01010101
+       .db %10101010
 spr_icon01:
        .db 16,7        ;armor  ; .......:.......:
-       .db %10000111,%11110000 ; █    ███████
-       .db %10011000,%00001100 ; █  ██       ██
-       .db %10110011,%11000110 ; █ ██  ████   ██
-       .db %10110000,%11110110 ; █ ██    ████ ██
-       .db %10110011,%11000110 ; █ ██  ████   ██
-       .db %10011000,%00001100 ; █  ██       ██
-       .db %10000111,%11110000 ; █    ███████
+       .db %10000111           ; █    ███████
+       .db %10011000           ; █  ██       ██
+       .db %10110011           ; █ ██  ████   ██
+       .db %10110000           ; █ ██    ████ ██
+       .db %10110011           ; █ ██  ████   ██
+       .db %10011000           ; █  ██       ██
+       .db %10000111           ; █    ███████
+       .db 7
+       .db %11110000
+       .db %00001100
+       .db %11000110
+       .db %11100110
+       .db %11000110
+       .db %00001100
+       .db %11110000
 spr_icon02:
        .db 16,7        ;torpedo  .......:.......:
-       .db %10111000,%00010101 ; █ ███      █ █ █
-       .db %10011100,%00010101 ; █  ███     █ █ █
-       .db %10111000,%01001010 ; █ ███    █  █ █
-       .db %10000000,%11101010 ; █       ███ █ █
-       .db %11100001,%11100101 ; ███    ████  █ █
-       .db %10011000,%11110101 ; █  ██   ████ █ █
-       .db %11100110,%00110010 ; ███  ██   ██  █
+       .db %10111000           ; █ ███      █ █ █
+       .db %10011100           ; █  ███     █ █ █
+       .db %10111000           ; █ ███    █  █ █
+       .db %10000000           ; █       ███ █ █
+       .db %11100001           ; ███    ████  █ █
+       .db %10011000           ; █  ██   ████ █ █
+       .db %11100110           ; ███  ██   ██  █
+       .db 7
+       .db %00010101
+       .db %00010101
+       .db %01001010
+       .db %11101010
+       .db %11100101
+       .db %11110101
+       .db %00110010
 spr_icon03:
        .db 16,7        ;bullets  .......:.......:
-       .db %10000000,%11000000 ; █       ██
-       .db %10000011,%11100000 ; █     █████ ▒▒▒
-       .db %10011000,%11000000 ; █  ██   ██  ▒▒▒
-       .db %11111100,%00000000 ; ██████      ▒▒▒
-       .db %10011000,%11000000 ; █  ██   ██  ▒▒▒
-       .db %10000011,%11100000 ; █     █████ ▒▒▒
-       .db %10000000,%11000000 ; █       ██
+       .db %10000000           ; █       ██
+       .db %10000011           ; █     █████ ▒▒▒
+       .db %10011000           ; █  ██   ██  ▒▒▒
+       .db %11111100           ; ██████      ▒▒▒
+       .db %10011000           ; █  ██   ██  ▒▒▒
+       .db %10000011           ; █     █████ ▒▒▒
+       .db %10000000           ; █       ██
+       .db 7
+       .db %11000000
+       .db %11100000
+       .db %11000000
+       .db %00000000
+       .db %11000000
+       .db %11100000
+       .db %11000000
 spr_icon04:
        .db 16,7        ;laser    .......:.......:
-       .db %10000000,%00000000 ; █
-       .db %10110010,%10000000 ; █ ██  █ █
-       .db %10111011,%00000000 ; █ ███ ██
-       .db %10011101,%11111111 ; █  ███ █████████
-       .db %10111011,%00000000 ; █ ███ ██
-       .db %10110010,%10000000 ; █ ██  █ █
-       .db %10000000,%00000000 ; █
+       .db %10000000           ; █
+       .db %10110010           ; █ ██  █ █
+       .db %10111011           ; █ ███ ██
+       .db %10011101           ; █  ███ █████████
+       .db %10111011           ; █ ███ ██
+       .db %10110010           ; █ ██  █ █
+       .db %10000000           ; █
+       .db 7
+       .db %00000000
+       .db %10000000
+       .db %00000000
+       .db %11111111
+       .db %00000000
+       .db %10000000
+       .db %00000000
 spr_icon05:
        .db 16,7        ;multiple .......:.......:
-       .db %10000011,%10000000 ; █     ███
-       .db %10000001,%11100110 ; █      ████  ██
-       .db %10000001,%11100000 ; █      ████
-       .db %10000011,%10000000 ; █     ███
-       .db %10011000,%00000000 ; █  ██
-       .db %10111100,%11000011 ; █ ████  ██    ██
-       .db %10011000,%00000000 ; █  ██
+       .db %10000011           ; █     ███
+       .db %10000001           ; █      ████  ██
+       .db %10000001           ; █      ████
+       .db %10000011           ; █     ███
+       .db %10011000           ; █  ██
+       .db %10111100           ; █ ████  ██    ██
+       .db %10011000           ; █  ██
+       .db 7
+       .db %10000000
+       .db %11100110
+       .db %11100000
+       .db %10000000
+       .db %00000000
+       .db %11000011
+       .db %00000000
 spr_dividerline:
        .db 8,7
        .db 128,128,128,128,128,128,128 ;128 = %10000000
@@ -3166,9 +3220,6 @@ txt_teacherans:   .db Lneg,"14.2063168184",0
 
 ;---------------------------- save data -------------------------------------
 
-PutWhere       .dw GRAPH_MEM           ;where to put the wide sprites
-laserlasts     .db 5
-
 storehi_start:
 hiscore                .dw $0000
 hiname         .db "Shiar.97",0
@@ -3196,31 +3247,31 @@ storesave_end:
 ;XLlevelsdata:---------------------------------------------------------------
 
 level00:
-       .db 0
+       .db 0                           ;story identifier
        .db $21,$1d,"Cosmic year 6716"          ,0,0,$1d,$06
        .db $1b,$1d,"storyline coming soon..."  ,0,0,$1d,$06
        .db $09,$19,"the Nemesis saga continues",0,1
        .db $2e,$21,"with NEMESIS 86"           ,0,1
        .db $52,$36,"by Shiar"                  ,0,0,$19,$23
-       .db $ff
+       .db $ff                         ;story end
 
 ;format:[nr.dif.enemies]x [enemy nr]
 ;      [enemy frequency] [next lvl]
 ;      [level_info: 0000:damage 0:directfire 0:ground 0:ceiling 0:diagfire]
-;      [level_move] [level_fire] [tunnel size] [groundtype]
+;      [level_move] [tunnel size] [groundtype]
 ;      [16_ground] [16_ceiling] [stars1] [stars2]
 
-       .db $15,$07,$08                 ;fireFreq; moveType; enemyType
+       .db $07,$08                     ;moveType; enemyType
 level01:                               ;efrequency must be odd if halfluring!
        .db 3,$01,$02,$03
-       .db $1b,$2f,%00010001
-       .db 0,255
+       .db $1b,$2f,%00010000
+       .db 0
        .db 0,0
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ;16
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1
 
-       .db $10,$07,$09
+       .db 0,0
 
        .db 0
        .db $01,01,"And the storyline conti",
@@ -3231,59 +3282,85 @@ level01:                                ;efrequency must be odd if halfluring!
                .db "anet =)",0,0,1,20
        .db $FF
 
-       .db $10,$07,$09
+       .db $07,$09
 level02:
        .db 1,$02
-       .db $13,$4b,%00100101,0,064,0,0
+       .db $13,$4b,%00100100,0,0,0
        .db 1,2,3,4,5,6,6,5,4,3,4,5,4,3,2,1
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1
 
+        .db 0,0
+
        .db 0
        .db $01,01,"Blablabla...",0,1
        .db $01,34,"this storyline sux",0,0,1,39
        .db $FF
 
-       .db $0E,$07,$09
+       .db $07,$09
 level03:
        .db 1,$03
-       .db $2d,$3f,%00010110,0,255,-9,1
+       .db $2d,$3f,%00010110,0,-9,1
        .db 3,2,4,3,2,2,1,1,1,1 ,1,1,21,17,18,20
        .db 1,1,1,1,1,1,1,3,6,12,9,1,21,19,18,18
        .db -1,-1 ;=%11111111=line
 
-       .db $0D,$07,$08
+       .db $07,$08
 level04:
        .db 1,$04
-       .db $11,$41,%00100001,0,057,0,0
+       .db $11,$41,%00100001,0,0,0
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1
-       .db $0C,$07,$09
+       .db $07,$09
 level05:
        .db 1,$05
-       .db $11,$45,%00100101,%10,031,-7,1
+       .db $11,$45,%00100101,%10,-7,1
        .db 14,12,11,9,10,7,7,5,4,3,4,4,2,3,1,2
        .db 1, 1, 1, 1,1, 1,1,1,1,1,1,1,1,1,1,1
        .db 1,1
-       .db $0B,$07,$08
+       .db $07,$08
 level06:
        .db 1,$06
-       .db $19,$3a,%00100111,0,255,-4,1
+       .db $19,$3a,%00100111,0,-4,1
        .db 20,22,18,15,9,1,1,1,1,1,1,1,1,1,1,1
        .db 20,22,18,15,9,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1
 
-       .db $08,$07,$09
+       .db $07,$09
 level07:
        .db 1,$07
-       .db $09,$ff,%00100001,0,043,0,0
+       .db $09,$ff,%00100001,0,0,0
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        .db 1,1
 
 ;------------------------------ enemies -------------------------------------
 
+;format: [000000:HP 00:occ] [HP64] [sprite] [appearance(ypos)]
+;       [time2fire] [firefreq] [0] [0]
+enemyspecs:
+       .db 0,%00100110,(spr_enemy01-spr_enemy00)/2,1,10,10,0,0 ;#1
+       .db 0,%00101010,(spr_enemy02-spr_enemy00)/2,3,20,20,0,0 ;#2
+       .db 0,%00001111,(spr_enemy03-spr_enemy00)/2,2,100,5,0,0 ;#3
+
+       .db 0,%00000110,(spr_enemy04-spr_enemy00)/2,2,0,0,0,0   ;#4
+       .db 0,%00000111,(spr_enemy05-spr_enemy00)/2,3,0,0,0,0   ;#5
+       .db 0,%00001011,(spr_enemy06-spr_enemy00)/2,2,0,0,0,0   ;#6
+
+       .db 0,%00011011,(spr_enemy07-spr_enemy00)/2,3,0,0,0,0   ;#7
+
+       .db 1,%00110011,(spr_boss0_1-spr_enemy00)/2,1,15,10,0,0 ;boss1
+       .db 1,%11001011,(spr_boss0_2-spr_enemy00)/2,3,10,8,0,0  ;boss2
+
+       .db 0,%00000000,0,0,0,0,0,0
+       .db 0,%00000000,0,0,0,0,0,0
+       .db 0,%00000000,0,0,0,0,0,0
+       .db 0,%00000000,0,0,0,0,0,0
+       .db 0,%00000000,0,0,0,0,0,0
+       .db 0,%00000000,0,0,0,0,0,0
+       .db 0,%00000000,0,0,0,0,0,0
+
 spr_enemy00:
        .db 8,8                         ;pickup
        .db %00011000                   ;    ██
@@ -3361,52 +3438,51 @@ spr_enemy08:
        .db %00011110                   ;    ████
 
 spr_boss0_1:
-       .db 16,10                       ;boss type one
-       .db %00000001,%11111111         ;        █████████
-       .db %00001111,%11111110         ;     ███████████
-       .db %00111111,%11110000         ;   ██████████
-       .db %01011111,%10000000         ;  █ ██████
-       .db %10011111,%01000000         ; █  █████ █
-       .db %10011111,%01000000         ; █  █████ █
-       .db %01011111,%10000000         ;  █ ██████
-       .db %00111111,%11110000         ;   ██████████
-       .db %00001111,%11111110         ;     ███████████
-       .db %00000001,%11111111         ;        █████████
+       .db 16,10                       ;boss type one   :
+       .db %00000001                   ;        █████████
+       .db %00001111                   ;     ███████████
+       .db %00111111                   ;   ██████████
+       .db %01011111                   ;  █ ██████
+       .db %10011111                   ; █  █████ █
+       .db %10011111                   ; █  █████ █
+       .db %01011111                   ;  █ ██████
+       .db %00111111                   ;   ██████████
+       .db %00001111                   ;     ███████████
+       .db %00000001                   ;        █████████
+       .db 10
+       .db %11111111
+       .db %11111110
+       .db %11110000
+       .db %10000000
+       .db %01000000
+       .db %01000000
+       .db %10000000
+       .db %11110000
+       .db %11111110
+       .db %11111111
 spr_boss0_2:
        .db 16,10                       ;boss type:one   :
-       .db %11111110,%00000000         ; ███████
-       .db %00001111,%10001111         ;     █████   ████
-       .db %00111111,%11100011         ;   █████████   ██
-       .db %01001111,%11111110         ;  █  ███████████
-       .db %10001101,%01111100         ; █   ██ █ █████
-       .db %10001101,%01111100         ; █   ██ █ █████
-       .db %01001111,%11111110         ;  █  ███████████
-       .db %00111111,%11100011         ;   █████████   ██
-       .db %00001111,%10001111         ;     █████   ████
-       .db %11111110,%00000000         ; ███████
-
-;format: [000000:HP 00:occ] [HP64] [appearance(ypos)] [unused]
-XLenemyinfos:
-       .db %00100110,0,(spr_enemy01-spr_enemy00)/2,1   ;#1
-       .db %00101010,0,(spr_enemy02-spr_enemy00)/2,3   ;#2
-       .db %00001111,0,(spr_enemy03-spr_enemy00)/2,2   ;#3
-
-       .db %00000110,0,(spr_enemy04-spr_enemy00)/2,2   ;#4
-       .db %00000111,0,(spr_enemy05-spr_enemy00)/2,3   ;#5
-       .db %00001011,0,(spr_enemy06-spr_enemy00)/2,2   ;#6
-
-       .db %00011011,0,(spr_enemy07-spr_enemy00)/2,3   ;#7
-
-       .db %00110011,1,(spr_boss0_1-spr_enemy00)/2,1   ;boss1
-       .db %01001011,1,(spr_boss0_2-spr_enemy00)/2,3   ;boss2
-
-       .db %00000000,0,0,0
-       .db %00000000,0,0,0
-       .db %00000000,0,0,0
-       .db %00000000,0,0,0
-       .db %00000000,0,0,0
-       .db %00000000,0,0,0
-       .db %00000000,0,0,0
+       .db %11111110                   ; ███████
+       .db %00001111                   ;     █████   ████
+       .db %00111111                   ;   █████████   ██
+       .db %01001111                   ;  █  ███████████
+       .db %10001101                   ; █   ██ █ █████
+       .db %10001101                   ; █   ██ █ █████
+       .db %01001111                   ;  █  ███████████
+       .db %00111111                   ;   █████████   ██
+       .db %00001111                   ;     █████   ████
+       .db %11111110                   ; ███████
+       .db 10
+       .db %00000000
+       .db %10001111
+       .db %11100011
+       .db %11111110
+       .db %01111100
+       .db %01111100
+       .db %11111110
+       .db %11100011
+       .db %10001111
+       .db %00000000
 
 ;----------------------------------------------------------------------------
 ;----------------------------- logo ------------------------------------------
@@ -3443,7 +3519,7 @@ logo_nemesis:
 ;----------------------------------------------------------------------------
 ;----------------------------------------------------------------------------
 
-; 0.97.625 -- 25.VI.00 -- size 5753
+; 0.97.625 -- 25.VI.00 -- size 5729
 ;
 ;      # bullets do damage in all levels
 ;      * more armor at armor-upgrade and extra armor at end of a level
@@ -3473,6 +3549,15 @@ logo_nemesis:
 ;      + weapon can be combination of bullets/lasers (max. of 3 per weapon)
 ;      * bullet-icon is removed when laser is selected
 ;      * enemy sprite table integrated in enemy specs (-1 byte/enemy)
+;      + random enemy is chosen from any number of enemies per level
+;      * time to first enemy fire defined per enemy, not per level
+;      + CLIPPED sprites!! no more in/out popping enemies! wow...
+;      * bullets/enemies removed when _entirely_ off screen
+;      # enemies would sometimes be hit by bullets going right below them
+;      # size of the second bullet was too big (invisible hit)
+;      * the frequency an enemy fires bullets is defined per enemy
+;      + wide clipped sprites implemented (width 1-16 pixels)
+;      # bosses first move left until x=100, otherwise they'd be off-screen
 ;
 ;
 ;       + added        - removed       * changed       # bug fixed
\ No newline at end of file