Jump to content
IGNORED

IntyBASIC wide BITMAPs?


Peripheral

Recommended Posts


I've been getting my feet wet with IntyBASIC, and playing around
with BITMAPs and backtab cards and such for drawing background graphics.

I realize there are tools such as IntyCOLOR available, and probably others,
for seasoned game developers.  But for simplicity I was hoping to avoid
additional tool complexity.

 

The BITMAP statement is fine, but I found it a bit limiting.
In particular, if I want to create a small image consisting of,
say, four bitmaps in two rows and two columns,  I would have to
declare them linearly, like so:

 

    BITMAP "________"
    BITMAP "___X____"
    BITMAP "___X____"
    BITMAP "___X____"
    BITMAP "___X____"
    BITMAP "___X____"
    BITMAP "________"
    BITMAP "________"

 

    BITMAP "________"
    BITMAP "__XXXX__"
    BITMAP "_____X__"
    BITMAP "__XXXX__"
    BITMAP "__X_____"
    BITMAP "__XXXX__"
    BITMAP "________"
    BITMAP "________"

 

    BITMAP "________"
    BITMAP "__XXXX__"
    BITMAP "_____X__"
    BITMAP "__XXXX__"
    BITMAP "_____X__"
    BITMAP "__XXXX__"
    BITMAP "________"
    BITMAP "________"

 

    BITMAP "________"
    BITMAP "__X__X__"
    BITMAP "__X__X__"
    BITMAP "__XXXX__"
    BITMAP "_____X__"
    BITMAP "_____X__"
    BITMAP "________"
    BITMAP "________"

 

Such an image could be more easily edited and visualized if it
could be declared as follows:

 

    BITMAP "________________"
    BITMAP "___X______XXXX__"
    BITMAP "___X_________X__"
    BITMAP "___X______XXXX__"
    BITMAP "___X______X_____"
    BITMAP "___X______XXXX__"
    BITMAP "________________"
    BITMAP "________________"
    BITMAP "________________"
    BITMAP "__XXXX____X__X__"
    BITMAP "_____X____X__X__"
    BITMAP "__XXXX____XXXX__"
    BITMAP "_____X_______X__"
    BITMAP "__XXXX_______X__"
    BITMAP "________________"
    BITMAP "________________"

 

As IntyBASIC already has to "pair up" separate BITMAP statements
to emit as one DECLE, it was straightforward to have it combine eight
BITMAP statements and linearize them.  The necessary changes are in the
attached IntyBASIC.cpp and manual.txt (sorry, I didn't update manual_es.txt).

 

Is this a feature others would find useful?

 

I vaguely recall Oscar mentioning there will be no more IntyBASIC updates.
But is it possible to at least add this change to the IntyBASIC github sources?

 

I worked around the issue by preprocessing my sources with an awk script
that linearizes these wide bitmap strings.  But having support in the
compiler would be preferable.

 

In this same area, I would like to see the hyphen (-) added to the list
of 0-bit indicators (0, underscore, space and .)  I find the hyphen
more visually appealing, and centered, than these other characters.
But I didn't make that change, as there's a (likely small) risk
of breaking some existing program.
 

IntyBASIC.cpp manual.txt

  • Like 1
Link to comment
Share on other sites

There may be an even simpler way to do this, if people find it useful:  You could write it as a MACRO for the assembler pre-processor, and include it as a library.  The only thing is that, because the IntyBASIC user functions (DEF FN) do not support assembly, there wouldn't be an IntyBASIC interface for it.  Therefore, you would have to put all your graphic macros in a file by itself and include them as an assembly source:

ASM INCLUDE "mygraphics.asm"

 

As for the custom macro, I believe @intvnut created one already that takes bitmap card definitions of arbitrary width and split it into individual character cards.  Take a look at the macro library called "gfx_wide.mac" that comes with the SDK-1600 distribution (the distro that includes jzIntv and the as1600 assembler), in the "macro" folder.

 

The description of its functionality seems to be exactly what you are looking for:

;; ======================================================================== ;;
;;  WIDE_GFX.MAC                                                            ;;
;;                                                                          ;;
;;  MACROS DEFINED IN THIS FILE:                                            ;;
;;      wgfx_start n     Start a packed graphic of width 'n' pixels         ;;
;;      wgfx     s       Add an 8-pixel wide row to a packed graphic        ;;
;;      wgfx_flush       End a packed graphic                               ;;
;;                                                                          ;;
;;  These macros allow defining graphics wider than a single tile.  The     ;;
;;  wide graphics are divided up into 8x8 tiles left to right.  Graphics    ;;
;;  may be as wide as 256 pixels, which is certainly overkill.  :-)         ;;
;;                                                                          ;;
;;  Graphics taller than 8px are supported.  wgfx will always force the     ;;
;;  height of the graphic to be a multiple of 8, with the pixels aligned    ;;
;;  to the top of the tiles.  The generated width will also be a multiple   ;;
;;  of 8, aligned to the left, although only pixels within the user-        ;;
;;  specified width will get set.                                           ;;
;;                                                                          ;;
;;  EXAMPLE USAGE:                                                          ;;
;;                                                                          ;;
;;  wgfx_start 60                                                           ;;
;;  wgfx ".###........................................................"     ;;
;;  wgfx "#...#.....................................#...#............."     ;;
;;  wgfx "#...#.....................................#................."     ;;
;;  wgfx "#####.#...#..##..#.##..###..###...##.....###..#.###.##...##."     ;;
;;  wgfx "#...#.#...#.#.##.##...#..#.#...#.#.##.....#...#.#..#..#.#.##"     ;;
;;  wgfx "#...#..#.#..##...#....#..#..####.##.......#...#.#..#..#.##.."     ;;
;;  wgfx "#...#...#....###.#.....###.....#..###......##.#.#..#..#..###"     ;;
;;  wgfx "............................###............................."     ;;
;;  wgfx_flush                                                              ;;
;;                                                                          ;;
;; ======================================================================== ;;

 

You could either prepend all those "wgfx" calls with "ASM" in order to use them in your IntyBASIC source, or you could just put them in a separate file as I mentioned above, and include them as an assembly source.

 

This could be included in anybody's programs, and does not require modification to the IntyBASIC source or distro.  If it is useful to others, I may include it in a future release of the IntyBASIC SDK, along with the new tracker.

 

    -dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

7 minutes ago, DZ-Jay said:

As for the custom macro, I believe @intvnut created one already that takes bitmap card definitions of arbitrary width and split it into individual character cards. 

I thought about mentioning wgfx.  I don't actually use IntyBASIC, though, so I don't know how well it does (or doesn't) mesh with IntyBASIC facilities.  I think IntyBASIC's BITMAP was based on my original 8-pixel wide gfx_start/gfx/gfx_flush macros.  So, perhaps wgfx_start/wgfx/wgfx_flush map nicely.

 

Also, a fun fact:  The font shown in the wide_gfx.mac example is an early version of the "Narrow A" font used in LTO Flash's GUI.  I had started developing the font for Super Pro Space Patrol (which never released).

 

LTO Flash has two narrow, proportionally spaced fonts, actually: "Narrow A" and "Narrow B".  LTO Flash uses "Narrow B" when it can't fit a long name into the available space with "Narrow A".

Link to comment
Share on other sites

Very nice!

 

Including the wgfx facility with ASM works like a charm.

 

Just in case this feature is wanted in IntyBASIC itself, I attached here a small update to my original IntyBASIC.cpp change.

 

The  8-character BITMAP strings need only come in pairs, not in groups of 8.

I don't know how useful that would be, but if someone is using that capability,

they could have tried:

 

BITMAP "01234567"

BITMAP "01234567"

BITMAP "01234567abcdefgh"

...

 

My original change required wide bitmaps to start on an 8 BITMAP boundary,

and would have choked in this case.

Now they need only start on an even BITMAP boundary.

 

I also replaced  a potentially stale reference to the lexer's

"name" variable, as it could have been trashed by a get_lex() call.

 

I should also mention that my changes have two other minor fixes.

I replaced "int" with "size_t" in a few places to eliminate compiler warnings.

 

And at the end of compilation, I issue an error if there are any dangling BITMAP

statements that haven't been paired up.  Currently IntyBASIC just silently drops

these on the floor.

 

Anyway, this is probably all moot as the wgfx facility suffices.

If I so desired, I could probably even tweak my local copy

of wide_gfx.mac to accept hyphen as a 0!

 

I'll leave it to Oscar's discretion as to whether to add this to IntyBASIC.

 

thanks all!

 

 

IntyBASIC.cpp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...