9 Title: .db "Nemesis v0.1.718 by Shiar",0
13 just_fired = $c0f9 ;byte
16 ;-------------------- init ----------------------------------------------------
21 ;-------------------- main menu -----------------------------------------------
25 ;-------------------- exit ----------------------------------------------------
30 ;----------------------- game setup -------------------------------------------
33 ld hl,stored_data_start
34 ld bc,variables_end-stored_data_start-1
36 ;---------------------- display setup ----------------------------------------
60 ;------------------------------------------------------------------------------
61 ;-------------------------- game loop -----------------------------------------
62 ;------------------------------------------------------------------------------
65 ld hl,timer ;update time
70 ld hl,GRAPH_MEM+(16*12)
82 ld a,%00111111 ;<exit> pressed?
88 jr z,quit ;yes: quit game
91 call Level_event ;insert enemies
92 call Handle_Ship ;move you
93 call Fire_bullet ;check for fire
95 call Handle_enemies ;move enemies
96 call Enemies_hit ;check for collision with enemies
98 call Display_Screen ;display all
99 ; halt \ halt \ halt ;delay
100 jr game_main_loop ;loop
104 ;---------------------- display -----------------------------------------------
107 ld a,64 ;Display Image
108 ld hl,GRAPH_MEM+(16*12)
120 ; ld hl,$1007 ;Display Score
126 ;------------------------- handle ship ----------------------------------------
131 ; jr nz,you_not_normal
183 no_up: ld ix,spr_ship
220 ;------------------------- fire bullet ----------------------------------------
237 or a ;can't fire when 1
239 ld (hl),1 ;just fired
248 jr z,found_ybullet ;0 = no bullet here
250 djnz find_ybullet ;look next bullet
254 ld (hl),1 ;use bullet
265 ;------------------------ handle bullets --------------------------------------
269 ld (hl),0 ;dump this bullet!
287 djnz scan_your_bullets
298 ld (hl),a ;save new pos.
304 call drw_spr ;display bullet
309 hit_enemies: ;Hits with normal enemies
314 jr nz,nohit ;no hit when enemy_occ <> 1
336 ld (hl),a ;remove bullet
341 ld (hl),a ;explosionFrame 0
343 ld (hl),2 ;set to explode
353 djnz hit_enemies ;check next enemy
356 ;--------------------------- level events -------------------------------------
403 ;--------------------------- handle enemies -----------------------------------
415 jr z,normal_enemy ;occ "normal" 1
417 jr z,exploding_enemy ;occ "exploding" 2
418 jr next_enemy ;occ "no enemy" 0
449 ld (hl),$0000 ;bye bye enemy
465 call explosion_stuff ;display explosion
470 jr z,enemy_gone ;remove when at last frame
472 ld (hl),a ;next frame
475 ;--------------------------- check collision ----------------------------------
478 ld de,(x) ;e = X, d = Y
488 ret z ;-1 = no more enemies
491 jr nz,nocrash ;1 = enemy
495 ld a,(hl) ;check x match
503 ld a,(hl) ;check y match
512 ld (hl),0 ;explosionFrame 0
514 ld (hl),2 ;set to explode
520 ;--------------------------- next level ---------------------------------------
527 ;--------------------------- putsprite ----------------------------------------
530 .db 128,64,32,16,8,4,2,1
561 _oloop: push bc ;Save # of rows
562 push hl ;Save screen address
564 ld c,(ix+2) ;Load one line of image
566 _smc1: ld a,1 ;Load pixel mask
567 _iloop: sla c ;Test leftmost pixel
568 jr nc,_noplot ;See if a plot is needed
569 ld e,a ;OR pixel with screen
574 jr nc,_notedge ;Test if edge of byte reached
575 inc hl ;Go to next byte
577 pop hl ;Restore address
578 ld bc,12 ;Go to next line
590 ldhld: call UNPACK_HL
608 up_data: .db "PAD98",0
612 ;------------------------------- sprites --------------------------------------
618 .db %11111100 ; ██████
619 .db %11110010 ; ████ █
620 .db %11111100 ; ██████
625 .db 5,3 ;your bullets
627 .db %11111000 ; █████
631 .db 3,3 ;enemy bullets
637 .db 6,6 ;enemy type one
645 .db 6,6 ;enemy type two
646 .db %01111100 ; █████
648 .db %10111000 ; █ ███
649 .db %10111000 ; █ ███
651 .db %01111100 ; █████
653 .db 6,6 ;enemy type three
655 .db %01111100 ; █████
656 .db %11111000 ; █████
657 .db %11111000 ; █████
658 .db %01111100 ; █████
726 ;---------------------------- enemy types -------------------------------------
728 ;enemy01: .db $01,$00,$00 ;$hits $fire frequency
729 ;enemy02: .db $02,$00,$00
730 ;enemy03: .db $04,$00,$00
732 ;---------------------------- level data --------------------------------------
735 .db $10,$00,$40 ;$time (ff=end) $type $y-pos
756 ;---------------------------- texts -------------------------------------------
759 .db "* * NEMESIS * *",0
761 ;---------------------------- save data ---------------------------------------
765 curevent .dw Leveldata+1 ;next event
766 nextevent .db (Leveldata) ;time to next event
773 ybullets .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;10 x (state,x,y)
774 ;ebuls .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
775 enemies .dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
776 .dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
777 .dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
778 .dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
779 .dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
780 ; 0011 2233 >> 0=occupation (0=no enemy 1=normal 2=exploding)
781 ; 1=frame/ship 2=x 3=y
786 warped_status .db $00
801 ;0.01.717 -- 17.VII.99 -- size 984
803 ; + movement of ship over whole screen
804 ; + enemies moving from right to left, appearing right at specified times
806 ; 0.1.718 -- 18.VII.99 -- size 907
808 ; * no crash when level restarts for the third time
809 ; * exit-procedure updated, unnecessary stuff/keychecks removed
810 ; * alot of unused code removed
811 ; + different types of enemies (just look different)
812 ; + collision detection!! enemy ships disappear when you hit them
814 ; 0.2.718 -- 18.VII.99 -- size 1153
816 ; + ability to fire bullets (F1). Enemies disappear on impact
817 ; * enemies explode instead of disappearing