.model small
.code

		org	100h
		
Start:          call    InitGraphics
                call    DrawPicture
		call	SetPalette
                call    ReadKey
                call    DoneGraphics

ExitEntry:	xor	ax,ax	; return to text mode
		mov	al,3
		int	10h

		int	20h


InitGraphics proc near
		xor	ax,ax
		mov	al,13h
		int	10h
		ret
InitGraphics endp

DoneGraphics proc near
		xor	ax,ax
		mov	al,3
		int	10h
		ret
DoneGraphics endp

DrawPicture proc near

		mov	cx,200  ; set Height of screen

Strings:	push	cx
		mov	dx,cx
		mov	cx,320  ; set Width of screen

Columns:	push	cx

		mov     ax,cx
		push	cx
		mov	cx,1
		shr     ax,cl	; color is AL value
		add	ax,19
		pop	cx

		mov	ah,0ch	; function write pixel dot
		xor	bh,bh	; on video page 0
		int	10h	; call video BIOS

		push	ax
		call	CheckKey	; if not keypressed
		pop	ax
		jz	ContinueLoops	; do continue

                pop     cx
                pop     cx
                ret

ContinueLoops:
		pop	cx
loop	Columns

		pop	cx
loop	Strings
                ret
DrawPicture endp

SetPalette proc near
		mov	ax,101bh
		mov	bx,0
		mov	cx,256
		int	10h
		ret
SetPalette endp

CheckKey proc near
		mov	ah,1
		int	16h
		ret
CheckKey endp

ReadKey proc near
                mov     ah,0
                int     16h
                ret
ReadKey endp
End	Start