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 :)




;---------------------------------------
;Ã,  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 !


QuoteDoes 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,. :*(