
.MODEL FLAT
.486p

;P L A S T I C (or something like..)
;Credits:

.BSS 

JCL: db First3DObject dup(?)

.DATA 

SML: include "coolmuzzak.dat"
HGH: include "3dobjects.dat"
HGH: include "normaltextures.dat"
ASTHAROTH: include "poortextures.dat"
ECO: include "marvelouslogo.dat"

.CODE

Start:

; Some textures taken form our friends on Necrostudios .. hi! :D
; One of the textures is a photo from an ashtray in TLOTB fun houze.
; Thanks to Sml for the music
; Thanks to our girlfriends too for moral support (and for supporting us)

	mov ax,013h
	int 10h
	mov edi,0a0000h
	mov ecx,16384
	;Some trash code here :D
ASTHAROTH:
	xor eax,eax
	mov [edi],eax
	inc eax
	dec ecx
	jnz ASTHAROTH
	jmp HGH
	;Just for clear the pipeline.... 
HGH:
	;The real code goes here :D
	;Only runs in debug mode.
	#ifdef X_DEBUG
	; Assert: FreePtr is always multiple of 4
	test	bl,3
	jnz		gmAbort
	#endif
	lea		eax,[ebx+ecx]	; Calc end of block address in EAX
	cmp		ebx,[iMEM_HeapPtr]
	je		gmGrowHeap		; No free blocks - grow the heap
	#ifdef X_DEBUG
	; Assert: FreePtr never exceeds MEM_HeapPtr
	ja		gmAbort
	; Assert: EBX lies between MEM_HeapOrg and MEM_MEM_HeapEnd
	cmp		ebx,[iMEM_HeapOrg]
	jb		gmAbort
	cmp		ebx,[iMEM_HeapEnd]
	jnb		gmAbort
	#endif

;Greetings to:
; Collapse, Concept,Fuzzion,DMX,AMB,Tpolm,Necrostudios,RGBA
; 3pixels,Iguana,Asynkro,Software Failure,Hansa,Incognita
; 9ard, Synth,Spöntz,Unknown,Zonan,Boah,Haujob,Inf,Procreation

	mov		edx,4				; EDX = block size (4 if ptr odd)
	test	byte ptr [ebx],1	; Is the Extended Entry bit = 0?
	jz		gmSizeOk			; Jump if the block size is 4 bytes
	mov		edx,[ebx+4]			;Get size from MEM_FreeList entry
	#ifdef X_DEBUG
	; Assert: EDX is both multiple of 4 and >= 8
	test	dl,3
	jnz		gmAbort
	cmp		edx,8
	jb		gmAbort
	#endif			

	
;If you wanna contact.. try www.tlotb.com
;See you!!
; PS: The real demo was done in C :(

end Start


