TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: SAM IZZO
date: 1997-12-27 23:33:00
subject: Fire effect 1/2

Well, here's a small fire routine I've been working on.  Thanks to all those
who responded to my question about allocating memory!  I used that info here 
:)
Hope it's not too big.. Should be in two parts..

; ---------------------------------------------------------------------------
; Fire effect by Jestyr aka Sam Izzo (taran@alphalink.com.au)
; Written on: 27-12-1997
;
; Compiled with A86 which is why there are lots of db statements: A86 doesn't
; support 80386 instructions.  Shouldn't be hard to convert to TASM.  I did
; it once, but it was 31 bytes bigger and I got a jump out of range error,
; whereas I didn't get one in A86 (??)
;
; It's fast enough (almost) on my P100.  I was aiming to get it fast, decent
; looking, and small.  I hope I managed alright :)  It's guaranteed to be
; slow on a 386, I dunno how it'll run on a 486, but it should be fine on
; any kind of Pentium.  If you can get it smaller, mail me please!
;
; It doesn't check for free memory, so make sure you have about 130k free.  I
; think most people should be able to manage that!  There are also no checks
; for 80386 and VGA!  You were warned =P
;
; It should be 242 bytes with A86.
;
; Oh, and hit escape to quit!
; ---------------------------------------------------------------------------
      ; resize block so we can allocate some memory
      mov bx, 64d ; prolly too much, but better to be safe than sorry
      mov ah, 4ah
      int 21h
      ; allocate some memory
      mov ah, 48h
      mov bx, 4040d
      int 21h
      ; first buffer is accessed through gs
      db 8eh, 0e8h ; mov gs, ax
      ; zero it
      mov es, ax
      xor di, di
      mov cx, 32320d
      xor ax, ax
      rep stosw
      ; allocate some more memory
      mov ah, 48h
      mov bx, 4040d
      int 21h
      ; second buffer is accessed through fs
      db 8eh, 0e0h ; mov fs, ax
      ; zero it
      mov es, ax
      xor di, di
      mov cx, 32320d
      xor ax, ax
      rep stosw
      ; set vid mode to 320x200x256
      mov ax, 0013h
      int 10h
      ; set up palette
      ; here's some pseudocode for how i set the palette:
      ; for i = 0 to 63
      ; begin
      ;    setpal(i, i, 0, 0)
      ;    setpal(i+64, 63, i, 0)
      ;    setpal(i+128, 63, 63, i)
      ;    setpal(i+192, 63, 63, 63)
      ; end
      mov dx, 3c8h
      mov cx, 63d
     @palloop1:
      mov al, cl
      out dx, al
      inc dx
      out dx, al
      xor al, al
      out dx, al
      out dx, al
      dec dx
      mov al, cl
      add al, 64d
      out dx, al
      inc dx
      mov al, 63d
      out dx, al
      mov al, cl
      out dx, al
      xor al, al
      out dx, al
      dec dx
      mov al, cl
      add al, 128d
      out dx, al
      inc dx
      mov al, 63d
      out dx, al
      out dx, al
      mov al, cl
      out dx, al
      dec dx
      add al, 192d
      out dx, al
      inc dx
      mov al, 63d
      out dx, al
      out dx, al
      out dx, al
      dec dx
      dec cx
      jns @palloop1

--- FMail/386 1.20+
---------------
* Origin: Comms Barrier BBS +61.3.9585.1112, +61.3.9583.6119 (3:632/533)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.