Jump to content
IGNORED

VBXE - PC Based Graphics Tool


Stephen

Recommended Posts

I had not planned on releasing this so early but at the request of Yaron, I've decided to put it out early.  It's a simple little program which will load an 8-bpp BMP image and allow an export of a VBXE palette (in 2 formats)*, and RAW image.  Alternately, it can load RAW image files and palettes. Any open image can have its palette changed.  Many more features are planned.  The ZIP file includes an executable and a help file along with some sample data.  It is a .NET application, which should run on both Windows and Linux machines (using Mono).

 

Please let me know if there are any issues.  I've only tested on one other machine as I never intended this to be released yet.

 

*

Current source code examples assume the palette is stored as 256 bytes R, 256 bytes G, 256 bytes B because it's easier (and faster) code.  BUT - I had two issues with this.  1st of all, it is not how BMP images store their palette.  2nd - the code was self modifying so cannot run from ROM.  Because of this, I wrote a routine to load in the data assuming linear RGB triplets.

Spoiler

Code.thumb.png.a0bf7d2a94262323b09848842e4897eb.png

 

VBXEditor.zip

  • Like 11
Link to comment
Share on other sites

On 2/16/2023 at 10:22 PM, Stephen said:

Current source code examples assume the palette is stored as 256 bytes R, 256 bytes G, 256 bytes B because it's easier (and faster) code.  BUT - I had two issues with this.  1st of all, it is not how BMP images store their palette.  2nd - the code was self modifying so cannot run from ROM.  Because of this, I wrote a routine to load in the data assuming linear RGB triplets.

Well, it just happends I got all the tools for this written already from my PC demoscene days thus examples were using either dap or dat format (dap - data and palette) 

these tools were never published though since they were written in assembly to work under dos, and in order to use them, one need to resort to dosbox or similiar virtualisation

 

  • Like 2
Link to comment
Share on other sites

2 hours ago, candle said:

Well, it just happends I got all the tools for this written already from my PC demoscene days thus examples were using either dap or dat format (dap - data and palette) 

these tools were never published though since they were written in assembly to work under dos, and in order to use them, one need to resort to dosbox or similiar virtualisation

 

Cool - it's definitely faster and more compact/elegant code when done that way.  All of this stuff I am doing is very basic, but I'm teaching myself 6502 as I go along, so it was a fun little challenge to implement reading the linear palette.

 

BTW - it was awesome when I found the hidden message in the fonts.raw file of your scroll.asm demo.  Thanks for sharing the source, it's what gt me started on all this.

Link to comment
Share on other sites

Cool, I also did a RGB extractor for this in 2009 in Freebasic which I'm still using today 🙂 - but I was to lazy to do a raw bmp pixel data extractor.. - at the moment I'm using a hex editor for this rip out the pixel data, so this will save really some time! Do I need to mirror the BMP, or does your program this?  Thanks!

  • Like 1
Link to comment
Share on other sites

good work guys.

 

in my other thread of black belt i was exploring VBXE i was using a python script that extract palette and raw data from an image and compress it.

So the produced script produces 3 files:

1. pallete.bin

2. orig.bin

3. compressed.bin

 

In my project i just add palette and compressed files (as original is very big - over 30K), and decompress it in run time into VBXE memory.

 

As the owner of the script is @popmilo and since the script has gone though some iterations, i'll let him share the python file .

 

Link to comment
Share on other sites

Hi guys, nice tools you have there :)

 

Here's script that Yaron mentioned. It extracts pixels and palette from indexed png image and produces binary data for:
1. Palette in sequence of reds, greens, blues so it can easily be copied into vbxe palette. Like if there are 6 colors in palette, there will be 6 bytes for red componente, 6 green and 6 blue, total of 18 bytes binary.

2. "sprites.bin" with raw pixel values that you can blit to screen and get your sprites.

3. "sprites_compressed.bin" in custom compression similar to rle, with each byte being made from two 4 bit nibbles,  "number of pixels" and "pixel color". Works pretty well with only limit being only 16 possible colors per image. 

 

If you would want to combine more than one png into single vbxe palette and gfx data, you would have to append colors as new data is added with also changing pixel values to fit new expanded palettes. For single png in 16 colors it just works.

 

Cheers!
Vladimir


 

 

vbxe_converter.zip

  • Thanks 3
Link to comment
Share on other sites

On 2/20/2023 at 9:01 PM, Thelen said:

Cool, I also did a RGB extractor for this in 2009 in Freebasic which I'm still using today 🙂 - but I was to lazy to do a raw bmp pixel data extractor.. - at the moment I'm using a hex editor for this rip out the pixel data, so this will save really some time! Do I need to mirror the BMP, or does your program this?  Thanks!

Me using PureBasic for ages for tooling… not into C or C++. Lazarus (Pascal) could be similar but for 10+ Years I stuck to PB.

  • Like 2
Link to comment
Share on other sites

OK - due to some new things I needed, expect a new version this weekend.  New features are:

  1. Ability to export in "packed pixel" mode, for showing graphics in 640-pixel mode.
    1. I don't yet have the ability to re-import these.  I'll try to add that before I make the next release.
  2. Ability to export multiple (and different sized) .raw files from a single imported image.  This will allow a background image and a sprite sheet to share the same palette but be different sizes.  Terrible UI for this at the moment.

I have to get the help file updated and wire in some sort of UI for the multi-export before I can post an update.

  • Like 3
Link to comment
Share on other sites

  • 2 months later...
On 2/16/2023 at 10:22 PM, Stephen said:

Current source code examples assume the palette is stored as 256 bytes R, 256 bytes G, 256 bytes B because it's easier (and faster) code.  BUT - I had two issues with this.  1st of all, it is not how BMP images store their palette.  2nd - the code was self modifying so cannot run from ROM.  Because of this, I wrote a routine to load in the data assuming linear RGB triplets.

  Reveal hidden contents

Code.thumb.png.a0bf7d2a94262323b09848842e4897eb.png

 

Hi Stephen, is it possible to get/use your sourcecode 'VBXE_SetPalette2' function which is in the hidden content? 🙂 (couldn't find it in your .zip file) I'm too lazy to type it over from the image and OCR messes things up... 🙂

 

Link to comment
Share on other sites

34 minutes ago, Thelen said:

Hi Stephen, is it possible to get/use your sourcecode 'VBXE_SetPalette2' function which is in the hidden content? 🙂 (couldn't find it in your .zip file) I'm too lazy to type it over from the image and OCR messes things up... 🙂

Sure thing.  Apologies for formatting - cannot get this POS forum to properly format any of my asm.

;--------------------------------------------------------
; VBXE_SetPalette2 - sets palette
;	A			- palette number
;	Y_Register	- palette pointer - Data MUST be page aligned
; NOTE: This code can run from ROM
;       The palette is stored as 256 RGB triplets
VBXE_SetPalette2
	vbsta VBXE_PSEL				; Set Palette 1
	lda #0
	vbsta VBXE_CSEL				; Start at colour 0

	tay
LoadPal1_1 lda (Y_Register),y
	sta	VBXE_CR					; set the red component
	iny
	beq OverFlow1				; since 256 / 3 is not even, we must skip to next section and resume at CG
	lda (Y_Register),y
	sta	VBXE_CG					; set the green component
	iny
	lda (Y_Register),y
	sta	VBXE_CB					; set the blue component and increment CSEL
	iny
	bne	LoadPal1_1				; copy a page
LoadPal1_2 lda (Y_Register),y
	sta	VBXE_CR					; set the red component
	iny
	beq LoadPal1_3
LP1_2_G
	lda (Y_Register),y
	sta	VBXE_CG					; set the green component
	iny
	beq OverFlow2				; since 256 / 3 is not even, we must skip to next section and resume at CB
	lda (Y_Register),y
	sta	VBXE_CB					; set the blue component and increment CSEL
	iny
	bne	LoadPal1_2				; copy a page
LoadPal1_3 lda (Y_Register),y
	sta	VBXE_CR					; set the red component
	iny
	lda (Y_Register),y
	sta	VBXE_CG					; set the green component
	iny
LP1_3_B
	lda (Y_Register),y
	sta	VBXE_CB					; set the blue component and increment CSEL
	iny
	bne	LoadPal1_3				; copy a page
	rts

OverFlow1
	inc Y_Register + 1
	jmp LP1_2_G
OverFlow2
	inc Y_Register + 1
	jmp LP1_3_B

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...