Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > bitmap display/extraction
2006-08-11 02:42
Trifox
Account closed

Registered: Mar 2006
Posts: 108
bitmap display/extraction

hi all, i have a severe problem, i have some pictures, they are mulcticolor only, so it should be easy to extract the image data from it, can anyone point me to a description of those .prg multicolor images?

btw. i have a font/charset ( 2x2) in png format, what is the easiest/fastest way to get a c64 charset from it? i would not like to write a converter for this .,..

can there be a program wich outputs the bytes (valued 0..3 so, to bits a pixel) only????

time is runing out...
2006-08-11 08:35
Jetboy

Registered: Jul 2006
Posts: 221
Try some programs on pc that deal with c64 stuff - Thimanthes, ConGo.

As for converting png font, just convert image to c64, and then use centauri logo editor to change the bitmap into c64 font (though you will need 4 character map for each leter).

There are description of c64 formats in ConGo.
2006-08-11 13:19
MRT
Account closed

Registered: Sep 2005
Posts: 149
Quoting trifox
can anyone point me to a description of those .prg multicolor images?

There is no standard for .prg files for images. There are multiple well-known formats though, such as Amica Paint format or Koala Paint format for example.
For which formats are you searching?


Some formats write the .prg files as runnable files. If this is the case for your .prg files, it's quite easy to extract the images.
Just run the .prg file and check which VIC bank is beeing displayed ($dd00). Then check where (inside the VIC bank) the charset (bitmap data) resides ($d018).
Write $1f40 bytes to disk.
Also check the VideoMatricBaseAddress (normal charscreen) in $d018. This is where you find some of the color data.
Write $3e8 bytes to disk.
And then at last, at $d800 you will find the remaining color data.
Write $3e8 bytes to disk.

Oh, and check $d021 for the background color :-)

That should be it for normal multicolor bitmap mode.
2006-08-11 13:27
Trifox
Account closed

Registered: Mar 2006
Posts: 108
ok, thank you for reply, at first i have a hires picture, 320x200 pixel big, ( only used some pixels for chars) now i want to extract this image, is it right that this hires pic is located from $0400-somewhere? where 8 consecutive bits form a 8x8 pixel block on screen ? so all i have to do is to read 8 bytes and put them in my char memory ... ;)? correct me if iam wrong ... i think i will load such a prg file at the tail of my asm proggy, and search for the data area, i hope it is a connected block of memory ...
2006-08-11 13:33
Stryyker

Registered: Dec 2001
Posts: 465
What was used to create the images? If you don't know then do you know the file size?

Most bitmap gfx editors store the bitmap data then the colour data. When testing I would often load the file to $2000 (8192) then change the VIC screen/charset point to use that as the bitmap or charset (poke 53272,24 or something). poke 53269,59 and you'll sort of see it.

If you load a font in to $2000 you'll see how the first 8 bytes = character $00, the next 8 bytes loaded are for character $01 etc. The 8 bytes are arranged so the first byte = first line at the top, bext byte = next line down until you get your 8 pixel height (so 8 bytes = 1 character).
2006-08-11 14:10
Trifox
Account closed

Registered: Mar 2006
Posts: 108
here is the charset picture, created with congo ... i need urgent help with that gfx stuff, cause i would like to release a demo tomorrow, text output is fine already, all i need is this )=/$()=/$(=)/ 2x2 charset, beside of that i would like to extract a picture from a multicolor image

this one is the 2x2 font as hires picture
http://www.fractalmovies.com/c64/charset.prg
2006-08-11 14:19
MRT
Account closed

Registered: Sep 2005
Posts: 149
Quoting trifox
at first i have a hires picture, 320x200 pixel big, ( only used some pixels for chars) now i want to extract this image, is it right that this hires pic is located from $0400-somewhere?


NO! Without knowing the programm which created the file or knowing (figuring out) the fileformat, you can never be sure where the image data resides in the file.

AND... For Hires bitmaps, it works in an otherway then MultiCol bitmaps.
1. You don't have additional color data at $d800
2. You don't use $d021 (screen background color)

So, in other words... You have only two data banks in your hires file.
1. Charscreen data (colors in high and low nybles)
2. Bitmap data

Charscreen data is $3e8 bytes long
Bitmap data is $1f40 bytes long

So, if your file-size (in bytes) is 9002 ($232a), try to cut-up your .prg file like this:
2 bytes for mem address
$3e8 byes charscreen data
$1f40 bytes bitmap data

or like this
2 bytes for mem address
$1f40 bytes bitmap data
$3e8 byes charscreen data


If your size (in bytes) is more like 9218 ($2402), try to cut-up your .prg like this:
2 bytes for mem address
$400 byes charscreen data
$2000 bytes bitmap data

or like this
2 bytes for mem address
$2000 bytes bitmap data
$400 byes charscreen data

2006-08-11 14:27
MRT
Account closed

Registered: Sep 2005
Posts: 149
Quoting trifox
this one is the 2x2 font as hires picture
http://www.fractalmovies.com/c64/charset.prg

When you load this image and press space and the chars are beeing displayed...
your colordata is at $0400
your bitmap data is at $2000

Just open it in Vice and use monitor to write $2000 to $3f40 to file..

But then still... It's going to be a bitch to use this bitmap data straight up as a charset, coz the parts of the chars aren't well sorted.
2006-08-11 14:28
enthusi

Registered: May 2004
Posts: 675
An also common yet a bit wasty format is coloram at $5c00 and bitmap data at $6000. The Hires-Ed I use uses that.
2006-08-11 14:41
Trifox
Account closed

Registered: Mar 2006
Posts: 108
okay thank you for that explanation, i will try it out ... resorting the chars is then my problem, but if i got them, it should be no problem anymore ....
2006-08-11 14:44
MRT
Account closed

Registered: Sep 2005
Posts: 149
Quote: okay thank you for that explanation, i will try it out ... resorting the chars is then my problem, but if i got them, it should be no problem anymore ....

K, try to resort them in a way that you don't use more then $800 bytes for the bitmap data. That way you make sure that you can use it as a charset...
Then you'll have to save it from $2000 to $2800 ;-)
2006-08-11 15:08
Trifox
Account closed

Registered: Mar 2006
Posts: 108
hi, i stepped over this tool
PicChar v0.1
has anyone used it before ? how is the input format of this tool, there is no comment about accepted input formats, it seems that it rads just any type of file, but i am not sure in which format i have to use so that i can get what i want ... ;(
2006-08-11 15:12
MRT
Account closed

Registered: Sep 2005
Posts: 149
POST FROM PRIVATE MESSAGE

>> Well..?
>> Did that solve your problem?
>>
>
> i am coming closer to what i want to achieve, the $d018 register reads value $19 so, what parts do i need to extract?
>
> $d018 has value $19
>
> so, screen mem is $0400 - $07f8 what data is stored there ? only color data ? that would explain why all have the same value ....
>
> but i am used to $18 value in register $d018 ...

He he... If you're busy with the chars, just see forum posts... It'll guide you...

Let me explain $d018:
bit 0: uppercase/lowercase charset
bit 1-3: charset/bitmap address
bit 4-7: charscreen address

The real possition in mem depends on the first two bits (0-1) of $dd00. This register is for the VIC bank...
possible VIC banks are:
$0000
$4000
$8000
$c000

Witin one of these VIC banks you'll find a charset/bitmap address:
bit 1-3:
000: VICBank + $0000
001: VICBank + $0800
010: VICBank + $1000
011: VICBank + $1800
100: VICBank + $2000
101: VICBank + $2800
110: VICBank + $3000
111: VICBank + $3800

Note: When used in a normal manner, bitmaps only use 000 ($0000) or 100 ($2000) to show bitmap data

Within the same manner you can use the bits 4-7 for calculating the charscreen address.
2006-08-11 15:17
MRT
Account closed

Registered: Sep 2005
Posts: 149
Quote: hi, i stepped over this tool
PicChar v0.1
has anyone used it before ? how is the input format of this tool, there is no comment about accepted input formats, it seems that it rads just any type of file, but i am not sure in which format i have to use so that i can get what i want ... ;(


NO, It's from Scout... Don't use it, or it'll blow up your computer... ;-)
:-D

No realy, Use that tool! It's sure easier than moving all char-parts by hand... If the tool can do 4x4 chars?
2006-08-11 15:22
Scout

Registered: Dec 2002
Posts: 1568
Quote: NO, It's from Scout... Don't use it, or it'll blow up your computer... ;-)
:-D

No realy, Use that tool! It's sure easier than moving all char-parts by hand... If the tool can do 4x4 chars?


*BOOM!*

The program converts any hires screen into a charset.
Even more than 1 pic can be used.
Yay!
I also have an unreleased version of PicChar which makes it possible to create an inverse charset if needed (eor #$ff :).
Double yay!

Also, for the people who struggle with the d018/dd00 settings I recommend D018 Manager

---
8Bit Mayhem - The Commodore 64 Scenemusic Podcast
http://8bitmayhem.blogspot.com/
2006-08-11 16:30
enthusi

Registered: May 2004
Posts: 675
I recommend against it :)
Its not THAT hard and starting with tools you will always think of $d018 as an evil dark corner...
2006-08-11 16:52
Trifox
Account closed

Registered: Mar 2006
Posts: 108
anyhow i do it i just get crapp ... uaaaaaaaaaargh, but now i have some time ( 24 hours left till deadline ) to convert this picture into a charset ....
2006-08-11 17:01
Trifox
Account closed

Registered: Mar 2006
Posts: 108
http://www.fractalmovies.com/c64/screenshot.gif

this is what it looks like when i load the char data ... why the hell are some of the characters inverted, while some arent ?!?!?!?
2006-08-11 17:09
Tch
Account closed

Registered: Sep 2004
Posts: 512
Quote: anyhow i do it i just get crapp ... uaaaaaaaaaargh, but now i have some time ( 24 hours left till deadline ) to convert this picture into a charset ....

Yoh Trifox,why not rip another 2x2 somewhere.
Will save you lots of time and then figure it out without a deadline.
C64+Deadline is BAD!! ;)
2006-08-11 17:15
Scout

Registered: Dec 2002
Posts: 1568
Quote: http://www.fractalmovies.com/c64/screenshot.gif

this is what it looks like when i load the char data ... why the hell are some of the characters inverted, while some arent ?!?!?!?


Seems your original pic is fucked up.
---
8Bit Mayhem - The Commodore 64 Scenemusic Podcast
http://8bitmayhem.blogspot.com/
2006-08-11 17:54
Trifox
Account closed

Registered: Mar 2006
Posts: 108
so, what makes a picture fuck up ? congo ?
2006-08-11 18:10
Hoogo

Registered: Jun 2002
Posts: 102
A hires-Bitmap contains 2 colors each char, there is no unique backgroundcolor for the whole screen like there is in charset mode. So in every char congo had free choise to us black for 0 and 1 for white or vice versa. Congo has chosen to turn the upperleftmost pixel to 0, no matter if it was black or white.
2006-08-11 18:49
chatGPZ

Registered: Dec 2001
Posts: 11136
use amicaconvert, or grahams converter, or the one by cosmos designs or or or. :) there must be a few hundred of such tools :=D
2006-08-11 18:57
Graham
Account closed

Registered: Dec 2002
Posts: 990
Try my tool:

GFX Transformer 1.0

This automatically corrects the bitmap.
2006-08-11 19:53
Trifox
Account closed

Registered: Mar 2006
Posts: 108
i believe there are a thousands of things like that,
iam now proud to tell you that i have HAND CONVERTED everey wrong char in that piccy, next one to come is a multicolor bitmap, so, if displaying a multicolor image i just have to save the memory areas $0400 - $07f8 ? for the colors, and usually $2000-$4000 for the image data ?

btw which registers must be switched on in the vic for mc bitmap mode ?
2006-08-11 20:32
Slammer

Registered: Feb 2004
Posts: 416
Another easy way to convert a charset is to write your own converter. In Kick Assembler this can be done in only a couple of lines. Here is how to do:

1) First organize your letters in the right order according to the PETSCII format in a grahics program like photoshop and saved it in the file 2x2char.gif. See it here http://www.6581.dk/2x2char.gif

2) Write the converter in Kick Assembler:

.pc = $3800
.var charsetPic = LoadPicture("2x2char.gif", List().add($000000, $ffffff))
.function picToCharset(byteNo, picture) {
.var ypos = [byteNo&7] + 8*[[byteNo>>9]&1]
.var xpos = 2*[[byteNo>>3]&$3f] + [[byteNo>>10]&1]
.return picture.getSinglecolorByte(xpos,ypos)
}
.fill $800, picToCharset(i,charsetPic)

3) Now assemble the program and you now have a converted charset that can be used in a scroll as it's done here http://www.6581.dk/2x2scroll.prg

If you insist on converting from some kind of c64 bitmap format instead of gif then use the LoadBinary function instead of the LoadPicture function (Fx. LoadBinary("koalapic.prg", BF_KOALA)) and access the bitmap data via. the getBitmap function.
2006-08-11 20:35
chatGPZ

Registered: Dec 2001
Posts: 11136
dd00 - videobank (=3, first bank)
d018 - videoram and bitmap ($18, videoram at $0400, bitmap at $2000)
d016 - enable multicolor (=usually $d8)
d011 - enable bitmap mode (=$3b)

for the colors in mc the videoram and the colorram (at $d800) is used (and background color in d021 ofcourse)
2006-08-11 20:36
Slammer

Registered: Feb 2004
Posts: 416
There is a bug in csdb.. Dont know why but it keep repeating the last of the message no matter how much I edit it :( It also cut some of the last part.. so basicly ignore whats after point 3
2006-08-12 00:52
Trifox
Account closed

Registered: Mar 2006
Posts: 108
ok, finished with converting this font, now i have a picture, register $d018 says $79 color data at $2400 and image data at $2000 if someone is awake at 0300 please contact me
register $dd00 contains value $c6
2006-08-12 01:21
Trifox
Account closed

Registered: Mar 2006
Posts: 108
juppi image is making no problems any more ... ;)
2006-08-12 01:36
Trifox
Account closed

Registered: Mar 2006
Posts: 108
i am a bit stupid, where to store the image 3rd color ? somewhere $fff ?
2006-08-12 06:13
Slammer

Registered: Feb 2004
Posts: 416
My guess is $d800 (and the next 40x25 bytes).

2006-08-12 11:42
Trifox
Account closed

Registered: Mar 2006
Posts: 108
everything is fine now, today is the day when i will release my first demo ever! gfx by ptoing sfx by rio and code by me!
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Airwolf/F4CG
Guests online: 103
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 MWS  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.129 sec.