ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
; plasmoid/deep 1995:
; well here it is another kewl code by plasmoid...diz code is awfull hot and
; dedicated to a little girly, i donno if i should start a funky offensiv in
; order to get connected ;)...we'll see... press return to stemp a logo in
; the fire
; ("1996: if my girlfriend had known this text ^^ , PEINLICH!")
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
.model tiny
code            segment use16
		assume  cs:code,ds:code
		org     100h
		locals
xsize		equ	320
ysize		equ	70
hotfire:        jmp     main
include		ocean.pal
info		db 	" ש hot fire ש code by plasmoid ש "
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
.386						; ש here we go again...
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
shades		proc	near
		mov	bp,8*2
five:		mov	ax,shad1x[bp]
		mov	bx,shad1y[bp]
		mov	si,shad2x[bp]
		mov	di,shad2y[bp]
		call	line
		mov	ax,dire1x[bp]
		add	shad1x[bp],ax
		mov	ax,dire2x[bp]
		add	shad2x[bp],ax
		mov	ax,dire1y[bp]
		add	shad1y[bp],ax
		mov	ax,dire2y[bp]
		add	shad2y[bp],ax
		sub	bp,2
		jnz	five

		mov	bp,8*2
check:		cmp	shad1x[bp],4
		jb	toosmallx1
		cmp	shad2x[bp],4
		jb	toosmallx2
		cmp	shad1x[bp],310
		ja	toosmallx1
		cmp	shad2x[bp],310
		ja	toosmallx2
		cmp	shad1y[bp],4
		jb	toosmally1
		cmp	shad2y[bp],4
		jb	toosmally2
		cmp	shad1y[bp],60
		ja	toosmally1
		cmp	shad2y[bp],60
		ja	toosmally2
		jmp	cont
toosmallx1:	neg	dire1x[bp]
		jmp	cont
toosmally1:	neg	dire1y[bp]
		jmp	cont
toosmallx2:	neg	dire2x[bp]
		jmp	cont
toosmally2:	neg	dire2y[bp]
cont:		sub	bp,2
		jnz	check
		ret
shad1x		dw	120,010,040,310,240,020,210,140,210,140
shad1y		dw	050,030,020,004,063,023,014,042,030,045
shad2x		dw	150,110,240,010,140,220,045,035,023,022
shad2y		dw	030,060,010,044,023,064,021,045,060,006
dire1x		dw	 -1,  1, -1, -1,  1,  1,  1,  1, -1,  1
dire1y		dw        1, -1, -1,  1, -1, -1, -1, -1, -1, -1
dire2x		dw	  1, -1, -1,  1, -1,  1, -1, -1, -1, -1
dire2y		dw        1,  1, -1, -1,  1, -1,  1, -1,  1,  1
shades          endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
pixel           proc near
		push    dx                      ; ש ax-x bx-y
		push    bx
		push    ax
		mov     dx,ax                   ; ש multis y * 320
		shl     dx,8                    ;   using    * 256
		shl     ax,6                    ;   using    *  64
		add     ax,dx                   ;            = 320
		add     bx,ax                   ; ש add y to x
		cmp	byte ptr ds:fireblock[bx],250-30
		ja	@okay
@inc:           add     byte ptr ds:fireblock[bx],15        ; ש mov it!
@okay:          pop     ax
		pop     bx
		pop     dx
		ret
pixel           endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
line            proc near
		s1      equ [bp-10h]            ; ש ax-x bx-y
		s2      equ [bp-0eh]            ; ש si-x bx-y
		s3      equ [bp-0ch]
		s4      equ [bp-0ah]
		x1      equ [bp-08h]
		y1      equ [bp-06h]
		x2      equ [bp-04h]
		y2      equ [bp-02h]

		enter   10h,0
		mov     x1,ax                   ; ש here cum some nice
		mov     y1,bx                   ;   explaining words
		mov     x2,si
		mov     y2,di
		mov     si,x2                   ; ש checks if sign
		sub     si,x1                   ;   meaning if  or 
		jns     @lab1
		neg     si                      ; ש change sign
@lab1:          mov     di,y2                   ; ש checks if sign
		sub     di,y1                   ;   meaning if  or 
		jns     @lab2
		neg     di                      ; ש change sign
@lab2:          cmp     si,di
		jge     @lab3a                  ; ש m <= 1
		jmp     @lab20                  ; ש m >  1

@lab3a:         mov     bx,x1                   ; ש checks if x1 <= x2
		cmp     bx,x2
		jg      @lab4
		mov     bx,1                    ; ש go right!
		jmp     @lab5
@lab4:          mov     bx,-1                   ; ש go left!
@lab5:          mov     ax,y1                   ; ש checks if y1 <= y2
		cmp     ax,y2
		jg      @lab6
		mov     ax,1                    ; ש go up!
		jmp     @lab7

@lab6:          mov     ax,-1                   ; ש go down!
; small comment: Going down, mayday, mayday (from Comanche)
@lab7:          mov     s1,bx                   ; ש save m on stack
		mov     s2,ax
		add     di,di                   ; ש draw point
		mov     s3,di
		sub     di,si
		mov     bx,di
		sub     bx,si
		mov     s4,bx
		mov     bx,x1
		mov     ax,y1
		call    pixel

@lab8:          cmp     bx,x2                   ; ש points left?
		jz      @lab3
		add     bx,s1                   ; ש increases x
		or      di,di                   ; ש checks if y should
		jns     @lab10                  ;   be increased
		add     di,s3
		jmp     @lab11
@lab10:         add     di,s4                   ; ש next point
		add     ax,s2
@lab11:         call    pixel
		jmp     @lab8

@lab20:         mov     bx,y1                   ; ש checks if y1 <= y2
		cmp     bx,y2
		jg      @lab12
		mov     bx,1                    ; ש go up!
		jmp     @lab13

@lab12:         mov     bx,-1                   ; ש go down!
; small comment: Going down, mayday, mayday (from Comanche)
@lab13:         mov     ax,x1                   ; ש checks if x1 <= x2
		cmp     ax,x2
		jg      @lab14
		mov     ax,1                    ; ש go right!
		jmp     @lab15
@lab14:         mov     ax,-1                   ; ש go left!
@lab15:         mov     s1,bx                   ; ש save m on stack
		mov     s2,ax
		add     si,si                   ; ש draw point
		mov     s3,si
		sub     si,di
		mov     bx,si
		sub     bx,di
		mov     s4,bx
		mov     di,si
		mov     bx,x1
		mov     ax,y1
		call    pixel
@lab16:         cmp     ax,y2                   ; ש points left?
		jz      @lab3
		add     ax,s1                   ; ש increases x
		or      di,di                   ; ש checks if y should
		jns     @lab18                  ;   be increased
		add     di,s3
		jmp     @lab19
@lab18:         add     di,s4                   ; ש next point
		add     bx,s2
@lab19:         call    pixel
		jmp     @lab16

@lab3:          leave
		ret
line            endp

ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
displaylogo	proc	near
		mov	si,offset vgalogo
		mov	di,offset fireblock+21*320+60
		mov	bx,39
pic2fire:	mov	cx,200
pis2fire:	mov	al,ds:[si]
		cmp	al,00
		je	nopixel
		mov	ds:[di],al
nopixel:	inc	si
		inc	di
		loop	pis2fire
		add	di,320-200
		dec	bx
		jnz	pic2fire
		ret
displaylogo	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
convert         proc    near
		xor     bx,bx
@@two:          mov     cx,bp           ; ש lg to cx
@@one:          xor     dx,dx
		mov     dl,ds:[si]      ; ש read from srce to dl
		mov     bl,dl           ; ש convert in dx...
		shr     bl,6
		cmp	bl,0
		je	put1
		shl	bl,4
		add     bl,select
put1:		mov     ds:[di],bl
		inc     di
		mov     bl,dl
		shl     bl,2
		shr     bl,6
		cmp	bl,0
		je	put2
		shl	bl,4
		add     bl,select
put2:		mov     ds:[di],bl
		inc     di
		mov     bl,dl
		shl     bl,4
		shr     bl,6
		cmp	bl,0
		je	put3
		shl	bl,4
		add     bl,select
put3:		mov     ds:[di],bl
		inc     di
		mov     bl,dl
		shl     bl,6
		shr     bl,6
		cmp	bl,0
		je	put4
		shl	bl,4
		add     bl,select
put4:		mov     ds:[di],bl
		inc     di
		inc     si
		loop    @@one
		dec     ax              ; ש dec
		jnz     @@two
		ret
select          db      00h
convert         endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
cga2vga         proc    near
		mov     si,offset logo
		mov     di,offset vgalogo
		mov     ax,39
		mov     bp,200/4
		call    convert
		ret
cga2vga         endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
fire2scr	proc	near
		mov	si,offset fireblock
		xor	di,di
@scr:		mov	cx,xsize*ysize/4
		rep	movsd
		ret
fire2scr	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
newhotline	proc	near
		push	ax
		mov	ax,random1
		mov	bx,random2
		mov	cx,random3
		mov	dx,random4
		ror	dx,cl
		xchg	ch,cl
		rol	ax,cl
		xchg	dx,cx
		xor	bx,cx
		add	ax,bx
		inc	dx
		xchg	dh,dl
		shl	bx,cl
		xchg	dl,dh
		mov	random1,ax
		mov	random2,bx
		mov	random3,cx
		mov	random4,dx
		pop	bx
		mul	bx
		mov	bx,0ffffh
		div	bx
		ret
newhotline	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
burning		proc	near
		push	ds
		pop	es
		mov	di,offset fireblock+(ysize-1)*xsize
		mov	si,xsize
newline:	mov	ax,2
		call	newhotline
		cmp	al,1
		jne	putstone
		mov	al,03fh
putstone:	stosb
		dec	si
		jnz	newline

		;xor	bx,bx
		mov	cx,xsize*(ysize-1)/2
		mov	si,offset fireblock
blending:	mov	ax,[si+(xsize-1)]
		add	ax,[si+(xsize+0)]
		add	ax,[si+(xsize+1)]
		add	ax,[si+(xsize*2)]
		cmp	cx,xsize*30
		ja	faster
		dec	ax
faster:		shr	ax,2
		and	ax,03f3fh
		mov	[si],ax
		add	si,2
		loop	blending
		push	0a000h
		pop	es
		ret
burning		endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
int_key         proc    near
		cli
		push	ax
		in	al,60h
		cmp	al,01			; ש escape
		je	put
		cmp	al,28			; ש return
		je	put
		jmp	none			; ש none
put:		mov	cs:keystroke,al
		jmp	okey
none:		mov	cs:keystroke,0ffh
okey:		in	al,61h
		mov	ah,al
		or	al,80h
		out	61h,al
		sti
		mov	al,20h
		out	20h,al
		pop	ax
		iret
keystroke	db	00
int_key         endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
initkeyboard    proc    near
		cli
		mov	eax,fs:[9*4]
		mov	oldint9,eax
		mov	ax,cs
		shl	eax,16
		mov	ax,offset int_key
		mov	fs:[9*4],eax
		sti
		ret
oldint9         dd      ?
initkeyboard    endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
killkeyboard    proc near
		cli
		mov	eax,oldint9
		mov	fs:[9*4],eax
		sti
		ret
killkeyboard    endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
initsystem      proc    near
		mov     ah,0fh
		int     10h
		mov     oldmode,al

		mov     ax,0013h		; ש do all the init
		int     10h			;   shit

		push	cs
		pop	ds
		push    0a000h
		pop	es

		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

		mov 	dx,3d4h
    		mov 	al,9
	    	out 	dx,al
    		inc 	dx
    		in 	al,dx
    		and 	al,0e0h
    		add 	al,5
   		out	dx,al

		ret
oldmode         db      90h
initsystem     endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
killsystem   	proc    near
		xor     ah,ah
		mov     al,oldmode
		int     10h
		mov     ah,12h          ; ש restore palette
		mov     bl,31h
		mov     al,00h
		int     10h
		ret
killsystem   	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
checkkey	proc	near
		cmp byte ptr keystroke,01	; ש escape
		je	escape
		cmp byte ptr keystroke,28	; ש return
		je	return
		jmp	no
escape:		jmp	exit
return:		call	displaylogo
no:		ret
checkkey	endp
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
random1		dw	12345
random2		dw	23451
random3		dw	34512
random4		dw	45123

fireblock	db	xsize*ysize+200 dup (0)
vgalogo		db	200*39 dup (0)

include		hotfire.dat
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
main:		call	initsystem
		call	initkeyboard
		call	cga2vga

noop:		call	checkkey
		call	burning
		call	fire2scr
;		call	shades
		jmp	noop

exit:		call	killkeyboard
		call	killsystem
		pop	ax
		ret
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
code            ends
ִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִִ
end             hotfire

