Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - BmpToTile

Reply to topic
Author Message
cactus
  • Guest
Reply with quote
BmpToTile
Post Posted: Tue Jan 14, 2003 2:04 am
Hi,
I have progress in my wild ambition to program SMS:
Now i can load tiles!AND I know how to change palette (thanks maxim)Yhhuu!!!
But I have today a question for Maxim and his BMPTOTILE converter:
I droped a 96*96 bmp in order to convert it;the program give me 2 files,
1=the tiles
2=the order to re-assemble the tiles

Now,how to use this second file.inc ???
I don't know how to put in the source...

Thanks again!

PS:Maxim I repeat i have great interest in your tutorials for programing sms !!!

 
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Tue Jan 14, 2003 8:52 am
Quote
> I have progress in my wild ambition to program SMS:
> Now i can load tiles!AND I know how to change palette (thanks maxim)Yhhuu!!!
> But I have today a question for Maxim and his BMPTOTILE converter:
> I droped a 96*96 bmp in order to convert it;the program give me 2 files,
> 1=the tiles
> 2=the order to re-assemble the tiles

> Now,how to use this second file.inc ???
> I don't know how to put in the source...

You know how to include it because it's exactly the same as the way you include the tile data. It depends which options you chose for the second one.

"Tile offset" is which tile index you intend to load the tiles at, so the indices will match.
"Pad with" will pad the data to 32 columns wide with the byte you give, so you don't have to figure that out yourself.
"Use sprite palette" and "In front of sprites" toggle two of the tile status bits in the generated data.

Most importantly, "Bytes" will leave out the high byte of each name table entry and you will have to re-insert it in the source. This is only possible if there are no bits set in the high byte, ie. the maximum tile index is less than $100 and no status bits are used.

The easiest thing to do is:

1. Uncheck "Bytes"
2. Pad with zeroes (or whatever index your blank tile is)
3. Use this code:

; Set VRAM to write to name table address
ld a,$00
out ($bf),a
ld a,$78
out ($bf),a
; Output data
; Draw tiles
ld hl,TileMap
ld c,$be
ld b,$00
otir
ld b,$20
otir

In your case, you have 96x96=144 tiles, needing 288 bytes to be defined; so you need to otir with b set to $00, which will output 256, and then again for the rest.

The problem with this is, it is very wasteful of ROM space. So, before figuring out compression, I put in the option to leave out the high bytes, since as long as your tile indices are low, they're all zero. Then I coded a function for drawing such an image without padding, called DrawImageBytes in my graphics.inc. See there for the parameters, and good luck.

Speaking of my tutorial, it seems you are maybe exceeding how far I've got with it. However, I've going into a lot of detail so it may still be useful to you. I hope to get the first instalment finished today.

Maxim
  View user's profile Send private message Visit poster's website
  • Joined: 15 Jun 2021
  • Posts: 5
  • Location: SPb, Russia
Reply with quote
Compression
Post Posted: Tue Jun 15, 2021 2:56 pm
Hi! Finally manage to register here. I'm another newbie self-proclaimed developer. So I started my simple project using Maxim's tutorial, and already I see it's taken too much space for what it is. For slightly bigger game compression of graphics is a must. I understand what Bmp2tile can compress tiles. But somehow, I just can't. The only option it give me is to create <>.inc file. Where do I go wrong? Do I need to download something additional? Help please.
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 863
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Tue Jun 15, 2021 8:03 pm
Titun wrote
Hi! Finally manage to register here. I'm another newbie self-proclaimed developer. So I started my simple project using Maxim's tutorial, and already I see it's taken too much space for what it is. For slightly bigger game compression of graphics is a must. I understand what Bmp2tile can compress tiles. But somehow, I just can't. The only option it give me is to create <>.inc file. Where do I go wrong? Do I need to download something additional? Help please.


In the latest version of Bmp2tile, you have to install the plugins, or it won't support compression.

https://github.com/maxim-zhao/bmp2tilecompressors
  View user's profile Send private message Visit poster's website
  • Joined: 15 Jun 2021
  • Posts: 5
  • Location: SPb, Russia
Reply with quote
Post Posted: Wed Jun 16, 2021 7:40 am
Ok, so I download compressors. And unzip it to Bmp2tile directory and still nothing. The messages field give me something like this:
Discovering compressors
Loaded .....\gfxcomp_phantasystar.dll but found no compressors
Added 1 compressors

What do I do wrong?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Wed Jun 16, 2021 8:41 am
What versions of bmp2tile and the DLLs are you using? What version of Windows are you using? I suspect it may be a C runtime dependency issue, you can search for “Windows 10 universal C runtime” to download from Microsoft’s website but I think it should be built in for Windows 10.
  View user's profile Send private message Visit poster's website
  • Joined: 15 Jun 2021
  • Posts: 5
  • Location: SPb, Russia
Reply with quote
Post Posted: Wed Jun 16, 2021 9:47 am
Maxim wrote
What versions of bmp2tile and the DLLs are you using? What version of Windows are you using? I suspect it may be a C runtime dependency issue, you can search for “Windows 10 universal C runtime” to download from Microsoft’s website but I think it should be built in for Windows 10.

I have Windows 7, Bmp2tile 0.5. And about DLLs, sorry I don't know how to see it version. So problem is must be my OS, yeah? Ok, I'll try to search this C runtime. Thanks!
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3762
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Wed Jun 16, 2021 10:10 am
did you try with version 0.44? If that works it means you have some issues with .NET
  View user's profile Send private message Visit poster's website
  • Joined: 15 Jun 2021
  • Posts: 5
  • Location: SPb, Russia
Reply with quote
Post Posted: Wed Jun 16, 2021 12:30 pm
sverx wrote
did you try with version 0.44? If that works it means you have some issues with .NET

Ok, so version 0.44 doesn't even start. )
It tells me my PC miss VCRUNTIME140.dll and also MSVPC140.dll
  View user's profile Send private message
  • Joined: 18 Dec 2012
  • Posts: 9
  • Location: France
Reply with quote
Post Posted: Wed Jun 16, 2021 1:22 pm
Titun wrote
It tells me my PC miss VCRUNTIME140.dll and also MSVPC140.dll

It means that you need to install "Microsoft Visual C++ 2015 Redistributable".
It can be found here: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-download...
Look for the "Visual Studio 2015, 2017 and 2019" section.
Download the installers for "x86: vc_redist.x86.exe" and "x64: vc_redist.x64.exe" (ignore ARM64).
Then install both.
  View user's profile Send private message
  • Joined: 15 Jun 2021
  • Posts: 5
  • Location: SPb, Russia
Reply with quote
Post Posted: Wed Jun 16, 2021 7:43 pm
Nolendil wrote
Titun wrote
It tells me my PC miss VCRUNTIME140.dll and also MSVPC140.dll

It means that you need to install "Microsoft Visual C++ 2015 Redistributable".
It can be found here: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-download...
Look for the "Visual Studio 2015, 2017 and 2019" section.
Download the installers for "x86: vc_redist.x86.exe" and "x64: vc_redist.x64.exe" (ignore ARM64).
Then install both.

Wow, thanks! Now it's working in either 0.44 or 0.5 Bmp2tile. Greatness awaits 😀
  View user's profile Send private message
  • Joined: 18 Dec 2012
  • Posts: 9
  • Location: France
Reply with quote
Post Posted: Wed Jun 16, 2021 10:44 pm
Titun wrote
Wow, thanks! Now it's working in either 0.44 or 0.5 Bmp2tile. Greatness awaits 😀

Yeah! 😀
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!