VOGONS


First post, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

https://github.com/PeterSwinkels/Bird

Although nothing particularly special, I felt like writing and showing this. 😀

I am probably not going to make this into much more than it already is, however any feedback is welcome! 😀

Also, any advice on calculating the proper array size to store graphical data is welcome. Assuming the integer data type, I know it involves four bytes for width and height and I need to calculate how many bytes all the pixels take up. It sounds easy in theory, but is harder than it appears in practice.

My GitHub:
https://github.com/peterswinkels

Reply 2 of 8, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

Due to the overwhelming lack of response this got, I doubt there is any point in starting yet another thread, so I am just going to recycle the one I made not too long ago. 😀

Some more QBasic stuff:
https://github.com/PeterSwinkels/QBasic-font-demos

Make whatever you wil of thisl, if this thread gets locked or something I know when to take a hint.

My GitHub:
https://github.com/peterswinkels

Reply 3 of 8, by Jo22

User metadata
Rank l33t++
Rank
l33t++

Hi, thanks! 😀 Personally, I do like QB45 and Basic programming, but I do know little about sprites. Hence I didn't reply when this thread was new. 🙁
I'm sure though that there are other QB fans, still.
Or fans of Turbo Basic or Power Basic, also. The latter was popular in the 90s.
There also are lots of users on the net who grew up with the simpler GW-Basic.
Then there are PDS 7.x and and VBDOS, which have lots of features and are good candidates for future retro development.

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 4 of 8, by pshipkov

User metadata
Rank l33t
Rank
l33t

Claculating the number of bytes of an int array is trivial, i guess thats why nobody responded. : )
DIM numBytes AS INTEGER : numBytes = (width * height) * 2 ' bytes per int (in qbasic)

retro bits and bytes

Reply 5 of 8, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

Allow me to clarify, this thread's primary purpose is to just share a sprite demo written in QBasic for the sake of a bit of nostalgia and for anyone who's interested in learning about the topic of sprite programming in QBasic.

As to calculating array sizes for graphics in QBasic, here's another way:

DEFINT A-Z
CONST GETHEADERSIZE = &H4

DECLARE FUNCTION GetArraySize& (WidthV AS INTEGER, Height AS INTEGER, BitsPerPixel AS INTEGER, Planes AS INTEGER)


FUNCTION GetArraySize& (WidthV AS INTEGER, Height AS INTEGER, BitsPerPlane AS INTEGER, Planes AS INTEGER)
GetArraySize& = GETHEADERSIZE + (INT((WidthV * BitsPerPlane + 7) / 8) * Planes) * Height
END FUNCTION

My GitHub:
https://github.com/peterswinkels

Reply 6 of 8, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

And since the primary goal of this thread was to share sprite related QBasic stuff:

DEFINT A-Z
CONST CHARACTERSIZE = 34
CONST STEPX = 8
CONST STEPY = 16

DECLARE SUB DisplayText (Text AS STRING, x AS INTEGER, y AS INTEGER, Verb AS STRING)
DECLARE SUB Initialize ()
DECLARE SUB LoadFontData ()
DECLARE SUB Main ()
DECLARE SUB Quit ()

DIM SHARED FontData(0 TO 8703) AS INTEGER

Initialize
LoadFontData
CALL Main
Quit

SUB DisplayText (Text AS STRING, x AS INTEGER, y AS INTEGER, Verb AS STRING)
DIM Index AS INTEGER
DIM Length AS INTEGER

Length = LEN(Text)

SELECT CASE UCASE$(LTRIM$(RTRIM$(Verb)))
CASE "OR"
FOR Index = 1 TO Length
PUT (x, y), FontData(ASC(MID$(Text, Index, 1)) * CHARACTERSIZE), OR

IF x + STEPX > 632 THEN
x = 0
y = y + STEPY
ELSE
x = x + STEPX
END IF
NEXT Index
CASE "PRESET"
FOR Index = 1 TO Length
PUT (x, y), FontData(ASC(MID$(Text, Index, 1)) * CHARACTERSIZE), PRESET

IF x + STEPX > 632 THEN
x = 0
y = y + STEPY
ELSE
x = x + STEPX
END IF
NEXT Index

CASE "PSET"
FOR Index = 1 TO Length
PUT (x, y), FontData(ASC(MID$(Text, Index, 1)) * CHARACTERSIZE), PSET

IF x + STEPX > 632 THEN
x = 0
y = y + STEPY
ELSE
x = x + STEPX
END IF
NEXT Index
CASE ELSE
Show last 35 lines
   ERROR 5
END SELECT
END SUB

SUB Initialize ()
SCREEN 12
PALETTE
CLS
END SUB

SUB LoadFontData ()
DEF SEG = VARSEG(FontData(0))
BLOAD "VGAFont.dat", VARPTR(FontData(0))
END SUB

SUB Main ()
DIM Banner AS STRING

Banner = "V G A F O N T - B Y : P E T E R S W I N K E L S , - * * * 2 0 2 5 * * *"
DisplayText Banner, 8, 16, "PSET"
DisplayText Banner, 9, 17, "OR"
DisplayText " Press any key to exit. ", 18, 45, "PRESET"

DO
LOOP WHILE INKEY$ = ""
END SUB

SUB Quit ()
SCREEN 0
WIDTH 80, 25
COLOR 7, 0
CLS
SYSTEM
END SUB

While not animated and technically more about fonts than sprites this might also be of interest or amusing for anyone into QBasic sprite/graphics programming. 😀

EDIT:
The complete project can be found here:
https://github.com/PeterSwinkels/QBasic-font- … ee/main/VGAFont

My GitHub:
https://github.com/peterswinkels

Reply 7 of 8, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

Here's an excerpt from a graphics intense QuickBASIC (but should also work in QBasic) program demonstrating how to achieve a side ways scrolling image effect:

SUB DisplayWorldMap
DIM Map1(&H0 TO &H6400)
DIM Map2(&H0 TO &H1D0)

DisplayImage 95, 60, "World.map", "", 0, 0
DO
GET (95, 60)-STEP(445, 225), Map1
GET (541, 60)-STEP(2, 225), Map2
PUT (95, 60), Map2, PSET
PUT (98, 60), Map1, PSET
LOOP WHILE INKEY$ = ""
END SUB

The full project can be found at:
https://github.com/PeterSwinkels/QuickBASIC-- … tree/main/Topo3

To be clear: the main purpose of this thread is just showing off some Q(uick) BASIC graphics stuff I have made.

My GitHub:
https://github.com/peterswinkels

Reply 8 of 8, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

And a final note for now:
While I am mostly talking about QBasic specifically, most of this code could probably be made to work in other MS-DOS based BASIC dialects with little to no effort. 😀

My GitHub:
https://github.com/peterswinkels