comment +

For compilation  use:

Turbo  Assembler 2.02
tasm /m2 colorfal.asm
tlink /t colorfal.obj

code: bitl/7dump

comment end! +

.model tiny
.data
pattern DB 0,8,2,10, 12,4,14,6, 3,11,1,9, 15,7,13,5

.code
.486
org 0100h

start:

mov al, 13h
int 10h

add dh, al                 ; cs + 1300h
mov ds, dx
add dh, al
mov fs, dx
add dh, al
mov gs, dx

mov ax, 1010h
mov bh, 60
mov dx, 0008h
@r:
xor ch, ch
   @g:
   xor cl, cl
          @b:
          int 10h
          inc bx
          add cl, al ;16
          cmp cl, bh
          jbe @b
   add ch, dl
   cmp ch, bh
   jbe @g
add dh, dl
cmp dh, bh
jbe @r


;**********************************************************************
; MAIN LOOP
;**********************************************************************
push 0a000h
pop es

@mainloop:


push ds

mov dh, 3
@bl3:

mov dl, 3
@quad:
in ax, 40h
xadd cs:[100h], ax
xor ah, al
mov bl, 48
test al, 2
jnz @sk
xor bl, bl
@sk:
shr ax, 5
mov di, ax

mov cx, 16
@h:
  mov al, 16
  @w:
  mov ds:[di], bl
  inc di
  dec al
  jnz @w
add di, 320-16
loop @h

dec dl
jnz @quad

;---------------- BLUR----------------------------

     mov si, 320
     mov cx, (320*202)/4
     @blur:
        lodsd
        add al, ds:[si+1]
        add al, [si-320]
        add al, [si+320]
        shr al, 2
        mov ds:[si+321-4], eax
     loop @blur

;--------------------------------------------------
mov ax, ds
add ah, 13h
mov ds, ax
dec dh
jnz @bl3

pop ds


     mov  dx, 3DAh           ; Wait for vertical retrace
@w1:
     in   al, dx
     test al, 8
     jnz  @w1
@w2:
     in   al, dx
     test al, 8
     jz   @w2


;mov bp, 320*4
xor di, di
mov cl, 200
@y:
mov dl, cl
and dl, 3
shl dl, 2
mov si, 319
@x:
   mov bx, si
   and bx, 3
   add bl, dl
   mov al, cs:[bx+pattern]
   mov ah, al
   mov bl, al
   add ah, ds:[di+320*4]
   add al, fs:[di+320*4]
   add bl, gs:[di+320*4]
   shl ah, 2
   shr al, 1
   shr bl, 4
   and ax, 0e0fch
   add al, ah
   add al, bl
   stosb
dec si
jns @x
loop @y



in al, 60h                    ; wait for ESC
dec al
jnz @mainloop                 ; none received, start over


;**********************************************************************
; EXIT
;**********************************************************************
mov ax, 3                ; back to text
int 10h                  ; mode

;int 20h                  ; exit
ret
end start

