Dark Bit Factory & Gravity

PROGRAMMING => Other languages => ASM => Topic started by: Rbz on May 12, 2006

Title: Picture Loader
Post by: Rbz on May 12, 2006
Here's a simple asm picture loader, hope it's useful for someone.

http://rbz.sitesled.com/Files/Picture_Loader.zip

PS: GFX by AlienEye :)



Code: [Select]
;---------------------------------------
;Â  Simple ASM picture loader by Rbraz 2006
;Â  Compile with FASM 1.66
;---------------------------------------

;-------------- COM file
 org 100h

;-------------- Video Mode-XÂ  --->Â  320x200x256 color palette
 mov al,13h
 int 10h

 push 0a000h  Â ; ES = 0A000h
 pop es  Â  Â  Â  ;
 xor di,di  Â  Â ; offset


;-------------- Load picture palette
 mov si,Pal

 mov cl,00h

.palette:

 mov  Â  dx,3c8h
 mov  Â  al,cl  Â  Â  ;[col]
 out  Â  dx,al
 inc  Â  dx
 mov  Â  al,[si]  Â  ;[r]

 inc  Â  si  Â  Â  Â  Â ; Inc "si"

 out  Â  dx,al
 mov  Â  al,[si]  Â  ;[g]

 inc  Â  si  Â  Â  Â  Â ; In "si"

 out  Â  dx,al
 mov  Â  al,[si]  Â  ;[b]
 out  Â  dx,al

 inc  Â  si  Â  Â  Â  Â ; Inc "si"

 inc cl
 cmp cl,255
 jne .palette
;-----------------------------------



;---------------- Main function --------------
Main:
  Â  Â  Â  mov si,DBF_Pic  Â  Â  ; our Picture offset
  Â  Â  Â  mov cx, 51200  Â  Â  Â ; Loop 51200 times
  Â  Â  Â  xor di,di
.loop1:
  Â  Â  Â  movsb  Â  Â  Â  Â  Â  Â  Â ; stores byte
  Â  Â  Â  LOOP .loop1



;------------------ Loop until not key hit = ESC
 in  Â al,60h
 cbw
 dec  ax
 jnz  Main

;----------- Back to text mode
 mov  Â ax,03H
 int  Â 10h

;----------- Exit to DOS
 mov  Â ax,4c00h
 int  Â 21h


;----------------------------------------------- DATA -------------------------------------------------------

Pal: include "dbf.bmp.pal.asm"

DBF_Pic: include "dbf.bmp.raw.asm"

Title: Re: Picture Loader
Post by: relsoft on May 12, 2006
Kool!!! Does it support other image types?
Title: Re: Picture Loader
Post by: Clyde on May 12, 2006
Welldone, Smart work Rbraz buddy. 8)

Clever Cloggs :p
Title: Re: Picture Loader
Post by: Shockwave on May 12, 2006
Kewl :)
Title: Re: Picture Loader
Post by: Rbz on May 12, 2006
Thanks !


Quote
Does it support other image types?

Nope, I can only load bitmap images (256 color palette), and I'll recode this one to load direct from a .BMP file ;)
Title: Re: Picture Loader
Post by: relsoft on May 15, 2006
I have a PCX loader but it's in TASM,. :*(