• Welcome to Dark Bit Factory & Gravity.
 

Picture Loader

Started by Rbz, May 12, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Rbz

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"


Challenge Trophies Won:

relsoft

Kool!!! Does it support other image types?
Challenge Trophies Won:

Clyde

Welldone, Smart work Rbraz buddy. 8)

Clever Cloggs :p
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Shockwave

Shockwave ^ Codigos
Challenge Trophies Won:

Rbz

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 ;)
Challenge Trophies Won:

relsoft

I have a PCX loader but it's in TASM,. :*(
Challenge Trophies Won: