;------------------------------------------------------------------------------
;---------------------- NEMESIS -----------------------------------------------
;------------------------------------------------------------------------------
-; >>> NEMESIS <<< Version 0.96 BETA by SHIAR
-; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
; Title : Nemesis
; Version : 0.96
; Release Date : 30.X.99
-; Filename : nemesis.86p (4836) nemesis0.86p (888)
+; Filename : nemesis.86p (5kb)
; Author(s) : Shiar
; Email Address : shiar0@hotmail.com
; ICQ ; #43840958
-; Web Page : come.to/shiar
-; Description : cool arcade-shoot-em-up-game (release 12/99)
-; Where to get this game : www.ticalc.org
-; Other games by author : N/A
+; Web Page : www.shiar.org
+; Description : cool arcade-shoot-em-up-game
+; Where to get this game : www.shiar.org | www.ticalc.org
+; Other games by author : Worm
-; ABOUT: This source should only be used for learning practises, do not
-; alter it, and certainly do not distribute an altered version!!
+; ABOUT: This source should only be used for learning practises, do not
+; alter it, and certainly do not distribute an altered version!!
; NOTE: &&& marks uncertainties or things to optimize
-;---------------------- nemesis.z80 start -------------------------------------
+;---------------------- nemesis.z80 start -----------------------------------
#include "asm86.h"
#include "ti86asm.inc" ;standard ti86 romcalls
storepos = _asm_exec_ram+6000 ;120 OF 165
storepos2 = _asm_exec_ram+6200 ;141 OF 167
-;---------------------- in-game vars ------------------------------------------
+;---------------------- in-game vars ----------------------------------------
just_fired = storepos+2 ; +2 ;counts how long a blast lasts
curline = storepos+2 ; +2 ;used to display SFX
;^-----------------------------------<1 ;-120=$78
-enemies = storepos2 ; +0 ;info about each enemy (6byt)
-enemysize = 7
-nrenemies = 10 ;max. nr of enemies
+enemies = storepos2 ; +0 ;info about each enemy
+enemysize = 7 ;infobytes per enemy
+nrenemies = 16 ;max. nr of enemies
-ybullets = enemies+(nrenemies*enemysize) ;60 bytes = 20(state,x,y)
+ybullets = enemies+(nrenemies*enemysize) ;60 bytes = 20(state,damg,x,y)
nrybuls = 32 ; +80\
-ebullets = ybullets+(nrybuls*3) ;+110 ;30 bytes = 10(state,x,y)
+ebullets = ybullets+(nrybuls*4) ;+110 ;30 bytes = 10(state,x,y)
nrebuls = 16
ybuls = ebullets+(nrebuls*3) ;+140
; [HP64] [000000:HP left 00:(00=no enemy 01=exploding 10=normal 11=moving)]
; [ship type or explosion frame] [x] [y] [move] [fire]
-;---------------------- introduction ------------------------------------------
+;---------------------- introduction ----------------------------------------
nop ;hello yas/ase/rascall/whathever
jp init ;here's the program, but first: a description
.db %11100000 ; ███ ;recommend 80x50 screen mode
.DB 0 ;clear stupid YAS-line
-;---------------------- init --------------------------------------------------
+;---------------------- init ------------------------------------------------
level_name: .db 8,"nemesis0"
ld i,a
im 2
-;---------------------- main menu ---------------------------------------------
+;---------------------- main menu -------------------------------------------
LogoPut:
xor a ;white bitmask (a=0)
startnewgame:
cal New_game
-;------------------------------------------------------------------------------
-;---------------------- game loop ---------------------------------------------
-;------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;---------------------- game loop -------------------------------------------
+;----------------------------------------------------------------------------
game_main_loop: ;REPEATS FROM HERE EVERY FRAME
ld hl,timer ;update time
ld (curweapdamage),a
ret
-;--------------------------- ground -------------------------------------------
+;--------------------------- ground -----------------------------------------
Handle_ground:
ld a,(timer)
ld b,5
jp damage_you
-;--------------------------- ceiling ------------------------------------------
+;--------------------------- ceiling ----------------------------------------
Handle_ceiling:
ld a,(timer)
ld b,5
jp damage_you ;otherwise you don't wanna be in that ship
-;--------------------------- move stars ---------------------------------------
+;--------------------------- move stars -------------------------------------
DisplayStars: ;inputs: hl=starx# a=stars# b=nrstars#
ld e,(hl)
dnz movestars_loop
ret ;for stupid people, here's another comment...
-;--------------------------- pause --------------------------------------------
+;--------------------------- pause ------------------------------------------
Pause:
ld hl,$0200 ;top left
jr nz,pause ;no, wait some more
ret ;continue
-;--------------------------- teacher ------------------------------------------
+;--------------------------- teacher ----------------------------------------
Teacher:
ld (iy+12),5 ;enable flashing cursor
jr teacherloop
-;--------------------------- exit ---------------------------------------------
+;--------------------------- exit -------------------------------------------
quit:
im 1 ;release keyfix procedure
jp _clrWindow ;as _clrLCD but also clears TEXT_MEM (like the
;_clrScrn) AND also executes _homeup and ret
-;--------------------------- display ------------------------------------------
+;--------------------------- display ----------------------------------------
Display_Screen:
ld hl,GRAPH_MEM ;from storage (top left)
savestr: ;@here the score will be stored
.db "00000",0 ;don't worry, it's just temporary
-;------------------------- handle ship ----------------------------------------
+;------------------------- handle ship --------------------------------------
Handle_Ship:
ld a,(your_occ) ;are
ld (your_occ),a ;set to explode
ret
-;------------------------- place multiples ------------------------------------
+;------------------------- place multiples ----------------------------------
Place_multiples:
ld (mx),de ;set last multiple-position
dnz place_multiples ;repeat
ret
-;------------------------- select upgrade -------------------------------------
+;------------------------- select upgrade -----------------------------------
select:
ld hl,your_pickup ;select pickups
ld hl,your_weapon
ld a,(hl)
inc a
- cp 10
- jp nc,disp_icons ;>=10
- ld (hl),a
- cal loadweapon
+ cp maxnrweapons
+ jp nc,disp_icons ;weapon maxed out
+ ld (hl),a ;set new weapon
+ cal loadweapon ;load it (damage and stuff)
jp disp_icons ;display n return
select4:
dec a ;is it 4?
ld (hl),0 ;reset pickups
jp disp_icons ;display/return
-;------------------------- fire bullet ----------------------------------------
+;------------------------- fire bullet --------------------------------------
Fire_bullet:
ld hl,just_fired
ret
enemy_lashit: ;&&&before nolashit
+ ld a,1 ;damage
cal enemy_hit
jr nolashit
fire_ybullet:
ld hl,ybullets
- ld de,3
+ ld de,4
ld b,maxbullets
find_ybullet:
ld a,(hl)
found_ybullet:
ld (hl),c ;use the bullet and set correct bullet-type
+ inc hl ;@damage
+ ld (hl),1 ;set bullet damage
+curweapdamage =$-1
ld a,(firex) ;your x-pos
add a,5 ;place bullet in front of you
inc hl ;go to bullet-x
ld (weapincs),a ;reset damage
ret
-;------------------------ handle bullets --------------------------------------
+;------------------------ handle bullets ------------------------------------
bullet_left:
ld a,124
ld (hl),a ;save new pos.
ld d,a ;d = X
- inc hl ;to y-pos
+ inc hl ;@y-pos
ld a,c
cal _shracc
dec a
ret
remove_bullet:
- dec hl
+ pop hl ;cal bullet_left
+ pop hl ;enemy+type
ld (hl),0 ;dump this bullet!
- pop hl
- jr next_ybullet
+ jr next_ybullet+1 ;+1:skip pop hl at next_ybullet
Handle_bullets:
ld hl,ybullets
ld b,maxbullets
scan_bullets:
- psh bc
- psh hl
+ psh bc ;bullet counter
+ psh hl ;save enemy+type
ld (temp1),hl ;needed for check_bullethits
- ld a,(hl)
- inc hl
+ ld a,(hl) ;@bulletType
+ inc hl ;@damage
+ inc hl ;@x
or a
jp z,next_ybullet ;bulletType=0 >> no bullet
- ld c,a
+ ld c,a ;c=type
and %1111
- ld b,a
+ ld b,a ;b=0000type
cal bullet_left ;move bullet left
display_bullet:
- psh de
+ psh de ;save de =position
+ dec hl ;@x
+ dec hl ;@damage
+ ld a,(hl) ;bullet damage=size
ld hl,XLbullettable ;pointer to first bullet
- ld a,(curweapdamage) ;bullet damage=size
srl a
srl a ;per 4
inc a ;must be at least 1
nextbulletlook:
- inc hl ;next bullet
- dec a
+ inc hl ;next bullet sprite pointer
+ dec a ;for each 4 points of damage
jr nz,nextbulletlook
+ ld d,a ;ld d,0
ld a,(hl) ;load pointer offset
- ld d,0
ld e,a ;convert to 16bit
ld ix,spr_bullet01 ;first sprite
add ix,de ;add offset (go to correct sprite)
- pop de ;position saved
+ pop de ;saved position
psh de ;but will be altered so save again
cal putsprite ;display bullet
pop de
cal check_bullethits
next_ybullet:
- pop hl
- pop bc
+ pop hl ;restore enemy+type
inc hl
inc hl
inc hl
+ inc hl ;skip type,dam,x,y: next enemy+type
+ pop bc ;b=counter
dnz scan_bullets ;next bullet (loop)
ret
-;--------------------------- check bullethits --------------------------------
+;--------------------------- check bullethits -------------------------------
check_bullethits: ;INPUT: de=X,Y; (temp1)=bullet
ld b,nrenemies
jp m,nohit
psh hl
- xor a
- ld (0),a ;remove bullet
+ ld hl,0 ;@bulletType
temp1 =$-2
- pop hl
-
+ ld (hl),0 ;remove bullet
+ inc hl ;@damage
+ ld a,(hl) ;set damage
+ pop hl ;enemy+y
cal enemy_hit
nohit:
pop hl
dnz hit_enemies ;check next enemy
ret
-enemy_hit:
- dec hl
- dec hl
- dec hl
-
- ld a,1 ;damage to inflict
-curweapdamage =$-1
- rla
- rla ;*4
+enemy_hit: ;in:a=damage;hl=enemy+y
+ add a,a ;a=damage to inflict
+ add a,a ;first 2 bits used for occ.
ld b,a
- ld a,(hl) ;load occ
- sub b ;decrease HP (if <0 then c is set)
+
+ dec hl ;@x
+ dec hl ;@type
+ dec hl ;@hp00 (occ)
+ ld a,(hl) ;load hp00
+ sub b ;decrease HP (if <0xx then c is set)
ld (hl),a ;save (no flag-changes)
- dec hl ;goto hp64; no change in c
+ dec hl ;@hp64; no change in c
ld a,(hl) ;load; no c-change
- sbc a,0 ;if c then decrease a
+ sbc a,0 ;if cf then decrease a
ld (hl),a ;save back the new value
ret nc ;if a>=0 then return, otherwise explode
ld hl,1 ;increase score by one
jp scoreInc ;+ret
-;--------------------------- handle torpedo ----------------------------------
+;--------------------------- handle torpedo ---------------------------------
Handle_torp:
ld a,(torp_occ)
ld (torp_occ),a
ret
-;--------------------------- level events -------------------------------------
+;--------------------------- level events -----------------------------------
Level_event:
ld hl,nextevent ;time to next event <ld a,(nextevent)
ffireOK:ld (de),a ;save fire
ret ;return
-;--------------------------- enemy fires --------------------------------------
+;--------------------------- enemy fires ------------------------------------
Enemy_fires: ;de = x,y
dec d
ld (hl),e ;set y-pos
ret
-;----------------------------- enemy bullets ----------------------------------
+;----------------------------- enemy bullets --------------------------------
Enemy_bullets:
ld hl,ebullets
ld (hl),0 ;bullet > unused
jr next_bullet+1 ;next bullet (SKIP THE <POP HL> = one byte)
-;--------------------------- handle enemies -----------------------------------
+;--------------------------- handle enemies ---------------------------------
Handle_enemies:
ld hl,enemies+1
ld (hl),a ;next frame
jr next_enemy
-;--------------------------- moving enemies -----------------------------------
+;--------------------------- moving enemies ---------------------------------
moving_enemy:
ld a,(level_move)
inc e ;otherwise save new position
ret ;and return
-;--------------------------- check collision ----------------------------------
+;--------------------------- check collision --------------------------------
Enemies_hit:
ld hl,(x) ;e = X, d = Y
dnz check_collision
ret
-;--------------------------- story -------------------------------------------
+;--------------------------- story ------------------------------------------
storyPage:
psh hl
ld (levelp),hl ;set the level-pointer
ret ;and return
-;--------------------------- SFX ---------------------------------------------
+;--------------------------- SFX --------------------------------------------
CDoSFX:
ld hl,VIDEO_MEM
dnz SFXframe
ret
-;--------------------------- show icon ----------------------------------------
+;--------------------------- show icon --------------------------------------
drawline:
ld (hl),a ;draw one piece of the divider-line
dec hl \ dec hl
jp _vputs ;display on screen +ret
-;--------------------------- proc ---------------------------------------------
+;--------------------------- proc -------------------------------------------
Random5016:
cal Random50 ; a = 0..50
pop hl
jr Decompress
-;--------------------------- game over / new game / death ---------------------
+;--------------------------- game over / new game / death -------------------
chartable:
.db 0,"!<>^",0,0,0,0
.db 0,"xtoje0",0 ;enter..clear
jp c,game_over
jr samelevel
-;--------------------------- next level ---------------------------------------
+;--------------------------- next level -------------------------------------
Next_level:
ld a,(your_armor) ;load current armor
ld bc,(nrenemies*enemysize)+((nrybuls+nrebuls)*3)-1
ldir ;clear enemies + bullets (y/e)
-;--------------------------- setup game ---------------------------------------
+;--------------------------- setup game -------------------------------------
game_setup:
cal BLACKLCD
; ld (weapdaminc),a ;damage increase
ret
-;--------------------------- putsprite ----------------------------------------
-;--------------------------- de =(X,Y) ----------------------------------------
+;--------------------------- putsprite --------------------------------------
+;--------------------------- de =(X,Y) --------------------------------------
offsets_table:
.db $80,$40,$20,$10,8,4,2,1
dnz _oloop
ret ;<jp>s are used instead of <jr> = faster
-;--------------------------- putbigsprite -------------------------------------
+;--------------------------- putbigsprite -----------------------------------
putwidesprite:
ld a,d
dnz woloop
ret
-;------------------------------------------------------------------------------
-;------------------------------- sprites --------------------------------------
-;------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;------------------------------- sprites ------------------------------------
+;----------------------------------------------------------------------------
spr_ship01:
.db 7,7 ;ship alpha class
.db %11111100 ; ██████
.db %01111000 ; ████
+;--------------------------------- bullets ----------------------------------
+
spr_bullet01:
- .db 5,3 ;your bullets
- .db %00110000 ; ░▒▓█▒
- .db %11111000 ; ░▒▓████▒
- .db %00110000 ; ░▒▓█▒
+ .db 5,3 ;dam=0-3
+ .db %00110000 ; ▒██
+ .db %01001000 ; ▒█ ▒█
+ .db %00110000 ; ▒██
spr_bullet02:
+ .db 5,3 ;dam=4-7
+ .db %00110000 ; ▒██
+ .db %01101000 ; ▒██▒█
+ .db %00110000 ; ▒██
+spr_bullet03:
+ .db 5,3 ;dam=8-11
+ .db %00110000 ; ▒██
+ .db %11101000 ;▒███▒█
+ .db %00110000 ; ▒██
+spr_bullet04:
+ .db 5,3 ;dam=8-11
+ .db %00110000 ; ▒██
+ .db %11111000 ;▒█████
+ .db %00110000 ; ▒██
+spr_bullet05:
+ .db 5,3 ;dam=8-11
+ .db %01110000 ; ▒███
+ .db %11111000 ;▒█████
+ .db %01110000 ; ▒███
+spr_bullet06:
.db 5,3
- .db %11110000 ; ░▒▓███▒
- .db %11111000 ; ░▒▓████▒
- .db %11110000 ; ░▒▓███▒
+ .db %11110000 ;▒████
+ .db %11111000 ;▒█████
+ .db %11110000 ;▒████
spr_bullett1:
.db 4,3 ;▒▒▒
.db %11100000 ;▒███
.db %11110000 ; ▒███▓▒░
.db %01100000 ; ▒█▓▒░
-;---------------------------------------- explosion -------------------------------------------
+;-------------------------------- explosion ---------------------------------
spr_explosion:
.db 8,6 ;1
.db %00000000 ;
.db %00000000 ;
-;--------------------------------------- bar -----------------------------------
+;------------------------------------ bar -----------------------------------
spr_iconhalf:
.db 16,7 ;selected .......:
.db 8,7
.db 128,128,128,128,128,128,128 ;128 = %10000000
-;-------------------------- weapondata ----------------------------------------
+;-------------------------- weapondata --------------------------------------
;format:[unused] [ybuls(max.bullets)] [0000:direction 0000:speed] [offset]
+maxnrweapons = 8+1
weapondata:
.db 2,1,%00000010,2,%00000000,0,%00000000,0 ;single fire
.db 2,1,%00000011,2,%00000000,0,%00000000,0 ;fast single
.db 16,1,%00010100,2,%00110100,2,%01000101,2
.db 16,1,%00010100,2,%00110100,2,%01000101,2
-;---------------------------- texts -------------------------------------------
+;---------------------------- texts -----------------------------------------
txt_about: .db " v0.96.A30",127,"by Shiar",0
txt_email: .db "shiar0@hotmail.com",0
txt_teacher: .db "(2",Lpi,"*.95)/sin 13",0
txt_teacherans: .db Lneg,"14.2063168184",0
-;---------------------------- save data ---------------------------------------
+;---------------------------- save data -------------------------------------
PutWhere .dw GRAPH_MEM ;where to put the wide sprites
laserlasts .db 5
storesave_end:
-;XLlevelsdata:----------------------------------------------------------------
+;XLlevelsdata:---------------------------------------------------------------
XLlevelsdata:
.db 0
.db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
.db 1,1
-;XLenemytable:----------------------------------------------------------------
+;XLenemytable:---------------------------------------------------------------
XLbullettable:
- .db (spr_bullet01-spr_bullet01)
- .db (spr_bullet01-spr_bullet01)
- .db (spr_bullet01-spr_bullet01)
- .db (spr_bullet01-spr_bullet01)
- .db (spr_bullet01-spr_bullet01)
- .db (spr_bullet01-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
- .db (spr_bullet02-spr_bullet01)
+ .db (spr_bullet01-spr_bullet01) ;0
+ .db (spr_bullet01-spr_bullet01) ;4
+ .db (spr_bullet02-spr_bullet01) ;8
+ .db (spr_bullet02-spr_bullet01) ;12
+ .db (spr_bullet03-spr_bullet01) ;16
+ .db (spr_bullet03-spr_bullet01) ;20
+ .db (spr_bullet03-spr_bullet01) ;24
+ .db (spr_bullet04-spr_bullet01) ;28
+ .db (spr_bullet04-spr_bullet01) ;32
+ .db (spr_bullet04-spr_bullet01) ;36
+ .db (spr_bullet05-spr_bullet01) ;40
+ .db (spr_bullet05-spr_bullet01) ;44
+ .db (spr_bullet05-spr_bullet01) ;48
+ .db (spr_bullet06-spr_bullet01) ;52
+ .db (spr_bullet06-spr_bullet01) ;56
+ .db (spr_bullet06-spr_bullet01) ;60
XLenemytable:
.db $00 ;00
.db (spr_enemy00-spr_enemy00)/2 ;0E
.db (spr_enemy00-spr_enemy00)/2 ;0F
-;XLenemyinfos:----------------------------------------------------------------
+;XLenemyinfos:---------------------------------------------------------------
XLenemyinfos:
;format: [000000:HP 00:occ] [HP64] [appearance(ypos)] [unused]
.db %00000000,0,0,0
.db %00000000,0,0,0
-;XLsprenemies:----------------------------------------------------------------
+;XLsprenemies:---------------------------------------------------------------
XLsprenemies:
spr_enemy00:
.db %01111111 ; ███████
.db %00011110 ; ████
-;-----------------------------------------------------------------------------
-;----------------------------- logo -------------------------------------------
+;----------------------------------------------------------------------------
+;----------------------------- logo ------------------------------------------
+;----------------------------------------------------------------------------
logo_nemesis:
.db %11111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00001011,%11111111,%11111111,%11111111,%11111000
.db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000001,%00010101
.db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000001,%00010001
-;----------------------------- end --------------------------------------------
+;----------------------------- end ------------------------------------------
.end
.end
-;------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; 0.95.A22 -- 22.X.99 -- size 5321
;
; instead of two 4-byte spaces 40 bytes apart! (cleaner code; faster)
; * ground/ceiling/stars are continued when at boss (c00l level 3 boss)
;
-; 0.97.B12 -- 12.XI.99 -- size
+; 0.97.622 -- 06.VI.99 -- size 5kb
;
; # bullets do damage in all levels
; * more armor at armor-upgrade and extra armor at end of a level
-; - internal levels again (no need, safer/smaller)
+; - internal levels again (no need 4 external, safer/smaller)
; # some registers not correctly pushed/popped
; * several optimizations (init.procs some bytes smaller)
+; + bullets "charge up" (more damage) when not firing
+; + more powerful bullets have different sprites (larger=more damage)
;
;
-; + added - removed * changed # bug fixed
-
+; + added - removed * changed # bug fixed
\ No newline at end of file