Dark Bit Factory & Gravity
PROGRAMMING => Other languages => ASM => Topic started 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"
-
Kool!!! Does it support other image types?
-
Welldone, Smart work Rbraz buddy. 8)
Clever Cloggs :p
-
Kewl :)
-
Thanks !
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 ;)
-
I have a PCX loader but it's in TASM,. :*(