Something to fix ?

by (no login)


Thanks for the tutorial, it runs nicely !

This was the first page i stumble upon :

But i get an error here (overflow)

Offset% = VAL("&H" + HEX$(320 * y%)) ' Hack to get integers bigger than 32767

Hint : load the source code to get the line breaks....and remove the "amp" stuff.

Here it is :


TYPE BMPHeaderType
id AS STRING * 2 'Should be "BM"
size AS LONG 'Size of the data
offset AS LONG 'Position of start of pixel data
horz AS LONG '
wid AS LONG 'Image width
hei AS LONG 'Image height
planes AS INTEGER '
bpp AS INTEGER 'Should read 8 for a 256 colour image
pakbyte AS LONG '
imagebytes AS LONG 'Width*Height
xres AS LONG '
yres AS LONG '
colch AS LONG '
ic AS LONG '
pal AS STRING * 1024 'Stored as <Blue, Green, Red, 0>

DIM inregs AS RegTypeX ' Data IN
DIM outregs AS RegTypeX ' Data OUT
DIM FileHandle AS INTEGER ' Handle used to reference the BMP file
DIM BMPHeader AS BmpHeaderType ' The BMP header

file$ = "demo.bmp" + CHR$(0) ' BMP file. DOS requires us to append a CHR$(0).

inregs.AX = &H3D00 ' Open the File
inregs.DS = VARSEG(file$) ' Segment address of the string
inregs.DX = SADD(file$) ' Offset address of the string (we use SADD
' when working with variable length strings)
CALL InterruptX(&H21, inregs, outregs)

IF outregs.FLAGS AND 1 THEN ' Check it opened ok
PRINT "Error opening >> " + file$

FileHandle = outregs.AX ' Save the file handle

inregs.AX = &H3F00 ' Read in the header
inregs.BX = FileHandle
inregs.CX = 1078
inregs.DS = VARSEG(BMPHeader)
inregs.DX = VARPTR(BMPHeader)
CALL InterruptX(&H21, inregs, outregs)

SCREEN 13 ' Set dislay mode

a$ = BMPHeader.pal ' Change the palette
OUT &H3C8, 0
FOR i% = 1 TO 1024 STEP 4
b% = ASC(MID$(a$, i%, 1)) \ 4 'blue
g% = ASC(MID$(a$, i% + 1, 1)) \ 4 'green
r% = ASC(MID$(a$, i% + 2, 1)) \ 4 'red
OUT &H3C9, r%
OUT &H3C9, g%
OUT &H3C9, b%

PixelBuffer$ = SPACE$(BMPHeader.wid)
iHeight% = BMPHeader.hei - 1
Segment% = &HA000 ' Address of SCREEN 13 memory

inregs.AX = &H3F00
inregs.BX = FileHandle
inregs.CX = BMPHeader.wid

FOR y% = iHeight% TO 0 STEP -1

Offset% = VAL("&H" + HEX$(320& * y%)) ' Hack to get integers bigger than 32767

inregs.DS = Segment%
inregs.DX = Offset%
CALL InterruptX(&H21, inregs, outregs)


inregs.DS = 0 ' Close the file
inregs.DX = 0
inregs.AX = &H3E00
inregs.BX = FileHandle
CALL InterruptX(&H21, inregs, outregs)





Posted on Jul 15, 2008, 5:59 AM

Respond to this message   

Return to Index

Response TitleAuthor and Date
There is no real fix for large images, but other changes are needed on Jul 15
 *Thanks for answering, Ted, I haven't got a clue about this stuff :-P on Jul 15
  Actually Antoni tried the PEEK stuff and it worked ;-) on Jul 15
Re: Something to fix ? on Jul 15
 If you'd have looked at my corrections Tim on Jul 15
  Re: If you'd have looked at my corrections Tim on Jul 15
   Sounds reasonable, so how would you recode the "hack"? on Jul 15
  Bitmap loader edited by 1998 VirtuaSoft on Jul 16
   If I understand your question... on Jul 16
    i'm using this to display a 8 bit bsaved bmp on Jul 16
     You know, of course, that SCREEN 2 only has 2 attributes... on Jul 16
      Just to display some numbers, eventually a watch.. on Jul 16
       Try using a TYPE and dot variables on Jul 16
       What you may have to do... on Jul 16
        Here's an example of a SCREEN 2 image processed as described above... on Jul 16
         Raw format on Jul 16
          RAW is similar to Binary. I just uploaded a BSAVER program on Jul 16
           RAW to Data on Jul 18
            *Not sure about RAW, with .BMP's pad to 32-bit boundaries (mennonite?). on Jul 18
          *Not familiar with RAW -- mennonite should be able to help you (post in main forum). on Jul 16
           you don't want us to talk about raw images here?mennonite on Jul 17
            i don't have a font loader... on Jul 17
             You don't need no Front Loader man! on Jul 17
              Some nice fonts !!! on Jul 18
               Here are some more... on Jul 18
                What files are needed with the Qbasics.bas program? on Jul 18
                 The font files are all included in the zips... on Jul 18
                  Is there any chance to get , , , , ..? on Jul 19
                Very cool ! on Jul 19
                 Resizing isn't possible with bitmap fonts... on Jul 19
        * This sounds like a great idea for Monochrome. I think I will make one! on Jul 16
        I made a Screen 12 to 2 program that uses your code Bob on Jul 19
         As I understand it... on Jul 19
          HP 200lx on Jul 20
           *Interesting -- thanks :-) on Jul 20
            Screen shot with fonts ! on Jul 20
             *Thanks -- lol -- first time I ever saw "Press any key to continue" in French! on Jul 20
        Actually, your One Bit routine in Winbit works in Screen 2 also Bob on Jul 20
         *Hey, good to know -- I've never used SCREEN 2 (of course). on Jul 20
          Here is my code for SCREEN 2 BSAVES (URL) on Jul 20
           *Nice work! You are officially the SCREEN 2 expert around here! on Jul 20
            * As Elvis would say: "Thankyou very much" on Jul 20
             Some question with takes my sleep ... on Jul 21
              That probably won't apply to your palmtop... on Jul 21
               I use a skin softener on my palmtops ! on Jul 21
                *I tried your suggestion, but the images were all blurry after that. on Jul 21
                 * Could be, but the palm screen might be better. on Jul 21
                  Nerds on Jul 21
                   *Yeah, that's great. We're all familiar with it around here ;-) on Jul 21
     Where are the color settings? on Jul 16
 * Also. You can load 4 BPP bitmaps in Screen 13 on Jul 15

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement