BASIC's question mark and PRINT

Pete Turnbull pete at dunnington.plus.com
Mon Nov 21 17:57:21 CST 2005


On Nov 21 2005, 22:27, Jules Richardson wrote:

> BBC BASIC used P. too, although the manual in front of me suggests
that it
> wasn't until version 4 (circa 1985 probably) - I don't think prior
versions
> supported token abbreviations (version 3 may have; this was produced
purely
> for the US market).

No, all versions, from the original 1981 version, support
abbreviations.

> The '?' token was used by BBC BASIC for peek and poke as I recall.

Yes, that's right.  '?' for byte values, and '!' for word values.  You
could do interesting things with them.  For example,

?&400=0  means poke zero into (hex)0400

but &400?1=0  means poke zero into the address 1 higher than &400 --
this is useful if you replace either the '1' or the '&400' in my
example with a variable, and use it in a loop.  Or set a variable to
the address  of some buffer or control block, and then fill specific
entries in the control block with values:

800 DEF PROCdiskaccess
810 returncode=10:parm?drive:parm!1=buffer
820 IF format THEN PROCformatparms:GOTO 850
830 parm?5=3:IF rnotw THEN parm?6=&53 else parm?6=&4B
840 parm?7=track:parm?8=sector:parm?9=&21
850 A%=&7F:X%=parm:Y%=0:CALL OSWORD
[ result code processing and display here ]
890 ENDPROC

which is a piece of a disk sector editor program I wrote in November
1982 (according to the REMs at its head).  That particular bit is the
procedure to set up a parameter block at an address "parm" (defined
further up the program) and call an OS routine called OSWORD which with
7F in A (and the address in X and Y, in this case it's in zero page)
calls the routine that accesses the 8271 disk controller.  "CALL" in
BBC BASIC copies the variables A%, X%, and Y% into the obvious 6502
registers and does a JSR to the address following the "CALL" keyword.

All of which has very little to do with '?' as shorthand for PRINT!

-- 
Pete						Peter Turnbull
						Network Manager
						University of York


More information about the cctalk mailing list