Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Topics

Recent Status Updates

View All Updates

- - - - -

I need to develop a game in assembler

assembler game

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic



    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 17 June 2018 - 10:20 PM

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. the game should work in DOSBox.72.


code segment
assume cs:code, ds:data
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 ;


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 ;вывод точки

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
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
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
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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download