< -->

;vscroll.asm
;Плавная прокрутка экрана по вертикали. Выход - Esc
         .model tiny
         .code
         .186
         org 100h
start:
      push      0B800h
      pop       es
      xor       si, si
      mov       di, 80*25*2
      mov       cx, di
      rep       movs es:any_label, es:any_label
      mov       dx, 03D4h
screen_loop:
      mov   cx, 80*12*2
line_loop:
      mov       al, 0Ch
      mov       ah, ch
      out       dx, ax
      inc       ax
      mov       ah, cl
      out       dx, ax

      mov       bx, 15
      sub       cx, 80
pel_loop:
      call      wait_retrace
      mov       al, 8
      mov       ah, bl
      out       dx, ax
      dec       bx
      jge       pel_loop

      in        al, 60h
      cmp       al, 81h
      jz        done

      cmp       cx, 0
      jge       line_loop
      jmp       short screen_loop
done:
      mov       ax, 8
      out       dx, ax
      add       ax, 4
      out       dx, ax
      inc       ax
      out       dx, ax
      ret

wait_retrace proc near
             push dx
             mov  dx, 03DAh
VRTL1:
             in   al, dx
             test al, 8
             jnz  VRTL1
VRTL2:
             in al, dx
             test   al, 8
             jz     VRTL2
             pop    dx
             ret
wait_retrace endp
any_label    label      byte
             end        start

Назад