Well, here is some code I've written a while ago. This is just to plot single pixels in SCREEN 11.
But if you wanna do 1-bit sprites you can always use some technique I used with my ol' programs (when I used Qbasic 1.0 and memory/speed didn't allow me to have tons of sprites). If you check QB help for the LINE command, you'll notice that there is a parameter called "pattern". It is just a 16 bits number. The line will be drawn following that pattern, in 16 pixels bits, so if a bit is 1 then a pixel will be drawn and if a bit is 0 the pixel won't.
I figured out that having 16 different designs in 16 pixels wide horizontal lines one in the top of another, I could draw simple sprites.
The code goes as follows. I think it is self-explicative. The good thing with it is that sprites are blit very fast and that they only take 32 bytes:
Code:
DECLARE SUB Put1BitSprite (x%, y%, Spr%())
DIM MySprite%(15) ' A sprite takes 32 bytes.
SCREEN 11
' Read and convert sprite:
' This is done 'cause my sprite is in binary format in the DATAs. It would
' be better to convert them to integer numbers (you just have to have a
' proggie like this and print out the values, and then use them directly).
RESTORE mySpriteInBin:
FOR i% = 0 TO 15
' Better pre-calt the two bytes, then use CVI:
byte1% = 0
FOR j% = 0 TO 7
READ a%
byte1% = byte1% + a% * 2 ^ (7 - j%)
NEXT j%
byte2% = 0
FOR j% = 0 TO 7
READ a%
byte2% = byte2% + a% * 2 ^ (7 - j%)
NEXT j%
MySprite%(i%) = CVI(CHR$(byte2%) + CHR$(byte1%))
NEXT i%
LOCATE 1, 20: PRINT "1 PLANE SPRITES"
' Let's draw some of them
FOR x% = 0 TO 400 STEP 20
Put1BitSprite x%, x%, MySprite%()
NEXT x%
' Sprite in binary data
' (It would be better to pre-calculate this, but...)
mySpriteInBin:
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0
DATA 0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0
DATA 0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0
DATA 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0
DATA 0,0,1,1,0,0,1,0,0,0,1,0,0,1,1,0
DATA 0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0
DATA 0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0
DATA 0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0
DATA 0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0
DATA 0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0
DATA 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0
DATA 0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0
DATA 0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0
DATA 0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0
SUB Put1BitSprite (x%, y%, Spr%())
' This technique relies on LINE's pattern drawing capability.
' As patterns are described by 16 bits integers, drawing 16 pixels
' in horizontal lines using our Spr% data as patterns will draw
' our tiny 1 bit sprite.
'
' This can be used in any screen mode. Just replace the '1' by a
' colour% number (add a parameter).
FOR i% = 0 TO 15
LINE (x%, i% + y%)-(15 + x%, i% + y%), 1, , Spr%(i%)
NEXT i%
END SUB