fe86778efbe027b3cf2bdb45881bdcf2e0b19160
[nemesis.git] / nemesis.z80
1         .include "asm86.h"
2         .include "ti86asm.inc"
3         .include "ram86.inc"
4
5         .org _asm_exec_ram
6
7 TEXT_MEM = _textShadow
8 DELC_LEN = _undelBufLen         ;$64 bytes long
9
10          nop
11          jp init
12         .dw $0001               ;description type 2 (= +YASicon)
13         .dw Title               ;pointer to description
14         .dw spr_ship            ;pointer to YAS icon
15
16 Title:  .db "Nemesis v0.91.95 by Shiar",0
17
18 just_fired      = TEXT_MEM      ;byte
19 temp1           = TEXT_MEM+1    ;word
20 RanPos          = TEXT_MEM+3    ;byte
21 firex           = TEXT_MEM+4    ;byte
22 firey           = firex+1       ;byte
23 mx              = TEXT_MEM+6    ;byte
24 my              = mx+1          ;byte
25 your_locpos     = TEXT_MEM+8    ;byte
26 your_prevpos    = TEXT_MEM+9    ;16 words
27
28 nrybullets      = 10
29 ybullets        = your_prevpos+32                       ;20 x (state,x,y)
30 nrebullets      = 10
31 ebullets        = ybullets+(nrybullets*3)               ;10 x (state,x,y)
32
33 nrenemies       = 10
34 enemies         = DELC_LEN
35         ; %111111 (HP left) 11 (00=no enemy 01=exploding 10=normal 11=moving)
36         ; %11111111 (ship type or explosion frame)  %11111111 (x) %11111111 (y)
37 add2enemy       = nrenemies*4
38 enemiesxtra     = enemies+add2enemy
39
40 ;---------------------- init --------------------------------------------------
41
42 init:
43         call _runindicoff       ;turn the run-indicator off, obviously
44         call _clrLCD            ;clean the screen
45         ld  (iy+13),0
46         xor a
47         ld  (DELC_LEN),a
48
49         ld  a,(CONTRAST)        ;load current contrast level
50         cp  $1f                 ;if already at maximum...
51         jr  z,skipdarken        ;...then skip level increase
52         inc a                   ;otherwise increase contrast level
53 skipdarken:
54         out (2),a               ;set it
55
56 ;---------------------- main menu ---------------------------------------------
57
58 LogoPut:
59         ld hl,logo_nemesis      ;from...
60         ld de,VIDEO_MEM+16      ;...to one line from top
61         ld a,19                 ;19 rows
62 LogoLoop:
63         ld bc,16                ;set screen width
64         ldir                    ;display one line
65         dec a                   ;decrease line-counter
66         jr nz,LogoLoop          ;repeat when counter is not yet zero
67
68 menutext:
69         ld  hl,$1608            ;just below logo
70         ld  (_penCol),hl
71         ld  hl,txt_about        ;display "by Shiar (ICQ#43840958)"
72         call _vputs
73
74         ld  hl,$0705            ;located one row above bottom
75         ld  (_curRow),hl        ;go there
76         ld  hl,txt_1player      ;display "ONE PLAYER"
77         call _puts
78         ld  hl,$0706            ;below oneplayer text
79         ld  (_curRow),hl
80         ld  hl,txt_2players     ;display "TWO PLAYERS"
81         call _puts
82
83         call _getkey            ;wait for keypress
84         call New_game           ;prepare level
85
86 ;------------------------------------------------------------------------------
87 ;---------------------- game loop ---------------------------------------------
88 ;------------------------------------------------------------------------------
89
90 game_main_loop:
91         ld  hl,timer            ;update time
92         inc (hl)                ;increase by 1
93         ld  b,(hl)              ;new time
94
95         ld  hl,RanPos           ;random counter
96         ld  a,(hl)              ;random value
97         add a,b                 ;even more random by adding timer
98         ld  (hl),a              ;save even more random value back
99
100 Clear_screen:
101         xor a                   ;empty bitmask
102         ld  hl,GRAPH_MEM        ;screen location (top left)
103         ld  b,$E0               ;loop 0E0h = 224 times = 256-32 for score-bar)
104 clearloop:
105         ld  (hl),a              ;clear four times (total = 224*4 = 896 bytes)
106         inc hl
107         ld  (hl),a
108         inc hl
109         ld  (hl),a
110         inc hl
111         ld  (hl),a
112         inc hl
113         djnz clearloop          ;repeat 224x
114
115 check_exitkey:
116         call GET_KEY
117         cp  K_EXIT
118         jr  z,quit
119         cp  K_MORE
120         call z,Pause
121 ;       ld  a,%00111111         ;<exit> pressed?
122 ;       out (1),a
123 ;       nop \ nop
124 ;       in  a,(1)
125 ;       bit 6,a                 ;test bit 6 = <EXIT>
126 ;       jr  z,quit              ;yes: quit game
127
128 game_stuff:
129         call Level_event        ;insert enemies
130         call Handle_Ship        ;move you
131         call Handle_enemies     ;move enemies
132
133         call Fire_bullet        ;check for fire
134         call Handle_bullets     ;move your bullets
135         call Handle_torp        ;move your torpedo
136         call Enemy_bullets      ;move enemy bullets
137         call Enemies_hit        ;check for collision with enemies
138
139         call Display_Screen     ;display all
140         halt \ halt             ;delay
141         jr   game_main_loop     ;loop
142
143 ;--------------------------- pause --------------------------------------------
144
145 Pause:
146         ld  hl,$0200            ;top left
147         ld  (_curRow),hl
148         ld  hl,txt_pressenter   ;"Enter to continue"
149         call _puts              ;display message
150 pause:
151         call _getkey            ;enter low-power mode and wait for key
152         cp  kEnter              ;keypressed = enter?
153         jr  nz,pause            ;no, wait some more
154         ret                     ;continue
155
156 ;--------------------------- exit ---------------------------------------------
157
158 quit:
159         ld  a,(CONTRAST)        ;load original contrast level
160         out (2),a               ;and set it back
161         ld  (iy+13),6
162         ret                     ;quit Nemesis :(
163
164 ;--------------------------- display ------------------------------------------
165
166 Display_Screen:
167         ld  hl,GRAPH_MEM        ;from storage (top left)
168         ld  de,VIDEO_MEM        ;to screen (top left)
169         ld  a,56                ;display height = 64 bytes (minus 8 for bar)
170 displayloop:
171         ld  bc,16               ;display width = 16 bytes (16*8bits=256pixels)
172         ldir                    ;16x de >> hl
173         dec a                   ;next line
174         jr  nz,displayloop      ;loop 64x
175
176         ld  hl,$396b            ;Display Score
177         ld  (_penCol),hl        ;bottom right of screen
178         ld  hl,(timer)
179         ld  h,0
180
181 _D_HL_DECI:             ;------- display 5-digit value -------
182         ld   de,savestr+4       ;savenr saves number string
183         ld   b,5                ;five digits
184 ldhld:  call UNPACK_HL          ;one digit of hl
185         add  a,'0'              ;make number
186         ld   (de),a             ;save into savenr
187         dec  de                 ;point to next digit
188         djnz ldhld              ;repeat for all digits
189
190         ld   hl,savestr
191         call _vputs             ;display string
192         ret
193
194 savestr:
195         .db "SHIAR",0
196
197 ;------------------------- handle ship ----------------------------------------
198
199 Handle_Ship:
200         ld  a,(your_occ)
201         or  a
202         jr  z,ok                ;0 = normal stat
203
204         inc a                   ;next (explosion)frame
205         ld  (your_occ),a        ;save
206
207         cp  34                  ;last explosion frame?
208         jp  c,exploding_you     ;not yet: display explosion
209         cp  40                  ;delay finished?
210         jp  z,You_die           ;yes = game over
211         ret                     ;don't display anything
212
213 ok:
214         ld  a,%01111110
215         out (1),a
216         ld  hl,y
217         in  a,(1)
218         rra                     ;rotate right (put last bit in c)
219         ld  b,a                 ;we need a
220
221         jr  c,no_down
222         ld  a,(hl)
223         cp  49                  ;55-6 = bottom of screen
224         jr  z,no_down
225         inc a
226         ld  (hl),a
227 no_down:
228         dec hl
229         rr  b                   ;because we now use b, it's rr instead of rra
230         jr  c,no_left
231         ld  a,(hl)
232         sub 1                   ;<dec a> doesn't affect c-flag
233         jr  c,no_left           ;-1 = left side
234         ld  (hl),a
235 no_left:
236         rr  b   
237         jr  c,no_right
238         ld  a,(hl)
239         cp  121                 ;127-6 = right side
240         jr  z,no_right
241         inc a
242         ld  (hl),a
243 no_right:
244         ld  d,(hl)
245         inc hl
246         rr  b
247         jr  c,no_up
248         ld  a,(hl)
249         sub 1                   ;<dec a> doesn't affect carry-flag
250         jr  c,no_up             ;-1 = top of screen
251         ld  (hl),a              ;save new y
252
253 no_up:  ld  e,(hl)
254         ld  ix,spr_ship01       ;ship sprite
255         ld  hl,your_inv         ;invulnerable?
256         ld  a,(hl)              ;load time in a
257         or  a                   ;is it 0?
258         jr  z,handle_multiples  ;yes so ship = normal (display \ continue)
259
260         ld  b,a                 ;save inv-time
261         ld  a,(timer)           ;load frame nr.
262         and %00000011           ;a=0 once every four frames
263         jr  nz,not_time         ;a<>0 = not time to update counter
264         dec (hl)                ;decrease inv-time left
265 not_time:
266         and %00000010           ;a switches 0<->1 every 2 frames
267         jr  z,no_flicker        ;don't show normal sprite anyway
268         ld  a,b                 ;pop inv-time
269         and %11110000           ;inv-time <16 ticks left?
270         jr  handle_multiples    ;yes: display normal sprite and continue
271
272 no_flicker:
273         ld  ix,spr_ship01i      ;display inv-ship (ld ix is faster than add ix)
274
275 handle_multiples:
276         call putsprite          ;display your ship
277
278         ld  a,(your_multiples)  ;do you have multiples
279         or  a                   ;no?
280         ret z                   ;then don't handle them either
281
282         ld  hl,your_locpos      ;location to save this position
283         ld  a,(hl)              ;load a
284         inc a                   ;a=a+1
285         and %00001111           ;if a>15 then a=a-16
286         ld  (hl),a              ;save new a
287         add a,a                 ;a=a*2
288         ld  c,a                 ;de=a
289         ld  b,0
290
291         ld  hl,your_prevpos     ;previous positions
292         add hl,bc               ;16 turns ago
293         ld  d,(hl)              ;old x-pos
294         inc hl                  ;and
295         ld  e,(hl)              ;old y-pos
296         ld  (mx),de             ;save multiple position in (mx)
297
298         ld  a,(y)               ;load new y-pos
299         ld  (hl),a              ;save it for 16 turns in the future
300         dec hl                  ;and
301         ld  a,(x)               ;load new x-pos
302         ld  (hl),a              ;save that too
303
304         ld  ix,spr_multiple     ;sprite of the multiple
305         jp  putsprite           ;display it + <ret>
306
307 exploding_you:
308         srl a                   ;half the framerate
309         dec a                   ;first frame is 1>inc>srl>dec = 0
310         ld  hl,x-1
311
312 explosion_stuff:
313         rra
314         add a,a
315         add a,a
316         add a,a
317         ld  c,a
318         ld  b,0
319         ld  ix,spr_explosion
320         add ix,bc
321         inc hl
322         ld  d,(hl)
323         inc hl
324         ld  e,(hl)
325         jp  putsprite
326
327 damage_you:
328         ld  a,(your_inv)        ;invulnerability left?
329         or  a
330         ret nz                  ;return if inv>0
331         ld  hl,your_armor       ;armor left
332         ld  a,(hl)              ;check
333         dec a                   ;is it 0?
334         jp  m,no_armor          ;yes, 0hp left so explode
335         ld  (hl),a              ;no, so save decreased hp
336         call disp_armor         ;and display new value
337         ret                     ;and return
338 no_armor:
339         ld  a,%01               ;occ %xxxxxx01 = explode
340         ld  (your_occ),a        ;set to explode
341         ret
342
343 ;------------------------- fire bullet ----------------------------------------
344
345 Fire_bullet:
346         ld  a,(your_occ)        ;are you 100% OK?
347         or  a                   ;a=0??
348         ret nz                  ;return if not normal stat
349
350         ld  a,%00111111         ;function keys (F1-F5)
351         out (1),a               ;ask for them
352         nop \ nop               ;delay 8 clocks
353         in  a,(1)               ;get zem!
354         bit 4,a                 ;test bit 4 = F1-key
355         jr  z,fire              ;fire pressed?
356         ld  hl,just_fired
357         ld  (hl),0              ;no: reset just_fired
358         bit 3,a                 ;test bit 3 = F2-key &&&
359         ret nz                  ;return if not
360
361 select:
362         ld  hl,your_pickup      ;select pickups
363         ld  a,(hl)              ;load pickups taken so far
364         dec a                   ;is it 1?
365         jr  nz,select2          ;no, carry on
366         ld  (hl),a              ;reset pickups (a=0)
367         ld  hl,your_armor       ;change armor
368         inc (hl)                ;increase HPs by one
369         jp  disp_icons          ;display and return
370 select2:
371         dec a                   ;is it 2?
372         jr  nz,select3          ;no, carry on
373         ld  (hl),a              ;reset pickups
374         inc a                   ;a=1
375         ld  (torp_occ),a        ;ready torpedoes
376         jp  disp_icons          ;display 'n return
377 select3:
378         dec a                   ;is it 3?
379         jr  nz,select4          ;no, carry on
380         ld  (hl),a              ;reset pickups
381         jp  disp_icons          ;display n return
382 select4:
383         dec a                   ;is it 4?
384         jr  nz,select5          ;no, carry on again
385         ld  (hl),a              ;reset pickups
386         inc a                   ;a=1
387         ld  (your_laser),a      ;ready laser
388         jp  disp_icons          ;display + return
389 select5:
390         dec a                   ;is it 5?
391         jr  nz,select6          ;no, carry on once more
392         ld  (hl),a              ;reset pickups
393         inc a
394         ld  (your_multiples),a
395         jp  disp_icons          ;display, return
396 select6:
397         ld  (hl),0              ;reset pickups
398         jp  disp_icons          ;display/return
399
400 fire:   ld  hl,RanPos           ;random
401         inc (hl)                ;update random counter
402         ld  hl,just_fired
403         ld  a,(hl)              ;just_fired
404         or  a                   ;zero when key just pressed (not already in)
405         ret nz                  ;return when already pressed
406         inc (hl)                ;set just_fired to 1
407
408         ld  hl,(x)              ;yes: first fire from ship position (x)
409         ld  (firex),hl          ;set firepos
410         ld  a,(your_multiples)  ;any multiples?
411         dec a                   ;nope?
412         jr  nz,fireany          ;then just fire somethin'
413         call fireany            ;and blast
414         ld  hl,(my)             ;then, fire from multiple position (mx)
415         ld  a,(mx)              ;<ex h,l>
416         ld  h,a                 ; ^^^^^^
417         ld  (firex),hl          ;set firepos
418                                 ;blast again and <ret>
419 fireany:
420         ld  a,(your_laser)      ;do you have laser?
421         dec a                   ;1=yes
422         jr  nz,fire_ybullet     ;no, just fire a bullet
423
424 fire_laser:                     ;yes, fire that laser instead
425         ld  a,(firex)           ;a = your x-pos
426         ld  d,a
427
428         ld  hl,GRAPH_MEM        ;save-location
429         ld  a,(firey)           ;y-coord
430         add a,3                 ;at middle of your ship (y+3)
431         ld  e,a                 ;save laser-y in e
432         add a,a                 ;y*2
433         add a,a                 ;y*4
434         add a,a                 ;y*8
435         rl  b                   ;b (=0) =b*2+overflow (if y>32 then bc=bc+256)
436         add a,a                 ;y*16 (width of screen)
437         rl  b                   ;b=b*2+overflow (if y>64 then bc=bc+512)
438         inc a                   ;8 pixels to right (a=even so no overflow)
439
440         srl d                   ;X/2
441         srl d                   ;X/4
442         srl d                   ;X/8
443         add a,d                 ;a = (Y*16+X/8) mod 256 (c set on overflow)
444         jr  nc,_nolc            ;jump if no carry = no overflow = a<=255
445         inc b                   ;a>255 so increase bc by 256
446 _nolc:  ld  c,a                 ;c = (Y*16+X/8) mod 256
447         add hl,bc               ;bc = Y*16+X/8
448           
449         ld  a,15                ;128/8=16=screen width ** minus one (inc a ^^)
450         sub d                   ;minus x-start (d=X/8)
451         ld  b,a
452         ld  c,0
453 drawlaser:
454         ld  (hl),%11111111
455         inc hl                  ;Go to next byte
456         djnz drawlaser
457
458 handle_laser:
459         ld  a,(firex)
460         ld  d,a                 ;d was divided, so reload the laser-x
461
462 check_laserhits:                ;de = (x,y)
463         ld  ix,nolashit
464         ld  b,nrenemies
465         ld  hl,enemies
466
467 laserhits:                      ;Hits with normal enemies
468         push hl
469
470         ld  a,(hl)
471         and %00000010
472         jr  z,nolashit          ;no hit when enemy_occ <> 2/3
473
474         inc hl                  ;enemy type
475         ld  a,(hl)
476         or  a                   ;enemy #0 = pickup
477         jr  z,nolashit          ;yes: don't destroy
478
479         inc hl
480         ld  a,(hl)              ;check x
481         sub d
482         jp  m,nolashit          ;no hit when enemy is left of you
483
484         inc hl
485         ld  a,(hl)              ;check y
486         sub e
487         jp  z,enemy_hit         ;a-e=0 = laser on top line of enemy = hit
488         jr  nc,nolashit         ;a-e>0 = enemy above laser = no hit
489         add a,5                 ;add enemy height
490         jp  p,enemy_hit         ;a-e>0 = hit
491
492 nolashit:
493         pop hl
494         inc hl                  ;go to next enemy
495         inc hl
496         inc hl
497         inc hl
498         djnz laserhits          ;check all enemies
499
500         ld  a,d                 ;<ex d,e>
501         ld  d,e
502         ld  e,a
503         jr  fire_torp           ;fire torpedoes as well
504
505 fire_ybullet:
506         ld  hl,ybullets
507         ld  de,3
508         ld  b,nrybullets
509 find_ybullet:
510         ld  a,(hl)
511         or  a
512         jr  z,found_ybullet     ;0 = no bullet here
513         add hl,de
514         djnz find_ybullet       ;look next bullet
515         ret
516
517 found_ybullet:
518         ld  (hl),1              ;use bullet
519         ld  a,(firex)           ;your x-pos
520         add a,5                 ;place bullet in front of you
521         inc hl                  ;go to bullet-x
522         ld  (hl),a              ;set x
523         ld  e,a                 ;save torp-x in e
524
525         ld  a,(firey)           ;your y-pos
526         add a,2                 ;place bullet at the middle of your ship
527         inc hl                  ;go to bullet-y
528         ld  (hl),a              ;set y
529         add a,3                 ;place torpedo at bottom of ship
530         ld  d,a                 ;save torp-y in d
531
532 fire_torp:
533         ld  hl,torp_occ         ;torpedo...
534         ld  a,(hl)              ;load torpInfo
535         dec a                   ;do you have (unused) torpedoes?
536         ret nz                  ;nope (a must be 1)
537         ld  (hl),2              ;yes; use torpedo
538         ld  (torp_pos),de       ;save torpedo position (in de)
539         ret
540
541 ;------------------------ handle bullets --------------------------------------
542
543 remove_bullet:
544         dec hl
545         ld  (hl),0              ;dump this bullet!
546         ret
547
548 Handle_bullets:
549         ld  hl,ybullets
550         ld  b,nrybullets
551 scan_bullets:
552         push bc
553         push hl
554         ld  (temp1),hl
555         ld  a,(hl)
556         inc hl
557         dec a                   ;type 1?
558         call z,bullet_2left     ;yes: 2left
559         pop hl
560         pop bc
561         ld  de,3
562         add hl,de               ;3 x <inc hl>
563         djnz scan_bullets       ;next bullet (loop)
564         ret
565
566 bullet_2left:
567         ld  a,(hl)              ;d = X
568         cp  122                 ;off screen? (x>128-5)
569         jr  nc,remove_bullet
570         add a,2                 ;move 2 2 the right
571         ld  (hl),a              ;save new pos.
572         ld  d,a
573
574         inc hl                  ;to y-pos
575         ld  e,(hl)              ;e = Y
576
577         ld  ix,spr_bullet01
578         push de
579         call putsprite          ;display bullet
580         pop de
581
582 check_bullethits:               ;INPUT: de=X,Y
583         ld  b,nrenemies
584         ld  hl,enemies
585         ld  ix,nohit
586
587 hit_enemies:                    ;Hits with normal enemies
588         push hl
589
590         ld  a,(hl)
591         and %00000010
592         jr  z,nohit             ;no hit when enemy_occ <> 2/3
593
594         inc hl                  ;enemy type
595         ld  a,(hl)
596         or  a                   ;enemy #0 = pickup
597         jr  z,nohit             ;yes: don't destroy
598
599         inc hl
600         ld  a,(hl)              ;check x
601         sub d
602         add a,5
603         jp  m,nohit
604         cp  8
605         jr  nc,nohit
606
607         inc hl
608         ld  a,(hl)              ;check y
609         sub e
610         add a,5
611         jp  m,nohit
612         cp  10
613         jr  nc,nohit
614
615         push hl
616         ld  hl,(temp1)
617         ld  (hl),$00            ;remove bullet
618         pop hl
619
620 enemy_hit:
621         dec hl
622         dec hl
623         dec hl
624         ld  a,(hl)              ;occ
625         ld  c,a                 ;push occ
626         and %11111100           ;occ/4 = HP left        ;<srl a\srl a
627         jr  nz,hpleft           ;not zero -> jump
628         ld  (hl),%01            ;set to explode
629
630         ld  a,(RanPos)          ;use random var
631         and %01011011           ;matches 0 100/2/2/2/2/2=3% of the time
632         jr  nz,pickupdone       ;otherwise just explode
633         ld  (hl),%00000110      ;change it into a pickup (with 2 HP)
634 pickupdone:
635         inc hl
636         ld  (hl),$00            ;explosionFrame 0
637         jp  (ix)
638
639 hpleft:
640         ld  a,c                 ;pop occ
641         sub %00000100           ;decrease HP by one
642         ld  (hl),a              ;save
643         jp  (ix)
644
645 nohit:
646         pop hl
647         inc hl
648         inc hl
649         inc hl
650         inc hl
651         djnz hit_enemies        ;check next enemy
652         ret
653
654 ;--------------------------- handle torpedo -----------------------------------
655
656 Handle_torp:
657         ld  a,(torp_occ)
658         sub 2
659         ret m                   ;return if occ=0/1
660
661         ld  hl,torp_pos         ;x-position
662         ld  a,(hl)              ;load in a
663         inc a                   ;move right
664         cp  125                 ;right edge reached
665         jr  nc,remove_torp      ;remove if x>125
666         ld  (hl),a              ;save new x
667         ld  d,a
668
669         inc hl                  ;y-position
670         ld  a,(hl)
671         inc a                   ;move down
672         cp  56                  ;bottom reached
673         jr  nc,remove_torp      ;remove if y>40
674         ld  (hl),a              ;save new y
675         ld  e,a
676
677         ld  ix,spr_bullett1
678         push de
679         call putsprite          ;display torpedo
680         pop de
681         jr check_bullethits     ;check for hits with enemies
682
683 remove_torp:
684         ld  a,1
685         ld  (torp_occ),a
686         ret
687
688 ;--------------------------- level events -------------------------------------
689
690 Level_event:
691         ld  hl,nextevent        ;time to next event     <ld  a,(nextevent)
692         dec (hl)                ;decrease counter       <dec a
693         ld  a,(hl)              ;look at counter        <ld  (nextevent),a
694         or  a                   ;has it reached zero?
695         ret nz                  ;nope: get outta here!
696
697         ld  a,(eventtime)       ;enemy frequency (lvl)
698         ld  (nextevent),a       ;set time to next event
699         ld  hl,eventleft
700         dec (hl)                ;update enemy-counter
701
702         ld  a,(hl)              ;look at counter
703         or  a                   ;has it reached 0?
704         jp  z,Next_level        ;yes: level finished
705         dec a                   ;has it reached 1?
706         jr  nz,do_event         ;nope: wait for enemies to leave
707         inc hl                  ;nextevent located behind eventleft
708         ld  (hl),119            ;set delay
709         ret                     ;don't place any more enemies
710
711 do_event:
712         ld  de,enemies-4
713 chk_noenemy:
714         inc de
715         inc de
716         inc de
717         inc de
718         ld  a,(de)
719         or  a                   ;0 = no enemy present
720         jr  nz,chk_noenemy
721
722 place_enemy:
723         ld  a,(eventenemy)      ;enemy type to place (lvl)
724         ld  hl,enemy00          ;enemy 1 specs
725         add a,a                 ;a=type*2
726         add a,a                 ;a=type*4
727         ld  c,a                 ;c=type
728         ld  b,0                 ;bc = enemy nr.
729         add hl,bc               ;hl = enemy specs
730         ld  a,(hl)              ;load hitpoints+occ of this enemy class
731         ld  (de),a              ;occ
732
733         inc hl                  ;next enemyInfo byte
734         inc de                  ;next byte of current enemy
735         ld  a,(hl)              ;load movement+type of this enemy class
736         ld  (de),a              ;enemy type
737
738         inc de                  ;set x-pos
739         ld  a,122               ;appear at right edge of screen (128-6)
740         ld  (de),a              ;= x-position
741
742         inc de                  ;set y-pos
743         inc hl                  ;where to place??
744         ld  a,(hl)              ;load placeInfo
745         dec a                   ;is it 1?
746         jr  z,random_enemy      ;yes: create random value <51 in a
747         dec a                   ;is it 2?
748         jr  z,lure_enemy        ;yes: create a 100% luring enemy
749                                 ;otherwise?
750 halflure_enemy:                 ;yes (of course it is): pick one (50% lure)
751         ld  a,(timer)           ;look at frame-number
752         and %00000001           ;make random if odd frame nr.
753         jr  nz,random_enemy     ;1st possibility: random enemy
754 lure_enemy:                     ;2nd possibility: luring enemy
755         ld  a,(y)               ;place at same y-pos as YOUR ship
756         jr  ypos_OK
757
758 random_enemy:
759         call Random             ;make a (in a) random value 0-255
760         cp  51                  ;y may not be more than 51
761         jr  c,ypos_OK           ;OK if a<51
762         and %00111111           ;a = 0..63
763         sub 13                  ;a = -13..50
764         jr  c,random_enemy      ;not OK if a<0
765
766 ypos_OK:                        ;random value successfully created
767         ld  (de),a              ;save y-position
768
769         ld  hl,add2enemy-3      ;offset to xtra enemy info
770         add hl,de               ;hl points to <xtra info: move>
771         ld  (hl),1              ;set move-counter to 1
772         inc hl                  ;hl to <xtra info: fire>
773         ld  (hl),1              ;set time-to-fire to 1 frame (fires directly)
774         ret                     ;return
775
776 Random:
777         ld  a,(RanPos)          ;a handy random-var.
778         ld  hl,x                ;add your x-coord for randomness
779         adc a,(hl)
780         ld  hl,y                ;add your y-coord for randomness
781         adc a,(hl)
782         ld  (RanPos),a          ;save altered random-var
783         ret                     ;RanPos also in #a
784
785 ;--------------------------- enemy fires --------------------------------------
786
787 Enemy_fires:                    ;de = x,y
788         push de
789         dec d
790         dec d                   ;d = x-2
791         inc e                   ;e = y+1
792
793         ld  b,nrebullets
794         ld  hl,ebullets
795 find_ebullet:
796         ld  a,(hl)
797         or  a
798         jr  z,found_ebullet     ;0 = not used
799         inc hl \ inc hl \ inc hl
800         djnz find_ebullet       ;look next bullet
801         ret
802
803 found_ebullet:
804         ld  (hl),1              ;use bullet &&&
805         inc hl
806         ld  (hl),d              ;set x-pos
807         inc hl
808         ld  (hl),e              ;set y-pos
809         pop de
810         ret         
811
812 ;----------------------------- enemy bullets ----------------------------------
813
814 Enemy_bullets:
815         ld  hl,ebullets
816         ld  b,nrebullets
817 handle_bullet:
818         push bc
819         push hl
820         ld  a,(hl)              ;load bulletType in a
821         or  a                   ;is it 0?
822         jr  nz,enemy_bullet     ;no: handle bullet
823 next_bullet:
824         pop hl                  ;do not move the <pop hl>
825         pop bc
826         inc hl \ inc hl \ inc hl
827         djnz handle_bullet
828         ret
829
830 enemy_bullet:
831         ld  b,a                 ;save type
832         inc hl                  ;bullet x
833         ld  a,(hl)              ;check if it has reached the left side of scrn
834         and %11111110           ;it is <2 (0 or 1)?
835         jr  z,remove_ebullet    ;yes, remove bullet
836         dec (hl)                ;move one left
837         dec (hl)                ;and another one
838         ld  d,(hl)              ;d=x
839         inc hl                  ;@y
840
841         ld  a,b                 ;restore type
842         dec a                   ;type 1?
843         jr  z,ebullet_common    ;normal bullet
844
845 ebullet_down:
846         ld  a,(timer)
847         rra
848         jr  c,ebullet_common
849         inc (hl)
850
851 ebullet_common:
852         ld  e,(hl)              ;e=y
853         ld  ix,spr_bullete1     ;display enemy bullet
854         call putsprite
855
856 ebullet_hits:
857         ld  a,(your_occ)
858         or  a
859         jr  nz,next_bullet      ;0 = you're normal
860
861         pop hl
862         push hl
863         inc hl                  ;check x
864         ld  a,(x)
865         sub (hl)
866         add a,6
867         jp  m,next_bullet
868         cp  9
869         jr  nc,next_bullet
870
871         inc hl                  ;check y
872         ld  a,(y)
873         sub (hl)
874         add a,6
875         jp  m,next_bullet
876         cp  9
877         jr  nc,next_bullet
878
879         call damage_you         ;HIT!!
880 remove_ebullet:
881         pop hl                  ;hl could be destroyed by damage_you
882         ld  (hl),0              ;bullet > unused
883         jr  next_bullet+1       ;next bullet (SKIP THE <POP HL> = one byte)
884
885 ;--------------------------- handle enemies -----------------------------------
886
887 Handle_enemies:
888         ld  hl,enemies
889         ld  b,nrenemies         ;handle all enemies
890
891 handle_enemy:
892         push bc
893         push hl
894
895         ld  a,(hl)
896         and %00000011
897         jr  z,next_enemy        ;occ "no enemy" 0
898         dec a
899         jr  z,exploding_enemy   ;occ "exploding" 1
900         ld  b,a                 ;b=2 if moving, otherwise b=1
901
902 normal_enemy:                   ;occ "normal" 2 or "moving" 3
903         inc hl
904         push hl
905
906         ld  e,(hl)              ;e = enemy type
907         ld  c,e                 ;c = e
908         ld  d,0                 ;de = e
909         ld  hl,sprites          ;hl = @sprites offset-table
910         add hl,de               ;points to offset of current enemy offset
911         ld  e,(hl)              ;de = @enemy offset
912
913         ld  ix,spr_enemy00      ;first enemy sprite
914         add ix,de               ;add offset for current enemy
915         pop hl
916
917         inc hl
918         ld  a,(hl)              ;x
919         dec a                   ;move left
920         jr  c,remove_enemy      ;off screen
921         jr  z,remove_enemy      ;"
922         ld  d,a
923
924         inc hl
925         ld  e,(hl)              ;y
926         ld  a,b                 ;moving state was stored in b earlier
927         dec a                   ;is it 1?
928         call nz,moving_enemy    ;2 = moving enemy
929
930         dec hl                  ;@x
931         ld  (hl),d              ;store new x
932
933 check_enemyfire:
934         ld  a,c                 ;a = enemy type
935         or  a                   ;type 0? (pickup)
936         jr  z,firing_done       ;pickups don't fire
937
938         ld  bc,add2enemy+1-2    ;offset of <xtra enemy info: fire>
939         add hl,bc               ;go there (@hl)
940         dec (hl)                ;decrease counter till next blast
941         ld  a,(hl)              ;load new counter
942         or  a                   ;has it reached zero?
943         jr  nz,firing_done      ;finished if not
944
945         add a,64                ;re-set counter for next blast
946         ld  (hl),a              ;save
947         call Enemy_fires        ;fires bullet
948
949 firing_done:
950         push de                 ;save registers for firing-use
951         call putsprite          ;display sprite @ix
952         pop  de                 ;restore (destroyed by putsprite)
953
954 next_enemy:
955         pop hl
956         ld  bc,$0004
957         add hl,bc
958         pop bc
959         djnz handle_enemy
960         ret
961
962 remove_enemy:
963         pop hl
964         ld  (hl),$0000          ;bye bye enemy
965         push hl
966         jr  next_enemy
967
968 exploding_enemy:
969         inc  hl
970         push hl
971         ld   a,(hl)
972         call explosion_stuff    ;display explosion
973         pop  hl
974
975         ld  a,(hl)
976         cp  15
977         jr  z,remove_enemy      ;remove when at last frame
978         inc a
979         ld  (hl),a              ;next frame
980         jr  next_enemy
981
982 ;--------------------------- moving enemies -----------------------------------
983
984 moving_enemy:
985 movetype_updown:
986         ld  bc,add2enemy
987         add hl,bc
988
989         ld  a,(hl)
990         dec a
991         jr  nz,move_updated
992         add a,128
993 move_updated:
994         ld  (hl),a
995
996         or  a                   ;reset carry flag
997         sbc hl,bc
998         and %00100000
999         jr  z,movedown
1000
1001 moveup:
1002         ld  a,(hl)              ;load y-position
1003         dec a                   ;decrease y-pos (=move up)
1004         ret m                   ;don't move off the screen (y<0)
1005         ld  (hl),a              ;save new y-pos
1006         ret                     ;finish
1007 movedown:
1008         ld  a,(hl)              ;load current y
1009         inc a                   ;increase y-pos
1010         cp  55                  ;compare with bottom
1011         ret nc                  ;return if it has passed that line (>40)
1012         ld  (hl),a              ;otherwise save new position
1013         ret                     ;and return
1014
1015 ;--------------------------- check collision ----------------------------------
1016
1017 Enemies_hit:
1018         ld  a,(your_occ)
1019         or  a                   ;0 = you're normal
1020         ret nz
1021
1022         ld  de,(x)              ;e = X, d = Y
1023         ld  hl,enemies
1024         ld  b,nrenemies         ;check all 20 enemies
1025 check_collision:
1026         push hl
1027         ld  a,(hl)
1028         and %00000010
1029         jr  z,check_next        ;2 or 3 = ok
1030         inc hl
1031
1032 collide_enemy:
1033 ;       push hl
1034 ;       push bc
1035 ;       ld  hl,enemy00          ;enemy 1 specs
1036 ;       add a,a                 ;a=type*2
1037 ;       add a,a                 ;a=type*4
1038 ;       ld  c,a                 ;c=type
1039 ;       ld  b,0                 ;bc = 4 * enemy nr.
1040 ;       add hl,bc               ;hl = enemy specs
1041 ;       ld  a,(hl)              ;load size byte
1042 ;       pop bc
1043 ;       pop hl
1044 ;       ld  c,a                 ;save size in c
1045
1046         inc hl
1047         ld  a,(hl)              ;check x match
1048         sub e                   ;enemy position minus yours
1049         add a,6
1050         jp  m,check_next
1051         cp  12
1052         jr  nc,check_next
1053
1054         inc hl
1055         ld  a,(hl)              ;check y match
1056         sub d                   ;same as with x-check
1057         add a,6
1058         jp  m,check_next
1059         cp  12
1060         jr  nc,check_next
1061         dec hl
1062         dec hl
1063
1064 take_pickup:
1065         ld  a,(hl)              ;load enemy type
1066         or  a
1067         jr  nz,collide          ;enemy when <>0
1068
1069         push hl
1070         ld  hl,your_pickup      ;your pickups
1071         ld  a,(hl)              ;current
1072         inc a                   ;go to next
1073         cp  5                   ;pickups >=5
1074         jr  c,not_maxpickup
1075         ld  a,1                 ;yes: reset to pickup 1
1076 not_maxpickup:
1077         ld  (hl),a              ;save new
1078         call disp_icons         ;display altered pickupicons
1079         pop hl
1080
1081         dec hl                  ;to enemy occ
1082         xor a                   ;set to 0 = gone
1083         ld  (hl),a              ;remove
1084         jr  check_next          ;all done, next..
1085
1086 collide:
1087         xor a
1088         ld  (hl),a              ;explosionFrame 0
1089         dec hl
1090         inc a
1091         ld  (hl),a              ;set to explode
1092         call damage_you         ;auch!
1093
1094 check_next:
1095         pop hl
1096         inc hl
1097         inc hl
1098         inc hl
1099         inc hl
1100         djnz check_collision
1101         ret
1102
1103 ;--------------------------- show icon ----------------------------------------
1104
1105 disp_icons:
1106         ld  hl,VIDEO_MEM+(16*57);57 rows down = seven rows from bottom
1107         ld  b,16*7              ;draw 16x (screen width) 7x (height)
1108 cleanline:
1109         ld  a,%00000000         ;blank line mask
1110         ld  (hl),a              ;draw one piece of the divider-line
1111         inc hl                  ;move right (8 pixels = 1 byte)
1112         djnz cleanline          ;repeat (16bytes * 7rows * 8pixels)
1113
1114         ld  hl,VIDEO_MEM+(56*16)
1115         ld  (PutWhere),hl
1116
1117         call disp_lives
1118
1119         ld  ix,spr_icon01       ;armorIcon
1120         ld  de,$1a01            ;icon #1
1121         call putwidesprite      ;display icon
1122         call disp_armor         ;display value
1123
1124         ld  ix,spr_icon00
1125         ld  a,(torp_occ)
1126         or  a
1127         jr  z,no_torp
1128         ld  ix,spr_icon02       ;torpedoIcon
1129 no_torp:
1130         ld  de,$2a01            ;icon #2
1131         call putwidesprite      ;display
1132
1133         ld  ix,spr_icon00       ;
1134         ld  de,$3a01            ;icon #3
1135         call putwidesprite
1136
1137         ld  ix,spr_icon00       ;emptyIcon
1138         ld  a,(your_laser)
1139         or  a
1140         jr  z,no_laser
1141         ld  ix,spr_icon04       ;laserIcon
1142 no_laser:
1143         ld  de,$4a01            ;icon #4
1144         call putwidesprite
1145
1146         ld  ix,spr_icon00       ;emptyIcon
1147         ld  a,(your_multiples)
1148         or  a
1149         jr  z,no_multiples
1150         ld  ix,spr_icon05
1151 no_multiples:
1152         ld  de,$5a01            ;icon #5
1153         call putwidesprite
1154
1155         ld  a,(your_pickup)     ;pickups taken
1156         add a,a                 ;picks*2
1157         ret z                   ;return if no pickups
1158         add a,a                 ;picks*4
1159         add a,a                 ;picks*8
1160         add a,a                 ;picks*$10
1161         add a,$0a               ;add 0ah
1162         ld  d,a                 ;y-pos = picks * $10 + $0a (1a,2a,3a,4a,5a)
1163         ld  e,$01               ;x-pos = bottom (1a01,2a01,3a01,4a01,5a01)
1164
1165         ld  ix,spr_icon
1166         call putwidesprite
1167         ret
1168
1169 disp_armor:
1170         ld  hl,$3926            ;Display Armor left
1171         ld  (_penCol),hl        ;place @ armorIcon
1172         ld  a,(your_armor)      ;load armor left
1173         add a,'0'               ;make digit
1174         call _vputmap           ;display char
1175         ret
1176
1177 disp_lives:
1178         ld  hl,$3900            ;display Lives
1179         ld  (_penCol),hl        ;bottom left
1180         ld  hl,savestr+2
1181         ld  (hl),'L'
1182         inc hl
1183         ld  (hl),'x'
1184         inc hl
1185
1186         ld  a,(lives)           ;nr of lives in a
1187         add a,'0'               ;make digit
1188         ld  (hl),a
1189         dec hl \ dec hl
1190         call _vputs             ;display on screen
1191         ret
1192
1193 ;--------------------------- game over / new game / death ---------------------
1194
1195 game_over:
1196         call _clrLCD            ;clear screen
1197         ld  hl,$0603
1198         ld  (_curRow),hl        ;center
1199         ld  hl,txt_gameover
1200         call _puts              ;display "GAME OVER"
1201
1202         ld  b,$20
1203 wait2:  halt \ halt
1204         djnz wait2              ;delay
1205         call _getkey            ;wait for keypress
1206
1207         pop hl                  ;=ret (game_over was called from a procedure)
1208         ret                     ;quit to TI-OS or shell
1209
1210 New_game:
1211         xor a                   ;score 0
1212         ld  (score),a           ;reset score
1213         inc a                   ;level #1
1214         ld  (level),a           ;reset level nr
1215         ld  hl,level01          ;set level pointer to level#1
1216         ld  (levelp),hl         ;reset level pointer
1217         ld  hl,lives            ;starting lives
1218         ld  (hl),4              ;3 lives (will be decreased @ You_die)
1219
1220 You_die:
1221         ld  hl,lives
1222         dec (hl)                ;decrease lives
1223         ld  a,(hl)              ;load lives left
1224         inc a                   ;if lives=0ffh then a=0
1225         jr  z,game_over         ;if so, game's over
1226
1227         xor a                   ;a=0
1228         ld  (your_armor),a      ;no armor
1229         ld  (torp_occ),a        ;no torpedoes
1230  inc a
1231         ld  (your_laser),a      ;no laser
1232  xor a
1233         ld  (your_pickup),a     ;reset pickups
1234         ld  (your_multiples),a  ;no multiples
1235         jr  nonext_level
1236
1237 ;--------------------------- next level ---------------------------------------
1238
1239 Next_level:
1240         ld  hl,level            ;level number
1241         inc (hl)                ;increase it
1242         ld  hl,(levelp)         ;level pointer
1243         inc hl
1244         inc hl
1245         inc hl                  ;update to point to next level
1246         ld  (levelp),hl         ;save
1247
1248 nonext_level:
1249         ld  a,80
1250         ld  (nextevent),a       ;time to first enemy appearance
1251
1252         ld  hl,(levelp)         ;level pointer
1253         ld  a,(hl)              ;load new level-enemy type
1254         ld  (eventenemy),a      ;set level-enemy
1255         inc hl
1256         ld  a,(hl)              ;load new appearance-time
1257         ld  (eventtime),a       ;set
1258         inc hl
1259         ld  a,(hl)              ;load nr of enemies in this level
1260         ld  (eventleft),a       ;set nr of events left
1261
1262         xor a
1263         ld  (timer),a           ;reset time
1264         ld  hl,your_occ         ;hl = your_occ
1265         ld  (hl),a              ;reset your ship (not exploding)
1266         inc hl                  ;hl = your_inv
1267         ld  (hl),50             ;set 50 frames invulnerable
1268         ld  hl,x                ;begin position x=...
1269         ld  (hl),a              ;...=a=0=left
1270         inc hl                  ;y=...
1271         ld  (hl),24             ;...=24=middle
1272
1273         xor a                   ;reset previous positions
1274         ld  hl,your_prevpos     ;place all previous positions
1275         ld  b,16                ;all 16 of them
1276 place_multiples:
1277         ld  (hl),a              ;set prev-x to 0
1278         inc hl                  ;next
1279         ld  (hl),24             ;set prev-y to 24
1280         inc hl                  ;next
1281         djnz place_multiples    ;repeat
1282
1283 ;--------------------------- setup game ---------------------------------------
1284
1285 game_setup:
1286         call _clrLCD            ;clear screen
1287         ld a,%10111011
1288         ld  hl,VIDEO_MEM        ;screen location (top left)
1289         ld  b,0                 ;b = 0 (loop 0-1 = 0FFh = 256 times)
1290 clearloop2:
1291         inc a
1292         ld  (hl),a              ;clear four times (total = 256*4 = 1024 bytes)
1293         inc hl
1294         ld  (hl),a
1295         inc hl
1296         xor $ff
1297         ld  (hl),a
1298         inc hl
1299         ld  (hl),a
1300         inc hl
1301         xor $ff
1302         djnz clearloop2         ;repeat 256x
1303
1304         ld  hl,$0703
1305         ld  (_curRow),hl        ;center
1306         ld  hl,txt_level
1307         call _puts              ;display "LEVEL "
1308
1309         ld  a,(level)
1310         ld  l,a
1311         ld  h,$00
1312
1313         call UNPACK_HL
1314         add a,'0'
1315         ld  b,a
1316         call UNPACK_HL
1317         add a,'0'
1318         call _putc              ;display second digit
1319         ld  a,b
1320         call _putmap            ;display first digit
1321
1322         ld  hl,$0904
1323         ld  (_curRow),hl        ;display lives left below level nr
1324         ld  hl,txt_lives        ;bar text: "Lx0"...
1325         ld  a,(lives)           ;lives left
1326         add a,'0'               ;make value
1327         ld  (txt_lives+3),a     ;add to text
1328         call _puts              ;display the string
1329
1330         ld  b,$20
1331 wait:   halt \ halt
1332         djnz wait               ;delay
1333         call _getkey            ;wait for keypress
1334
1335         call _clrLCD            ;clear screen
1336         call disp_icons         ;display bottom icons
1337
1338         ld  hl,VIDEO_MEM+(16*56);56 rows down = eight rows from bottom
1339         ld  b,16                ;draw 16x (screen width)
1340 drawline:
1341         ld  a,%11111111         ;horizontal line mask
1342         ld  (hl),a              ;draw one piece of the divider-line
1343         inc hl                  ;move right (8 pixels = 1 byte)
1344         djnz drawline           ;repeat (16bytes * 8pixels =128= screen width)
1345         ret
1346
1347 ;--------------------------- putsprite ----------------------------------------
1348 ;--------------------------- de =(X,Y) ----------------------------------------
1349
1350 offsets_table:
1351         .db 128,64,32,%10000,%01000,%00100,%00010,%00001
1352 putsprite:
1353         ld  a,d                 ;a = X
1354         and %00000111           ;a = X mod 8 = bit nr. to mask
1355         ld  hl,offsets_table    ;pixel mask table
1356         ld  c,a                 ;bit nr.
1357         ld  b,0                 ;word
1358         add hl,bc               ;add to table
1359         ld  a,(hl)              ;a = pixel mask
1360         ld  (_smc1+1),a         ;alter pixel mask
1361
1362         ld  hl,GRAPH_MEM        ;save-location
1363         ld  a,e                 ;y-coord
1364         add a,a                 ;y*2
1365         add a,a                 ;y*4
1366         add a,a                 ;y*8
1367         rl  b                   ;b (=0) =b*2+overflow (if y>32 then bc=bc+256)
1368         add a,a                 ;y*16 (width of screen)
1369         rl  b                   ;b=b*2+overflow (if y>64 then bc=bc+512)
1370         srl d                   ;d/2
1371         srl d                   ;d/4
1372         srl d                   ;d/8 (8 bits in byte) ** c is set when overflow
1373         add a,d                 ;a = (Y*16+X/8) mod 256
1374         jr  nc,_n1              ;jump if no carry = no overflow = a<=255
1375         inc b                   ;a>255 so increase bc by 256
1376 _n1:    ld  c,a                 ;c = (Y*16+X/8) mod 256
1377         add hl,bc               ;bc = Y*16+X/8
1378           
1379         ld  d,(ix)
1380         ld  b,(ix+1)
1381 _oloop: push bc                 ;Save # of rows
1382         push hl                 ;Save screen address
1383         ld  b,d                 ;Load width
1384         ld  c,(ix+2)            ;Load one line of image
1385         inc ix
1386 _smc1:  ld  a,1                 ;Load pixel mask
1387 _iloop: sla c                   ;Test leftmost pixel
1388         jr  nc,_noplot          ;See if a plot is needed
1389         ld  e,a                 ;OR pixel with screen
1390         or  (hl)
1391         ld  (hl),a
1392         ld  a,e
1393 _noplot:rrca
1394         jr  nc,_notedge         ;Test if edge of byte reached
1395         inc hl                  ;Go to next byte
1396 _notedge:
1397         djnz _iloop
1398         pop hl                  ;Restore address
1399         ld  bc,16               ;Go to next line
1400         add hl,bc
1401         pop bc                  ;Restore data
1402         djnz _oloop
1403         ret
1404
1405 ;--------------------------- putbigsprite -------------------------------------
1406
1407 putwidesprite:
1408         ld       a,d
1409         and      7
1410         ld       hl,offsets_table
1411         ld       c,a
1412         ld       b,0
1413         add      hl,bc
1414         ld       a,(hl)
1415         ld       (wsmc1+1),a
1416         ld       (wsmc2+1),a
1417         ld       hl,(PutWhere)
1418
1419         ld       a,e
1420         add      a,a
1421         add      a,a
1422         add      a,a
1423
1424         rl       b
1425         add      a,a
1426         rl       b
1427         srl      d
1428         srl      d
1429         srl      d
1430         add      a,d
1431         jr       nc,n1
1432         inc      b
1433 n1:     ld       c,a
1434         add      hl,bc                                    
1435           
1436         ld       d,(ix)       
1437         ld       b,(ix+1)        
1438 woloop: push     bc                         ;Save # of rows
1439         push     hl                         ;Save screen address
1440         ld       b,d                        ;Load width
1441         ld       c,(ix+2)                   ;Load one line of image
1442         inc      ix
1443 wsmc1:  ld       a,1                        ;Load pixel mask
1444 wiloop: sla      c                          ;Test leftmost pixel
1445         jr       nc,wnoplot                 ;See if a plot is needed
1446         ld       e,a                        ;OR pixel with screen
1447         or       (hl)
1448         ld       (hl),a
1449         ld       a,e
1450 wnoplot:
1451         rrca
1452         jr       nc,wnotedge                ;Test if edge of byte reached
1453         inc      hl                         ;Go to next byte
1454 wnotedge:
1455 wsmc2:  cp       1
1456         jr       z,wover_1
1457
1458         djnz     wiloop
1459         pop      hl                         ;Restore address
1460         ld       bc,16                      ;Go to next line
1461         add      hl,bc
1462         pop      bc                         ;Restore data
1463         djnz     woloop
1464         ret
1465 wover_1:
1466         ld       c,(ix+2)
1467         inc      ix
1468         djnz     wiloop
1469         dec      ix
1470         pop      hl
1471         ld       bc,16
1472         add      hl,bc
1473         pop      bc
1474         djnz     woloop
1475         ret
1476
1477 ;------------------------------------------------------------------------------
1478 ;------------------------------- sprites --------------------------------------
1479 ;------------------------------------------------------------------------------
1480
1481 spr_ship:
1482         .db 9,1         ;ship icon
1483         .db %11100000   ; ███
1484         .db %01111000   ;  ████
1485         .db %00111110   ;   █████
1486         .db %01111001   ;  ████  █
1487         .db %01111001   ;  ████  █
1488         .db %01111001   ;  ████  █
1489         .db %00111110   ;   █████
1490         .db %01111000   ;  ████
1491         .db %11100000   ; ███
1492
1493 spr_ship01:
1494         .db 7,7         ;ship alpha class
1495         .db %01111000   ;  ████
1496         .db %11100000   ; ███
1497         .db %11111100   ; ██████
1498         .db %11110010   ; ████  █
1499         .db %11111100   ; ██████
1500         .db %11100000   ; ███
1501         .db %01111000   ;  ████
1502 spr_ship01i:
1503         .db 7,7         ;ship alpha class
1504         .db %01010000   ;  █ █
1505         .db %10100000   ; █ █
1506         .db %01010100   ;  █ █ █
1507         .db %10100010   ; █ █   █
1508         .db %01010100   ;  █ █ █
1509         .db %10100000   ; █ █
1510         .db %01010000   ;  █ █
1511
1512 spr_ship02:
1513         .db 7,7         ;ship beta class
1514         .db %11100000   ; ███
1515         .db %11110000   ; ████
1516         .db %01111100   ;  █████
1517         .db %01110010   ;  ███  █
1518         .db %01111100   ;  █████
1519         .db %11110000   ; ████
1520         .db %11100000   ; ███
1521 spr_ship02i:
1522         .db 7,7         ;ship beta class
1523         .db %01000000   ;  █
1524         .db %10100000   ; █ █
1525         .db %01010100   ;  █ █ █
1526         .db %00100010   ;   █   █
1527         .db %01010100   ;  █ █ █
1528         .db %10100000   ; █ █
1529         .db %01000000   ;  █
1530
1531 spr_multiple:
1532         .db 6,4         ;multiples
1533         .db %01111000   ;  ████
1534         .db %11111100   ; ██████
1535         .db %11111100   ; ██████
1536         .db %01111000   ;  ████
1537
1538 spr_bullet01:
1539         .db 5,3         ;your bullets
1540         .db %00110000   ;   ░▒▓█▒
1541         .db %11111000   ; ░▒▓████▒
1542         .db %00110000   ;   ░▒▓█▒
1543 spr_bullet02:
1544         .db 5,3
1545         .db %11110000   ; ░▒▓███▒
1546         .db %11111000   ; ░▒▓████▒
1547         .db %11110000   ; ░▒▓███▒
1548 spr_bullett1:
1549         .db 4,3         ;▒▒▒
1550         .db %11100000   ;▒███
1551         .db %11110000   ; ████
1552         .db %01110000   ;  ███
1553
1554 spr_bullete1:
1555         .db 4,3         ;enemy bullets
1556         .db %01100000   ;  ▒█▓▒░
1557         .db %11110000   ; ▒███▓▒░
1558         .db %01100000   ;  ▒█▓▒░
1559
1560 ;---------------------------------------- explosion -------------------------------------------
1561
1562 spr_explosion:                               
1563         .db 8,6         ;1
1564         .db %00000000
1565         .db %00011100   ;    ███
1566         .db %00111110   ;   █████
1567         .db %01010110   ;  █ █ ██
1568         .db %00111000   ;   ███
1569         .db %00000000
1570
1571         .db 8,6         ;2
1572         .db %00110000   ;   ██
1573         .db %01001110   ;  █ ▒███
1574         .db %10111110   ; █ █████
1575         .db %01001111   ;  █ ▒████
1576         .db %00111000   ;   ███
1577         .db %00011010   ;    ██ █
1578
1579         .db 8,6         ;3
1580         .db %10110000   ; █ ██
1581         .db %01001110   ;  █  ███
1582         .db %10110101   ; █ ██▒█▒█
1583         .db %01000101   ;  █  ▒█▒█
1584         .db %00111110   ;   █████
1585         .db %01011010   ;  █ ██ █
1586
1587         .db 8,6         ;4
1588         .db %00101010   ; ▒ █▒█ █
1589         .db %01000110   ;  █  ▒██
1590         .db %10110101   ; █ ██ █ █
1591         .db %01100110   ;  ██  ██▒
1592         .db %00111100   ;   ████▒
1593         .db %01011001   ;  █ ██ ▒█
1594
1595         .db 8,6         ;5
1596         .db %01000000   ;  █▒ ▒ ▒
1597         .db %00100101   ;  ▒█  █▒█
1598         .db %00010100   ; ▒ ▒█ █ ▒
1599         .db %01000100   ;  █▒  █
1600         .db %00010010   ;   ▒█▒▒█
1601         .db %10011010   ; █▒ ██ █▒
1602
1603         .db 8,6         ;6
1604         .db %01000100   ;  █   █
1605         .db %00100000   ;   ▒█ ▒ ▒
1606         .db %00000001   ;    ▒ ▒ █
1607         .db %01000100   ;  █   █
1608         .db %00100010   ;   █▒  █
1609         .db %01001000   ; ▒█ ▒█ ▒
1610
1611         .db 8,6         ;7
1612         .db %00001000   ;  ▒  █▒
1613         .db %11000010   ; ██ ▒  █
1614         .db %00000000   ;        ▒
1615         .db %00100000   ;  ▒█  ▒
1616         .db %00000001   ;   ▒   ▒█
1617         .db %00110000   ;  ▒██▒
1618
1619         .db 8,6         ;8
1620         .db %00000100   ;     ▒█
1621         .db %00000000   ; ▒▒    ▒
1622         .db %01000000   ;  █
1623         .db %00000000   ;   ▒
1624         .db %00000010   ;       █▒
1625         .db %00100100   ;   █▒ █
1626
1627 ;--------------------------------------- bar -----------------------------------
1628
1629 spr_icon:
1630         .db 16,7        ;unused   .......:.......:
1631         .db %11111111,%11111111 ; ████████████████
1632         .db %11000000,%00000001 ; ██             █
1633         .db %11000000,%00000001 ; ██             █
1634         .db %11000000,%00000001 ; ██             █
1635         .db %11000000,%00000001 ; ██             █
1636         .db %11000000,%00000001 ; ██             █
1637         .db %11111111,%11111111 ; ████████████████
1638 spr_icon00:
1639         .db 16,7        ;unused   .......:.......:
1640         .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
1641         .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
1642         .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
1643         .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
1644         .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
1645         .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
1646         .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
1647 spr_icon01:
1648         .db 16,7        ;armor  ; .......:.......:
1649         .db %10001111,%10000000 ; █   █████
1650         .db %10010000,%01000000 ; █  █     █  ▒▒▒
1651         .db %10101110,%00100000 ; █ █ ███   █ ▒▒▒
1652         .db %10100111,%10100000 ; █ █  ████ █ ▒▒▒
1653         .db %10101110,%00100000 ; █ █ ███   █ ▒▒▒
1654         .db %10010000,%01000000 ; █  █     █  ▒▒▒
1655         .db %10001111,%10000000 ; █   █████
1656 spr_icon02:
1657         .db 16,7        ;torpedo  .......:.......:
1658         .db %10111000,%00010101 ; █ ███      █ █ █
1659         .db %10011100,%00010101 ; █  ███     █ █ █
1660         .db %10111000,%01001010 ; █ ███    █  █ █
1661         .db %10000000,%11101010 ; █       ███ █ █
1662         .db %11100001,%11100101 ; ███    ████  █ █
1663         .db %10011000,%11110101 ; █  ██   ████ █ █
1664         .db %11100110,%00110010 ; ███  ██   ██  █
1665 spr_icon03:
1666         .db 16,7        ;         .......:.......:
1667         .db %10000000,%01010100 ; █
1668         .db %10011110,%00101010 ; █
1669         .db %10111000,%00010101 ; █
1670         .db %10111111,%10101010 ; █
1671         .db %10111111,%00010101 ; █
1672         .db %10111000,%00101010 ; █
1673         .db %10011110,%01010100 ; █
1674 spr_icon04:
1675         .db 16,7        ;laser    .......:.......:
1676         .db %10000000,%00000000 ; █
1677         .db %10110010,%10000000 ; █ ██  █ █
1678         .db %10111011,%00000000 ; █ ███ ██
1679         .db %10011101,%11111111 ; █  ███ █████████
1680         .db %10111011,%00000000 ; █ ███ ██
1681         .db %10110010,%10000000 ; █ ██  █ █
1682         .db %10000000,%00000000 ; █
1683 spr_icon05:
1684         .db 16,7        ;multiple .......:.......:
1685         .db %10000011,%10000000 ; █     ███
1686         .db %10000001,%11100111 ; █      ████  ███
1687         .db %10000001,%11100000 ; █      ████
1688         .db %10000011,%10000000 ; █     ███
1689         .db %10011000,%00000000 ; █  ██
1690         .db %10111100,%01110000 ; █ ████   ███
1691         .db %10011000,%00000000 ; █  ██
1692
1693 ;---------------------------- texts -------------------------------------------
1694
1695 txt_about:      .db "v0.91.95 ","by Shiar  "
1696                 .db "(ICQ#43840958)",0
1697 txt_1player:    .db "1 PLAYER",0
1698 txt_2players:   .db "2 PLAYERS",0
1699 txt_level:      .db "LEVEL ",0
1700 txt_gameover:   .db "GAME OVER!",0
1701 txt_lives:      .db "Lx0?",0
1702 txt_pressenter: .db "Enter to continue",0
1703
1704 ;---------------------------- save data ---------------------------------------
1705
1706 stored_data_start:
1707
1708 PutWhere        .dw GRAPH_MEM           ;where to put the wide sprites
1709
1710 timer           .db $00                 ;frame counter
1711 level           .db $00                 ;level number
1712 levelp          .dw level01             ;pointer to level data
1713
1714 eventenemy      .db $02                 ;enemy type
1715 eventtime       .db $15                 ;enemy frequency
1716 eventleft       .db $00                 ;nr. of enemies still to come
1717 nextevent       .db $50                 ;time to next event
1718
1719 score           .dw $0000
1720
1721 your_pickup     .db $00
1722 your_occ        .db $00                 ;0=normal 1..16=exploding
1723 your_inv        .db $50                 ;invincibility left
1724 your_armor      .db $13                 ;HP left
1725 lives           .db $04                 ;
1726 x               .db $16                 ;x-pos
1727 y               .db $46                 ;think about it..
1728 hp              .db $00                 ;hitpoints left
1729
1730 your_laser      .db $01                 ;laser avail: 0=no, 1=yes
1731 your_multiples  .db $00                 ;multiples present
1732 torp_occ        .db $00                 ;torp.state: 0=unavail 1=avail 2=presnt
1733 torp_pos        .dw $0000               ;torpedo position (x,y)
1734
1735 ;---------------------------- enemy data --------------------------------------
1736
1737 sprites:
1738         .db $00
1739         .db spr_enemy01-spr_enemy00
1740         .db spr_enemy02-spr_enemy00
1741         .db spr_enemy03-spr_enemy00
1742         .db spr_enemy04-spr_enemy00
1743         .db spr_enemy05-spr_enemy00
1744         .db spr_enemy06-spr_enemy00
1745         .db spr_enemy07-spr_enemy00
1746
1747 spr_enemy00:
1748         .db 7,5         ;pickup
1749         .db %11111110   ; ███████
1750         .db %10011010   ; █  ██ █
1751         .db %11111110   ; ███████
1752         .db %10011010   ; █  ██ █
1753         .db %11111110   ; ███████
1754 spr_enemy01:
1755         .db 6,6         ;enemy type one
1756         .db %00111100   ;   ████
1757         .db %01110000   ;  ███
1758         .db %11110000   ; ████
1759         .db %11110000   ; ████
1760         .db %01110000   ;  ███
1761         .db %00111100   ;   ████
1762 spr_enemy02:
1763         .db 8,6         ;enemy type two
1764         .db %00111111   ;    █████
1765         .db %01111000   ;  ████
1766         .db %11111100   ; ██████
1767         .db %11111100   ; ██████
1768         .db %01111000   ;  ████
1769         .db %00111111   ;    █████
1770 spr_enemy03:
1771         .db 6,6         ;enemy type three
1772         .db %01111100   ;  █████
1773         .db %11110000   ; ████
1774         .db %11111000   ; █████
1775         .db %11111000   ; █████
1776         .db %11110000   ; ████
1777         .db %01111100   ;  █████
1778 spr_enemy04:
1779         .db 6,6         ;enemy type four
1780         .db %00111000   ;   ███
1781         .db %01111100   ;  █████
1782         .db %11111000   ; █████
1783         .db %11111000   ; █████
1784         .db %01111100   ;  █████
1785         .db %00111000   ;   ███
1786 spr_enemy05:
1787         .db 7,6         ;enemy type four
1788         .db %00011110   ;    ████
1789         .db %01111110   ;  ██████
1790         .db %11111100   ; ██████
1791         .db %11111100   ; ██████
1792         .db %01111110   ;  ██████
1793         .db %00011110   ;    ████
1794 spr_enemy06:
1795         .db 7,6         ;enemy type four
1796         .db %00011100   ;    ███
1797         .db %01111110   ;  ██████
1798         .db %10111000   ; █ ███
1799         .db %10111000   ; █ ███
1800         .db %01111110   ;  ██████
1801         .db %00011100   ;    ███
1802 spr_enemy07:
1803         .db 8,6         ;enemy type four
1804         .db %00011110   ;    ████
1805         .db %01111111   ;  ███████
1806 enemy00:.db %10011100   ; █  ███
1807         .db %10011100   ; █  ███
1808         .db %01111111   ;  ███████
1809         .db %00011110   ;    ████
1810
1811         ;enemyInfo:     %000000:HP %10:occ $00:type $00:app $00:unused
1812 enemy01:                        ;#1     HP:1    app:random
1813         .db %00000010,1,1,0
1814 enemy02:                        ;#2     HP:1    app:halflure
1815         .db %00000010,2,3,0
1816 enemy03:                        ;#3     HP:1    app:random      moving
1817         .db %00000011,3,1,0
1818 enemy04:                        ;#4     HP:2    app:lure
1819         .db %00000110,4,2,0
1820 enemy05:                        ;#5     HP:2    app:random      moving
1821         .db %00000111,5,1,0
1822 enemy06:                        ;#6     HP:2    app:lure        moving
1823         .db %00000111,6,2,0
1824 enemy07:                        ;#7     HP:4    app:halflure    moving
1825         .db %00001111,7,3,0
1826
1827 ;----------------------------- level info -------------------------------------
1828
1829 level01:
1830         .db $01,$1b,$2f                 ;enemy nr ; enemy frequency ; next lvl
1831 level02:                                ;frequency must be odd if halfluring!
1832         .db $02,$11,$4b
1833 level03:
1834         .db $03,$1d,$3f
1835 level04:
1836         .db $04,$0d,$4f
1837 level05:
1838         .db $05,$25,$3d
1839 level06:
1840         .db $06,$23,$39
1841 level07:
1842         .db $07,$1f,$f9
1843
1844 ;----------------------------- logo -------------------------------------------
1845
1846 logo_nemesis:
1847 .db %11111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00001011,%11111111,%11111111,%11111111,%11111000
1848 .db %01111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00011011,%11111111,%11111111,%11111111,%11110000
1849 .db %00111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00111011,%11111111,%11111111,%11111111,%11100000
1850 .db %00011111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%01111011,%11111111,%11111111,%11111111,%11000000
1851 .db %00000000,%00000000,%00000001,%00011110,%00010000,%00000000,%10000001,%00011110,%00010000,%000000001,%00000000,%00001000,%01000000,%00000000,%00000000,%00000000
1852 .db %00000000,%00000000,%00000011,%00011110,%00110000,%00000001,%10000011,%00011110,%00110000,%000000011,%00000000,%00011000,%11000000,%00000000,%00000000,%00000000
1853 .db %00000000,%00000000,%00000111,%00011110,%01110000,%00000011,%10000111,%00011110,%01110000,%000000111,%00000000,%00111001,%11000000,%00000000,%00000000,%00000000
1854 .db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
1855 .db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
1856 .db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
1857 .db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
1858 .db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
1859 .db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
1860 .db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
1861 .db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
1862 .db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000111,%11010001
1863 .db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000001,%00011011
1864 .db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000001,%00010101
1865 .db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000001,%00010001
1866
1867 ;----------------------------- end --------------------------------------------
1868
1869         .end
1870 .end
1871
1872 ;----------------------------- NEMESIS'86 by Shiar ----------------------------
1873
1874 ;Game · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · NEMESIS
1875 ;Version  · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·  0.9.94
1876 ;Latest modification  · · · · · · · · · · · · · · · · · · · · · · · · · 4.IX.99
1877 ;Calc · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·  TI-86 only
1878 ;Size · · · · · · · · · · · · · · · · · · · · · · · · · · ·  2694 bytes on calc
1879
1880 ;Author · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · SHIAR
1881 ;ICQ · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·  #43840958
1882 ;E-mail · · · · · · · · · · · · · · · · · · · · · · · · · ·  shiar0@hotmail.com
1883 ;Homepage · · · · · · · · · · · · · · · · · · coming soon (www.wish.net/~shiar)
1884
1885 ;Notes:
1886 ;  <*> This game is not yet finished (BETA) and there may still be some bugs.
1887 ;  <*> Source will be released when the game has been finished.
1888 ;  <*> Have fun, and have even more fun with the completed version of NEMESIS!
1889
1890 ;----------------------------- version history --------------------------------
1891
1892 ;0.01.717 -- 17.VII.99 -- size 909
1893 ;
1894 ;       + used "Galaxian"-game engine (drawings, movement, enemy-routines)
1895 ;       + movement of ship over 3/4 screen (96 pixels; 32 pixels for score)
1896 ;       + enemies moving from right to left, appearing right at specified times
1897 ;
1898 ; 0.1.718 -- 18.VII.99 -- size 832
1899 ;
1900 ;       # no crash when level restarts for the third time
1901 ;       * exit-procedure updated, unnecessary stuff/keychecks removed
1902 ;       - alot of unused code removed
1903 ;       + different types of enemies (just look different)
1904 ;       + collision detection!! enemy ships disappear when you hit them
1905 ;
1906 ; 0.2.718 -- 18.VII.99 -- size 1078
1907 ;
1908 ;       + ability to fire bullets (F1). Enemies disappear on impact
1909 ;       * enemies explode instead of disappearing
1910 ;
1911 ; 0.3.719 -- 19.VII.99 -- size 1326
1912 ;
1913 ;       * bullets appear correctly (not INSIDE your ship)
1914 ;       + some enemies can take multiple hits (differs per class)
1915 ;       + all enemies fire bullets at random
1916 ;       + if you're hit by bullet/enemy, you'll lose one hitpoint
1917 ;
1918 ; 0.4.720 -- 20.VII.99 -- size 1406
1919 ;
1920 ;       # collision detection fixed and optimized (much faster now!)
1921 ;       + shell-icon added (YAS type)
1922 ;       * code optimizations, some data "compression"
1923 ;       * explosion looks better, and some vars removed/smaller
1924 ;       # enemies are removed when at left side (instead of becoming invisible)
1925 ;       + displays level number before each level begins
1926 ;
1927 ; 0.5.725 -- 25.VII.99 -- size 1703
1928 ;
1929 ;       * waits a sec at level display (in case of accidental keypress)
1930 ;       * moving enemies (move up+down)
1931 ;       # bullets removed correctly so they can be used again later
1932 ;       * first level made
1933 ;       # enemy weaponfire is fired from correct positions
1934 ;       + your ship explodes on impact with ships/bullets
1935 ;       * game over screen will be displayed just *after* your ship's gone
1936 ;       + frame counter onscreen
1937 ;
1938 ; 0.6.820 -- 20.IIX.99 -- size 2077
1939 ;
1940 ;       * play field increased to full screen instead of 3/4
1941 ;       + bottom eight lines used for score (etc) display
1942 ;       - no more solid levels, enemies are placed at random
1943 ;       + enemies appear every x turns (depends on level)
1944 ;       # fixed bullets so they don't disappear at 3/4 of the screen
1945 ;       * A LOT of optimizations both in speed and size!!
1946 ;       + enemy type, frequency, and number specified per level
1947 ;       + bottom score bar displays score, lives and icons (to be used later)
1948 ;       * smarter enemy handling (so enemies have different sizes)
1949 ;       + bottom bar divided from playing field by a horizontal line
1950 ;       + five levels (and five enemies) made
1951 ;       # game vars reset at start and game over
1952 ;       + NEMESIS LOGO displayed at startup!! (also, program grew 350bytes ):
1953 ;       + version/credits string displayed below logo: v0.6.820 by shiar (ICQ#)
1954 ;
1955 ; 0.6.825 -- 25.IIX.99 -- size 2085
1956 ;
1957 ;       # pointer to fifth ship corrected (ships in level 5 weren't displayed)
1958 ;       # calc doesn't crash anymore when game is continued after game over!!
1959 ;       + lives are decreased when ship is destroyed
1960 ;       # last eight pixels of divider line are shown correctly now
1961 ;
1962 ;  0.7.92 -- 02.IX .99 -- size 2303
1963 ;
1964 ;       + contrast is increased one level at startup (and restored on exit)
1965 ;       + invulnerable for a sec when you enter the game (inv-pickup later)
1966 ;       + when in invulnerable-mode, your ship look different!
1967 ;       + at the beginning you get three *hitpoints* so you can be hit 3 times
1968 ;       * bottomline icons are now 16 pixels wide and 7 pixels high!
1969 ;       + hitpoint icon added: displays nr. of hps left next to a nice picture
1970 ;       * maximum invulnerability-time is increased (can last upto 1024 frames)
1971 ;       + when invulnerable-mode has nearly expired, your ship flashes!
1972 ;       * again a lot of optimizations esp. in size ('bout 100 bytes)
1973 ;       + pickups! 10% chance a destroyed enemy changes into an armor-pickup
1974 ;       # code optimization caused some bullets to reappear as "fake" bullets
1975 ;       * pickups can't be destroyed by bullets (they pass right through it)
1976 ;
1977 ;  0.8.93 -- 03.IX .99 -- size 2433
1978 ;
1979 ;       + enemies move individually, not all at the same time!! Looks very nice
1980 ;       # titlescreen background is cleared (looked weird in Rascall and TI-OS)
1981 ;       + enemies fire at a ### rate instead of firing at will (too random)
1982 ;       # moving enemies don't move off the screen top/bottom (they wait there)
1983 ;       + seven playable levels going easy to hard (including moving enemies)
1984 ;       # xtraInfo data wasn't reset when a moving enemy entered the game
1985 ;       * longer delay when level is completed (NextLevel screen came too soon)
1986 ;
1987 ;  0.9.94 -- 04.IX .99 -- size 2693
1988 ;
1989 ;       # pickups no longer fire bullets like normal enemies
1990 ;       + <halt>s added so the game runs slower and looks better
1991 ;       + TORPEDOES!!! Bullets that fire downwards! Just like in Nemesis
1992 ;       * a pickup selects the next icon on bottom bar instead of increasing hp
1993 ;       + an icon can be taken by pressing F2. second icon selects torpedoes
1994 ;       + first icon increases armor, icon 3 and 4 are unused for now
1995 ;       * selecting an unused icon (3+4) resets pickups like icon 1 and 2
1996 ;       * when you're destroyed, you loose one life instead of going game over
1997 ;         you also loose all upgrades and pickups, but remain in the same level
1998 ;       * random is more randomized, no more "tricks" to fool the randomizer
1999 ;       # after game over the game is terminated instead of continuing+crashing
2000 ;       - no more armor to start with. you'll have to collect them on your own
2001 ;       * of course optimizations and a few tiny bug fixes (not important)
2002 ;       * increased the size of the enemy bullets so they're better to see
2003 ;
2004 ; 0.91.95 -- 05.IX .99 -- size 2797
2005 ;
2006 ;       + LASERS!!!!! four pickups and you fire laserbeams instead of bullets
2007 ;       * multiple enemies can be hit at once, very usefull when firing lasers
2008 ;       + MULTIPLE!! like the (shadow-)multiple from MSX-Nemesis. for 5 pickups
2009 ;         you get an multiple following you, firing bullets and lasers like you
2010 ;       * most data (enemy positions) stored at TEXT_MEM and DELC_LEN positions
2011 ;         instead of in program, saving A LOT of bytes in program-size
2012 ;       - at release of 0.91 bullets didn't work, laser is used instead
2013
2014
2015 ;        + added        - removed       * changed       # bug fixed