GO SUB

Short snippets of S*BASIC code, scripts, and programming aids

Most PE routines require EasyPtr's ptrmen_cde!

Cut these routines from the web page and paste them into your favourite QL editor..

Name Vers Description Remarks
Sprites and other PE Objects
txt2spr 0.02 Convert menu item text to sprite. Useful for drag'n drop? This version GD2 only!
enRLE 0.02 Sprite compression. Routine to do standard SMSQ/E sprite compressions. Here with a harness to compress some solid GD2 sprites.
Bounce 0.01 Jumping ball demo. Simple, ready-to-run routine demos moving a semi-transparent sprite. Basis for a games routine? GD2 only!
BlbCol 0.01 Colour blobs Simply give a blob any RGB colour. Find out more about blobs, etc.. GD2 only!
Pic2Spr 0.06 Convert PICs to SPRites Convert PICs of any QL or GD2 mode to SPRites of the same mode. RLE-compressed if wanted.
Pic2Pac 0.02 Convert PICs to PACs Compress PICs of any QL-native mode to - typically, for screen shots etc - 10%-30% of the original size.
Pac2Pic 0.01 Convert PACs to PICs Decompress PACs back to standard PICs.
MkBlk 0.02 Create sprites on the fly Generate ad hoc compressed, rectangular GD2 sprites of any colour, including Wman colours. Note: Renamed MkSpr.. to MkBlk..!
Spr2RLE 0.02 Compress simple, single GD2 sprites Save space by compressing your GD2 sprites.
Programming Aids
CDBdefs 0.00 Channel Definition Block functions Requires Channel toolkit. Cut out the ones you need and paste them into your program.
ScrollED 08WB Scrollable line editor for inclusion in S*Basic programs GD2-compatible version. (The idea was to write this in assembler, but I never got round to it.) Download code here.
DeHex 0.01 Remove hex and binary literals from SBASIC programs. SBASIC only.
PokeDatW 0.01 An aid to add binary data to your SBASIC programs without DATA statements. Output for SBASIC and MBASIC (Minerva) only (even when compiled!) as Qdos doesnt do multiple pokes in one go.
Files, Directories, and Directory Devices
DevGet 0.06 Given a device's USE name, return its real name (and vice versa) SMSQ/E & Qlib. Probably not relevant for Qdos.
DelDir 0.01 Demo and tutorial: Traversing a directory tree (bottom up) Commented S*Basic code to scan and DELETE a directory tree. (Nowadays Id do it differently ;o)
HDRen 0.05 Give your QXL.WIN-type hard disk a sensible name! For QPC, QXL and other systems that use the QLWA container HD
DirSize 0.01 Get the file count and size of a directory tree. Qmenu + SMSQ/E, or Qdos with DDL2 + tk2 + PE.
QLone 0.02 Clone a complete device or directory tree. SMSQ/E / Qdos with DDL2 + tk2.
NextFile 0.11 Get filenames from a directory one at a time as needed. SMSQ/E / Qdos with DDL2 + tk2.
NextFileDir 0.05 Get filenames from a directory one at a time as needed while traversing the whole directory tree. SMSQ/E / Qdos with DDL2 + tk2. Also needs TK NUMI2S or similar
NextDosFile 0.03 Get a DOS directory tree as a stream of filenames. QPC2 (V5+) and SMSQmulator (V2.3+) only. (Earlier versions might not work!)
FilesOpen 0.02 Find out how many open files there are on a device, - eg before dismounting it. SMSQ/E and SBASIC only, as it stands.
DirUp/DirDn 0.05 Functions to move up or down a directory level. SMSQ/E or Qdos with TK2 with DDL2.
ParseFnm 0.01 Routine to split a filename into its components. Rewritten from scratch! S*BASIC for all systems with DDL2.
Sorting and Searching
Unique 0.01 Search and create a list of unique items. S*BASIC for all systems. The example here uses my CMP% function, but it can be modified to do without.
UniqueIndOfs 0.02 Search and create a list of unique items stored in a heap. S*BASIC for all systems. The example here uses various toolkit commands, but it can be modified to do without.
Mem-QS-BS 0.03 Sort and search strings in memory. S*BASIC for all systems. The example here uses my POKESTR$, PEEKSTR$, and CMP% functions, but it could be modified to do without.
HeapUniqueX 0.01 Create a list of unique items in a stretchable heap. SBASIC (SuperBASIC+TK2 with modifications). Various toolkit commands required. Single entry point "Black Box" solution.
Experimental
SB Slave 0.02 Demo of how SBASIC can be used as a slave by another program Could be used in a QL browser?
Drawing
Circle 0.06 Draw a circle or ellipse using pixel coordinates. Draw outlined or filled circles. S*BASIC (except harness).
Line 0.01 Draw a straight line using only integer math and using pixel coordinates. This algorithm is ideal for an assembler implementation..
Miscellaneous
Calendar 0.12 Template script to produce basic calendars View readme and sample output here
Kbdbtn 0.00 Button to change keyboard languages PE + Qmenu.
Magnify 0.01 Simple screen magnifyer PE + GD2 only! Requires ptrmen_cde and my Rpix toolkit. Get the compiled version here.
BlockFount 0.03 Write characters in large sizes All platforms. Demo requires my Chans toolkit.
Wrap 0.06 Wrap text, ie break lines at space Wrap and split lines, eg for popup help texts, etc.
FloodFill 0.02 FloodFill an area or shape Fill an area or enclosed shape with a single colour, a texture or an image. GD2 only although routines can be adapted for standard QL modes.
We should avoid duplication of effort, because that is being done by others
- Athur Mitchell (British industrialist)