Statistics

Members: 1927
News: 293
Web Links: 1
Visitors: 3933322

Who's Online

We have 1 guest online
Damn Vulnerable LinuxDamn Vulnerable Linux (DVL) is a Linux-based (modified Damn Small Linux) tool for IT-Security & IT-Anti- Security and Attack & Defense. [CLICK HERE FOR MORE INFOS! ]

Featured Conference Video

T16-Recon2006-Joe_Stewart-OllyBonE.gif OllyBone - Semi-Automatic Unpacking on IA-32. View the conference video here!
Home arrow Conference Proceedings arrow Assembly arrow Fire Demo in
Fire Demo in
User Rating: / 0
PoorBest 
Written by iCE   


[Another preface, I must be getting wordy in my old age. I received this code from iCE as a potential snippet or challenge; I chose to include it as the latter, for it put a nice spin on one of the classic asm learning programs: the VGA fire demo.

 

 

I have not pushed iCE for a commentary as the code is rather clear; it produces a small greyscale fire [roughly a third of the screen in my DOS VMWare box] that runs until a key is pressed. The key is using the greyscale as a sort of dynamic palette; this eliminates the need for a costly color palette that is easily 100 bytes itself. Although to be sure, the program now runs the risk of being renamed "static.asm" ;)

_m ]

; 66 bytes Graphic Fire demo.
; assemble using 'Tasm FIRE.ASM' and 'Tlink /t FIRE.OBJ' ;======================================================================FIRE.ASM .MODEL TINY
.CODE
.386
ORG 100H

START

        push    0a000h
pop     es
push    es
pop     ds
mov     al,13h          ; mode 13h. (AX=0)
int     10h
; gray-scale routine
mov     dx,3c8h
CBW                     ; set ax=0
out     dx,al
inc     dx
gs_loop:
out     dx,al
out     dx,al
out     dx,al
inc     ax
jnz     short gs_loop

;---
MainLoop:

        mov     si,1280         ;
mov     ch,5dh          ; y-pos, the less the faster demo
push    si
push    cx
Sloop

lodsb add al,[si] ; pick color and add al,[si+320] ; pick one more and shr al,2 ; divide, we got a

; 'smooth-fire-routine'

        mov     [si-960],al     ; put color
loop    short Sloop
pop     di
pop     cx
Randoml

mul word ptr [di+1] ; 'random' routine. inc ax stosw loop short Randoml

        MOV     AH,1            ; check keypress
INT     16h
Jz      short MainLoop

;---
Die:

        mov     ax,3            ; text-mode
int     10h
ret                     ; A com program may end using ret
END     start

;==========================================================================-EOF