delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/30/15:17:51

From: "Tony Friery" <tony AT basoft DOT enta DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Q: Creating Allegro Bitmap from Binary Data
Date: Thu, 30 Sep 1999 18:17:24 +0100
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
NNTP-Posting-Host: warp7-32.enta-net.co.uk
Message-ID: <37f39fd3.0@energise.enta.net>
X-Trace: 30 Sep 1999 18:37:23 -0100, warp7-32.enta-net.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi there,

I am currently writing an Emulator for the (now near-vintage) Sharp MZ-80B
and have a question regarding the Screen-Generator Code.

The Graphical Resolution is 2 simultaneous mono-planes of 320x200, and text
normally 40x25 using 8x8 font (Conveniently :) ) There is also an 80-column
mode which means an effective resolution of 640x400 which is what I have
chosen as the graphics mode.

At the moment, I use 5 bitmaps (eg FONTRAM, TEXTRAM, VID1RAM, VID2RAM,
TEMPRAM) in various resolutions and use a combination of stretch_blit, blit
and masked_blit to get them onto the screen.

With the text, this is normally OK (I pre-stretch into a temporary bitmap
beforehand as it will always be y*2 stretched anyway in order to save
overhead) but I need an efficient way of writing an 8-bit value into Video
Ram, without the following:

void FillBitmap(BITMAP (sbm, int begx, int begy, byte Data)
{
    int xl, colval;    /* xl is the X-Loop Variable */

    for (xl=0; xl<8; xl++)
    {
        colval=2*((Data>>xl) &1);
        putpixel(sbm, begx+(7-xl), begy, colval);
    }
}

Does this more efficient method exist? If so, can someone please point me in
the right direction :)

TIA
Tony Friery


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019