T
T
Type Programmer2018-05-01 13:30:21
assembler
Type Programmer, 2018-05-01 13:30:21

Assembler notices screen redrawing how to fix it?

#make_boot# 

org 7c00h 
use16 
jmp start 

e:  
mov ax,cs
mov ds,ax
ret 


put_pix: 
push ax 
push dx 
mov ax, 0a000h 
mov es, ax 
mov ax,320 
mul cx 
pop dx 
add ax,dx 
mov di,ax 
pop ax 
stosb 
ret 

fill_disp: 
mov bx,0000h
push ax 
mov ax,0A000h 
mov ds,ax 
pop ax 
mov ah,al 
mov [bx],ax 
p0: 
add bx,02h
mov [bx],ax 
cmp bx,0FFFEh 
jz e 
jmp p0 

e_draw: 
pop dx 
pop bx 
mov [x],dx 
mov [y],bx 
ret 

draw_sprite_nexline: 
inc si 
mov al,00h 
cmp al,[bx+si] 
jz e_draw 
dec si 
add [y],01h 
mov ax,[x_ret] 
mov [x],ax 
inc si 
jmp draw_sprite_1 

draw_sprite: 
mov ax,bx 
mov dx,[x] 
mov bx,[y] 
push bx 
push dx 
mov bx,ax 
mov ax,[x] 
mov [x_ret],ax 
mov si,0000h 
draw_sprite_1: 
mov ax, 0a000h 
mov es, ax 
mov ax,320 
mov cx,[y] 
mul cx 
mov dx,[x] 
add ax,dx 
mov di,ax 
mov al,[bx+si] 
cmp al,255 
jz draw_sprite_2 
stosb 
draw_sprite_2: 
inc si 
mov al,00h 
cmp al,[bx+si] 
jz draw_sprite_nexline 
add [x],1 
jmp draw_sprite_1 


start: 
mov ah, 0 
mov al, 13h 
int 10h 
p4: 
mov ah,00h
int 1Ah   
mov bx,dx
p0_cycl:
mov ah,00h
int 1Ah
sub dx,bx
cmp dx,1
jz p1_cycl
jnz p0_cycl
p1_cycl:
mov al,89
call fill_disp
add [x],1
mov bx,sprite
mov di,0000h
mov si,di
call draw_sprite
jmp p4 




x_ret dw 0 
x dw 0
y dw 100 


sprite db 15,15,15,15,15,15,15,15,15,0,15,15,15,15,15,15,15,15,15,0,15,15,255,15,15,15,40,15,15,0,15,15,15,15,15,15,15,15,15,0,15,15,15,15,15,15,15,15,15,0,15,15,40,40,40,40,40,15,15,0,15,15,15,15,15,15,15,15,15,0,0

A little less than 64,000 KB of memory is available, so I can’t create a second buffer, and when clearing and redrawing the sprite, something like flickering occurs, it’s noticeable that the screen is cleared and everything is drawn again. I don't know how to fix it...
PS: I'm just learning assembler...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vreitech, 2018-05-01
@MegaCraZy6

> I can't create a second buffer
> the screen is cleared and
everything is drawn correctly again. without buffering, that's how it should be.
the solution in general is to use buffering. in your case, there is no solution, although I still do not understand what the problem is to create a buffer, having 64 MB of RAM.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question