Comment * Programa psicotr▋ico mastod▋tico
		  *

jander SEGMENT

MAX_X EQU 319
MAX_Y EQU 199

pausa MACRO
	mov ah,8h
	int 21h
endm

putpixel MACRO x,y,color
mov ax,color
push ax
mov ax,y
push ax
mov ax,x
push ax
call _putpixel
endM

ORG 100h
	Inicio:
		ASSUME cs:jander,ds:jander,ss:jander

	call getmodo
	push ax

	mov al,13h
	call cambiamodo

	mov cx,60
chorrada:
	sti
;	mov ah,0Bh
;	int 21h
;	or al,al
;	jnz SuperFin
	call WRetrace
	cli
	push cx
	call COMO_MOLA
	pop cx
	mov bp,cx
	loop chorrada

  SuperFin:
	pop ax
	call cambiamodo

	int 20h


	COMO_MOLA proc
		mov si,MAX_X
		mov di,MAX_Y
	Looping:
	Looping2:
;		mov cx,di
;		add cx,si
;		dec cx
;		shr cx,1
;		add cx,bp
;		sub cx,2
		mov dx,3dah
		in al,dx
		and al,8
		mov cl,al
;		and cl,8h
		xor ch,ch
		putpixel si,di,cx
;	dec di
	dec di
	jns Looping2
	mov di,MAX_Y
;	dec si
	dec si
	jns looping
	ret
	endp

	getmodo PROC
		mov ax,0f00h
		int 10h
		ret
	endp

	cambiamodo PROC
		xor ah,ah
		int  10h
		ret
	endp

	_putpixel PROC
	ARG x:WORD,y:WORD,color:WORD
		push bp
		mov bp,sp
		mov ax,0A000h
		mov es,ax
		mov bx,y
		mov ax,320
		mul bx
		mov bx,x
		add bx,ax
		mov ax,color
		mov byte ptr es:[bx],al
		pop bp
		ret 6
	endp

	WRetrace PROC
		mov dx,3dah
	et1:
		in al,dx
		test al,8h
		jnz et1
	et2:
		in al,dx
		test al,8h
		jz et2
		ret
	endp

jander ENDS
END inicio


