;******************************************************************************
;** Program obslugi karty VGA                                                **
;******************************************************************************

;******************************************************************************
DOSSEG

.model	SMALL
.286

EKRAN	EQU 0A000h
GRAPH	EQU 13h
NO_KEY	EQU 01h

CODE	SEGMENT
     	ASSUME CS:CODE, DS:CODE
START:  mov ah, 0fh
	int 10h
	push ax
	push bx        ;Zapamietanie parametrow starego trybu na stosie
	mov ah, 00h
	mov al, GRAPH  
	int 10h	       ; Nowy tryb graficzny
	push 15d        ; kolor
	push 199d	; wspolrzedna y
	call hor
	add sp, 04h	;zdjecie parametrow ze stosu
	push 15d	; kolor
	push 319d	; wspolrzedne x
	call ver
	add sp, 04h
	mov ax, 10h
	mov bx, 0Eh
	push ax
	push bx
ET:	mov ah, 01h    ; czekanie na nacisniecie klawisza
 	int 16h
	je  ET
        pop bx
	pop ax
	mov ah, 00h
        int 10h
	mov ax, 4c00h
	int 21h 

hor proc
	push bp
	mov  bp, sp
	push ax
	push cx
	push bx
	push dx
	mov ax, [bp+4]
	mov cx, 320
	mul cx
	mov bx, ax
	mov ax, EKRAN
	mov es, ax
	mov ax, [bp+6]
petla:
	mov es:[bx], ax
	inc bx
	loop petla
	pop dx
	pop bx
	pop cx
	pop ax
	pop bp
        ret
endp

ver proc
	push bp
	mov  bp, sp
	push ax
	push cx
	push bx
	push dx
	mov ax, [bp+4]
	mov cx, 200d
	mov bx, ax
	mov ax, EKRAN
	mov es, ax
	mov ax, [bp+6]
petla1:
	mov es:[bx], ax
	add bx, 320d
	loop petla1
	pop dx
	pop bx
	pop cx
	pop ax
	pop bp
        ret
endp

CODE 	ENDS
END START