Oops and Xtv

Shows I’m new to WordPress. The last few posts I’ve made have not been categorised or tagged properly and at least one reply to a comment was made the wrong way (I only found out when I got an email asking me to approve my own comment!)

Ah, the joys of learning new skills after 32 years of using computers :o)

Actually, this post was to have been about a handy little procedure I call OOPS which helps me recover from programming oopsies when I test-run my programs in BASIC. I use Easyptr, SBASIC and Q-Liberator for most of my programming plus occasional assembler code. Assembler crashes are fatal (when I make a mistake in assembler I do it in style!), but for programs which fall over due to lesser slip-ups, a procedure like this is handy to quickly clear out menus in the main QL windows, restore ink and paper colours, clear out common heap allocations and the like before I make corrections and proceed to the next test-run.

The CLOSE command is an extended CLOSE command which closes all open channel numbers above #2. CLAMP clears memories used by the pointer environment, and CLCHP clears out common heap allocations.

16290 DEFine PROCedure Oops
16300   REMark this procedure just resets the windows, OVER etc
16310   MCLEAR #2 : PAPER #2,7 : INK #2,2 : OVER #2,0
16320   MCLEAR #1 : PAPER #1,2 : INK #1,7 : OVER #1,0
16330   MCLEAR #0 : PAPER #0,0 : INK #0,7 : OVER #0,0
16340   CLOSE : CLAMP : CLCHP
16350 END DEFine Oops

Another handy little pair of procedures are called XTV and XMON. These just expand the BASIC windows #0, #1 and #2 to fill the SMSQ/E screen. SCR_XLIM and SCR_YLIM are SBASIC functions which interrogate the system for the current display dimensions, in pixels.

29800 DEFine PROCedure XTV
29810   OUTLN #0,SCR_XLIM,SCR_YLIM,0,0
29820   WINDOW SCR_XLIM,SCR_YLIM-52,0,0
29830   WINDOW #2,SCR_XLIM,SCR_YLIM-52,0,0
29840   WINDOW #0,SCR_XLIM,52,0,SCR_YLIM-52
29850   BORDER #1,1,255
29860   BORDER #2,1,255
29870   BORDER #0,1,255
29880   CLS : CLS #2 : CLS #0
29890 END DEFine XTV
29900 :
29910 DEFine PROCedure XMON
29920   OUTLN #0,SCR_XLIM,SCR_YLIM,0,0
29930   WINDOW SCR_XLIM/2,SCR_YLIM-54,SCR_XLIM/2,0
29940   WINDOW #2,SCR_XLIM/2,SCR_YLIM-54,0,0
29950   WINDOW #0,SCR_XLIM,52,0,SCR_YLIM-52
29960   BORDER #1,1,255
29970   BORDER #2,1,255
29980   BORDER #0,1,255
29990   CLS : CLS #2 : CLS #0
30000 END DEFine XMON
Advertisements

One thought on “Oops and Xtv

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s