[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2014-01-19T18:04:10-05:00 http://petesqbsite.com/phpBB3/app.php/feed/topic/3809 2014-01-19T18:04:10-05:00 2014-01-19T18:04:10-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=22874#p22874 <![CDATA[Re: EGA palette, BSAVE, BLOAD]]>
SCREEN modes 0, 7 and 9 are DAC screen modes which means you cannot just go and change some color attributes using OUT. Some are locked and must be unlocked or use PALETTE. You can find out more in Chapter 13 of my Qbasics tutorial in my signature.

Statistics: Posted by burger2227 — Sun Jan 19, 2014 6:04 pm


]]>
2014-01-19T05:56:21-05:00 2014-01-19T05:56:21-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=22872#p22872 <![CDATA[EGA palette, BSAVE, BLOAD]]>
I spent an evening re-writing a bitmap (.bmp) loader to work in EGA modes with correct colors from the .bmp palette in the header. The greatest challenge lied in the fact that unlike simplicity of 256-color mode, the 16 color image and mode represent a pixel as a nibble (half byte). I was able to separate file bytes into nibbles and write them to the screen. I had to make some control changes for some reason, I had to write each palette color number to &H3C8, followed by three color channels to &H3C9. All code examples on the web only write color 0 to &H3C8, but with EGA that simply doesn't work. Also, after the palette is written to memory, I also have to loop through PALETTE statement for colors 0 through 15 in both old and new color. I guess when the palette is written to memory only the block with 64 available colors is updated, I still have to update them in the 16 active colors.

I haven't programmed in QuickBasic in many years, I've since gotten CS and CE degrees in college, so most of my programming was done in Java and C.
Upon my return to QuickBasic I was very surprised there are no dedicated data type for byte (it's a char), and no type for a nibble or bit. There aren't even bitwise shift operations.

Now, the baddies. For some reason when I BSAVE from screen 9 (or 7 for that matter), the image I BLOAD comes out always in monochrome, the 16 colors are gone, even if default palette is used. I tried the color switch in screen 9, it doesn't have the desired effect.

The following two programs reproduce the problem (MS QuickBasic 4.5):

Code:

SCREEN 9CLSCIRCLE (320, 175), 100, 5PAINT (320, 175), 5DEF SEG = &HA000BSAVE "test.bsv", 0, 64000DEF SEG
Draws a purple circle, and dumps memory to the file.

Code:

SCREEN 9DEF SEG = &HA000BLOAD "test.bsv"DEF SEG
Loads memory from the file, but now the circle is white, even though the palette is still default. What the...?

So what's the solution to this color/palette problem? I realize that for screen 9 the memory page is larger than 64K, however this exact issue is also present in screen 7.

Also, where is the &HA000 offset documented, and where is the port documentation for &H3C7, &H3C8, &H3C9? I see people using these but I haven't found the official source of documentation for these. I'd certainly like to know more useful ports and memory offsets.

Statistics: Posted by r00tb33r — Sun Jan 19, 2014 5:56 am


]]>