Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #1530
| Path | csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | "Bill Buckels" <bbuckels@mts.net> |
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Re: Displaying BSAVE Double Hi-Res Graphics (DHGR) Image Files in AppleSoft BASIC |
| Date | Thu, 26 Feb 2015 20:52:30 -0600 |
| Organization | Aioe.org NNTP Server |
| Lines | 165 |
| Message-ID | <mcom5h$tvs$1@speranza.aioe.org> (permalink) |
| References | <marm5t$1ba$1@speranza.aioe.org> <ecb64098-b23f-43bd-9bbe-698e002f2c0d@googlegroups.com> <mcojpe$q7e$1@speranza.aioe.org> <mcol68$shg$1@speranza.aioe.org> |
| NNTP-Posting-Host | 1GPgIVFgxCQ/ZP0sWv6a8A.user.speranza.aioe.org |
| X-Complaints-To | abuse@aioe.org |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.6157 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5931 |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Xref | csiph.com comp.sys.apple2.programmer:1530 |
Show key headers only | View raw
"Bill Buckels" <bbuckels@mts.net> wrote:
<smip>
Here's the LGR and DLGR save options from Bmp2DHR. I won't post any more
source. I really don't expect anyone who can't use the command line to
understand this but for those who do, youi can see that Lo-Res and Double
Lo-Res conversion is pretty much fully supported in Bmp2DHR with most of the
options for HGR and DHGR conversion.
2-formats are available: raster-oriented or optionally BSAVE.
As far as a BSAVE Lo-Res or Double Lo-Res "
/* these cannot be loaded in a ProDOS BASIC program and should probably not
be loaded in a C program */
/* they are arguably unsafe to load even in DOS 3.3 since they clobber the
text screen holes */
Here's the save function...
/* save 2 output files */
int savelofragment()
{
FILE *fp;
unsigned char outfile[MAXF], temp, remap;
int x,y,x2,y2, offset;
/* raster files - single file output */
if (applesoft == 0) {
/* save single lo-res and double lo-res */
/* save raster images of 48 or 40 scanlines
(full graphics or mixed text and graphics) */
if (lores == 1) {
if (appletop == 1)
sprintf(outfile,"%s.STO",hgrwork);
else
sprintf(outfile,"%s.SLO",hgrwork);
}
else {
if (appletop == 1)
sprintf(outfile,"%s.DTO",hgrwork);
else
sprintf(outfile,"%s.DLO",hgrwork);
}
if (tags == 1) strcat(outfile,"#060400");
fp = fopen(outfile,"wb");
if (NULL == fp)return INVALID;
/* On the double lo res display each byte in
high memory is interleaved with a byte in low memory
in the interests of efficiency I am saving and loading
the interleaf on a scanline by scanline basis.
*/
memset(hgrbuf,0,LORAGSIZE);
for (y = 0; y< 48; y++) {
if (appletop == 1 && y > 39)break;
y2 = y;
/* first 40 bytes goes to auxilliary memory (even pixels) */
for (x = 0; x < 40; x++) {
x2 = (x*2);
remap = dhrgetpixel(x2,y2);
temp = dloauxcolor[remap];
setlopixel(temp,x,y,1);
}
/* followed by the interleaf (odd pixels)
next 40 bytes goes to main memory */
for (x = 0; x < 40; x++) {
x2 = (x*2) + 1;
temp = dhrgetpixel(x2,y2);
setlopixel(temp,x+40,y,1);
}
}
if (lores == 1) {
fputc(40,fp); /* bytes */
if (appletop == 1) fputc(20,fp);
else fputc(24,fp);
for (y = 0; y < 24; y++) {
if (appletop == 1 && y > 19)break;
offset = (y * 80)+40;
fwrite((unsigned char *)&hgrbuf[offset],1,40,fp);
}
}
else {
fputc(80,fp); /* bytes */
if (appletop == 1) {
fputc(20,fp); /* bytes (rasters / 2) */
fwrite(hgrbuf,1,LOTOPSIZE,fp);
}
else {
fputc(24,fp); /* bytes (rasters / 2) */
fwrite(hgrbuf,1,LORAGSIZE,fp);
}
}
fclose(fp);
printf("%s Saved!",outfile);
}
else {
/* bsaved images */
/* 2 files for double lo-res */
/* one file for lo-res */
/* these cannot be loaded in a ProDOS BASIC program and should
probably not be loaded in a C program */
/* they are arguably unsafe to load even in DOS 3.3
since they clobber the text screen holes */
/* for double lo-res the bsaved images are split into two files
the first file is loaded into aux mem
*/
if (lores == 0) {
sprintf(outfile,"%s.DL1",hgrwork);
if (tags == 1) strcat(outfile,"#060400");
fp = fopen(outfile,"wb");
if (NULL == fp)return INVALID;
memset(hgrbuf,0,LOBINSIZE);
for (y = 0; y< 48; y++) {
y2 = y;
for (x = 0; x < 40; x++) {
x2 = (x*2);
remap = dhrgetpixel(x2,y2);
temp = dloauxcolor[remap];
setlopixel(temp,x,y,0);
}
}
fwrite(hgrbuf,1,LOBINSIZE,fp);
fclose(fp);
printf("%s Saved!",outfile);
}
/*
for single lo res only 1 file is needed
for double lo res the second file is loaded into main mem
*/
if (lores == 1)
sprintf(outfile,"%s.SL2",hgrwork);
else
sprintf(outfile,"%s.DL2",hgrwork);
if (tags == 1) strcat(outfile,"#060400");
fp = fopen(outfile,"wb");
if (NULL == fp)return INVALID;
memset(hgrbuf,0,LOBINSIZE);
for (y = 0; y< 48; y++) {
y2 = y;
for (x = 0; x < 40; x++) {
x2 = (x*2) + 1;
temp = dhrgetpixel(x2,y2);
setlopixel(temp,x,y,0);
}
}
fwrite(hgrbuf,1,LOBINSIZE,fp);
fclose(fp);
printf("%s Saved!",outfile);
}
return SUCCESS;
}
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Displaying BSAVE Double Hi-Res Graphics (DHGR) Image Files in AppleSoft BASIC "Bill Buckels" <bbuckels@mts.net> - 2015-02-03 17:38 -0600
Re: Displaying BSAVE Double Hi-Res Graphics (DHGR) Image Files in AppleSoft BASIC laseractiveguy@gmail.com - 2015-02-26 01:02 -0800
Re: Displaying BSAVE Double Hi-Res Graphics (DHGR) Image Files in AppleSoft BASIC "Bill Buckels" <bbuckels@mts.net> - 2015-02-26 20:11 -0600
Re: Displaying BSAVE Double Hi-Res Graphics (DHGR) Image Files in AppleSoft BASIC "Bill Buckels" <bbuckels@mts.net> - 2015-02-26 20:35 -0600
Re: Displaying BSAVE Double Hi-Res Graphics (DHGR) Image Files in AppleSoft BASIC "Bill Buckels" <bbuckels@mts.net> - 2015-02-26 20:52 -0600
csiph-web