VGA Graphics?
VGA Graphics?
I have an old QuickBasic 4.5 game and it utilizes some graphics with a .vga extension. Was wondering if anyone might know how to open/convert these images? Or even what kind of images they are?
Dave.
Dave.
I could not find anything on google or www.wotsit.org on .vga files, maybe someone else knows. Your best bet would probably be to look at the source, or try and contact the author (if you know who it is).
As a last resort you can try and figure out the format yourself, if you don't get any other responses here.
As a last resort you can try and figure out the format yourself, if you don't get any other responses here.
Re: VGA Graphics?
Reveal size or upload it. I guess it's a raw copy of VGA RAM.davidshq wrote:old QuickBasic 4.5 game and it utilizes some graphics with a .vga extension.
Because it's raw :-Dthere would need to be some special parsing, but I'm not seeing any.
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
Well, you could try something like the following in QB:
If it works, then you could try PrintScreening, or we could export the data in a form that's easy for FB to read.
Alternatively, more information about the file really would be helpful.
This little program will give the exact file size and the first 32 bytes, which might be enough to glean the format from if you paste it here.(obviously, adjust the file names to suit.)
If we can extract the image data, probably the easiest format to work with will be BMP, because FB can load and save them natively. JPEG would be a bad choice of format here because it uses lossy compression, which degrades the image quality.
EDIT: Sorry, code fixed now, DOS386's fix was entirely accurate. I wrote both sections of code in QBASIC (I missed the dollar in my hasty fix-up for FB), and the "GET #1, 1, ..." was just careless. I'm guessing DOS386 and I both thought exactly the same thing when we saw the repeated FD in the output...
Code: Select all
SCREEN 13
DIM a%(10000)
DEF SEG = VARSEG(a%(0))
BLOAD "graphic.vga", VARPTR(a%(0))
PUT (0, 0), a%(0)
Alternatively, more information about the file really would be helpful.
This little program will give the exact file size and the first 32 bytes, which might be enough to glean the format from if you paste it here.
Code: Select all
DIM c AS STRING
c = " "
OPEN "graphic.vga" FOR BINARY AS #1
PRINT "File size:"; LOF(1)
PRINT "First 32 bytes:"
FOR i = 1 TO 100
GET #1, , c
PRINT HEX$(ASC(c)) + " ";
NEXT i
CLOSE #1
If we can extract the image data, probably the easiest format to work with will be BMP, because FB can load and save them natively. JPEG would be a bad choice of format here because it uses lossy compression, which degrades the image quality.
EDIT: Sorry, code fixed now, DOS386's fix was entirely accurate. I wrote both sections of code in QBASIC (I missed the dollar in my hasty fix-up for FB), and the "GET #1, 1, ..." was just careless. I'm guessing DOS386 and I both thought exactly the same thing when we saw the repeated FD in the output...
Last edited by counting_pine on Oct 30, 2008 9:38, edited 2 times in total.
I ran the second app. Here are the results:
File size: 3135
First 32 bytes:
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD F
D FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
Dave.
File size: 3135
First 32 bytes:
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD F
D FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
Dave.
1. Use BMP or PNG for new format (see above)davidshq wrote:Thoughts?
2. Upload the corpus delicti or post a few bytes from the beginning (see above) or post QB code or do a screenshot using SNARF
counting_pine's code is buggy:davidshq wrote:FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD F
D FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
Code: Select all
Get #1, 1, c
Code: Select all
Get #1, , c
http://www.freebasic.net/wiki/KeyPgBload
It's QB's BSAVE file :-)))
Okay, made those changes to the code and reran. Here are the new results:
File size: 3135
First 32 bytes:
FD 27 9F 0 0 38 C 29 0 41 0 0 0 0 0 0 0 FF FF FF FF FF 80 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 FF FF FF FF FF 80 0 0 0 0 0 0 0 3 FF F8 0 0 0 0 0 0 0 0 FF FE 0 7
FF 80 0 0 0 0 0 0 0 4 0 0 0 0 0 1 FF F8 0 0 FF FC 0 3 FF 80 0 0 0 0 0
What I want to do is convert this raw file to a BMP file.
Dave.
File size: 3135
First 32 bytes:
FD 27 9F 0 0 38 C 29 0 41 0 0 0 0 0 0 0 FF FF FF FF FF 80 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 FF FF FF FF FF 80 0 0 0 0 0 0 0 3 FF F8 0 0 0 0 0 0 0 0 FF FE 0 7
FF 80 0 0 0 0 0 0 0 4 0 0 0 0 0 1 FF F8 0 0 FF FC 0 3 FF 80 0 0 0 0 0
What I want to do is convert this raw file to a BMP file.
Dave.
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
If the first program works, then you can output the raw contents of the screen to a text file, by appending this code to the program:
Then, you can convert that data to a BMP file in FB with this program:
Code: Select all
OPEN "graphic.txt" FOR OUTPUT AS #1
FOR y = 0 TO 199
FOR x = 0 TO 319
PRINT #1, POINT(x, y);
NEXT x
PRINT #1,
NEXT y
CLOSE #1
Code: Select all
dim as integer x, y, c
screen 13
open "graphic.txt" for input as #1
for y = 0 to 199
for x = 0 to 319
input #1, c
pset (x, y), c
next x
next y
close #1
bsave "graphic.bmp", 0
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
I don't know if you had any luck with this, but from looking at the first portion of the file, and from the little I know about BSAVEd files, this program should be able to load the image.
It should compile and run (just about...) in both QB and FB, and if you uncomment a few lines in FB, it should automatically save the image as a BMP as well.
It should compile and run (just about...) in both QB and FB, and if you uncomment a few lines in FB, it should automatically save the image as a BMP as well.
Code: Select all
declare sub putplane (y as integer, w as integer, bb as integer)
dim c as string
dim z as integer, w as integer, h as integer
dim y as integer, b as integer
screen 13
open "graphic.vga" for binary access read as #1
c = " "
get #1, 1, c
if asc(c) <> &HFD then close #1: end
get #1, 6, z: z = z and 32767
get #1, 8, w: w = w and 32767
get #1, 10, h: h = h and 32767
seek #1, 12
for y = 0 to h - 1
for b = 0 to 3
putplane y, w, 2 ^ b
next b
next y
close #1
sleep
'uncomment these lines in FB to save the image as a bmp:
'dim as any ptr p = imagecreate(w, h)
'get (0, 0)-(w-1, h-1), p
'bsave "graphic.bmp", p, 0
'imagedestroy p
sub putplane (y as integer, w as integer, bb as integer)
dim c as string, cb as integer
dim x as integer
c = " "
for x = 0 to w - 1
if (x and 7) = 0 then get #1, , c: cb = asc(c)
pset (x, y), point(x, y) xor (bb and -cb \ 128)
cb = cb + cb and &HFF
next x
end sub
Now that I disappeared for two years...I used the above code and it worked wonderfully....except for one minor detail...the images are much smaller than they used to be once they are saved as BMP...any thoughts? I'm guessing since its a screen capture it might be an issue with it capturing the image at a higher resolution?
Dave.
Dave.