Author Topic: Picture Loader  (Read 5373 times)

0 Members and 1 Guest are viewing this topic.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Picture Loader
« 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"

Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: Picture Loader
« Reply #1 on: May 12, 2006 »
Kool!!! Does it support other image types?
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Picture Loader
« Reply #2 on: May 12, 2006 »
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:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Picture Loader
« Reply #3 on: May 12, 2006 »
Kewl :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Picture Loader
« Reply #4 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 ;)
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: Picture Loader
« Reply #5 on: May 15, 2006 »
I have a PCX loader but it's in TASM,. :*(
Challenge Trophies Won: