/*
Curtis Leung and Adrian Ng
cyl22 and an78
Sharp Shooter
5-2-2005
ECE 476, Spring 2005

Difficulties that were solved
1. Shooting 9 figures at the same time...going through each frame
2. Timing Issues: Need to delete all 9 monsters at the same time
As well as going through each guy in each frame
3. Making each guy 1 video_pt at a time cuz of timing issues since
for loop with video_pt of black pts waste time.
4. Making The Grid and errors involved in erasing all guys
-Problem in losing all guys at the same time because
Person can shake at high speeds
5. Out of SRAM on Sound, compiles fine but no sound
*/

// To Do
// 1. Landscape

//video gen and sound
//D.5 is sync:1000 ohm + diode to 75 ohm resistor
//D.6 is video:330 ohm + diode to 75 ohm resistor
//B.3 is sound and should have a 10k resistor to gnd

#pragma regalloc- //I allocate the registers myself
#pragma optsize- //optimize for speed

#include <Mega32.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <delay.h>
#include <string.h>

//cycles = 63.625 * 16 Note NTSC is 63.55
//but this line duration makes each frame exactly 1/60 sec
//which is nice for keeping a realtime clock
#define lineTime 1018

#define begin {
#define end }
#define ScreenTop 30
#define ScreenBot 230
#define t3 60
#define DYING_GUY 2

#define mfix(a,b) ((int)((((long)(a))*((long)(b)))>>8))

#define divide(a,b) ((long)((a)<<8)/(long)(b))

//NOTE that v1 to v8 and i must be in registers!
register char v1 @4;
register char v2 @5;
register char v3 @6;
register char v4 @7;
register char v5 @8;
register char v6 @9;
register char v7 @10;
register char v8 @11;
register int i @12;

#pragma regalloc+

char syncON, syncOFF;
int LineCount;
int time=60;

//animation
int x[9], y[9];
int vx[9], vy[9], drawer=0;

//NEW DEFINED VARIABLES
unsigned char numberone[9], Stationary, Light, timer[10], monster[12], bullets=6, trigger_timer=0;
long rightx[9] = {0x1F00, 0x4900, 0x7300, 0x1F00, 0x4900, 0x7300, 0x1F00, 0x4900, 0x7300};
long leftx[9] = {0x0400, 0x2E00, 0x5800, 0x0400, 0x2E00, 0x5800, 0x0400, 0x2E00, 0x5800};
long bottomy[9] = {0x0F00, 0x0F00, 0x0F00, 0x2900, 0x2900, 0x2900, 0x4300, 0x4300, 0x4300};
long topy[9] = {0x1500, 0x1500, 0x1500, 0x2F00, 0x2F00, 0x2F00, 0x4900, 0x4900, 0x4900};
unsigned char life = 5, supermanlife[9];
unsigned char ii, frame, hit;
char lose = 0, win =0,game=0;

//From -90 to 90 in 15 degree increments
//unsigned int sineTable[13]= {-256,-247,-222,-181, -128, -66, 0, 66, 128, 181, 222, 247, 256}; //need loc to avoid glitch
//unsigned int cosTable[13]= {0, 66, 128, 181, 222, 247, 256, 247, 222, 181, 128, 66, 0}; //need loc to avoid glitch

//unsigned char sineTable[13]= {-1,-.9659,-0.866,-.707, -0.5, -.2588, 0, .2588, .5, .707, .866, .9659, 1}; //need loc to avoid glitch
//unsigned int cosTable[13]= {0, .2588, .5, .707, .866, .9659, 1, .9659, .866, .707, .5, .2588, 0}; //need loc to avoid glitch

char screen[1600], t, ts[10];
char outputword[20];
flash char cu1[]="LIFE";
flash char cu2[]="WELCOME TO";
flash char cu3[]="SHARP SHOOTER";
flash char cu4[]=" ";
flash char cu5[]="BY CURTIS";
flash char cu6[]="AND ADRIAN";
flash char cu7[]="MAN MAKER WINS";
flash char cu8[]="GUN WINS";
flash char cu9[]="RELOAD TO PLAY";
flash char cu10[]="AGAIN";
//char temp_buffer[15];

//Musical note values
//C below middle C to C above middle C
//zeros are rests
/*flash char notes[] = {239,213,189,179,159,142,126,
120,106,94,90,80,71,63,60,0,0,0,0};
*/
//Gun 120
//Normal Guy 90,80
//Lose Health 70,75,80
//Gain Health 70, 65, 60
flash char notes[] = {55,90,80,70,75,80,70,
65,60,213,239,213,239,213,0,0,0,0};

char note, musicT;

//Point plot lookup table
//One bit masks
flash char pos[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};

//define some character bitmaps
//5x7 characters
flash char bitmap[39][7]={
//0
0b01110000,
0b11111000,
0b11111000,
0b11111000,
0b11111000,
0b11111000,
0b01110000,
//1
0b00100000,
0b01100000,
0b00100000,
0b00100000,
0b00100000,
0b00100000,
0b01110000,
//2
0b01110000,
0b10001000,
0b00001000,
0b00010000,
0b00100000,
0b01000000,
0b11111000,
//3
0b11111000,
0b00010000,
0b00100000,
0b00010000,
0b00001000,
0b10001000,
0b01110000,
//4
0b00010000,
0b00110000,
0b01010000,
0b10010000,
0b11111000,
0b00010000,
0b00010000,
//5
0b11111000,
0b10000000,
0b11110000,
0b00001000,
0b00001000,
0b10001000,
0b01110000,
//6
0b01000000,
0b10000000,
0b10000000,
0b11110000,
0b10001000,
0b10001000,
0b01110000,
//7
0b11111000,
0b00001000,
0b00010000,
0b00100000,
0b01000000,
0b10000000,
0b10000000,
//8
0b01110000,
0b10001000,
0b10001000,
0b01110000,
0b10001000,
0b10001000,
0b01110000,
//9
0b01110000,
0b10001000,
0b10001000,
0b01111000,
0b00001000,
0b00001000,
0b00010000,
//A
0b01110000,
0b10001000,
0b10001000,
0b10001000,
0b11111000,
0b10001000,
0b10001000,
//B
0b11110000,
0b10001000,
0b10001000,
0b11110000,
0b10001000,
0b10001000,
0b11110000,
//C
0b01110000,
0b10001000,
0b10000000,
0b10000000,
0b10000000,
0b10001000,
0b01110000,
//D
0b11110000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b11110000,
//E
0b11111000,
0b10000000,
0b10000000,
0b11111000,
0b10000000,
0b10000000,
0b11111000,
//F
0b11111000,
0b10000000,
0b10000000,
0b11111000,
0b10000000,
0b10000000,
0b10000000,
//G
0b01110000,
0b10001000,
0b10000000,
0b10011000,
0b10001000,
0b10001000,
0b01110000,
//H
0b10001000,
0b10001000,
0b10001000,
0b11111000,
0b10001000,
0b10001000,
0b10001000,
//I
0b01110000,
0b00100000,
0b00100000,
0b00100000,
0b00100000,
0b00100000,
0b01110000,
//J
0b00111000,
0b00010000,
0b00010000,
0b00010000,
0b00010000,
0b10010000,
0b01100000,
//K
0b10001000,
0b10010000,
0b10100000,
0b11000000,
0b10100000,
0b10010000,
0b10001000,
//L
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b11111000,
//M
0b10001000,
0b11011000,
0b10101000,
0b10101000,
0b10001000,
0b10001000,
0b10001000,
//N
0b10001000,
0b10001000,
0b11001000,
0b10101000,
0b10011000,
0b10001000,
0b10001000,
//O
0b01110000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b01110000,
//P
0b11110000,
0b10001000,
0b10001000,
0b11110000,
0b10000000,
0b10000000,
0b10000000,
//Q
0b01110000,
0b10001000,
0b10001000,
0b10001000,
0b10101000,
0b10010000,
0b01101000,
//R
0b11110000,
0b10001000,
0b10001000,
0b11110000,
0b10100000,
0b10010000,
0b10001000,
//S
0b01111000,
0b10000000,
0b10000000,
0b01110000,
0b00001000,
0b00001000,
0b11110000,
//T
0b11111000,
0b00100000,
0b00100000,
0b00100000,
0b00100000,
0b00100000,
0b00100000,
//U
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b01110000,
//V
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b01010000,
0b00100000,
//W
0b10001000,
0b10001000,
0b10001000,
0b10101000,
0b10101000,
0b10101000,
0b01010000,
//X
0b10001000,
0b10001000,
0b01010000,
0b00100000,
0b01010000,
0b10001000,
0b10001000,
//Y
0b10001000,
0b10001000,
0b10001000,
0b01010000,
0b00100000,
0b00100000,
0b00100000,
//Z
0b11111000,
0b00001000,
0b00010000,
0b00100000,
0b01000000,
0b10000000,
0b11111000,
//figure1
0b01110000,
0b00100000,
0b01110000,
0b10101000,
0b00100000,
0b01010000,
0b10001000,
//figure2
0b01110000,
0b10101000,
0b01110000,
0b00100000,
0b00100000,
0b01010000,
0b10001000,

//erase
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000
};

 

//================================
//3x5 font numbers, then letters
//packed two per definition for fast
//copy to the screen at x-position divisible by 4
flash char smallbitmap[39][5]={
//0
0b11101110,
0b10101010,
0b10101010,
0b10101010,
0b11101110,
//1
0b01000100,
0b11001100,
0b01000100,
0b01000100,
0b11101110,
//2
0b11101110,
0b00100010,
0b11101110,
0b10001000,
0b11101110,
//3
0b11101110,
0b00100010,
0b11101110,
0b00100010,
0b11101110,
//4
0b10101010,
0b10101010,
0b11101110,
0b00100010,
0b00100010,
//5
0b11101110,
0b10001000,
0b11101110,
0b00100010,
0b11101110,
//6
0b11001100,
0b10001000,
0b11101110,
0b10101010,
0b11101110,
//7
0b11101110,
0b00100010,
0b01000100,
0b10001000,
0b10001000,
//8
0b11101110,
0b10101010,
0b11101110,
0b10101010,
0b11101110,
//9
0b11101110,
0b10101010,
0b11101110,
0b00100010,
0b01100110,
//:
0b00000000,
0b01000100,
0b00000000,
0b01000100,
0b00000000,
//=
0b00000000,
0b11101110,
0b00000000,
0b11101110,
0b00000000,
//blank
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
//A
0b11101110,
0b10101010,
0b11101110,
0b10101010,
0b10101010,
//B
0b11001100,
0b10101010,
0b11101110,
0b10101010,
0b11001100,
//C
0b11101110,
0b10001000,
0b10001000,
0b10001000,
0b11101110,
//D
0b11001100,
0b10101010,
0b10101010,
0b10101010,
0b11001100,
//E
0b11101110,
0b10001000,
0b11101110,
0b10001000,
0b11101110,
//F
0b11101110,
0b10001000,
0b11101110,
0b10001000,
0b10001000,
//G
0b11101110,
0b10001000,
0b10001000,
0b10101010,
0b11101110,
//H
0b10101010,
0b10101010,
0b11101110,
0b10101010,
0b10101010,
//I
0b11101110,
0b01000100,
0b01000100,
0b01000100,
0b11101110,
//J
0b00100010,
0b00100010,
0b00100010,
0b10101010,
0b11101110,
//K
0b10001000,
0b10101010,
0b11001100,
0b11001100,
0b10101010,
//L
0b10001000,
0b10001000,
0b10001000,
0b10001000,
0b11101110,
//M
0b10101010,
0b11101110,
0b11101110,
0b10101010,
0b10101010,
//N
0b00000000,
0b11001100,
0b10101010,
0b10101010,
0b10101010,
//O
0b01000100,
0b10101010,
0b10101010,
0b10101010,
0b01000100,
//P
0b11101110,
0b10101010,
0b11101110,
0b10001000,
0b10001000,
//Q
0b01000100,
0b10101010,
0b10101010,
0b11101110,
0b01100110,
//R
0b11101110,
0b10101010,
0b11001100,
0b11101110,
0b10101010,
//S
0b11101110,
0b10001000,
0b11101110,
0b00100010,
0b11101110,
//T
0b11101110,
0b01000100,
0b01000100,
0b01000100,
0b01000100,
//U
0b10101010,
0b10101010,
0b10101010,
0b10101010,
0b11101110,
//V
0b10101010,
0b10101010,
0b10101010,
0b10101010,
0b01000100,
//W
0b10101010,
0b10101010,
0b11101110,
0b11101110,
0b10101010,
//X
0b00000000,
0b10101010,
0b01000100,
0b01000100,
0b10101010,
//Y
0b10101010,
0b10101010,
0b01000100,
0b01000100,
0b01000100,
//Z
0b11101110,
0b00100010,
0b01000100,
0b10001000,
0b11101110
};

//==================================
//This is the sync generator and raster generator. It MUST be entered from
//sleep mode to get accurate timing of the sync pulses
#pragma warn-
interrupt [TIM1_COMPA] void t1_cmpA(void)
begin
//start the Horizontal sync pulse
PORTD = syncON;
//update the curent scanline number
LineCount ++ ;
//begin inverted (Vertical) synch after line 247
if (LineCount==248)
begin
syncON = 0b00100000;
syncOFF = 0;
end
//back to regular sync after line 250
if (LineCount==251)
begin
syncON = 0;
syncOFF = 0b00100000;
end
//start new frame after line 262
if (LineCount==263)
begin
LineCount = 1;
end

delay_us(2); //adjust to make 5 us pulses
//end sync pulse
PORTD = syncOFF;

if (LineCount<ScreenBot && LineCount>=ScreenTop)
begin

//compute byte index for beginning of the next line
//left-shift 4 would be individual lines
// <<3 means line-double the pixels
//The 0xfff8 truncates the odd line bit
//i=(LineCount-ScreenTop)<<3 & 0xfff8; //

#asm
push r16
lds r12, _LineCount
lds r13, _Linecount+1
ldi r16, 30
sub r12, r16
ldi r16,0
sbc r13, r16
lsl r12
rol r13
lsl r12
rol r13
lsl r12
rol r13
mov r16,r12
andi r16,0xf0
mov r12,r16
pop r16
#endasm

//load 16 registers with screen info
#asm
push r14
push r15
push r16
push r17
push r18
push r19
push r26
push r27

ldi r26,low(_screen) ;base address of screen
ldi r27,high(_screen)
add r26,r12 ;offset into screen (add i)
adc r27,r13
ld r4,x+ ;load 16 registers and inc pointer
ld r5,x+
ld r6,x+
ld r7,x+
ld r8,x+
ld r9,x+
ld r10,x+
ld r11,x+
ld r12,x+
ld r13,x+
ld r14,x+
ld r15,x+
ld r16,x+
ld r17,x+
ld r18,x+
ld r19,x

pop r27
pop r26
#endasm

delay_us(4); //adjust to center image on screen

//blast 16 bytes to the screen
#asm
;but first a macro to make the code shorter
;the macro takes a register number as a parameter
;and dumps its bits serially to portD.6
;the nop can be eliminated to make the display narrower
.macro videobits ;regnum
BST @0,7
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,6
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,5
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,4
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,3
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,2
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,1
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30

BST @0,0
IN R30,0x12
BLD R30,6
nop
OUT 0x12,R30
.endm

videobits r4 ;video line -- byte 1
videobits r5 ;byte 2
videobits r6 ;byte 3
videobits r7 ;byte 4
videobits r8 ;byte 5
videobits r9 ;byte 6
videobits r10 ;byte 7
videobits r11 ;byte 8
videobits r12 ;byte 9
videobits r13 ;byte 10
videobits r14 ;byte 11
videobits r15 ;byte 12
videobits r16 ;byte 13
videobits r17 ;byte 14
videobits r18 ;byte 15
videobits r19 ;byte 16
clt ;clear video after the last pixel on the line
IN R30,0x12
BLD R30,6
OUT 0x12,R30

pop r19
pop r18
pop r17
pop r16
pop r15
pop r14
#endasm

end
end
#pragma warn+

//==================================
//plot one point
//at x,y with color 1=white 0=black 2=invert
#pragma warn-
void video_pt(char x, char y, char c)
begin

#asm
; i=(x>>3) + ((int)y<<4) ; the byte with the pixel in it

push r16
ldd r30,y+2 ;get x
lsr r30
lsr r30
lsr r30 ;divide x by 8
ldd r12,y+1 ;get y
lsl r12 ;mult y by 16
clr r13
lsl r12
rol r13
lsl r12
rol r13
lsl r12
rol r13
add r12, r30 ;add in x/8

;v2 = screen[i]; r5
;v3 = pos[x & 7]; r6
;v4 = c r7
ldi r30,low(_screen)
ldi r31,high(_screen)
add r30, r12
adc r31, r13
ld r5,Z ;get screen byte
ldd r26,y+2 ;get x
ldi r27,0
andi r26,0x07 ;form x & 7
ldi r30,low(_pos*2)
ldi r31,high(_pos*2)
add r30,r26
adc r31,r27
lpm r6,Z
ld r16,y ;get c

;if (v4==1) screen[i] = v2 | v3 ;
;if (v4==0) screen[i] = v2 & ~v3;
;if (v4==2) screen[i] = v2 ^ v3 ;

cpi r16,1
brne tst0
or r5,r6
tst0:
cpi r16,0
brne tst2
com r6
and r5,r6
tst2:
cpi r16,2
brne writescrn
eor r5,r6
writescrn:
ldi r30,low(_screen)
ldi r31,high(_screen)
add r30, r12
adc r31, r13
st Z, r5 ;write the byte back to the screen

pop r16
#endasm

end
#pragma warn+

//==================================
// put a big character on the screen
// c is index into bitmap

void video_putchar(char x, char y, char c)
begin
v7 = x;
for (v6=0;v6<7;v6++)
begin
v1 = bitmap[c][v6];
v8 = y+v6;
video_pt(v7, v8, (v1 & 0x80)==0x80);
video_pt(v7+1, v8, (v1 & 0x40)==0x40);
video_pt(v7+2, v8, (v1 & 0x20)==0x20);
video_pt(v7+3, v8, (v1 & 0x10)==0x10);
video_pt(v7+4, v8, (v1 & 0x08)==0x08);
end
end
/*
//==================================
// put a big character on the screen
// c is index into bitmap
void video_putAdrian(char x, char y, char c)
begin
v7 = x;
for (v6=0;v6<12;v6++)
begin
v1 = Adrian[c][v6];
v8 = y+v6;
video_pt(v7, v8, (v1 & 0x80)==0x80);
video_pt(v7+1, v8, (v1 & 0x40)==0x40);
video_pt(v7+2, v8, (v1 & 0x20)==0x20);
video_pt(v7+3, v8, (v1 & 0x10)==0x10);
video_pt(v7+4, v8, (v1 & 0x08)==0x08);
video_pt(v7+5, v8, (v1 & 0x04)==0x04);
video_pt(v7+6, v8, (v1 & 0x02)==0x02);
video_pt(v7+7, v8, (v1 & 0x01)==0x01);
end
end
*/

//Samurai Guy
void video_putBombMan(char x, char y)
begin

video_pt(x+1, y, 1);
video_pt(x+2, y, 1);
video_pt(x+3, y, 1);
video_pt(x+4, y, 1);
video_pt(x+5, y, 1);
video_pt(x+1, y+1, 1);
video_pt(x+5, y+1, 1);
video_pt(x+1, y+2, 1);
video_pt(x+5, y+2, 1);
video_pt(x+1, y+3, 1);
video_pt(x+5, y+3, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);
video_pt(x+2, y+5, 1);
video_pt(x+3, y+5, 1);
video_pt(x+4, y+5, 1);
video_pt(x+0, y+6, 1);
video_pt(x+1, y+6, 1);
video_pt(x+2, y+6, 1);
video_pt(x+3, y+6, 1);
video_pt(x+4, y+6, 1);
video_pt(x+5, y+6, 1);
video_pt(x+6, y+6, 1);
video_pt(x+0, y+7, 1);
video_pt(x+1, y+7, 1);
video_pt(x+2, y+7, 1);
video_pt(x+3, y+7, 1);
video_pt(x+4, y+7, 1);
video_pt(x+5, y+7, 1);
video_pt(x+6, y+7, 1);
video_pt(x+2, y+8, 1);
video_pt(x+3, y+8, 1);
video_pt(x+4, y+8, 1);
video_pt(x+2, y+9, 1);
video_pt(x+3, y+9, 1);
video_pt(x+4, y+9, 1);
video_pt(x+2, y+10, 1);
video_pt(x+4, y+10, 1);
video_pt(x+1, y+11, 1);
video_pt(x+2, y+11, 1);
video_pt(x+4, y+11, 1);
video_pt(x+5, y+11, 1);
end

//Erase Samurai Guy
void video_EraseBombMan(char x, char y)
begin

video_pt(x+1, y, 0);
video_pt(x+2, y, 0);
video_pt(x+3, y, 0);
video_pt(x+4, y, 0);
video_pt(x+5, y, 0);
video_pt(x+1, y+1, 0);
video_pt(x+5, y+1, 0);
video_pt(x+1, y+2, 0);
video_pt(x+5, y+2, 0);
video_pt(x+1, y+3, 0);
video_pt(x+5, y+3, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);
video_pt(x+2, y+5, 0);
video_pt(x+3, y+5, 0);
video_pt(x+4, y+5, 0);
video_pt(x+0, y+6, 0);
video_pt(x+1, y+6, 0);
video_pt(x+2, y+6, 0);
video_pt(x+3, y+6, 0);
video_pt(x+4, y+6, 0);
video_pt(x+5, y+6, 0);
video_pt(x+6, y+6, 0);
video_pt(x+0, y+7, 0);
video_pt(x+1, y+7, 0);
video_pt(x+2, y+7, 0);
video_pt(x+3, y+7, 0);
video_pt(x+4, y+7, 0);
video_pt(x+5, y+7, 0);
video_pt(x+6, y+7, 0);
video_pt(x+2, y+8, 0);
video_pt(x+3, y+8, 0);
video_pt(x+4, y+8, 0);
video_pt(x+2, y+9, 0);
video_pt(x+3, y+9, 0);
video_pt(x+4, y+9, 0);
video_pt(x+2, y+10, 0);
video_pt(x+4, y+10, 0);
video_pt(x+1, y+11, 0);
video_pt(x+2, y+11, 0);
video_pt(x+4, y+11, 0);
video_pt(x+5, y+11, 0);
end
//Samurai Guy with sword
void video_putBombMan2(char x, char y)
begin
video_pt(x-1, y, 1);
video_pt(x-1, y+1, 1);
video_pt(x-1, y+2, 1);
video_pt(x-1, y+3, 1);
video_pt(x-1, y+4, 1);
video_pt(x-1, y+5 , 1);
video_pt(x-1, y+6 , 1);
video_pt(x-1, y+7 , 1);
video_pt(x+7, y, 1);
video_pt(x+7, y+1, 1);
video_pt(x+7, y+2, 1);
video_pt(x+7, y+3, 1);
video_pt(x+7, y+4, 1);
video_pt(x+7, y+5 , 1);
video_pt(x+7, y+6 , 1);
video_pt(x+7, y+7 , 1);


video_pt(x+1, y, 1);
video_pt(x+2, y, 1);
video_pt(x+3, y, 1);
video_pt(x+4, y, 1);
video_pt(x+5, y, 1);
video_pt(x+1, y+1, 1);
video_pt(x+5, y+1, 1);
video_pt(x+1, y+2, 1);
video_pt(x+5, y+2, 1);
video_pt(x+1, y+3, 1);
video_pt(x+5, y+3, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);
video_pt(x+2, y+5, 1);
video_pt(x+3, y+5, 1);
video_pt(x+4, y+5, 1);
video_pt(x+0, y+6, 1);
video_pt(x+1, y+6, 1);
video_pt(x+2, y+6, 1);
video_pt(x+3, y+6, 1);
video_pt(x+4, y+6, 1);
video_pt(x+5, y+6, 1);
video_pt(x+6, y+6, 1);
video_pt(x+0, y+7, 1);
video_pt(x+1, y+7, 1);
video_pt(x+2, y+7, 1);
video_pt(x+3, y+7, 1);
video_pt(x+4, y+7, 1);
video_pt(x+5, y+7, 1);
video_pt(x+6, y+7, 1);
video_pt(x+2, y+8, 1);
video_pt(x+3, y+8, 1);
video_pt(x+4, y+8, 1);
video_pt(x+2, y+9, 1);
video_pt(x+3, y+9, 1);
video_pt(x+4, y+9, 1);
video_pt(x+2, y+10, 1);
video_pt(x+4, y+10, 1);
video_pt(x+1, y+11, 1);
video_pt(x+2, y+11, 1);
video_pt(x+4, y+11, 1);
video_pt(x+5, y+11, 1);
end

//Erase Samurai Guy with sword
void video_EraseBombMan2(char x, char y)
begin
video_pt(x-1, y, 0);
video_pt(x-1, y+1, 0);
video_pt(x-1, y+2, 0);
video_pt(x-1, y+3, 0);
video_pt(x-1, y+4, 0);
video_pt(x-1, y+5 , 0);
video_pt(x-1, y+6 , 0);
video_pt(x-1, y+7 , 0);
video_pt(x+7, y, 0);
video_pt(x+7, y+1, 0);
video_pt(x+7, y+2, 0);
video_pt(x+7, y+3, 0);
video_pt(x+7, y+4, 0);
video_pt(x+7, y+5 , 0);
video_pt(x+7, y+6 , 0);
video_pt(x+7 , y+7 , 0);

video_pt(x+1, y, 0);
video_pt(x+2, y, 0);
video_pt(x+3, y, 0);
video_pt(x+4, y, 0);
video_pt(x+5, y, 0);
video_pt(x+1, y+1, 0);
video_pt(x+5, y+1, 0);
video_pt(x+1, y+2, 0);
video_pt(x+5, y+2, 0);
video_pt(x+1, y+3, 0);
video_pt(x+5, y+3, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);
video_pt(x+2, y+5, 0);
video_pt(x+3, y+5, 0);
video_pt(x+4, y+5, 0);
video_pt(x+0, y+6, 0);
video_pt(x+1, y+6, 0);
video_pt(x+2, y+6, 0);
video_pt(x+3, y+6, 0);
video_pt(x+4, y+6, 0);
video_pt(x+5, y+6, 0);
video_pt(x+6, y+6, 0);
video_pt(x+0, y+7, 0);
video_pt(x+1, y+7, 0);
video_pt(x+2, y+7, 0);
video_pt(x+3, y+7, 0);
video_pt(x+4, y+7, 0);
video_pt(x+5, y+7, 0);
video_pt(x+6, y+7, 0);
video_pt(x+2, y+8, 0);
video_pt(x+3, y+8, 0);
video_pt(x+4, y+8, 0);
video_pt(x+2, y+9, 0);
video_pt(x+3, y+9, 0);
video_pt(x+4, y+9, 0);
video_pt(x+2, y+10, 0);
video_pt(x+4, y+10, 0);
video_pt(x+1, y+11, 0);
video_pt(x+2, y+11, 0);
video_pt(x+4, y+11, 0);
video_pt(x+5, y+11, 0);
end

//put Bullet
void video_putBullet(char x, char y)
begin

video_pt(x+2, y+0, 1);
video_pt(x+1, y+1, 1);
video_pt(x+2, y+1, 1);
video_pt(x+3, y+1, 1);
video_pt(x+0, y+2, 1);
video_pt(x+1, y+2, 1);
video_pt(x+2, y+2, 1);
video_pt(x+3, y+2, 1);
video_pt(x+4, y+2, 1);
video_pt(x+0, y+3, 1);
video_pt(x+1, y+3, 1);
video_pt(x+2, y+3, 1);
video_pt(x+3, y+3, 1);
video_pt(x+4, y+3, 1);
video_pt(x+0, y+4, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
end

//Erase Bullet
void video_EraseBullet(char x, char y)
begin

video_pt(x+2, y+0, 0);
video_pt(x+1, y+1, 0);
video_pt(x+2, y+1, 0);
video_pt(x+3, y+1, 0);
video_pt(x+0, y+2, 0);
video_pt(x+1, y+2, 0);
video_pt(x+2, y+2, 0);
video_pt(x+3, y+2, 0);
video_pt(x+4, y+2, 0);
video_pt(x+0, y+3, 0);
video_pt(x+1, y+3, 0);
video_pt(x+2, y+3, 0);
video_pt(x+3, y+3, 0);
video_pt(x+4, y+3, 0);
video_pt(x+0, y+4, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
end

//put heart
void video_putHeart(char x, char y)
begin

video_pt(x+3, y+1, 1);
video_pt(x+4, y+1, 1);
video_pt(x+3, y+2, 1);
video_pt(x+4, y+2, 1);
video_pt(x+1, y+3, 1);
video_pt(x+2, y+3, 1);
video_pt(x+3, y+3, 1);
video_pt(x+4, y+3, 1);
video_pt(x+5, y+3, 1);
video_pt(x+6, y+3, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);
video_pt(x+6, y+4, 1);
video_pt(x+3, y+5, 1);
video_pt(x+4, y+5, 1);
video_pt(x+3, y+6, 1);
video_pt(x+4, y+6, 1);
end

//Erase heart
void video_EraseHeart(char x, char y)
begin

video_pt(x+3, y+1, 0);
video_pt(x+4, y+1, 0);
video_pt(x+3, y+2, 0);
video_pt(x+4, y+2, 0);
video_pt(x+1, y+3, 0);
video_pt(x+2, y+3, 0);
video_pt(x+3, y+3, 0);
video_pt(x+4, y+3, 0);
video_pt(x+5, y+3, 0);
video_pt(x+6, y+3, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);
video_pt(x+6, y+4, 0);
video_pt(x+3, y+5, 0);
video_pt(x+4, y+5, 0);
video_pt(x+3, y+6, 0);
video_pt(x+4, y+6, 0);
end

//put man
void video_putMan(char x, char y)
begin

video_pt(x+1, y, 1);
video_pt(x+2, y, 1);
video_pt(x+3, y, 1);
video_pt(x+4, y, 1);
video_pt(x+5, y, 1);
video_pt(x+1, y+1, 1);
video_pt(x+5, y+1, 1);
video_pt(x+1, y+2, 1);
video_pt(x+5, y+2, 1);
video_pt(x+1, y+3, 1);
video_pt(x+5, y+3, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);
video_pt(x+2, y+5, 1);
video_pt(x+3, y+5, 1);
video_pt(x+4, y+5, 1);
video_pt(x+0, y+6, 1);
video_pt(x+1, y+6, 1);
video_pt(x+2, y+6, 1);
video_pt(x+3, y+6, 1);
video_pt(x+4, y+6, 1);
video_pt(x+5, y+6, 1);
video_pt(x+6, y+6, 1);
video_pt(x+0, y+7, 1);
video_pt(x+1, y+7, 1);
video_pt(x+2, y+7, 1);
video_pt(x+3, y+7, 1);
video_pt(x+4, y+7, 1);
video_pt(x+5, y+7, 1);
video_pt(x+6, y+7, 1);
video_pt(x+2, y+8, 1);
video_pt(x+3, y+8, 1);
video_pt(x+4, y+8, 1);
video_pt(x+2, y+9, 1);
video_pt(x+3, y+9, 1);
video_pt(x+4, y+9, 1);
video_pt(x+2, y+10, 1);
video_pt(x+4, y+10, 1);
video_pt(x+1, y+11, 1);
video_pt(x+2, y+11, 1);
video_pt(x+4, y+11, 1);
video_pt(x+5, y+11, 1);
end

//put big man 1
void video_putBigManTopHalf(char x, char y, char c)
begin

video_pt(x+1, y, c);
video_pt(x+2, y, c);
video_pt(x+3, y, c);
video_pt(x+4, y, c);
video_pt(x+5, y, c);
video_pt(x+6, y, c);
video_pt(x+7, y, c);
video_pt(x+8, y, c);
video_pt(x+9, y, c);
video_pt(x+10, y, c);

video_pt(x+1, y+1, c);
video_pt(x+10, y+1, c);
video_pt(x+1, y+2, c);
video_pt(x+10, y+2, c);
video_pt(x+1, y+3, c);
video_pt(x+10, y+3, c);
video_pt(x+1, y+4, c);
video_pt(x+10, y+4, c);
video_pt(x+1, y+5, c);
video_pt(x+10, y+5, c);
video_pt(x+1, y+6, c);
video_pt(x+10, y+6, c);
video_pt(x+1, y+7, c);
video_pt(x+10, y+7, c);
video_pt(x+1, y+8, c);
video_pt(x+10, y+8, c);

video_pt(x+1, y+9, c);
video_pt(x+2, y+9, c);
video_pt(x+3, y+9, c);
video_pt(x+4, y+9, c);
video_pt(x+5, y+9, c);
video_pt(x+6, y+9, c);
video_pt(x+7, y+9, c);
video_pt(x+8, y+9, c);
video_pt(x+9, y+9, c);
video_pt(x+10, y+9, c);

video_pt(x+3, y+10, c);
video_pt(x+4, y+10, c );
video_pt(x+5, y+10, c);
video_pt(x+6, y+10, c);
video_pt(x+7, y+10, c);

video_pt(x-4, y+11, c);
video_pt(x-3, y+11, c);
video_pt(x-2, y+11, c);
video_pt(x-1, y+11, c);
video_pt(x, y+11, c);
video_pt(x+1, y+11, c);
video_pt(x+2, y+11, c);
video_pt(x+3, y+11, c);
video_pt(x+4, y+11, c);
video_pt(x+5, y+11, c);
video_pt(x+6, y+11, c);
video_pt(x+7, y+11, c);
video_pt(x+8, y+11, c);
video_pt(x+9, y+11, c);
video_pt(x+10, y+11,c);
video_pt(x+11, y+11, c);
video_pt(x+12, y+11, c);
video_pt(x+13, y+11, c);
video_pt(x+14, y+11, c);
end

//put bigman 2
void video_putBigManBottomHalf(char x, char y, char c)
begin
video_pt(x-4, y+12, c);
video_pt(x-3, y+12, c);
video_pt(x-2, y+12, c);
video_pt(x-1, y+12, c);
video_pt(x, y+12, c);
video_pt(x+1, y+12, c);
video_pt(x+2, y+12, c);
video_pt(x+3, y+12, c);
video_pt(x+4, y+12, c);
video_pt(x+5, y+12, c);
video_pt(x+6, y+12, c);
video_pt(x+7, y+12, c);
video_pt(x+8, y+12, c);
video_pt(x+9, y+12, c);
video_pt(x+10, y+12, c);
video_pt(x+11, y+12, c);
video_pt(x+12, y+12, c);
video_pt(x+13, y+12, c);
video_pt(x+14, y+12, c);

video_pt(x+3, y+13, c);
video_pt(x+4, y+13, c);
video_pt(x+5, y+13, c);
video_pt(x+6, y+13, c);
video_pt(x+7, y+13, c);
video_pt(x+3, y+14, c);
video_pt(x+4, y+14, c);
video_pt(x+5, y+14, c);
video_pt(x+6, y+14, c);
video_pt(x+7, y+14, c);
video_pt(x+3, y+15, c);
video_pt(x+4, y+15, c);
video_pt(x+5, y+15, c);
video_pt(x+6, y+15, c);
video_pt(x+7, y+15, c);


video_pt(x-3, y+16, c);
video_pt(x-2, y+16, c);
video_pt(x-1, y+16, c);
video_pt(x, y+16, c);
video_pt(x+1, y+16, c);
video_pt(x+2, y+16, c);
video_pt(x+3, y+16, c);
video_pt(x+4, y+16, c);
video_pt(x+5, y+16, c);
video_pt(x+6, y+16, c);
video_pt(x+7, y+16, c);
video_pt(x+8, y+16, c);
video_pt(x+9, y+16, c);
video_pt(x+10, y+16, c);
video_pt(x+11, y+16, c);
video_pt(x+12, y+16, c);
video_pt(x+13, y+16, c);

video_pt(x-3, y+17, c);
video_pt(x-2, y+17, c);
video_pt(x-1, y+17, c);
video_pt(x, y+17, c);
video_pt(x+1, y+17, c);
video_pt(x+2, y+17, c);
video_pt(x+3, y+17, c);
video_pt(x+4, y+17, c);
video_pt(x+5, y+17, c);
video_pt(x+6, y+17, c);
video_pt(x+7, y+17, c);
video_pt(x+8, y+17, c);
video_pt(x+9, y+17, c);
video_pt(x+10, y+17, c);
video_pt(x+11, y+17, c);
video_pt(x+12, y+17, c);
video_pt(x+13, y+17, c);

video_pt(x+12, y+18, c);
video_pt(x+13, y+18, c);
video_pt(x+12, y+19, c);
video_pt(x+13, y+19, c);

video_pt(x-3, y+18, c);
video_pt(x-2, y+18, c);
video_pt(x-3, y+19, c);
video_pt(x-2, y+19, c);

end

void video_putSuperMan(char x, char y)
begin
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);
video_pt(x+2, y+5, 1);
video_pt(x+3, y+5, 1);
video_pt(x+4, y+5, 1);
video_pt(x+0, y+6, 1);
video_pt(x+1, y+6, 1);
video_pt(x+2, y+6, 1);
video_pt(x+3, y+6, 1);
video_pt(x+4, y+6, 1);
video_pt(x+5, y+6, 1);
video_pt(x+6, y+6, 1);
video_pt(x+0, y+7, 1);
video_pt(x+1, y+7, 1);
video_pt(x+2, y+7, 1);
video_pt(x+3, y+7, 1);
video_pt(x+4, y+7, 1);
video_pt(x+5, y+7, 1);
video_pt(x+6, y+7, 1);
video_pt(x+2, y+8, 1);
video_pt(x+3, y+8, 1);
video_pt(x+4, y+8, 1);
video_pt(x+2, y+9, 1);
video_pt(x+3, y+9, 1);
video_pt(x+4, y+9, 1);
video_pt(x+2, y+10, 1);
video_pt(x+4, y+10, 1);
video_pt(x+1, y+11, 1);
video_pt(x+2, y+11, 1);
video_pt(x+4, y+11, 1);
video_pt(x+5, y+11, 1);
end

void video_EraseSuperMan(char x, char y)
begin
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);
video_pt(x+2, y+5, 0);
video_pt(x+3, y+5, 0);
video_pt(x+4, y+5, 0);
video_pt(x+0, y+6, 0);
video_pt(x+1, y+6, 0);
video_pt(x+2, y+6, 0);
video_pt(x+3, y+6, 0);
video_pt(x+4, y+6, 0);
video_pt(x+5, y+6, 0);
video_pt(x+6, y+6, 0);
video_pt(x+0, y+7, 0);
video_pt(x+1, y+7, 0);
video_pt(x+2, y+7, 0);
video_pt(x+3, y+7, 0);
video_pt(x+4, y+7, 0);
video_pt(x+5, y+7, 0);
video_pt(x+6, y+7, 0);
video_pt(x+2, y+8, 0);
video_pt(x+3, y+8, 0);
video_pt(x+4, y+8, 0);
video_pt(x+2, y+9, 0);
video_pt(x+3, y+9, 0);
video_pt(x+4, y+9, 0);
video_pt(x+2, y+10, 0);
video_pt(x+4, y+10, 0);
video_pt(x+1, y+11, 0);
video_pt(x+2, y+11, 0);
video_pt(x+4, y+11, 0);
video_pt(x+5, y+11, 0);
end

void video_putBomb(char x, char y)
begin

video_pt(x+1, y, 1);
video_pt(x+2, y, 1);
video_pt(x+3, y, 1);
video_pt(x+4, y, 1);
video_pt(x+5, y, 1);
video_pt(x+1, y+1, 1);
video_pt(x+2, y+1, 1);
video_pt(x+3, y+1, 1);
video_pt(x+4, y+1, 1);
video_pt(x+5, y+1, 1);
video_pt(x+1, y+2, 1);
video_pt(x+2, y+2, 1);
video_pt(x+3, y+2, 1);
video_pt(x+4, y+2, 1);
video_pt(x+5, y+2, 1);
video_pt(x+1, y+3, 1);
video_pt(x+2, y+3, 1);
video_pt(x+3, y+3, 1);
video_pt(x+4, y+3, 1);
video_pt(x+5, y+3, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);

end

void video_EraseBomb(char x, char y)
begin

video_pt(x+1, y, 0);
video_pt(x+2, y, 0);
video_pt(x+3, y, 0);
video_pt(x+4, y, 0);
video_pt(x+5, y, 0);
video_pt(x+1, y+1, 0);
video_pt(x+2, y+1, 0);
video_pt(x+3, y+1, 0);
video_pt(x+4, y+1, 0);
video_pt(x+5, y+1, 0);
video_pt(x+1, y+2, 0);
video_pt(x+2, y+2, 0);
video_pt(x+3, y+2, 0);
video_pt(x+4, y+2, 0);
video_pt(x+5, y+2, 0);
video_pt(x+1, y+3, 0);
video_pt(x+2, y+3, 0);
video_pt(x+3, y+3, 0);
video_pt(x+4, y+3, 0);
video_pt(x+5, y+3, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);

end

//put dying man
void video_putDyingMan(char x, char y)
begin
video_pt(x+1, y, 1);
video_pt(x+2, y, 1);
video_pt(x+3, y, 1);
video_pt(x+4, y, 1);
video_pt(x+5, y, 1);
video_pt(x+1, y+1, 1);
video_pt(x+5, y+1, 1);
video_pt(x+1, y+2, 1);
video_pt(x+5, y+2, 1);
video_pt(x+1, y+3, 1);
video_pt(x+5, y+3, 1);
video_pt(x+1, y+4, 1);
video_pt(x+2, y+4, 1);
video_pt(x+3, y+4, 1);
video_pt(x+4, y+4, 1);
video_pt(x+5, y+4, 1);
video_pt(x+2, y+5, 1);
video_pt(x+3, y+5, 1);
video_pt(x+4, y+5, 1);
video_pt(x+0, y+6, 1);
video_pt(x+1, y+6, 1);
video_pt(x+2, y+6, 1);
video_pt(x+3, y+6, 1);
video_pt(x+4, y+6, 1);
video_pt(x+5, y+6, 1);
video_pt(x+6, y+6, 1);
video_pt(x+0, y+7, 1);
video_pt(x+1, y+7, 1);
video_pt(x+2, y+7, 1);
video_pt(x+3, y+7, 1);
video_pt(x+4, y+7, 1);
video_pt(x+5, y+7, 1);
video_pt(x+6, y+7, 1);
video_pt(x+0, y+9, 1);
video_pt(x+2, y+9, 1);
video_pt(x+3, y+9, 1);
video_pt(x+4, y+9, 1);
video_pt(x+6, y+9, 1);
video_pt(x, y+10, 1);
video_pt(x+1, y+10, 1);
video_pt(x+2, y+10, 1);
video_pt(x+3, y+10, 1);
video_pt(x+4, y+10, 1);
video_pt(x+5, y+10, 1);
video_pt(x+6, y+10, 1);
end

//Erase dying man
void video_EraseDyingMan(char x, char y)
begin
video_pt(x+1, y, 0);
video_pt(x+2, y, 0);
video_pt(x+3, y, 0);
video_pt(x+4, y, 0);
video_pt(x+5, y, 0);
video_pt(x+1, y+1, 0);
video_pt(x+5, y+1, 0);
video_pt(x+1, y+2, 0);
video_pt(x+5, y+2, 0);
video_pt(x+1, y+3, 0);
video_pt(x+5, y+3, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);
video_pt(x+2, y+5, 0);
video_pt(x+3, y+5, 0);
video_pt(x+4, y+5, 0);
video_pt(x+0, y+6, 0);
video_pt(x+1, y+6, 0);
video_pt(x+2, y+6, 0);
video_pt(x+3, y+6, 0);
video_pt(x+4, y+6, 0);
video_pt(x+5, y+6, 0);
video_pt(x+6, y+6, 0);
video_pt(x+0, y+7, 0);
video_pt(x+1, y+7, 0);
video_pt(x+2, y+7, 0);
video_pt(x+3, y+7, 0);
video_pt(x+4, y+7, 0);
video_pt(x+5, y+7, 0);
video_pt(x+6, y+7, 0);
video_pt(x+0, y+9, 0);
video_pt(x+2, y+9, 0);
video_pt(x+3, y+9, 0);
video_pt(x+4, y+9, 0);
video_pt(x+6, y+9, 0);
video_pt(x, y+10, 0);
video_pt(x+1, y+10, 0);
video_pt(x+2, y+10, 0);
video_pt(x+3, y+10, 0);
video_pt(x+4, y+10, 0);
video_pt(x+5, y+10, 0);
video_pt(x+6, y+10, 0);
end

//Erase man
void video_EraseMan(char x, char y)
begin

video_pt(x+1, y, 0);
video_pt(x+2, y, 0);
video_pt(x+3, y, 0);
video_pt(x+4, y, 0);
video_pt(x+5, y, 0);
video_pt(x+1, y+1, 0);
video_pt(x+5, y+1, 0);
video_pt(x+1, y+2, 0);
video_pt(x+5, y+2, 0);
video_pt(x+1, y+3, 0);
video_pt(x+5, y+3, 0);
video_pt(x+1, y+4, 0);
video_pt(x+2, y+4, 0);
video_pt(x+3, y+4, 0);
video_pt(x+4, y+4, 0);
video_pt(x+5, y+4, 0);
video_pt(x+2, y+5, 0);
video_pt(x+3, y+5, 0);
video_pt(x+4, y+5, 0);
video_pt(x+0, y+6, 0);
video_pt(x+1, y+6, 0);
video_pt(x+2, y+6, 0);
video_pt(x+3, y+6, 0);
video_pt(x+4, y+6, 0);
video_pt(x+5, y+6, 0);
video_pt(x+6, y+6, 0);
video_pt(x+0, y+7, 0);
video_pt(x+1, y+7, 0);
video_pt(x+2, y+7, 0);
video_pt(x+3, y+7, 0);
video_pt(x+4, y+7, 0);
video_pt(x+5, y+7, 0);
video_pt(x+6, y+7, 0);
video_pt(x+2, y+8, 0);
video_pt(x+3, y+8, 0);
video_pt(x+4, y+8, 0);
video_pt(x+2, y+9, 0);
video_pt(x+3, y+9, 0);
video_pt(x+4, y+9, 0);
video_pt(x+2, y+10, 0);
video_pt(x+4, y+10, 0);
video_pt(x+1, y+11, 0);
video_pt(x+2, y+11, 0);
video_pt(x+4, y+11, 0);
video_pt(x+5, y+11, 0);
end
//==================================
// put a string of big characters on the screen
void video_puts(char x, char y, char *str)
begin
char i ;
for (i=0; str[i]!=0; i++)
begin
if (str[i]>=0x30 && str[i]<=0x3a)
video_putchar(x,y,str[i]-0x30);
else if (str[i]==0x20)
video_putchar(x,y,38);
else video_putchar(x,y,str[i]-0x40+9);
x = x+6;
end
end

//==================================
// put a small character on the screen
// x-cood must be on divisible by 4
// c is index into bitmap
void video_smallchar(char x, char y, char c)
begin
char mask;
i=((int)x>>3) + ((int)y<<4) ;
if (x == (x & 0xf8)) mask = 0x0f; //f8
else mask = 0xf0;

screen[i] = (screen[i] & mask) | (smallbitmap[c][0] & ~mask);
screen[i+16] = (screen[i+16] & mask) | (smallbitmap[c][1] & ~mask);
screen[i+32] = (screen[i+32] & mask) | (smallbitmap[c][2] & ~mask);
screen[i+48] = (screen[i+48] & mask) | (smallbitmap[c][3] & ~mask);
screen[i+64] = (screen[i+64] & mask) | (smallbitmap[c][4] & ~mask);
end

//==================================
// put a string of small characters on the screen
// x-cood must be on divisible by 4
void video_putsmalls(char x, char y, char *str)
begin
char i ;
for (i=0; str[i]!=0; i++)
begin
if (str[i]>=0x30 && str[i]<=0x3a)
video_smallchar(x,y,str[i]-0x30);
else if (str[i]==0x20)
video_smallchar(x,y,12);
else video_smallchar(x,y,str[i]-0x40+12);
x = x+4;
end
end

//==================================
//plot a line
//at x1,y1 to x2,y2 with color 1=white 0=black 2=invert
//NOTE: this function requires signed chars
//Code is from David Rodgers,
//"Procedural Elements of Computer Graphics",1985
void video_line(char x1, char y1, char x2, char y2, char c)
begin
int e;
signed char dx,dy,j, temp;
signed char s1,s2, xchange;
signed char x,y;

x = x1;
y = y1;
dx = cabs(x2-x1);
dy = cabs(y2-y1);
s1 = csign(x2-x1);
s2 = csign(y2-y1);
xchange = 0;
if (dy>dx)
begin
temp = dx;
dx = dy;
dy = temp;
xchange = 1;
end
e = ((int)dy<<1) - dx;
for (j=0; j<=dx; j++)
begin
video_pt(x,y,c) ;
if (e>=0)
begin
if (xchange==1) x = x + s1;
else y = y + s2;
e = e - ((int)dx<<1);
end
if (xchange==1) y = y + s2;
else x = x + s1;
e = e + ((int)dy<<1);
end
end

//==================================
//return the value of one point
//at x,y with color 1=white 0=black 2=invert
char video_set(char x, char y)
begin
//The following construction
//detects exactly one bit at the x,y location
i=((int)x>>3) + ((int)y<<4) ;
return ( screen[i] & 1<<(7-(x & 0x7)));
end

//==================================
//clears the screen
void clear(){
for(ii=0 ; ii<=1600 ; ii++) screen[ii] = 0;
}

 

//==================================
// set up the ports and timers
void main(void)
begin

for (ii=0; ii<9; ii++)
supermanlife[ii]=2;

//PORT A Gun Input
DDRA = 0x00;
PORTA = 0xFF;

//Port B
//DDRB = 0x00;
//PORTB = 0xFF;

//PORT C
DDRC = 0x00;
PORTC = 0xFF;


//A/D Stuff
ADMUX = 0b00100000;
ADCSR = 0b11000111;
ADCSR.6=1;


//init timer 1 to generate sync
OCR1A = lineTime; //One NTSC line
TCCR1B = 9; //full speed; clear-on-match
TCCR1A = 0x00; //turn off pwm and oc lines
TIMSK = 0x10; //enable interrupt T1 cmp

//init ports
DDRD = 0xf0; //video out and switches
//D.5 is sync:1000 ohm + diode to 75 ohm resistor
//D.6 is video:330 ohm + diode to 75 ohm resistor

//initialize synch constants
LineCount = 1;
syncON = 0b00000000;
syncOFF = 0b00100000;

//Print "CORNELL"
//video_puts(13,3,cu1);
//Print "ECE476"
//video_puts(65,3,cu2);

//side lines
#define width 126


//init software timer
t=0;


//init monster
monster[0]=2;

//init animation
//DDRC= 0xff;

// PORTC=0x00;

for (ii=0; ii<9; ii++)
begin
vx[ii] = 0x0100;
vy[ii]= 0x0100;
end

//video_pt(x,y,1);

//init musical scale
note = 0;
musicT = 0;
//use OC0 (pin B.3) for music
DDRB.3 = 1 ;

//enable sleep mode
MCUCR = 0b10000000;
#asm ("sei");

//The following loop executes once/video line during lines
//1-230, then does all of the frame-end processing
while(1)
begin

//stall here until next line starts
//sleep enable; mode=idle
//use sleep to make entry into sync ISR uniform time

#asm ("sleep");

//The following code executes during the vertical blanking
//Code here can be as long as
//a total of 60 lines x 63.5 uSec/line x 8 cycles/uSec

//light sensor
/*
if (PINA.1 == 1)
begin
PORTC = 0x00;
end

//trigger
if (~PINA.0 == 1)
begin
PORTC = 0xFF;
end
*/
if (LineCount <210 && game==1)
begin
if (frame ==11 && PINA.1 ==1) Stationary = 1;
Light =Light || PINA.1;

/*if (frame ==12 && PINA.1 == 1 && Stationary == 0) numberone[0] = 0;
if (frame ==13 && PINA.1 == 1 && Stationary == 0) numberone[1] = 0;
if (frame ==14 && PINA.1 == 1 && Stationary == 0) numberone[2] = 0;
if (frame ==15 && PINA.1 == 1 && Stationary == 0) numberone[3] = 0;
if (frame ==16 && PINA.1 == 1 && Stationary == 0) numberone[4] = 0;
if (frame ==17 && PINA.1 == 1 && Stationary == 0) numberone[5] = 0;
if (frame ==18 && PINA.1 == 1 && Stationary == 0) numberone[6] = 0;
if (frame ==19 && PINA.1 == 1 && Stationary == 0) numberone[7] = 0;
if (frame ==20 && PINA.1 == 1 && Stationary == 0) numberone[8] = 0;
*/
end

//STARTHERE
if (LineCount==231)
begin
switch(game)
{
//initial state
case 0:

if((musicT++) > 15) //each note 1/4 second
begin
musicT = 0;
TCCR0 = 0;
if (notes[note]>0) TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[note++] ;
if (note>18) note = 0; //test for end of scale
end

//"Welcome to"
if (drawer==0)
{
strcpyf(outputword, cu2);
video_puts(25,25,outputword);
drawer++;
}
// "Sharp Shooter"
else if (drawer==1)
{
strcpyf(outputword, cu3);
video_puts(35,35, outputword);
drawer++;
x[0]=0x0500;
y[0]=0x0600;
}
//draws big man
else if (drawer==2)
{
video_putBigManTopHalf(5,25,1);
drawer++;
}
else if (drawer==3)
{
video_putBigManBottomHalf(5,25,1);
drawer++;
}
//Writes by curtis and adrian
else if (drawer==4)
{
strcpyf(outputword, cu5);
video_putsmalls(24,50,outputword);
drawer++;
}
else if (drawer==5)
{
strcpyf(outputword, cu6);
video_putsmalls(64,50,outputword);
drawer++;
}
//draws running man on top half of the screen
else if (drawer==6)
{
video_EraseMan((char)(x[0]>>8),(char)(y[0]>>8));



if (x[0]<0x0400){ vx[0] = -vx[0]; x[0]=0x0400;} //42+4 = 46
if (y[0]<0x0300 ) {vy[0] = -vy[0]; y[0]=0x0300;} //11+4
if (y[0]>0x0800 ) {vy[0] = -vy[0]; y[0]=0x0800;} //37-4-12 = 21

x[0] = x[0] + vx[0];
y[0] = y[0] + vy[0];

if (x[0]>0x7600)
begin
drawer++;
x[0]=0x0500;
y[0]=0x4900;
end
else video_putMan((char)(x[0]>>8),(char)(y[0]>>8));

}
//draws running man on bottom half of the screen
else if (drawer==7)
{
video_EraseMan((char)(x[0]>>8),(char)(y[0]>>8));



if (x[0]<0x0400){ vx[0] = -vx[0]; x[0]=0x0400;} //42+4 = 46
if (y[0]<0x4800 ) {vy[0] = -vy[0]; y[0]=0x04800;} //11+4
if (y[0]>0x4F00 ) {vy[0] = -vy[0]; y[0]=0x4F00;} //37-4-12 = 21

x[0] = x[0] + vx[0];
y[0] = y[0] + vy[0];

if (x[0]>0x7600)
begin
drawer=5;
x[0]=0x0500;
y[0]=0x0600;
end
else video_putMan((char)(x[0]>>8),(char)(y[0]>>8));
}

//if gun shot, proceed to game
if (~PINA.0 == 1)
{
game = 1;
drawer=0;
TCCR0=0;


}
break;

//===================================================================
//playing game state
case 1:
//Add time each 1/60th of a second
trigger_timer++;

//Drawing the Screen a bit at a time
if (drawer ==0)
{
strcpyf(outputword, cu4);
video_puts(25,25,outputword);
drawer++;
}
//erase word
else if(drawer ==1)
{
video_puts(35,35,outputword);
drawer++;
}
//erase big man
else if (drawer ==2)
{
video_putBigManTopHalf(5,25,0);
drawer++;
}
else if (drawer==3)
{
video_putBigManBottomHalf(5,25,0);
drawer++;
}
else if (drawer==4)
{
strcpyf(outputword, cu4);
video_putsmalls(24,50,outputword);
drawer++;
}
else if (drawer==5)
{
strcpyf(outputword, cu4);
video_putsmalls(64,50,outputword);
drawer++;
}
//erases running man
else if (drawer==6)
{
video_EraseMan((char)((x[0]-vx[0])>>8),(char)((y[0]-vy[0])>>8));
drawer++;
}
else if (drawer==7)
{
video_EraseMan((char)(x[0]>>8),(char)(y[0]>>8));
drawer++;
}
else if (drawer ==8)
{
video_line(0,0,0,99,1);
video_line(width,0,width,99,1);
drawer++;
}
else if (drawer ==9)
{
//top line & bottom lines
video_line(0,0,width,0,1);
video_line(0,99,width,99,1);
drawer++;
}

else if (drawer ==10)
{
//top line & bottom lines cont.
video_line(0,11,width,11,1);
video_line(0,89,width,89,1);
drawer++;
}
else if (drawer==11)
{
//Middle Vertical Lines
video_line(42,11,42,89,1);
video_line(84,11,84,89,1);
drawer++;
}
else if (drawer ==12)
{
//Middle Verticl Lines cont.
video_line(0,37,width,37,1);
video_line(0,63,width,63,1);
drawer ++;
}
else if (drawer==13)
{
//Life Indicator
strcpyf(outputword, cu1);
video_puts(13, 3, outputword);
video_putHeart(40, 3);
video_putHeart(50, 3);
video_putHeart(60, 3);
drawer++;
}
else if (drawer==14)
{
//Life Indicator
video_putHeart(70, 3);
video_putHeart(80, 3);
drawer++;
}
else if(drawer==15)
{
//draw bullets
video_putBullet(5,93);
video_putBullet(15,93);
video_putBullet(25,93);
drawer++;
}
else if(drawer==16)
{
//draw bullets continued
video_putBullet(35,93);
video_putBullet(45,93);
video_putBullet(55,93);
drawer++;
}

//END GAME STATE
if (life == 0)
begin
game = 2;
drawer=0;
TCCR0 = 0;
OCR0=0;
end

//Play a note
//TCCR0 bits:
//bit 7 no force:
//bit 3 CTC on:
//bit 5,4 toggle OC0 pin
//bit 6 no PWM
//bit 2-0 prescaler 256 so 1 tick is 16 microsec
if((musicT++) > 15) //each note 1/4 second
begin
musicT = 0;

//continues on with the rest of the notes after the 1st note is played
if (hit ==1)
begin
TCCR0 = 0b00011100;
OCR0 =notes[2];
hit=0;
end
else if (hit ==2)
begin
TCCR0 = 0b00011100;
OCR0 =notes[4];
hit++;
end
else if (hit==3)
begin
TCCR0 = 0b00011100;
OCR0 =notes[5];
hit=0;
end
else if (hit==4)
begin
TCCR0 = 0b00011100;
OCR0 =notes[7];
hit++;
end
else if (hit==5)
begin
TCCR0 = 0b00011100;
OCR0 =notes[8];
hit=0;
end
else TCCR0=0; //turn off if no other notes need to be played

// if (notes[note]>0) TCCR0 = 0b00011100 ; //not a rest
// OCR0 = notes[note++] ;
// if (note>18) note = 0; //test for end of scale
end

//trigger turns on when it is shot less than 3 times per second and all the initial screens has been drawn
if (~PINA.0 == 1 && frame <=9 && trigger_timer>=20 && bullets > 0 && drawer>16)
begin

frame = 10;
trigger_timer = 0;

//Gun Shot
TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[0];
musicT=0;

//Erases Bullets Animation every time you shoot
if(bullets==6) video_EraseBullet(55,93);
if(bullets==5) video_EraseBullet(45,93);
if(bullets==4) video_EraseBullet(35,93);
if(bullets==3) video_EraseBullet(25,93);
if(bullets==2) video_EraseBullet(15,93);
if(bullets==1) video_EraseBullet(5,93);
bullets--;
end

//switch statement that leads to the creation of new men
switch (~PINC)
{
case 0x01:
if (numberone[0]==0)
{
x[0] = 0x1000;
y[0] = 0x1000;
//PORTC= 0xFE;
numberone[0] = 1;
}
break;

case 0x02:
if (numberone[1]==0)
{
x[1] = 0x3A00;
y[1] = 0x1000;
//PORTC = 0xFD;
numberone[1] = 1;
}
break;

case 0x04:
if (numberone[2]==0)
{
x[2] = 0x6400;
y[2] = 0x1000;
//PORTC = 0xFB;
numberone[2] = 1;
}
break;

case 0x08:
if (numberone[3]==0)
{
x[3] = 0x1000;
y[3] = 0x2900;
// PORTC = 0xF7;
numberone[3] = 1;
}
break;

case 0x10:
if (numberone[4]==0)
{
x[4] = 0x3A00;
y[4] = 0x2900;
//PORTC = 0xEF;
numberone[4] = 1;
}
break;

case 0x20:
if (numberone[5]==0)
{
x[5] = 0x6400;
y[5] = 0x2900;
// PORTC = 0xDF;
numberone[5] = 1;
}
break;

case 0x40:
if (numberone[6]==0)
{
x[6] = 0x1000;
y[6] = 0x4200;
// PORTC = 0xBF;
numberone[6] = 1;
}
break;

case 0x80:
if (numberone[7]==0)
{
x[7] = 0x3A00;
y[7] = 0x4200;
// PORTC = 0x7F;
numberone[7] = 1;
}
break;

}

//Pin for 9th guy
if (~PINA.2 ==1)
begin
if (numberone[8]==0)
{
x[8] = 0x6400;
y[8] = 0x4200;
numberone[8] = 1;
}
end

//the 4 buttons used to create different type of men
for (ii=0; ii<9; ii++)
begin
if (PINA.4 == 0 && numberone[ii] ==0) monster[ii]=0; //signifies first monster
if (PINA.6 == 0 && numberone[ii] ==0) monster[ii]=2; //signifies 2nd monster
if (PINA.5 == 0 && numberone[ii] ==0) monster[ii]=4; //signifies 3rd monster
if (PINA.7 == 0 && numberone[ii] ==0) monster[ii]=6; //signifies 4th monster
end

//Reload Button
if (PINA.3 == 0)
begin
video_putBullet(5,93);
video_putBullet(15,93);
video_putBullet(25,93);
video_putBullet(35,93);
video_putBullet(45,93);
video_putBullet(55,93);
bullets=6;
end


if (frame ==10 /*&& ~PINA.0 == 0*/)
begin

for (ii=0; ii<9; ii++)
begin
if (numberone[ii]==1)
begin
if (monster[ii]==0) video_EraseMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==1) video_EraseDyingMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==2) video_EraseBomb((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==4) video_EraseBombMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==5) video_EraseBombMan2((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==6) video_EraseSuperMan((char)(x[ii]>>8),(char)(y[ii]>>8));
end
end

/*
//Delete all dots
if (numberone[0] ==1)
begin
if (monster[0]==0) video_EraseMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==1) video_EraseDyingMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==2) video_EraseBomb((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==4) video_EraseBombMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==5) video_EraseBombMan2((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==6) video_EraseSuperMan((char)(x[0]>>8),(char)(y[0]>>8));
end
if (numberone[1] ==1) //video_EraseMan((char)(x[1]>>8),(char)(y[1]>>8));
begin
if (monster[1]==0) video_EraseMan((char)(x[1]>>8),(char)(y[1]>>8));
if (monster[1]==1) video_EraseDyingMan((char)(x[1]>>8),(char)(y[1]>>8));
if (monster[1]==2) video_EraseBomb((char)(x[1]>>8),(char)(y[1]>>8));
if (monster[1]==4) video_EraseBombMan((char)(x[1]>>8),(char)(y[1]>>8));
if (monster[1]==5) video_EraseBombMan2((char)(x[1]>>8),(char)(y[1]>>8));
if (monster[1]==6) video_EraseSuperMan((char)(x[1]>>8),(char)(y[1]>>8));
end
if (numberone[2] ==1) //video_EraseMan((char)(x[2]>>8),(char)(y[2]>>8));
begin
if (monster[2]==0) video_EraseMan((char)(x[2]>>8),(char)(y[2]>>8));
if (monster[2]==1) video_EraseDyingMan((char)(x[2]>>8),(char)(y[2]>>8));
if (monster[2]==2) video_EraseBomb((char)(x[2]>>8),(char)(y[2]>>8));
if (monster[2]==4) video_EraseBombMan((char)(x[2]>>8),(char)(y[2]>>8));
if (monster[2]==5) video_EraseBombMan2((char)(x[2]>>8),(char)(y[2]>>8));
if (monster[2]==6) video_EraseSuperMan((char)(x[2]>>8),(char)(y[2]>>8));
end
if (numberone[3] ==1) //video_EraseMan((char)(x[3]>>8),(char)(y[3]>>8));
begin
if (monster[3]==0) video_EraseMan((char)(x[3]>>8),(char)(y[3]>>8));
if (monster[3]==1) video_EraseDyingMan((char)(x[3]>>8),(char)(y[3]>>8));
if (monster[3]==2) video_EraseBomb((char)(x[3]>>8),(char)(y[3]>>8));
if (monster[3]==4) video_EraseBombMan((char)(x[3]>>8),(char)(y[3]>>8));
if (monster[3]==5) video_EraseBombMan2((char)(x[3]>>8),(char)(y[3]>>8));
if (monster[3]==6) video_EraseSuperMan((char)(x[3]>>8),(char)(y[3]>>8));
end

if (numberone[4] ==1) //video_EraseMan((char)(x[4]>>8),(char)(y[4]>>8));
begin
if (monster[4]==0) video_EraseMan((char)(x[4]>>8),(char)(y[4]>>8));
if (monster[4]==1) video_EraseDyingMan((char)(x[4]>>8),(char)(y[4]>>8));
if (monster[4]==2) video_EraseBomb((char)(x[4]>>8),(char)(y[4]>>8));
if (monster[4]==4) video_EraseBombMan((char)(x[4]>>8),(char)(y[4]>>8));
if (monster[4]==5) video_EraseBombMan2((char)(x[4]>>8),(char)(y[4]>>8));
if (monster[4]==6) video_EraseSuperMan((char)(x[4]>>8),(char)(y[4]>>8));
end

if (numberone[5] ==1) //video_EraseMan((char)(x[5]>>8),(char)(y[5]>>8));
begin
if (monster[5]==0) video_EraseMan((char)(x[5]>>8),(char)(y[5]>>8));
if (monster[5]==1) video_EraseDyingMan((char)(x[5]>>8),(char)(y[5]>>8));
if (monster[5]==2) video_EraseBomb((char)(x[5]>>8),(char)(y[5]>>8));
if (monster[5]==4) video_EraseBombMan((char)(x[5]>>8),(char)(y[5]>>8));
if (monster[5]==5) video_EraseBombMan2((char)(x[5]>>8),(char)(y[5]>>8));
if (monster[5]==6) video_EraseSuperMan((char)(x[5]>>8),(char)(y[5]>>8));
end

if (numberone[6] ==1) //video_EraseMan((char)(x[6]>>8),(char)(y[6]>>8));
begin
if (monster[6]==0) video_EraseMan((char)(x[6]>>8),(char)(y[6]>>8));
if (monster[6]==1) video_EraseDyingMan((char)(x[6]>>8),(char)(y[6]>>8));
if (monster[6]==2) video_EraseBomb((char)(x[6]>>8),(char)(y[6]>>8));
if (monster[6]==4) video_EraseBombMan((char)(x[6]>>8),(char)(y[6]>>8));
if (monster[6]==5) video_EraseBombMan2((char)(x[6]>>8),(char)(y[6]>>8));
if (monster[6]==6) video_EraseSuperMan((char)(x[6]>>8),(char)(y[6]>>8));
end

if (numberone[7] ==1) //video_EraseMan((char)(x[7]>>8),(char)(y[7]>>8));
begin
if (monster[7]==0) video_EraseMan((char)(x[7]>>8),(char)(y[7]>>8));
if (monster[7]==1) video_EraseDyingMan((char)(x[7]>>8),(char)(y[7]>>8));
if (monster[7]==2) video_EraseBomb((char)(x[7]>>8),(char)(y[7]>>8));
if (monster[7]==4) video_EraseBombMan((char)(x[7]>>8),(char)(y[7]>>8));
if (monster[7]==5) video_EraseBombMan2((char)(x[7]>>8),(char)(y[7]>>8));
if (monster[7]==6) video_EraseSuperMan((char)(x[7]>>8),(char)(y[7]>>8));
end

if (numberone[8] ==1) //video_EraseMan((char)(x[8]>>8),(char)(y[8]>>8));
begin
if (monster[8]==0) video_EraseMan((char)(x[8]>>8),(char)(y[8]>>8));
if (monster[8]==1) video_EraseDyingMan((char)(x[8]>>8),(char)(y[8]>>8));
if (monster[8]==2) video_EraseBomb((char)(x[8]>>8),(char)(y[8]>>8));
if (monster[8]==4) video_EraseBombMan((char)(x[8]>>8),(char)(y[8]>>8));
if (monster[8]==5) video_EraseBombMan2((char)(x[8]>>8),(char)(y[8]>>8));
if (monster[8]==6) video_EraseSuperMan((char)(x[8]>>8),(char)(y[8]>>8));
end
*/
end


if (frame ==11)
begin
//Create 1st Man
if (numberone[0] ==1)
begin
if (monster[0]==0) video_putMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==1) video_putDyingMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==2) video_putBomb((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==4) video_putBombMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==5) video_putBombMan2((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==6) video_putSuperMan((char)(x[0]>>8),(char)(y[0]>>8));
end

Light = 0;
end

for (ii=0; ii<9; ii++)
if (frame ==ii+12)
begin
//Delete ith Man
if (numberone[ii] ==1)
begin
if (monster[ii]==0) video_EraseMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==1) video_EraseDyingMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==2) video_EraseBomb((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==4) video_EraseBombMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==5) video_EraseBombMan2((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==6) video_EraseSuperMan((char)(x[ii]>>8),(char)(y[ii]>>8));
end

//Destruction of 1st Dot if Light is found
if (Light ==1 && Stationary ==0 && numberone[ii] ==1)
begin

if (monster[ii] != 6 || (monster[ii]==6 && supermanlife[ii]==0))
begin
numberone[ii]=0;
Light = 0;
Stationary = 1;
timer[ii] = 0;

//Sound for Normal Guy Death
TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[1];
hit = 1;
musicT=0;

//if the Headless superman is killed, gain a life
if (monster[ii] ==6)
{
if (life==4) begin
video_putHeart(80,3);
life++;
end

else if (life==3) begin
video_putHeart(70,3);
life++;
end

else if (life==2) begin
video_putHeart(60,3);
life++;
end

else if (life==1) begin
video_putHeart(50,3);
life++;
end
supermanlife[ii] = 2;

//Sound for Gaining Health
TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[6];
hit = 4;
musicT=0;

}

//if bomb or samurai guy with sword is shot at, lose a life
if (monster[ii]==2 || monster[ii]==5)
begin
if (life==5) begin
video_EraseHeart(80,3);
life--;
end

else if (life==4) begin
video_EraseHeart(70,3);
life--;
end

else if (life==3) begin
video_EraseHeart(60,3);
life--;
end

else if (life==2) begin
video_EraseHeart(50,3);
life--;
end

else if (life==1) begin
video_EraseHeart(40,3);
life--;
end

//Sound for Losing Health
TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[3];
hit = 2;
musicT=0;

end //monster[0]==2 || monster[0]==5

monster[ii] = 0;
end
else // (monster[0]==6)
begin
supermanlife[ii]--;
Light = 0;
Stationary = 1;
end

end //Light==1 && Stationary ==0

if (ii==8)
begin
frame = 0;
Stationary = 0;
end
else
begin
//Create 2nd Man
if (numberone[ii+1] ==1)
begin
if (monster[ii+1]==0) video_putMan((char)(x[ii+1]>>8),(char)(y[ii+1]>>8));
if (monster[ii+1]==1) video_putDyingMan((char)(x[ii+1]>>8),(char)(y[ii+1]>>8));
if (monster[ii+1]==2) video_putBomb((char)(x[ii+1]>>8),(char)(y[ii+1]>>8));
if (monster[ii+1]==4) video_putBombMan((char)(x[ii+1]>>8),(char)(y[ii+1]>>8));
if (monster[ii+1]==5) video_putBombMan2((char)(x[ii+1]>>8),(char)(y[ii+1]>>8));
if (monster[ii+1]==6) video_putSuperMan((char)(x[ii+1]>>8),(char)(y[ii+1]>>8));
end
end
end //for loop
/*
if (frame ==13)
begin
//Delete 2nd Dot
if (numberone[1] ==1)
video_EraseMan((char)(x[1]>>8),(char)(y[1]>>8));

//Destruction of 2nd Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[1]=0;
Light = 0;
Stationary = 1;
end

//Create 3rd Dot
if (numberone[2] ==1)
video_putMan((char)(x[2]>>8),(char)(y[2]>>8));
end

if (frame ==14)
begin
//Delete 3rd Dot
if (numberone[2] ==1)
video_EraseMan((char)(x[2]>>8),(char)(y[2]>>8));

//Destruction of 3rd Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[2]=0;
Light = 0;
Stationary = 1;
end

//Create 4th Dot
if (numberone[3] ==1)
video_putMan((char)(x[3]>>8),(char)(y[3]>>8));
end

if (frame ==15)
begin
//Delete 4th Dot
if (numberone[3] ==1)
video_EraseMan((char)(x[3]>>8),(char)(y[3]>>8));

//Destruction of 4th Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[3]=0;
Light = 0;
Stationary = 1;
end

//Create 5th Dot
if (numberone[4] ==1)
video_putMan((char)(x[4]>>8),(char)(y[4]>>8));
end

if (frame ==16)
begin
//Delete 5th Dot
if (numberone[4] ==1)
video_EraseMan((char)(x[4]>>8),(char)(y[4]>>8));

//Destruction of 5th Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[4]=0;
Light = 0;
Stationary = 1;
end

//Create 6th Dot
if (numberone[5] ==1)
video_putMan((char)(x[5]>>8),(char)(y[5]>>8));
end

if (frame ==17)
begin
//Delete 6th Dot
if (numberone[5] ==1)
video_EraseMan((char)(x[5]>>8),(char)(y[5]>>8));

//Destruction of 6th Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[5]=0;
Light = 0;
Stationary = 1;
end

//Create 7th Dot
if (numberone[6] ==1)
video_putMan((char)(x[6]>>8),(char)(y[6]>>8));
end

if (frame ==18)
begin
//Delete 7th Dot
if (numberone[6] ==1)
video_EraseMan((char)(x[6]>>8),(char)(y[6]>>8));

//Destruction of 7th Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[6]=0;
Light = 0;
Stationary = 1;
end

//Create 8th Dot
if (numberone[7] ==1)
video_putMan((char)(x[7]>>8),(char)(y[7]>>8));
end

if (frame ==19)
begin
//Delete 8th Dot
if (numberone[7] ==1)
video_EraseMan((char)(x[7]>>8),(char)(y[7]>>8));

//Destruction of 8th. Dot if Light is found
if (Light ==1 && Stationary ==0)
begin
numberone[7]=0;
Light = 0;
Stationary = 1;
end

//Create 9th Dot
if (numberone[8] ==1)
video_putMan((char)(x[8]>>8),(char)(y[8]>>8));
end
*/
/*
if (frame ==20)
begin
//Delete 9th Dot
if (numberone[8] ==1)
video_EraseMan((char)(x[8]>>8),(char)(y[8]>>8));
frame = 0;
Stationary = 0;
end
*/
//================================================================================
//This is the part of the code that updates the motion of the different men
for (ii=0; ii<9; ii++)
begin
if (frame ==ii && numberone[ii])
begin
//Erases Man
if (monster[ii]==0) video_EraseMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==1) video_EraseDyingMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==2) video_EraseBomb((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==4) video_EraseBombMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==5) video_EraseBombMan2((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==6) video_EraseSuperMan((char)(x[ii]>>8),(char)(y[ii]>>8));

//if timer is 4, make normal man jump
if (timer[ii] == 4 && monster[ii]==0) monster[ii]=1;

//time has run out for the normal guy or bomb in 5 seconds and headless superman in 8 seconds
if ((timer[ii]==5 && (monster[ii]==0 || monster[ii]==1 || monster[ii]==2)) || (timer[ii]==8 && monster[ii]==6))
{

//if the time has run out for the normal guy or the headless superman, lose a health
if (monster[ii]==1 || monster[ii]==6)
begin

if (life==5) begin
video_EraseHeart(80,3);
life--;
end

else if (life==4) begin
video_EraseHeart(70,3);
life--;
end

else if (life==3) begin
video_EraseHeart(60,3);
life--;
end

else if (life==2) begin
video_EraseHeart(50,3);
life--;
end

else if (life==1) begin
video_EraseHeart(40,3);
life--;
end

//Sound for Losing Health
TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[3];
hit = 2;
musicT=0;
end

timer[ii]=0;
numberone[ii]=0;
monster[ii]=0;

}

//change to the samurai guy with swords in 2 seconds
if(timer[ii]==2 && monster[ii]==4)
begin
monster[ii]=5;
end

//change back to the samurai guy w/o swords in 4 seconds
if(timer[ii]==4 && monster[ii]==5)
begin
monster[ii]=4;
end

if(timer[ii]==6 && monster[ii]==4)
begin
//Sound for Losing Health
TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[3];
hit = 2;
musicT=0;

timer[ii]=0;
numberone[ii]=0;
monster[ii]=0;
//lose a health if samurai guy is not killed in 6 seconds
if (life==5) begin
video_EraseHeart(80,3);
life--;
end

else if (life==4) begin
video_EraseHeart(70,3);
life--;
end

else if (life==3) begin
video_EraseHeart(60,3);
life--;
end

else if (life==2) begin
video_EraseHeart(50,3);
life--;
end

else if (life==1) begin
video_EraseHeart(40,3);
life--;
end

end

//update position
x[ii] = x[ii] + vx[ii];
y[ii] = y[ii] + vy[ii];

//SIDE BOUNDARIES
if (x[ii]>rightx[ii]){ vx[ii] = -vx[ii]; x[ii]=rightx[ii];} //42-4-7 = 31
if (x[ii]<leftx[ii]){ vx[ii] = -vx[ii]; x[ii]=leftx[ii];} //0+4
if (y[ii]<bottomy[ii] ) {vy[ii] = -vy[ii]; y[ii]=bottomy[ii];} //11+4
if (y[ii]>topy[ii] ) {vy[ii] = -vy[ii]; y[ii]=topy[ii];} //37-4-12 = 21


//Create new updated character
if (monster[ii]==0 && numberone[ii]) video_putMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==1 && numberone[ii]) video_putDyingMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==2 && numberone[ii]) video_putBomb((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==4 && numberone[ii]) video_putBombMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==5 && numberone[ii]) video_putBombMan2((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==6 && numberone[ii]) video_putSuperMan((char)(x[ii]>>8),(char)(y[ii]>>8));
end
end
/*
if (frame ==0 && numberone[0])
begin
if (monster[0]==0) video_EraseMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==1) video_EraseDyingMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==2) video_EraseBomb((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==4) video_EraseBombMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==5) video_EraseBombMan2((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==6) video_EraseSuperMan((char)(x[0]>>8),(char)(y[0]>>8));

if (timer[0] == DYING_GUY && monster[0]==0) monster[0]=1;

if (timer[0]==DYING_GUY+1 && (monster[0]==1 || monster[0]==2 || monster[0]==6))
{


if (monster[0]==1 || monster[0]==6)
begin
if (life==3) begin
video_EraseHeart(60,3);
life--;
end

else if (life==2) begin
video_EraseHeart(50,3);
life--;
end

else if (life==1) begin
video_EraseHeart(40,3);
life--;
end
end

timer[0]=0;
numberone[0]=0;
monster[0]=0;

}

if(timer[0]==1 && monster[0]==4)
begin
monster[0]=5;
end

if(timer[0]==2 && monster[0]==5)
begin
monster[0]=4;
end

if(timer[0]==3 && monster[0]==4)
begin
timer[0]=0;
numberone[0]=0;
monster[0]=0;
if (life==3) begin
video_EraseHeart(60,3);
life--;
end

else if (life==2) begin
video_EraseHeart(50,3);
life--;
end

else if (life==1) begin
video_EraseHeart(40,3);
life--;
end

end

x[0] = x[0] + vx[0];
y[0] = y[0] + vy[0];

if (x[0]>0x1F00){ vx[0] = -vx[0]; x[0]=0x1F00;} //42-4-7 = 31
if (x[0]<0x0400){ vx[0] = -vx[0]; x[0]=0x0400;} //0+4
if (y[0]<0x0F00 ) {vy[0] = -vy[0]; y[0]=0x0F00;} //11+4
if (y[0]>0x1500 ) {vy[0] = -vy[0]; y[0]=0x1500;} //37-4-12 = 21

if (monster[0]==0 && numberone[0]) video_putMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==1 && numberone[0]) video_putDyingMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==2 && numberone[0]) video_putBomb((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==4 && numberone[0]) video_putBombMan((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==5 && numberone[0]) video_putBombMan2((char)(x[0]>>8),(char)(y[0]>>8));
if (monster[0]==6 && numberone[0]) video_putSuperMan((char)(x[0]>>8),(char)(y[0]>>8));
end


if (frame ==1 && numberone[1])
begin
video_EraseMan((char)(x[1]>>8),(char)(y[1]>>8));


if (x[1]>0x4900){ vx[1] = -vx[1]; x[1]=0x4900;} //84-4-7 = 73
if (x[1]<0x2E00){ vx[1] = -vx[1]; x[1]=0x2E00;} //42+4 = 46
if (y[1]<0x0F00 ) {vy[1] = -vy[1]; y[1]=0x0F00;} //11+4
if (y[1]>0x1500 ) {vy[1] = -vy[1]; y[1]=0x1500;} //37-4-12 = 21

x[1] = x[1] + vx[1];
y[1] = y[1] + vy[1];

video_putMan((char)(x[1]>>8),(char)(y[1]>>8));
frame++;
end

if (frame ==2 && numberone[2])
begin
video_EraseMan((char)(x[2]>>8),(char)(y[2]>>8));


if (x[2]>0x7300){ vx[2] = -vx[2]; x[2]=0x7300;} //126-4-7= 115
if (x[2]<0x5800){ vx[2] = -vx[2]; x[2]=0x5800;} //84+4 = 88
if (y[2]<0x0F00 ) {vy[2] = -vy[2]; y[2]=0x0F00;} //11+4
if (y[2]>0x1500 ) {vy[2] = -vy[2]; y[2]=0x1500;} //37-4-12 = 21

x[2] = x[2] + vx[2];
y[2] = y[2] + vy[2];

video_putMan((char)(x[2]>>8),(char)(y[2]>>8));

end

if (frame ==3 && numberone[3])
begin
video_EraseMan((char)(x[3]>>8),(char)(y[3]>>8));


if (x[3]>0x1F00){ vx[3] = -vx[3]; x[3]=0x1F00;} //42-4-7 = 31
if (x[3]<0x0400){ vx[3] = -vx[3]; x[3]=0x0400;} //0+4 = 4
if (y[3]<0x2900 ) {vy[3] = -vy[3]; y[3]=0x2900;} //37+4 =41
if (y[3]>0x2F00 ) {vy[3] = -vy[3]; y[3]=0x2F00;} //63-4-12 = 47

x[3] = x[3] + vx[3];
y[3] = y[3] + vy[3];

video_putMan((char)(x[3]>>8),(char)(y[3]>>8));

end

if (frame ==4 && numberone[4])
begin
video_EraseMan((char)(x[4]>>8),(char)(y[4]>>8));


if (x[4]>0x4900){ vx[4] = -vx[4]; x[4]=0x4900;} //84-4-7 = 73
if (x[4]<0x2E00){ vx[4] = -vx[4]; x[4]=0x2E00;} //42+4 = 46
if (y[4]<0x2900 ) {vy[4] = -vy[4]; y[4]=0x2900;} //37+4 =41
if (y[4]>0x2F00 ) {vy[4] = -vy[4]; y[4]=0x2F00;} //63-4-12 = 47

x[4] = x[4] + vx[4];
y[4] = y[4] + vy[4];

video_putMan((char)(x[4]>>8),(char)(y[4]>>8));

end

if (frame ==5 && numberone[5])
begin
video_EraseMan((char)(x[5]>>8),(char)(y[5]>>8));


if (x[5]>0x7300){ vx[5] = -vx[5]; x[5]=0x7300;} //126-4-7= 115
if (x[5]<0x5800){ vx[5] = -vx[5]; x[5]=0x5800;} //84+4 = 88
if (y[5]<0x2900 ) {vy[5] = -vy[5]; y[5]=0x2900;} //37+4 =41
if (y[5]>0x2F00 ) {vy[5] = -vy[5]; y[5]=0x2F00;} //63-4-12 = 47

x[5] = x[5] + vx[5];
y[5] = y[5] + vy[5];

video_putMan((char)(x[5]>>8),(char)(y[5]>>8));

end

if (frame ==6 && numberone[6])
begin
video_EraseMan((char)(x[6]>>8),(char)(y[6]>>8));

x[6] = x[6] + vx[6];
y[6] = y[6] + vy[6];

if (x[6]>0x1F00){ vx[6] = -vx[6]; x[6]=0x1F00;} //42-4-7 = 31
if (x[6]<0x0400){ vx[6] = -vx[6]; x[6]=0x0400;} //0+4
if (y[6]<0x4300 ) {vy[6] = -vy[6]; y[6]=0x4300;} //63+4 = 67
if (y[6]>0x4900 ) {vy[6] = -vy[6]; y[6]=0x4900;} //89-4-12 = 73

video_putMan((char)(x[6]>>8),(char)(y[6]>>8));

end


if (frame ==7 && numberone[7])
begin
video_EraseMan((char)(x[7]>>8),(char)(y[7]>>8));


if (x[7]>0x4900){ vx[7] = -vx[7]; x[7]=0x4900;} //84-4-7 = 73
if (x[7]<0x2E00){ vx[7] = -vx[7]; x[7]=0x2E00;} //42+4 = 46
if (y[7]<0x4300 ) {vy[7] = -vy[7]; y[7]=0x4300;} //63+4 = 67
if (y[7]>0x4900 ) {vy[7] = -vy[7]; y[7]=0x4900;} //89-4-12 = 73

x[7] = x[7] + vx[7];
y[7] = y[7] + vy[7];

video_putMan((char)(x[7]>>8),(char)(y[7]>>8));

end

if (frame ==8 && numberone[8])
begin
video_EraseMan((char)(x[8]>>8),(char)(y[8]>>8));


if (x[8]>0x7300){ vx[8] = -vx[8]; x[8]=0x7300;} //126-4-7= 115
if (x[8]<0x5800){ vx[8] = -vx[8]; x[8]=0x5800;} //84+4 = 88
if (y[8]<0x4300 ) {vy[8] = -vy[8]; y[8]=0x4300;} //63+4 = 67
if (y[8]>0x4900 ) {vy[8] = -vy[8]; y[8]=0x4900;} //89-4-12 = 73

x[8] = x[8] + vx[8];
y[8] = y[8] + vy[8];

video_putMan((char)(x[8]>>8),(char)(y[8]>>8));

end
*/
if (!(frame ==10 && ~PINA.0 == 1))
frame ++;
if (frame ==9)
frame = 0;



//internal reflector lines
// video_line(10,30,90,30,1);
// video_line(10,31,90,31,1);
// video_line(10,60,60,60,1);
// video_line(10,61,60,61,1);
// video_line(30,50,50,60,1);
// video_line(30,51,50,61,1);
// video_line(60,40,20,40,1);
// video_line(60,41,20,41,1);



//update the second clock
if (++t>59)
begin
t=0;
time = time - 1;
sprintf(ts,"%05d",time);
video_putsmalls(92,93,ts);

//update timer
if(numberone[0]==1) timer[0]++;
if(numberone[1]==1) timer[1]++;
if(numberone[2]==1) timer[2]++;
if(numberone[3]==1) timer[3]++;
if(numberone[4]==1) timer[4]++;
if(numberone[5]==1) timer[5]++;
if(numberone[6]==1) timer[6]++;
if(numberone[7]==1) timer[7]++;
if(numberone[8]==1) timer[8]++;
timer[9]++;

//game ends and gunman wins when time is 0
//go to conclusion screen afterwards
if (time == 0)
begin
game = 2;
drawer=0;
TCCR0 = 0;
OCR0=0;
end

end
break;

//=========================================================
//GAME ENDING STATE
case 2:
if((musicT++) > 15) //each note 1/4 second
begin
musicT = 0;
TCCR0 = 0;
if (notes[note]>0) TCCR0 = 0b00011100 ; //not a rest
OCR0 = notes[note++] ;
if (note>18) note = 0; //test for end of scale
end


//Erases Lines, People, and Bullets in a series of frames
if (drawer ==0)
{
video_line(0,0,0,99,0);
video_line(width,0,width,99,0);
drawer++;
}
else if (drawer ==1)
{
//top line & bottom lines
video_line(0,0,width,0,0);
video_line(0,99,width,99,0);
drawer++;
}

else if (drawer ==2)
{
//top line & bottom lines cont.
video_line(0,11,width,11,0);
video_line(0,89,width,89,0);
drawer++;
}
else if (drawer==3)
{
//Middle Vertical Lines
video_line(42,11,42,89,0);
video_line(84,11,84,89,0);
drawer++;
}
else if (drawer ==4)
{
//Middle Verticl Lines cont.
video_line(0,37,width,37,0);
video_line(0,63,width,63,0);
drawer ++;
}
else if (drawer==5)
{
//Life Indicator
strcpyf(outputword, cu4);
video_puts(13, 3, outputword);

drawer++;
}
else if (drawer==6)
{
for (ii=0; ii<9; ii++)
begin
if (numberone[ii]==1)
begin
if (monster[ii]==0) video_EraseMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==1) video_EraseDyingMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==2) video_EraseBomb((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==4) video_EraseBombMan((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==5) video_EraseBombMan2((char)(x[ii]>>8),(char)(y[ii]>>8));
if (monster[ii]==6) video_EraseSuperMan((char)(x[ii]>>8),(char)(y[ii]>>8));
end
end
drawer++;
}
else if (drawer==7)
{
if (life == 0)
{
strcpyf(outputword, cu7);
video_puts(25, 25, outputword);
drawer++;
}
else if (time == 0)
{
strcpyf(outputword, cu8);
video_puts(25, 25, outputword);
drawer++;
}
}
else if(drawer==8)
{
video_EraseBullet(5,93);
video_EraseBullet(15,93);
video_EraseBullet(25,93);
video_EraseBullet(35,93);
video_EraseBullet(45,93);
video_EraseBullet(55,93);
drawer++;
}
else if(drawer==9)
{
strcpyf(outputword, cu9);
video_putsmalls(40,35,outputword);
drawer++;
}
else if(drawer==10)
{
strcpyf(outputword, cu10);
video_putsmalls(56,45,outputword);
drawer++;
}
else if (drawer==11)
{
strcpyf(outputword, cu4);
video_putsmalls(92, 93, outputword);
drawer++;
}

else if (drawer==12)
{
video_EraseHeart(40, 3);
video_EraseHeart(50, 3);
video_EraseHeart(60, 3);
drawer++;
}
else if (drawer==13)
{
//Life Indicator
video_EraseHeart(70, 3);
video_EraseHeart(80, 3);
drawer++;
}

//once reload is pressed, erase everything created
//in conclusion screen and go back to Main Menu
if (PINA.3 == 0 && drawer == 14)
{
drawer++;
}

if (drawer==15)
{
strcpyf(outputword, cu4);
video_puts(25, 25, outputword);
drawer++;
}
else if(drawer==16)
{
strcpyf(outputword, cu4);
video_putsmalls(40,35,outputword);
drawer++;
}
else if (drawer==17)
{
strcpyf(outputword, cu4);
video_putsmalls(56,45,outputword);
game = 0;
drawer=0;
TCCR0=0;
life = 5;
bullets=6;
time=60;
for (ii=0; ii<9; ii++)
numberone[ii]=0;
}
break;

} //end of switch statement
end //line 231
end //while
end //main