Lana1
MIS
- May 6, 2012
- 1
Create a Game in assembly language That has an object that shoots at stars and moves horizantally using the mouse and shoots with left click.
What i have done till now:
org 100h
position db 23
my_position db 0
bullet db 12
MOV BX , 0B800H
MOV DS ,BX
MOV CX , 9
top: ADD SI , 16
MOV [SI] , "*"
loop top
myloop:
mov bullet,12
mov position,23
mov ch, 32
mov ah, 1
int 10h
mov ax,3
int 33h
mov ah,2
mov dh,24
shr cl,1
mov dl,cl
mov bh,0
int 10h
mov ah,0Ah
mov al,'!'
mov bh,0
mov cx,1
int 10h
mov ah,0Ah
mov al,' '
mov bh,0
mov cx,1
int 10h
mov ax, 3
int 33h
cmp bx,1
je click
jmp myloop
click:
mov my_position, cl
shr my_position,1
click2:
dec position
mov ah,2
mov dh,position
mov ah,2
mov dl,my_position
mov bh,0
int 10h
mov ah,0Ah
mov al,'*'
mov bh,0
mov cx,1
int 10h
mov ah,0Ah
mov al,' '
mov bh,0
mov cx,1
int 10h
add position , -1
add bullet , -1
jnz click2
jmp myloop
ret
But this code is a little slow and I can't seem to make a loop that makes a star disappear when it gets shooted. I would be grateful if someone helps me to fix this problem
What i have done till now:
org 100h
position db 23
my_position db 0
bullet db 12
MOV BX , 0B800H
MOV DS ,BX
MOV CX , 9
top: ADD SI , 16
MOV [SI] , "*"
loop top
myloop:
mov bullet,12
mov position,23
mov ch, 32
mov ah, 1
int 10h
mov ax,3
int 33h
mov ah,2
mov dh,24
shr cl,1
mov dl,cl
mov bh,0
int 10h
mov ah,0Ah
mov al,'!'
mov bh,0
mov cx,1
int 10h
mov ah,0Ah
mov al,' '
mov bh,0
mov cx,1
int 10h
mov ax, 3
int 33h
cmp bx,1
je click
jmp myloop
click:
mov my_position, cl
shr my_position,1
click2:
dec position
mov ah,2
mov dh,position
mov ah,2
mov dl,my_position
mov bh,0
int 10h
mov ah,0Ah
mov al,'*'
mov bh,0
mov cx,1
int 10h
mov ah,0Ah
mov al,' '
mov bh,0
mov cx,1
int 10h
add position , -1
add bullet , -1
jnz click2
jmp myloop
ret
But this code is a little slow and I can't seem to make a loop that makes a star disappear when it gets shooted. I would be grateful if someone helps me to fix this problem