flat assembler
Message board for the users of flat assembler.

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

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
I was wondering if someone can post some FASM code to show a BMP image in dos.. and if possible make it bootable from a disk...thanks!
Post 04 Dec 2004, 02:59
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Here is some asm code for dos BMP, it is not as easy as you think, 24 bit is easier then 8 bit , but then you have the size to think about. 24bit needs pmode and vesa, and then you need to load it, you can not use bios from pmode for floppy loading, very easierly, there are ways, but the code will not be small, or simple Crying or Very sad.

I would code you a demo, but i am busy with v3os, you should have a go and post back if you need help.
\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 04 Dec 2004, 04:24
View user's profile Send private message Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
I tried compiling it using FASM and it didnt work. Is it using FASM or Tasm? if its Tasm, where would i go to get an actual working version of it, I tried Tasm before, to compile a few of your other examples, and Tasm wouldnt even start..i dont know whats wrong...anyway, thaks for the help.
Post 04 Dec 2004, 04:58
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Its most likely masm, it will need converting for fasm, maybe someone else has a dos bmp display code, with fasm code ?.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 04 Dec 2004, 05:16
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
This is very simple 320x200x256 BMP viewer for bootsector


Last edited by ATV on 03 Feb 2006, 08:18; edited 1 time in total
Post 13 Dec 2004, 06:54
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Nice code ATV, you should of entered it, in the 512b compo Wink.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 13 Dec 2004, 15:37
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
ASHLEY4, it's not really OS, but there is some extra lines that can load real kernel. Maybe BootBMP should load DebugOS?
Post 15 Dec 2004, 06:54
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
But the compo was started, so we would get nippits of of code, to help people with OS dev.
And since the linux penguin, a lot of beginners like a boot up image, and your was a good example.
Now if you could of put the two (DebugOS that is) together you would of been onto a winner!.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 15 Dec 2004, 15:58
View user's profile Send private message Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
since that uses a floppy loading, to make it show that image in 32bit mode, what all would you have to do?
Post 25 Jun 2005, 19:14
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
That demo is run in realmode 16bit, it loads a 64k bmp, but you wanted higher-res and thats a bmp file of about 900k , not only will it take a long time to load, but you would need to use unreal mode, or make a pmode floppy driver.
Post 25 Jun 2005, 20:38
View user's profile Send private message Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
which one would be better, and faster? using real mode or a floppy driver?
Post 25 Jun 2005, 21:54
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Its unrealmode and they are the same speed as they both use the floppy , but unrealmode you can use int 13h for floppy, but in pmode you need to make a pmode floppy driver or set up v86.

Read up on unrealmode its a sort of cross between real and pmode.
Heres a start: http://www.mega-tokyo.com/osfaq2/index.php/UnrealMode
Post 26 Jun 2005, 09:56
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Little update, I have looked my old files and found pcxloader written few months back, but I have forget to send it (my near memory is very bad, because lack of vitamin B1/B12)

New bootloader can display pcx file and load over 64k kernel, but only in FAT12 and 320*200*256 pcx picture :-(no room for more code)
Also updated bootbmp for bmp pictures included


Description: 512 bytes bootsector PCX viewer
Download
Filename: BOOTPCX.ZIP
Filesize: 15.06 KB
Downloaded: 128 Time(s)

Post 03 Feb 2006, 08:19
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
How can you fit a 640x480x16 bitmap (Mode 0x13)?
Post 04 Apr 2006, 09:00
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
If you mean when the image is NOT exactly 640x480, then you should divide your original width,height with that 640,480 and pick the BIGGER constant. Then you can plot individual pixels from the source picture "constant" amount apart. The same you would act on the height. This means that when the picture is not of the same aspect - you will have some screen blank.

The other way is to have separate constants on the H,W parts so the image fits perfectly, but it might be stretched either way.
Post 04 Apr 2006, 13:11
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Adam, biggest problem is to show picture, because it can be 1bit*4color_planes or 4bits*1color_plane.
That depend what program saves that pcx picture.
Main unpacking is same, but if there is 4 color planes (640/8=80 bytes*4planes).
You need combine color planes. Something like:
screen[0]=(buf[0] and 1)*8+(buf[80] and 1)*4+(buf[160] and 1)*2+(buf[240] and 1)
Or you can use screen mode 12h (640*480*16) and write it in right color plane (it's not so easy as it sounds).
If picture is 4 bit in 1 plane, it need to handle high/low nibble.
And if that is not too complex already, some programs use packing over color planes.
So it's more easy to use some graphic tools to convert picture 640*480*16 -> 320*200*256

If you are looking for challenge try unpacking GIF
Post 08 Apr 2006, 07:17
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
I've tryed PNG, but the packing lacks documentation Sad I need some clearer documentation than the RFCs laconic one.
Post 08 Apr 2006, 08:21
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
ATV wrote:
If you are looking for challenge try unpacking GIF

And if looking for a bigger challenge, try JPEG Sad.

All image formats should be nonone OS dependent, other than than the load of file and memory aloting, so should only need writing once in asm (any offers Wink )
PS: There a pnglib here:
http://www.madwizard.org/view.php?page=downloads
coded with masm.
PPS: I think he just wants to display a 640x480 16 image at bootup, but put the wrong mode.
Post 08 Apr 2006, 10:43
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
Don't worry about packing! Any 640x480x16 BMP will fit on a 1.2MB floppy disk with a little over 1MB left!

Why bother with packing and unpacking image files, when you can leave the image in Raw or BMP format?

Remember to KISS (Keep It Simple, Stupid)
Post 17 Jun 2006, 03:16
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
Madis731 wrote:
If you mean when the image is NOT exactly 640x480, then you should divide your original width,height with that 640,480 and pick the BIGGER constant. Then you can plot individual pixels from the source picture "constant" amount apart. The same you would act on the height. This means that when the picture is not of the same aspect - you will have some screen blank.

The other way is to have separate constants on the H,W parts so the image fits perfectly, but it might be stretched either way.

The problem here is that the image is exactly 640x480. It is a 16-color BMP.
I can convert it to a variety of other file formats, but I like to work on the KISS (Keep It Simple, Stupid) principal.
Unpacking code wastes a bit of time.
Besides, the BMP only takes up 150KB
Post 17 Jun 2006, 03:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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.