ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
;  vesa routines to adress the whole screen for fish ... by plasmoid deep/thc
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
.386
.model tiny
code            segment use16
		assume  cs:code,ds:code,es:code
		org     100h
		locals
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
vesa:		jmp	main
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
setpalette 	proc	near
		mov     si,offset vgapalette
		mov     dx,03c8h                ; ש port PEL write mode
		mov     al,00h                  ;   at register 00h
		out     dx,al
		inc     dx                      ; ש port PEL data register
		mov     cx,0100h*3
		rep     outsb
		ret                             ; ש vga color a 100h times
setpalette	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
detectvesa	proc	near
		mov	ah,4fh			; (vesa functions)
		mov	al,00h			; ש detect vesa card
		push	cs			; ES:DI card puffer
		pop	es
		mov	di,offset cardpuffer
		int	10h			; ש for structure look in the
						;   file: cardpuf.txt
						; ש if okay AX = 004fh
		cmp	ah,00
		je	vesafound
		mov	ah,4ch
		int	21h
vesafound:	ret
cardpuffer	db	256 dup (0)
detectvesa	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
initvesa	proc	near
						; mode 5fh
						; ---------
						; 640x480x256 - 256k mem
		mov	ah,4fh			; (vesa functions)
		mov	al,02h			; ש set mode
		mov	bx,5fh			; BX mode number bit 14-0
						;    bit 15: 0 clear screen
						;            1 keep screen
		int	10h
						; ש if okay AX = 004fh

		mov	ah,4fh			; (vesa functions)
		mov	al,01h			; ש info on mode
		mov	cx,5fh			; CX mode number
		push	cs			; ES:DI info puffer
		pop	es
		mov	di,offset infopuffer
		int	10h			; ש for structure look in the
						;   file: infopuf.nfo
						; ש if okay AX = 004fh

		ret
infopuffer	db	256 dup (0)
initvesa	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
switchWin	proc	near
		mov	ah,4fh			; (vesa functions)
		mov	al,05h			; ש set win or read win
		mov	bh,0			; BH 0 set
						;    1 read
		mov	bl,0			; BL 0 win A
						;    1 win B
		mov	dx,bp			; DX position of win
						;    of wingranulaty
						;    (view infopuf.txt)
						; (wingranulaty is here
						;  4. DX=15 means 100
						;  lines
		int	10h
						; ש if okay AX = 004fh
switchWin	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
drawlines	proc	near
		push	0a000h
		pop	es
		xor	di,di
		mov	dx,50
loopy:		mov	eax,pattern
		mov	cx,640/2
		rep	stosd
		add	pattern,01010101h
		dec	dx
		jnz	loopy
		ret
pattern		dd	0
drawlines	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
vgapalette  label byte
            db 000h, 000h, 000h
            db 000h, 000h, 001h
            db 000h, 000h, 002h
            db 000h, 000h, 003h
            db 000h, 000h, 004h
            db 000h, 000h, 005h
            db 000h, 000h, 006h
            db 000h, 000h, 007h
            db 000h, 000h, 008h
            db 000h, 000h, 009h
            db 000h, 000h, 00Ah
            db 000h, 000h, 00Bh
            db 000h, 000h, 00Ch
            db 000h, 000h, 00Dh
            db 000h, 000h, 00Eh
            db 000h, 000h, 00Fh
            db 000h, 000h, 010h
            db 000h, 000h, 011h
            db 000h, 000h, 012h
            db 000h, 000h, 013h
            db 000h, 000h, 014h
            db 000h, 000h, 015h
            db 000h, 000h, 016h
            db 000h, 000h, 017h
            db 000h, 000h, 018h
            db 000h, 000h, 019h
            db 000h, 000h, 01Ah
            db 000h, 000h, 01Bh
            db 000h, 000h, 01Ch
            db 000h, 000h, 01Dh
            db 000h, 000h, 01Eh
            db 000h, 000h, 01Fh
            db 000h, 000h, 020h
            db 000h, 000h, 021h
            db 000h, 000h, 022h
            db 000h, 000h, 023h
            db 000h, 000h, 024h
            db 000h, 000h, 025h
            db 000h, 000h, 026h
            db 000h, 000h, 027h
            db 000h, 000h, 028h
            db 000h, 000h, 029h
            db 000h, 000h, 02Ah
            db 000h, 000h, 02Bh
            db 000h, 000h, 02Ch
            db 000h, 000h, 02Dh
            db 000h, 000h, 02Eh
            db 000h, 000h, 02Fh
            db 000h, 000h, 030h
            db 000h, 000h, 031h
            db 000h, 000h, 032h
            db 000h, 000h, 033h
            db 000h, 000h, 034h
            db 000h, 000h, 035h
            db 000h, 000h, 036h
            db 000h, 000h, 037h
            db 000h, 000h, 038h
            db 000h, 000h, 039h
            db 000h, 000h, 03Ah
            db 000h, 000h, 03Bh
            db 000h, 000h, 03Ch
            db 000h, 000h, 03Dh
            db 000h, 000h, 03Eh
            db 000h, 000h, 03Fh
            db 001h, 001h, 03Fh
            db 002h, 002h, 03Fh
            db 003h, 003h, 03Fh
            db 004h, 004h, 03Fh
            db 005h, 005h, 03Fh
            db 006h, 006h, 03Fh
            db 007h, 007h, 03Fh
            db 008h, 008h, 03Fh
            db 009h, 009h, 03Fh
            db 00Ah, 00Ah, 03Fh
            db 00Bh, 00Bh, 03Fh
            db 00Ch, 00Ch, 03Fh
            db 00Dh, 00Dh, 03Fh
            db 00Eh, 00Eh, 03Fh
            db 00Fh, 00Fh, 03Fh
            db 010h, 010h, 03Fh
            db 011h, 011h, 03Fh
            db 012h, 012h, 03Fh
            db 013h, 013h, 03Fh
            db 014h, 014h, 03Fh
            db 015h, 015h, 03Fh
            db 016h, 016h, 03Fh
            db 017h, 017h, 03Fh
            db 018h, 018h, 03Fh
            db 019h, 019h, 03Fh
            db 01Ah, 01Ah, 03Fh
            db 01Bh, 01Bh, 03Fh
            db 01Ch, 01Ch, 03Fh
            db 01Dh, 01Dh, 03Fh
            db 01Eh, 01Eh, 03Fh
            db 01Fh, 01Fh, 03Fh
            db 020h, 020h, 03Fh
            db 020h, 021h, 03Fh
            db 020h, 022h, 03Fh
            db 020h, 023h, 03Fh
            db 020h, 024h, 03Fh
            db 020h, 025h, 03Fh
            db 020h, 026h, 03Fh
            db 020h, 027h, 03Fh
            db 020h, 028h, 03Fh
            db 020h, 029h, 03Fh
            db 020h, 02Ah, 03Fh
            db 020h, 02Bh, 03Fh
            db 020h, 02Ch, 03Fh
            db 020h, 02Dh, 03Fh
            db 020h, 02Eh, 03Fh
            db 020h, 02Fh, 03Fh
            db 020h, 030h, 03Fh
            db 020h, 031h, 03Fh
            db 020h, 032h, 03Fh
            db 020h, 033h, 03Fh
            db 020h, 034h, 03Fh
            db 020h, 035h, 03Fh
            db 020h, 036h, 03Fh
            db 020h, 037h, 03Fh
            db 020h, 038h, 03Fh
            db 020h, 039h, 03Fh
            db 020h, 03Ah, 03Fh
            db 020h, 03Bh, 03Fh
            db 020h, 03Ch, 03Fh
            db 020h, 03Dh, 03Fh
            db 020h, 03Eh, 03Fh
            db 020h, 03Eh, 03Fh
            db 020h, 03Dh, 03Fh
            db 020h, 03Ch, 03Fh
            db 020h, 03Bh, 03Fh
            db 020h, 03Ah, 03Fh
            db 020h, 039h, 03Fh
            db 020h, 038h, 03Fh
            db 020h, 037h, 03Fh
            db 020h, 036h, 03Fh
            db 020h, 035h, 03Fh
            db 020h, 034h, 03Fh
            db 020h, 033h, 03Fh
            db 020h, 032h, 03Fh
            db 020h, 031h, 03Fh
            db 020h, 030h, 03Fh
            db 020h, 02Fh, 03Fh
            db 020h, 02Eh, 03Fh
            db 020h, 02Dh, 03Fh
            db 020h, 02Ch, 03Fh
            db 020h, 02Bh, 03Fh
            db 020h, 02Ah, 03Fh
            db 020h, 029h, 03Fh
            db 020h, 028h, 03Fh
            db 020h, 027h, 03Fh
            db 020h, 026h, 03Fh
            db 020h, 025h, 03Fh
            db 020h, 024h, 03Fh
            db 020h, 023h, 03Fh
            db 020h, 022h, 03Fh
            db 020h, 021h, 03Fh
            db 020h, 020h, 03Dh
            db 01fh, 01Fh, 03Fh
            db 01eh, 01Eh, 03Fh
            db 01dh, 01Dh, 03Fh
            db 01ch, 01Ch, 03Fh
            db 01bh, 01Bh, 03Fh
            db 01ah, 01Ah, 03Fh
            db 019h, 019h, 03Fh
            db 018h, 018h, 03Fh
            db 017h, 017h, 03Fh
            db 016h, 016h, 03Fh
            db 015h, 015h, 03Fh
            db 014h, 014h, 03Fh
            db 013h, 013h, 03Fh
            db 012h, 012h, 03Fh
            db 011h, 011h, 03Fh
            db 010h, 010h, 03Fh
            db 00fh, 00Fh, 03Fh
            db 00eh, 00Eh, 03Fh
            db 00dh, 00Dh, 03Fh
            db 00ch, 00Ch, 03Fh
            db 00bh, 00Bh, 03Fh
            db 00ah, 00Ah, 03Fh
            db 009h, 009h, 03Fh
            db 008h, 008h, 03Fh
            db 007h, 007h, 03Fh
            db 006h, 006h, 03Fh
            db 005h, 005h, 03Fh
            db 004h, 004h, 03Fh
            db 003h, 003h, 03Fh
            db 002h, 002h, 03Fh
            db 001h, 001h, 03Fh
            db 000h, 000h, 03Fh
            db 000h, 000h, 03Eh
            db 000h, 000h, 03Dh
            db 000h, 000h, 03Ch
            db 000h, 000h, 03Bh
            db 000h, 000h, 03Ah
            db 000h, 000h, 039h
            db 000h, 000h, 038h
            db 001h, 000h, 037h
            db 002h, 000h, 036h
            db 003h, 000h, 035h
            db 004h, 000h, 034h
            db 005h, 000h, 033h
            db 006h, 000h, 032h
            db 007h, 000h, 031h
            db 008h, 000h, 030h
            db 009h, 000h, 02Fh
            db 00ah, 000h, 02Eh
            db 00bh, 000h, 02Dh
            db 00ch, 000h, 02Ch
            db 00dh, 000h, 02Bh
            db 00eh, 000h, 02Ah
            db 00fh, 000h, 029h
            db 010h, 000h, 028h
            db 011h, 000h, 027h
            db 012h, 000h, 026h
            db 013h, 000h, 025h
            db 014h, 000h, 024h
            db 015h, 000h, 023h
            db 016h, 000h, 022h
            db 017h, 000h, 021h
            db 018h, 000h, 020h
            db 019h, 000h, 01Fh
            db 01ah, 000h, 01Eh
            db 01bh, 000h, 01Dh
            db 01ch, 000h, 01Ch
            db 01dh, 000h, 01Bh
            db 01eh, 000h, 01Ah
            db 020h, 000h, 019h
            db 021h, 000h, 018h
            db 023h, 000h, 017h
            db 024h, 000h, 016h
            db 025h, 000h, 015h
            db 026h, 000h, 014h
            db 027h, 000h, 013h
            db 028h, 000h, 012h
            db 029h, 000h, 011h
            db 02ah, 000h, 010h
            db 02bh, 000h, 00Fh
            db 02ch, 000h, 00Eh
            db 02dh, 000h, 00Dh
            db 02eh, 000h, 00Dh
            db 02fh, 000h, 00Dh
            db 030h, 000h, 00Dh
            db 031h, 000h, 00Dh
            db 032h, 000h, 00Dh
            db 033h, 000h, 00Dh
            db 034h, 000h, 00Dh
            db 035h, 000h, 00Dh
            db 036h, 000h, 00Dh
            db 037h, 000h, 00Dh
            db 038h, 000h, 00Dh
            db 039h, 000h, 00Dh
            db 03ah, 000h, 00Dh
            db 03bh, 000h, 00Dh
            db 03ch, 000h, 00Dh
            db 03dh, 000h, 00Dh
            db 03eh, 000h, 00Dh
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
main:		call	detectvesa
		call	initvesa
		call	setpalette
		call	drawlines
		mov	bp,15
		call	switchwin
		call	drawlines
		mov	bp,30
		call	switchwin
		call	drawlines
		mov	bp,45
		call	switchwin
		call	drawlines
		mov	bp,60
		call	switchwin
		call	drawlines
		mov	ah,1
		int	21h
		ret				; ש code optimization rules
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
code		ends
end		vesa