Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2345

programming • Re: BBC BASIC Find Character at X,Y

$
0
0
I'm not sure the regular User Guide makes this clear, but by default the BBC Micro can only actually redefine characters 128-159. So when you attempt to redefine character 240, it (silently) translates that number into the available range and redefines character 144. You can test this by doing PRINT CHR$(144) and you will see the man character. When you PRINT CHR$(240) the same translation happens behind the scenes and the man is printed. (Same with VDU 240 and VDU 144)

It is possible to redefine more characters than normal by 'exploding' the character set. This just means asking the OS to allocate more memory to allow the extra characters to be redefined. This is done using *FX 20,X where *FX 20,0 restores the original 'imploded' state, and *FX 20,1 through to *FX 20,6 allow a wider and wider range of characters to be redefined. The Advanced User Guide has details of this call. *FX is also known as OSBYTE. The Master allows for a full set of redefinitions by default and doesn't need to explode the character set.

Note that line 2040 seems to be missing a comma between the X and Y.

Code:

 1 CLS 2 LET V2=0 5 VDU 23,240,28,28,8,127,8,20,34,6510 *VNVDU ON20 MODE 130 CLS35 COLOUR 12940 COLOUR 255 PRINT CHR$(240);CHR$(240)60 LET X=070 LET Y=080 A$=FNREADCH(X,Y)90 V2=ASC(A$)95 PRINT V2100 STOP2000 DEF FNREADCH(X,Y)2010 LOCAL A%,LASTX,LASTY,C2020 LASTX=POS2030 LASTY=VPOS2040 VDU 31,X,Y2050 A%=1352060 C=USR(&FFF4)2070 C=C AND &FFFF2080 C=C DIV &1002090 VDU 31,LASTX,LASTY2100 = CHR$(C)

Statistics: Posted by TobyLobster — Sun Jan 05, 2025 7:23 pm



Viewing all articles
Browse latest Browse all 2345

Trending Articles