org 100h
jmp start

VIDEO_INT = 0x10		; The BIOS video interrupt
WRITE_DOT = 0x0C		; BIOS func to plot a pixel
SET_MODE = 0x00 		; BIOS func to set the video mode
VGA_256_COLOR_MODE = 0x0013	; Use to set 256-color mode
TEXT_MODE = 0x03		; Use to set 80x25 text mode

SCREEN_WIDTH = 320		; Width in pixels of mode 0x13
SCREEN_HEIGHT = 200		; Height in pixels of mode 0x13
NUM_COLORS = 256		; Number of colors in mode 0x13

start:
	push VGA_256_COLOR_MODE
	call set_mode

	repeat 150
		push %			; X = current loop counter
		push %			; Y = current loop counter
		push %			; color = current loop counter
		call plot_pixel_slow	; call Draw function
	end repeat

	push TEXT_MODE
	call set_mode

int 20h				; Terminate Program

set_mode:
	pop ax			; Move VGA_256_COLOR_MODE in al
	mov ah, SET_MODE	; Move 0x00 to ah
	int VIDEO_INT		; Call interrupt function
	ret

plot_pixel_slow:
	pop ax			; Move color to al
	mov ah, WRITE_DOT	; Move 0x00 to ah
	pop dx			; Y position of pixel
	pop cx			; X position of pixel
	int VIDEO_INT		; Call interrupt function
	ret