+offsets_table:
+ .db 128,64,32,%10000,%01000,%00100,%00010,%00001
+putsprite:
+ ld a,d ;a = X
+ and %00000111 ;a = X mod 8 = bit nr. to mask
+ ld hl,offsets_table ;pixel mask table
+ ld c,a ;bit nr.
+ ld b,0 ;word
+ add hl,bc ;add to table
+ ld a,(hl) ;a = pixel mask
+ ld (_smc1+1),a ;alter pixel mask
+
+ ld hl,GRAPH_MEM ;save-location
+ ld a,e ;y-coord
+ add a,a ;y*2
+ add a,a ;y*4
+ add a,a ;y*8
+ rl b ;b (=0) =b*2+overflow (if y>32 then bc=bc+256)
+ add a,a ;y*16 (width of screen)
+ rl b ;b=b*2+overflow (if y>64 then bc=bc+512)
+ srl d ;d/2
+ srl d ;d/4
+ srl d ;d/8 (8 bits in byte) ** c is set when overflow
+ add a,d ;a = (Y*16+X/8) mod 256
+ jp nc,_n1 ;jump if no carry = no overflow = a<=255
+ inc b ;a>255 so increase bc by 256
+_n1: ld c,a ;c = (Y*16+X/8) mod 256
+ add hl,bc ;bc = Y*16+X/8
+
+ ld d,(ix)
+ ld b,(ix+1)
+_oloop: psh bc ;Save # of rows
+ psh hl ;Save screen address
+ ld b,d ;Load width
+ ld c,(ix+2) ;Load one line of image
+ inc ix
+_smc1: ld a,1 ;Load pixel mask
+_iloop: sla c ;Test leftmost pixel
+ jp nc,_noplot ;See if a plot is needed
+ ld e,a ;OR pixel with screen
+ or (hl)
+ ld (hl),a
+ ld a,e
+_noplot:rrca
+ jp nc,_notedge ;Test if edge of byte reached
+ inc hl ;Go to next byte
+_notedge:
+ dnz _iloop
+ pop hl ;Restore address
+ ld bc,16 ;Go to next line
+ add hl,bc
+ pop bc ;Restore data
+ dnz _oloop
+ ret ;<jp>s are used instead of <jr> = faster
+
+;--------------------------- putbigsprite -------------------------------------
+
+putwidesprite:
+ ld a,d
+ and 7
+ ld hl,offsets_table
+ ld c,a
+ ld b,0
+ add hl,bc
+ ld a,(hl)
+ ld (wsmc1+1),a
+ ld (wsmc2+1),a
+ ld hl,(PutWhere)
+
+ ld a,e
+ add a,a
+ add a,a
+ add a,a
+
+ rl b
+ add a,a
+ rl b
+ srl d
+ srl d
+ srl d
+ add a,d
+ jr nc,n1
+ inc b
+n1: ld c,a
+ add hl,bc
+
+ ld d,(ix)
+ ld b,(ix+1)
+woloop: psh bc ;Save # of rows
+ psh hl ;Save screen address
+ ld b,d ;Load width
+ ld c,(ix+2) ;Load one line of image
+ inc ix
+wsmc1: ld a,1 ;Load pixel mask
+wiloop: sla c ;Test leftmost pixel
+ jr nc,wnoplot ;See if a plot is needed
+ ld e,a ;OR pixel with screen
+ or (hl)
+ ld (hl),a
+ ld a,e
+wnoplot:
+ rrca
+ jr nc,wnotedge ;Test if edge of byte reached
+ inc hl ;Go to next byte
+wnotedge:
+wsmc2: cp 1
+ jr z,wover_1
+
+ dnz wiloop
+ pop hl ;Restore address
+ ld bc,16 ;Go to next line
+ add hl,bc
+ pop bc ;Restore data
+ dnz woloop
+ ret
+wover_1:
+ ld c,(ix+2)
+ inc ix
+ dnz wiloop
+ dec ix
+ pop hl
+ ld bc,16
+ add hl,bc
+ pop bc
+ dnz woloop
+ ret
+
+;------------------------------------------------------------------------------
+;------------------------------- sprites --------------------------------------
+;------------------------------------------------------------------------------
+
+spr_ship01:
+ .db 7,7 ;ship alpha class
+ .db %01111000 ; ████
+ .db %11100000 ; ███
+ .db %01111100 ; █████
+ .db %11110010 ; ████ █
+ .db %01111100 ; █████
+ .db %11100000 ; ███
+ .db %01111000 ; ████
+spr_ship01i:
+ .db 7,7 ;ship alpha class
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+
+ .db %01010000 ; █ █
+ .db %10100000 ; █ █
+ .db %01010100 ; █ █ █
+ .db %10100010 ; █ █ █
+ .db %01010100 ; █ █ █
+ .db %10100000 ; █ █
+ .db %01010000 ; █ █
+
+spr_ship02:
+; .db 7,7 ;ship beta class
+; .db %11100000 ; ███
+; .db %11110000 ; ████
+; .db %01111100 ; █████
+; .db %01110010 ; ███ █
+; .db %01111100 ; █████
+; .db %11110000 ; ████
+; .db %11100000 ; ███
+spr_ship02i:
+; .db 7,7 ;ship beta class
+; .db %01000000 ; █
+; .db %10100000 ; █ █
+; .db %01010100 ; █ █ █
+; .db %00100010 ; █ █
+; .db %01010100 ; █ █ █
+; .db %10100000 ; █ █
+; .db %01000000 ; █
+
+spr_multiple:
+ .db 6,4 ;multiples
+ .db %01111000 ; ████
+ .db %11111100 ; ██████
+ .db %11111100 ; ██████
+ .db %01111000 ; ████
+
+spr_bullet01:
+ .db 5,3 ;your bullets
+ .db %00110000 ; ░▒▓█▒
+ .db %11111000 ; ░▒▓████▒
+ .db %00110000 ; ░▒▓█▒
+spr_bullet02:
+ .db 5,3
+ .db %11110000 ; ░▒▓███▒
+ .db %11111000 ; ░▒▓████▒
+ .db %11110000 ; ░▒▓███▒
+spr_bullett1:
+ .db 4,3 ;▒▒▒
+ .db %11100000 ;▒███
+ .db %11110000 ; ████
+ .db %01110000 ; ███
+
+spr_bullete1:
+ .db 4,3 ;enemy bullets
+ .db %01100000 ; ▒█▓▒░
+ .db %11110000 ; ▒███▓▒░
+ .db %01100000 ; ▒█▓▒░
+
+;---------------------------------------- explosion -------------------------------------------
+
+spr_explosion:
+ .db 8,6 ;1
+ .db %00000000
+ .db %00011100 ; ███
+ .db %00111110 ; █████
+ .db %01010110 ; █ █ ██
+ .db %00111000 ; ███
+ .db %00000000
+
+ .db 8,6 ;2
+ .db %00110000 ; ██
+ .db %01001110 ; █ ▒███
+ .db %10111110 ; █ █████
+ .db %01001111 ; █ ▒████
+ .db %00111000 ; ███
+ .db %00011010 ; ██ █
+
+ .db 8,6 ;3
+ .db %10110000 ; █ ██
+ .db %01001110 ; █ ███
+ .db %10110101 ; █ ██▒█▒█
+ .db %01000101 ; █ ▒█▒█
+ .db %00111110 ; █████
+ .db %01011010 ; █ ██ █
+
+ .db 8,6 ;4
+ .db %00101010 ; ▒ █▒█ █
+ .db %01000110 ; █ ▒██
+ .db %10110101 ; █ ██ █ █
+ .db %01100110 ; ██ ██▒
+ .db %00111100 ; ████▒
+ .db %01011001 ; █ ██ ▒█
+
+ .db 8,6 ;5
+ .db %01000000 ; █▒ ▒ ▒
+ .db %00100101 ; ▒█ █▒█
+ .db %00010100 ; ▒ ▒█ █ ▒
+ .db %01000100 ; █▒ █
+ .db %00010010 ; ▒█▒▒█
+ .db %10011010 ; █▒ ██ █▒
+
+ .db 8,6 ;6
+ .db %01000100 ; █ █
+ .db %00100000 ; ▒█ ▒ ▒
+ .db %00000001 ; ▒ ▒ █
+ .db %01000100 ; █ █
+ .db %00100010 ; █▒ █
+ .db %01001000 ; ▒█ ▒█ ▒
+
+ .db 8,6 ;7
+ .db %00001000 ; ▒ █▒
+ .db %11000010 ; ██ ▒ █
+ .db %00000000 ; ▒
+ .db %00100000 ; ▒█ ▒
+ .db %00000001 ; ▒ ▒█
+ .db %00110000 ; ▒██▒
+
+ .db 8,6 ;8
+ .db %00000100 ; ▒█
+ .db %00000000 ; ▒▒ ▒
+ .db %01000000 ; █
+ .db %00000000 ; ▒
+ .db %00000010 ; █▒
+ .db %00100100 ; █▒ █
+
+spr_yexplosion:
+ .db 8,6 ;8
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+ .db %00000000 ;
+
+;--------------------------------------- bar -----------------------------------
+
+spr_iconhalf:
+ .db 16,7 ;selected .......:
+ .db %11111111 ; ████████
+ .db %00000001 ; █
+ .db %00000001 ; █
+ .db %00000001 ; █
+ .db %00000001 ; █
+ .db %00000001 ; █
+ .db %11111111 ; ████████
+spr_icon:
+ .db 16,7 ;selected .......:.......:
+ .db %11111111,%11111111 ; ████████████████
+ .db %11000000,%00000001 ; ██ █
+ .db %11000000,%00000001 ; ██ █
+ .db %11000000,%00000001 ; ██ █
+ .db %11000000,%00000001 ; ██ █
+ .db %11000000,%00000001 ; ██ █
+ .db %11111111,%11111111 ; ████████████████
+spr_icon00:
+ .db 16,7 ;unused .......:.......:
+ .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
+ .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
+ .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
+ .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
+ .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
+ .db %11010101,%01010101 ; ██ █ █ █ █ █ █ █
+ .db %10101010,%10101010 ; █ █ █ █ █ █ █ █
+spr_icon01:
+ .db 16,7 ;armor ; .......:.......:
+ .db %10000111,%11110000 ; █ ███████
+ .db %10011000,%00001100 ; █ ██ ██
+ .db %10110011,%11000110 ; █ ██ ████ ██
+ .db %10110000,%11110110 ; █ ██ ████ ██
+ .db %10110011,%11000110 ; █ ██ ████ ██
+ .db %10011000,%00001100 ; █ ██ ██
+ .db %10000111,%11110000 ; █ ███████
+spr_icon02:
+ .db 16,7 ;torpedo .......:.......:
+ .db %10111000,%00010101 ; █ ███ █ █ █
+ .db %10011100,%00010101 ; █ ███ █ █ █
+ .db %10111000,%01001010 ; █ ███ █ █ █
+ .db %10000000,%11101010 ; █ ███ █ █
+ .db %11100001,%11100101 ; ███ ████ █ █
+ .db %10011000,%11110101 ; █ ██ ████ █ █
+ .db %11100110,%00110010 ; ███ ██ ██ █
+spr_icon03:
+ .db 16,7 ;bullets .......:.......:
+ .db %10000000,%11000000 ; █ ██
+ .db %10000011,%11100000 ; █ █████ ▒▒▒
+ .db %10011000,%11000000 ; █ ██ ██ ▒▒▒
+ .db %11111100,%00000000 ; ██████ ▒▒▒
+ .db %10011000,%11000000 ; █ ██ ██ ▒▒▒
+ .db %10000011,%11100000 ; █ █████ ▒▒▒
+ .db %10000000,%11000000 ; █ ██
+spr_icon04:
+ .db 16,7 ;laser .......:.......:
+ .db %10000000,%00000000 ; █
+ .db %10110010,%10000000 ; █ ██ █ █
+ .db %10111011,%00000000 ; █ ███ ██
+ .db %10011101,%11111111 ; █ ███ █████████
+ .db %10111011,%00000000 ; █ ███ ██
+ .db %10110010,%10000000 ; █ ██ █ █
+ .db %10000000,%00000000 ; █
+spr_icon05:
+ .db 16,7 ;multiple .......:.......:
+ .db %10000011,%10000000 ; █ ███
+ .db %10000001,%11100110 ; █ ████ ██
+ .db %10000001,%11100000 ; █ ████
+ .db %10000011,%10000000 ; █ ███
+ .db %10011000,%00000000 ; █ ██
+ .db %10111100,%11000011 ; █ ████ ██ ██
+ .db %10011000,%00000000 ; █ ██
+spr_dividerline:
+ .db 8,7
+ .db 128,128,128,128,128,128,128 ;128 = %10000000
+
+;---------------------------- texts -------------------------------------------
+
+txt_about: .db " v0.96.A30",127,"by Shiar",0
+txt_email: .db "shiar0@hotmail.com",0
+txt_menu1: .db "NEW GAME",0
+txt_menu2: .db "CONTINUE",0
+
+txt_level: .db "LEVEL ",0
+txt_gameover: .db "GAME OVER!",0
+txt_score: .db "Score",0
+txt_hiscore: .db "Hiscore",0
+txt_lives: .db "Lx0?",0
+
+txt_pressenter: .db "Enter to continue",0
+txt_teacher: .db "(2",Lpi,"*.95)/sin 13",0
+txt_teacherans: .db Lneg,"14.2063168184",0
+
+;---------------------------- save data ---------------------------------------
+
+PutWhere .dw GRAPH_MEM ;where to put the wide sprites
+laserlasts .db 5
+
+storehi_start:
+hiscore .dw $0000
+hiname .db "Shiar.96",0
+storehi_end:
+
+storesave_start:
+level .db $01 ;level number
+levelp .dw XLlevelsdata+4 ;pointer to level data
+pickuptimer .db $04 ;counts when to place a pickup
+score .dw $0000
+
+your_pickup .db $00
+your_occ .db $00 ;0=normal 1..16=exploding
+your_inv .db $00 ;invincibility left
+your_armor .db $0a ;HP left
+your_lives .db $03 ;
+
+your_weapon .db $02 ;laser avail: 0=no, 1=yes
+your_multiples .db $00 ;multiples present
+torp_occ .db $00 ;torp.state: 0=unavail 1=avail 2=presnt
+torp_pos .dw $0000 ;torpedo position (x,y)
+storesave_end:
+
+;----------------------------- logo -------------------------------------------
+
+logo_nemesis:
+.db %11111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00001011,%11111111,%11111111,%11111111,%11111000
+.db %01111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00011011,%11111111,%11111111,%11111111,%11110000
+.db %00111111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%00111011,%11111111,%11111111,%11111111,%11100000
+.db %00011111,%11111111,%11111111,%11111110,%11111111,%11110111,%11111111,%11111110,%11111111,%111101111,%11111111,%01111011,%11111111,%11111111,%11111111,%11000000
+.db %00000000,%00000000,%00000001,%00011110,%00010000,%00000000,%10000001,%00011110,%00010000,%000000001,%00000000,%00001000,%01000000,%00000000,%00000000,%00000000
+.db %00000000,%00000000,%00000011,%00011110,%00110000,%00000001,%10000011,%00011110,%00110000,%000000011,%00000000,%00011000,%11000000,%00000000,%00000000,%00000000
+.db %00000000,%00000000,%00000111,%00011110,%01110000,%00000011,%10000111,%00011110,%01110000,%000000111,%00000000,%00111001,%11000000,%00000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11111111,%00000111,%10001111,%00011110,%11111111,%000001111,%11111111,%01111011,%11111111,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11110000,%00000111,%10001111,%00011110,%11110000,%000000000,%00001111,%01111000,%00000011,%11000000,%00000000,%00000000
+.db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000111,%11010001
+.db %00000000,%00000000,%00001111,%00011110,%11111111,%11110111,%10001111,%00011110,%11111111,%111101111,%11111111,%01111011,%11111111,%11000000,%00000001,%00011011
+.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
+
+
+;------------------------------------------------------------------------------
+
+; 0.95.A22 -- 22.X.99 -- size 5321
+;
+; * total size of enemy-sprites can now be 510 bytes (space = doubled!)
+; # bullets hit enemies correctly that aren't 6x6; even the 16x10 bosses!
+; * at g/o or nextlevel checks for keys released instead of waiting abit
+; + name stored with hiscore (max. 8 chars, Shiar.95 by default)
+; + when entering hi-name DEL goes back one char (with check 4 no chars)
+; # program is reloaded at start so some score-bugs solved! (_asapvar=0)
+; * at death, upgrades and pickups AREN'T removed! (just armor=0)
+; # bullet is not displayed after being removed anymore
+; # armor-icon stays hilighted when armor is decreased
+; * when stars move off screen, they are placed at a NEW y-pos!
+; * the starting x-positions of stars are not random, so the stars are
+; spread all over screen. y is still random and changes during game
+; * make_random functions smaller and used by different procs
+; # MAJOR BUG! a "random" value was placed somewhere in mem thus
+; creating bugs like unexplained loss of armor and stuff! (I think)
+;
+; 0.96.A31 -- 31.X.99 -- size 4836 + 888
+;
+; # if you were hit when armor-icon selected, prog did weird stuff
+; + armor-bar (shows armor as a black line left at bottom)
+; # bugs involving armor-bar changing armor to a wrong value
+; # YES!!! the saving-bugs were caused by mmldir: it reset all data
+; at mem $8000, so data is now stored at asmexecram+6000 instead!
+; * external levels. All leveldata is loaded from "nemesis0"-var
+; * some optimization (like cal\ret>jp + unused code removed/shortened)
+; * storyline is loaded from level-file (will be compressed later..)
+; + story can be _between_ levels, not only at the start of a new game
+; * "new game" and "continue" in main menu are swapped (new comes 1st)
+; * enemy bullets can do more than one damage: differs per level
+; * collision does 4 damage, ground does 5, you start with 12 armor
+; # running the level-file no longer crashes your calc but just returns
+; * you now move 1.5 pixels per frame! this way you can outrun enemies
+; * hellofajob but enemy-data is now stored at one location in 6 bytes,
+; instead of two 4-byte spaces 40 bytes apart! (cleaner code; faster)
+; * ground/ceiling/stars are continued when at boss (c00l level 3 boss)
+;
+;
+; + added - removed * changed # bug fixed