flat assembler
Message board for the users of flat assembler.

Index > OS Construction > How to use images? revised..

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
I am also a great believer in KISS, here is some code, i made to display a 640x480 256 bmp for "Redragon", may help others.
Note: Change "test.bmp" before assembling, to change image.
Run the exe to put it on a floppy, fasm code included.
http://www.dex4u.com/Redragon/BmpView.zip
EDIT: Please just ask and i will upload it again (as need space).
Hope this helps.
Works in qemu too.


Last edited by Dex4u on 19 Jun 2006, 15:11; edited 2 times in total
Post 17 Jun 2006, 13:00
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Adam, here is my old pascal/asm routine to put pixel into screen mode $12. You need also handle high/low nibble.
To copy bmp line, mode $13 need only "rep movsb", but mode $12 lots of more code. Current BootBmp with 256 colors has 16 bytes free, maybe it is possible if you remove all messages and all extra stuff.
Code:
SCREENBYTES := 80;   { 80 for 640*480 or 100 for 800*600 }
Procedure SetPixel(x, y: Word; Col: Byte); Assembler;
Asm
  push ds
  mov  ax,Seg @Data
  mov  ds,ax
  mov  ax,$A000
  mov  es,ax
  mov  ax,[SCREENBYTES]
  mul  [y]
  mov  di,[x]
  mov  cx,di
  shr  di,3
  add  di,ax
  mov  dx,$03CE
  mov  ax,$0205     { Set writemode 2 }
  out  dx,ax
  and  cl,$07
  mov  ax,$8008     { Set bit mask cl }
  shr  ah,cl
  out  dx,ax
  mov  al,es:[di]   { Some graph card need dummy read before write }
  mov  al,[Col]
  mov  es:[di],al
  mov  ax,$FF08     { Set bit mask FF }
  out  dx,ax
  mov  dx,$03CE     { Set writemode 0 }
  mov  ax,$0005
  out  dx,ax
  pop  ds
End;
    
Post 19 Jun 2006, 14:21
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
What are the values of [di] and [Col]?
Post 19 Jun 2006, 20:56
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
Dex4u: It appears that your BMP viewer doesn't work too well.
Post 19 Jun 2006, 21:22
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Adam Kachwalla wrote:
Dex4u: It appears that your BMP viewer doesn't work too well.

It may help if you say in what way Wink
Post 19 Jun 2006, 21:47
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
That is about 10 years old pascal source, that time I didnt use many comment in my source.
col=color=0..15
x=0..639
y=0..479
di=(x shr 3)+80*y
cl=x and 7
Note: it is using writemode 2
You can also use writemode 0 but then you have to set right color plane your self. For more information search WriteEgaPlane in net.
Post 20 Jun 2006, 13:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.