473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

I need to develop a game in assembler

excuse me for my bad english, I'm from russia. I need to develop a game in assembler8086. I am student of KOMSOMOLSK-NA-AMURE STATE UNIVERSITY. I have a bad programming teacher. Can you help me with my problem? I drew a drawing for the game,but I can not go further. I need to implement the movement of the ball and its jumps through rectangles. Its easy game, but my teacher can*t help me. I need your help, please.

What I have tried:

code segment
assume cs:code, ds:data
jumps
begin:
mov ax, data
mov ds,ax
mov ah,0Fh
int 10h
push ax
mov ax, 0013h
int 10h
;==========


mov ax, data
mov ds,ax
push ds



mov Rectangle_X1, 0
mov Rectangle_Y1, 0
mov Rectangle_X2, 320
mov Rectangle_Y2, 200
mov Rectangle_Color, 15
call Rectangle

mov Rectangle_X1, 0
mov Rectangle_Y1, 151
mov Rectangle_X2, 320
mov Rectangle_Y2, 165
mov Rectangle_Color, 2
call Rectangle

mov Rectangle_X1, 45
mov Rectangle_Y1, 140
mov Rectangle_X2, 55
mov Rectangle_Y2, 151
mov Rectangle_Color, 6
call Rectangle

mov FillCircle_X, 25
mov FillCircle_Y , 140
mov FillCircle_R, 10
mov FillCircle_Color,55
call FillCircle




mov ah,02h
mov bh, 0
mov dh, 23
mov dl, 22
int 10h


mov dx, offset fio
mov ah,9h
int 21h

;==========
mov ax,0
int 16h
pop ax
mov ah,0
int 10h
mov ax,4c00h
int 21h
;-------------------------------------------------------
FillCircle proc
push ax
push bx
push cx
push dx
push di
push si
push es
push FillCircle_R

mov ax,0A000h ;установка es
mov es,ax ;на видеопамять

mov ax,FillCircle_R ;R*R
mul ax ;
mov dx,ax ;

push dx ;расчет di
inc FillCircle_R ;
mov ax,320 ;
mov bx,FillCircle_Y ;
sub bx,FillCircle_R ;
mul bx ;
mov cx,FillCircle_X ;
sub cx,FillCircle_R ;
add ax,cx ;
mov di,ax ;
pop dx ;

FillCircle_Draw:

push dx
mov ax,cx ;x
sub ax,FillCircle_X ;x-Xc
mul ax ;(x-Xc)^2
mov si,ax
mov ax,bx ;y
sub ax,FillCircle_Y ;y-Yc
mul ax ;(y-Yc)^2
add ax,si ;(x-Xc)^2 + (y-Yc)^2
pop dx

cmp ax,dx ;ax > R*R ?
ja FillCircle_Not_Draw ;если да

mov ah,FillCircle_Color
mov es:[di],byte ptr ah ;вывод точки

FillCircle_Not_Draw:
inc di
inc cx


mov ax,FillCircle_X
add ax,FillCircle_R
cmp cx,ax ;ограничение по Х
jne FillCircle_Draw


mov cx,FillCircle_X
sub cx,FillCircle_R

add di,320
sub di,FillCircle_R
sub di,FillCircle_R
inc bx

mov ax,FillCircle_Y
add ax,FillCircle_R
cmp bx,ax ;ограничение по Y
jl FillCircle_Draw

pop FillCircle_R
pop es
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
FillCircle endp
Rectangle proc
push ax
push bx
push cx
push dx
mov ah,0ch
mov bx,0
mov al,Rectangle_Color
mov cx,Rectangle_X1
mov dx,Rectangle_Y1
Rectangle_Label:
int 10h
inc cx
cmp cx, Rectangle_X2
jne Rectangle_Label
mov cx,Rectangle_X1
inc dx
cmp dx,Rectangle_Y2
jne Rectangle_Label
pop dx
pop cx
pop bx
pop ax
ret
Rectangle endp
code ends
data segment
FillCircle_X dw 0
FillCircle_Y dw 0
FillCircle_R dw 0
FillCircle_Color db 0
Rectangle_X1 dw 0
Rectangle_Y1 dw 0
Rectangle_X2 dw 0
Rectangle_Y2 dw 0
Rectangle_Color db 0
fio db 'Circle Running$'
data ends
end begin
Jun 18 '18 #1
0 2948

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: dchoubey | last post by:
hi, wanna want to know how can i develop j2me two player game by using gprs in which both players play symultaneosly.i develop a two player game by using bluetooth in which both player can play at...
1
by: Choubey | last post by:
hi, wanna want to know how can i develop j2me two player game by using gprs in which both players play symultaneosly.i develop a two player game by using bluetooth in which both player can play at...
21
by: Morten Aune Lyrstad | last post by:
I wish to create my own assembly language for script. For now it is mostly for fun and for the sake of the learning, but I am also creating a game engine where I want this system in. Once the...
0
by: DaRueSchni | last post by:
Hello, I am a student who needs to develop a game for an XDA. I´d like to create one where you need to walk through some floors and enter different rooms. (walk through floors maybe like 1st...
1
by: DaRueSchni | last post by:
Hello, I am a student who needs to develop a game for an XDA. I´d like to create one where you need to walk through some floors and enter different rooms. (walk through floors maybe like 1st...
18
by: jaso | last post by:
Hi, I'm making this video game in C. The game contains a player, enemies and bullets. These objects, which are arrays of structures, are initialized, updated and drawn in a game loop. Now I am...
4
by: robinsand | last post by:
My apologies to those of you who are more advanced Visual C++ .NET programmers, but I am working on a project for an MBA course that is condensed into an eight-week schedule, and I need help...
25
by: Daniel Jonsson | last post by:
So, I've reached the point where my building pipeline tools actually needs to be used by other people in my company. By this reason I actually need to think about the usability, and I've come to...
1
by: togikan | last post by:
Hi all, I'm having a problem converting an inline assembler function to .asm file. I need seperate inline assembler code because in x64 architecture doesn't have support for inline assembly. Here...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.