Loading ...
Sorry, an error occurred while loading the content.

old gwbasic vs liberty basic

Expand Messages
  • Marc
    Good Morning, I am used to gw-basic with the input command such as: input #1, var The Liberty Basic has an : input( #1,29) and I am confused as to how it
    Message 1 of 4 , Apr 19, 2013
    • 0 Attachment
      Good Morning,
      I am used to gw-basic with the input command such as:
      input #1, var

      The Liberty Basic has an :
      input( #1,29) and I am confused as to how it works. Does it get the 29 character or all the characters up to 29? I was tring to get the height of a Bitmap ( char 23 + char 24) and I understand char 24 must be multiplied by 256.
      Can anyone larify this for me.
      Thanks guys and girls,
      Marc
    • Rod
      Breaking apart a bmp header would go like this. a bmp header is 54 bytes long 14 for the file header and 40 for the bmp info. If it is less then 24bit
      Message 2 of 4 , Apr 19, 2013
      • 0 Attachment
        Breaking apart a bmp header would go like this.


        ' a bmp header is 54 bytes long 14 for the file header
        ' and 40 for the bmp info. If it is less then 24bit
        ' color it will have a color table.
        ' a 256 color file has 256 4 byte colors in a table
        ' following the headers
        filedialog "Open bmp file", "*.bmp", fileName$
        open fileName$ for input as #bmp
        print fileName$,lof(#bmp)
        'the bmpfileheader
        info$ = Input$(#bmp,lof(#bmp))
        print "bfType =";mid$(info$,1,2) 'always BM
        print "bfSize =";value(mid$(info$,3,4)),dechex$(asc(mid$(info$,3,1)));" ";dechex$(asc(mid$(info$,4,1)));" ";dechex$(asc(mid$(info$,5,1)));" ";dechex$(asc(mid$(info$,6,1)))
        print "bfReserved =";value(mid$(info$,7,2)),dechex$(asc(mid$(info$,7,1)));" ";dechex$(asc(mid$(info$,8,1)))
        print "bfReserved =";value(mid$(info$,9,2)),dechex$(asc(mid$(info$,9,1)));" ";dechex$(asc(mid$(info$,10,1)))
        print "bfOffBits =";value(mid$(info$,11,4)),dechex$(asc(mid$(info$,11,1)));" ";dechex$(asc(mid$(info$,12,1)));" ";dechex$(asc(mid$(info$,13,1)));" ";dechex$(asc(mid$(info$,14,1)))
        ' the bitmapinfoheader
        print "biSize =";value(mid$(info$,15,4)),dechex$(asc(mid$(info$,15,1)));" ";dechex$(asc(mid$(info$,16,1)));" ";dechex$(asc(mid$(info$,17,1)));" ";dechex$(asc(mid$(info$,18,1)))
        print "biWidth =";value(mid$(info$,19,4)),dechex$(asc(mid$(info$,19,1)));" ";dechex$(asc(mid$(info$,20,1)));" ";dechex$(asc(mid$(info$,21,1)));" ";dechex$(asc(mid$(info$,22,1)))
        print "biHight =";value(mid$(info$,23,4)),dechex$(asc(mid$(info$,23,1)));" ";dechex$(asc(mid$(info$,24,1)));" ";dechex$(asc(mid$(info$,25,1)));" ";dechex$(asc(mid$(info$,26,1)))
        print "biPlanes =";value(mid$(info$,27,2)),dechex$(asc(mid$(info$,27,1)));" ";dechex$(asc(mid$(info$,28,1)))
        print "biBitCount =";value(mid$(info$,29,2)),dechex$(asc(mid$(info$,29,1)));" ";dechex$(asc(mid$(info$,30,1)))
        print "biCompress =";value(mid$(info$,31,4)),dechex$(asc(mid$(info$,31,1)));" ";dechex$(asc(mid$(info$,32,1)));" ";dechex$(asc(mid$(info$,33,1)));" ";dechex$(asc(mid$(info$,34,1)))
        print "biSizeImage =";value(mid$(info$,35,4)),dechex$(asc(mid$(info$,35,1)));" ";dechex$(asc(mid$(info$,36,1)));" ";dechex$(asc(mid$(info$,37,1)));" ";dechex$(asc(mid$(info$,38,1)))
        print "biXPels =";value(mid$(info$,39,4)),dechex$(asc(mid$(info$,39,1)));" ";dechex$(asc(mid$(info$,40,1)));" ";dechex$(asc(mid$(info$,41,1)));" ";dechex$(asc(mid$(info$,42,1)))
        print "biYPels =";value(mid$(info$,43,4)),dechex$(asc(mid$(info$,43,1)));" ";dechex$(asc(mid$(info$,44,1)));" ";dechex$(asc(mid$(info$,45,1)));" ";dechex$(asc(mid$(info$,46,1)))
        print "biClrUsed =";value(mid$(info$,47,4)),dechex$(asc(mid$(info$,47,1)));" ";dechex$(asc(mid$(info$,48,1)));" ";dechex$(asc(mid$(info$,49,1)));" ";dechex$(asc(mid$(info$,50,1)))
        print "biClrImport =";value(mid$(info$,51,4)),dechex$(asc(mid$(info$,51,1)));" ";dechex$(asc(mid$(info$,52,1)));" ";dechex$(asc(mid$(info$,53,1)));" ";dechex$(asc(mid$(info$,54,1)))

        wait
        function value(x$)
        select case len(x$)
        case 1
        value = asc(x$)
        case 2
        value=asc(mid$(x$,1,1))
        value=value+(asc(mid$(x$,2,1))*256)
        case 4
        value=asc(mid$(x$,1,1))
        value=value+(asc(mid$(x$,2,1))*256)
        value=value+(asc(mid$(x$,3,1))*65536)
        value=value+(asc(mid$(x$,4,1))*4294967296)
        end select
        end function

        --- In libertybasic@yahoogroups.com, "Marc" <mrossi8888@...> wrote:
        >
        > Good Morning,
        > I am used to gw-basic with the input command such as:
        > input #1, var
        >
        > The Liberty Basic has an :
        > input( #1,29) and I am confused as to how it works. Does it get the 29 character or all the characters up to 29? I was tring to get the height of a Bitmap ( char 23 + char 24) and I understand char 24 must be multiplied by 256.
        > Can anyone larify this for me.
        > Thanks guys and girls,
        > Marc
        >
      • Rod
        I just noticed I left Input$(#handle,lof(#handle)) In place, that reads in the whole file as a string. I could have made it Input$(#handle,54) In which case it
        Message 3 of 4 , Apr 19, 2013
        • 0 Attachment
          I just noticed I left
          Input$(#handle,lof(#handle))
          In place, that reads in the whole file as a string.
          I could have made it
          Input$(#handle,54)
          In which case it would have just read in the first 54 bytes of the file which would have contained the entire header info. All you need for the task in hand extracting the width or height.
        • Marc Rossi
          Thanks, Rod.  I appreciate you doing all that code for me. Marc ________________________________ From: Rod To:
          Message 4 of 4 , Apr 20, 2013
          • 0 Attachment
            Thanks, Rod.  I appreciate you doing all that code for me.
            Marc


            ________________________________
            From: Rod <rodbird@...>
            To: libertybasic@yahoogroups.com
            Sent: Friday, April 19, 2013 1:38 PM
            Subject: [libertybasic] Re: old gwbasic vs liberty basic

             


            Breaking apart a bmp header would go like this.

            ' a bmp header is 54 bytes long 14 for the file header
            ' and 40 for the bmp info. If it is less then 24bit
            ' color it will have a color table.
            ' a 256 color file has 256 4 byte colors in a table
            ' following the headers
            filedialog "Open bmp file", "*.bmp", fileName$
            open fileName$ for input as #bmp
            print fileName$,lof(#bmp)
            'the bmpfileheader
            info$ = Input$(#bmp,lof(#bmp))
            print "bfType =";mid$(info$,1,2) 'always BM
            print "bfSize =";value(mid$(info$,3,4)),dechex$(asc(mid$(info$,3,1)));" ";dechex$(asc(mid$(info$,4,1)));" ";dechex$(asc(mid$(info$,5,1)));" ";dechex$(asc(mid$(info$,6,1)))
            print "bfReserved =";value(mid$(info$,7,2)),dechex$(asc(mid$(info$,7,1)));" ";dechex$(asc(mid$(info$,8,1)))
            print "bfReserved =";value(mid$(info$,9,2)),dechex$(asc(mid$(info$,9,1)));" ";dechex$(asc(mid$(info$,10,1)))
            print "bfOffBits =";value(mid$(info$,11,4)),dechex$(asc(mid$(info$,11,1)));" ";dechex$(asc(mid$(info$,12,1)));" ";dechex$(asc(mid$(info$,13,1)));" ";dechex$(asc(mid$(info$,14,1)))
            ' the bitmapinfoheader
            print "biSize =";value(mid$(info$,15,4)),dechex$(asc(mid$(info$,15,1)));" ";dechex$(asc(mid$(info$,16,1)));" ";dechex$(asc(mid$(info$,17,1)));" ";dechex$(asc(mid$(info$,18,1)))
            print "biWidth =";value(mid$(info$,19,4)),dechex$(asc(mid$(info$,19,1)));" ";dechex$(asc(mid$(info$,20,1)));" ";dechex$(asc(mid$(info$,21,1)));" ";dechex$(asc(mid$(info$,22,1)))
            print "biHight =";value(mid$(info$,23,4)),dechex$(asc(mid$(info$,23,1)));" ";dechex$(asc(mid$(info$,24,1)));" ";dechex$(asc(mid$(info$,25,1)));" ";dechex$(asc(mid$(info$,26,1)))
            print "biPlanes =";value(mid$(info$,27,2)),dechex$(asc(mid$(info$,27,1)));" ";dechex$(asc(mid$(info$,28,1)))
            print "biBitCount =";value(mid$(info$,29,2)),dechex$(asc(mid$(info$,29,1)));" ";dechex$(asc(mid$(info$,30,1)))
            print "biCompress =";value(mid$(info$,31,4)),dechex$(asc(mid$(info$,31,1)));" ";dechex$(asc(mid$(info$,32,1)));" ";dechex$(asc(mid$(info$,33,1)));" ";dechex$(asc(mid$(info$,34,1)))
            print "biSizeImage =";value(mid$(info$,35,4)),dechex$(asc(mid$(info$,35,1)));" ";dechex$(asc(mid$(info$,36,1)));" ";dechex$(asc(mid$(info$,37,1)));" ";dechex$(asc(mid$(info$,38,1)))
            print "biXPels =";value(mid$(info$,39,4)),dechex$(asc(mid$(info$,39,1)));" ";dechex$(asc(mid$(info$,40,1)));" ";dechex$(asc(mid$(info$,41,1)));" ";dechex$(asc(mid$(info$,42,1)))
            print "biYPels =";value(mid$(info$,43,4)),dechex$(asc(mid$(info$,43,1)));" ";dechex$(asc(mid$(info$,44,1)));" ";dechex$(asc(mid$(info$,45,1)));" ";dechex$(asc(mid$(info$,46,1)))
            print "biClrUsed =";value(mid$(info$,47,4)),dechex$(asc(mid$(info$,47,1)));" ";dechex$(asc(mid$(info$,48,1)));" ";dechex$(asc(mid$(info$,49,1)));" ";dechex$(asc(mid$(info$,50,1)))
            print "biClrImport =";value(mid$(info$,51,4)),dechex$(asc(mid$(info$,51,1)));" ";dechex$(asc(mid$(info$,52,1)));" ";dechex$(asc(mid$(info$,53,1)));" ";dechex$(asc(mid$(info$,54,1)))

            wait
            function value(x$)
            select case len(x$)
            case 1
            value = asc(x$)
            case 2
            value=asc(mid$(x$,1,1))
            value=value+(asc(mid$(x$,2,1))*256)
            case 4
            value=asc(mid$(x$,1,1))
            value=value+(asc(mid$(x$,2,1))*256)
            value=value+(asc(mid$(x$,3,1))*65536)
            value=value+(asc(mid$(x$,4,1))*4294967296)
            end select
            end function

            --- In mailto:libertybasic%40yahoogroups.com, "Marc" <mrossi8888@...> wrote:
            >
            > Good Morning,
            > I am used to gw-basic with the input command such as:
            > input #1, var
            >
            > The Liberty Basic has an :
            > input( #1,29) and I am confused as to how it works. Does it get the 29 character or all the characters up to 29? I was tring to get the height of a Bitmap ( char 23 + char 24) and I understand char 24 must be multiplied by 256.
            > Can anyone larify this for me.
            > Thanks guys and girls,
            > Marc
            >




            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.