A
A
Alertoso2021-04-20 18:59:36
assembler
Alertoso, 2021-04-20 18:59:36

How can you modify the air radar?

I am doing 7 labs in assembler on a graph, I sketched an air radar, how can I make it show a random number of points, and the points move and they are visible only when the radar beam passes through them?

org 100h
mov  ax,13h
int  10h
 
;очищаем видеобуффер
mov  di,screen
mov  cx,16000
xor  eax,eax
rep  stosd
 
push 0A000h
pop  es
 
;устанавливаем палитру (63 градации зелёного)
mov  cx,127
@@:mov  dx,3C8h
   mov  ax,cx
   out  dx,al
   inc  dx
   xor  al,al
   out  dx,al
   cmp  cx,63
   cmc
   sbb  ax,ax
   or   ax,cx
   out  dx,al
   xor  al,al
   out  dx,al
loop @b
 
fldz
main:fadd    [x]
     fld     st0
     fsincos
     fmul    [aspectratio] ;чтобы получился круг нужно учитывать отношение высоты к ширине (240/320=0.75)
     fxch    st1
 
     ;рисуем линию
     fldz
     fldz
     mov  cx,120
     @@:fadd st0,st2
        fist word[esp-4]
        fxch st1
        fadd st0,st3
        fist word[esp-2]
        fxch st1
        imul di,[esp-2],320
        add  di,[esp-4]
        mov  byte[screen+di+32160],63
         
     mov  si,6304
     cmp  di,-6304
        jne  skip
        
     mov  word[screen+di+32160+320],7F7Fh
         mov  dword[screen+di+32160+639],7F7F7F7Fh
         mov  dword[screen+di+32160+959],7F7F7F7Fh
         mov  word[screen+di+32160+1280],7F7Fh
      loop @b
;   jne skip        
     mov  word[screen+si+32160+320],7f7Fh
         mov  dword[screen+si+32160+639],7f7F7F7Fh
         mov  dword[screen+si+32160+959],7f7F7F7Fh
         mov  word[screen+si+32160+1280],7f7Fh
        skip:
    loop @b
 
    fstp st0
    fstp st0
    fstp st0
    fstp st0
 
    ;затухание цвета
    mov  di,63999
  @@:sub  byte[screen+di],1
       adc  byte[screen+di],0
       dec  di
  jne @b
 
    ;ожидание обратного вертикального хода луча
    mov  dx,3DAh
    @@:in   al,dx
       test al,8
    je @b
 
    ;копируем видеобуффер на экран
    mov  si,screen
    xor  di,di
    mov  cx,16000
    rep  movsd
 
    ;если нажат escape - выход
    in   al,60h
    dec  al
jne main
 
ret
x           dd 0.007
aspectratio dd 0.75
screen:

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question