Restoring ROM character data after VDU 23

bbc/electron apps, languages, utils, educational progs, demos + more
Post Reply
SparkyNZ
Posts: 68
Joined: Tue Feb 06, 2024 5:05 am
Contact:

Restoring ROM character data after VDU 23

Post by SparkyNZ »

Just been playing with VDU 23 command on page 171 of the User Guide..

Once I've modified character data for 'A' (CHR$(65)) for example, how do I programmatically restore the ROM character data?
james
Posts: 330
Joined: Tue Aug 15, 2023 8:41 pm
Location: NE Hampshire
Contact:

Re: Restoring ROM character data after VDU 23

Post by james »

It looks as though "FX20,0 might be the answer. Within certain limits and assumptions.

On a BBC B, space is initially allocated for 32 User Defined Characters. *FX20,0 will reset all of these.

If you have 'exploded' the font (ie, reserved more memory for additional character definitions), then *FX20,0 will shink the allocated memory back down to the default amount and clear it see: https://beebwiki.mdfs.net/OSBYTE_%2614

If you have a Master, then "FX24,n can apparently be used, see https://beebwiki.mdfs.net/OSBYTE_%2619

bbcb font clear.png
james
Posts: 330
Joined: Tue Aug 15, 2023 8:41 pm
Location: NE Hampshire
Contact:

Re: Restoring ROM character data after VDU 23

Post by james »

Another trick, on a BBC B, is to copy the font definition back out of ROM.
bbc font copy.png
Characters start in the OS ROM at &C000 and occupy 8 bytes each https://tobylobster.github.io/mos/mos/S-s4.html

All that snippet does is VDU23,65,[copy original 8 values from OS ROM]

Though note, the computer will still 'think' it's displaying a user-defined character. It's just one that looks like the original it's replacing
SparkyNZ
Posts: 68
Joined: Tue Feb 06, 2024 5:05 am
Contact:

Re: Restoring ROM character data after VDU 23

Post by SparkyNZ »

james wrote: Sat Apr 06, 2024 9:23 am It looks as though "FX20,0 might be the answer. Within certain limits and assumptions.

On a BBC B, space is initially allocated for 32 User Defined Characters. *FX20,0 will reset all of these.
This is quite interesting. the *FX20,0 does indeed restore the characters' pixel data but the previous image remains onscreen.. So I guess the BBC must render characters to a sort of framebuffer (as it does with lines etc) which is different from the CBM machines with their character mapped text mode screens.

Image

It's pretty cool though - here I have defined 'A' to be 3 different images and they can all be put onto the screen.

Update: Now why do my Image links never work when I use the Picture button?? It just displays "Image" in text above.

https://imgur.com/k9xgvPt
SparkyNZ
Posts: 68
Joined: Tue Feb 06, 2024 5:05 am
Contact:

Re: Restoring ROM character data after VDU 23

Post by SparkyNZ »

james wrote: Sat Apr 06, 2024 9:38 am Another trick, on a BBC B, is to copy the font definition back out of ROM.

bbc font copy.png

Characters start in the OS ROM at &C000 and occupy 8 bytes each https://tobylobster.github.io/mos/mos/S-s4.html
That's good to know also - using the actual bytes.

The BBC never did have a concept of multicolour characters did it? (other than background and foreground colour rendering)
SparkyNZ
Posts: 68
Joined: Tue Feb 06, 2024 5:05 am
Contact:

Re: Restoring ROM character data after VDU 23

Post by SparkyNZ »

james wrote: Sat Apr 06, 2024 9:38 am Another trick, on a BBC B, is to copy the font definition back out of ROM.
That trick didn't work for me on the b2 emulator. Maybe I'm not emulating the BBC B by default - I got spaces for the 'A' so maybe the character data is stored in a different location. Yeah, looks like I'm emulating the Master 128 at the moment. :-)
tom_seddon
Posts: 889
Joined: Tue Aug 30, 2005 12:42 am
Contact:

Re: Restoring ROM character data after VDU 23

Post by tom_seddon »

It's more complicated on the Master. The font data is at a documented location ($b900 in ROM 15 - see Master Reference Manual part 1, page E.4-5), but this is not very convenient to access from BASIC. But it's easy enough to use OSBYTE 25: https://beebwiki.mdfs.net/OSBYTE_%2619

(Note that the BeebWiki page previously incorrectly called this OSBYTE 24, which I've fixed. OSBYTE 24 does nothing on the Master.)

--Tom
User avatar
BeebMaster
Posts: 7379
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Restoring ROM character data after VDU 23

Post by BeebMaster »

SparkyNZ wrote: Sat Apr 06, 2024 9:34 pm
The BBC never did have a concept of multicolour characters did it? (other than background and foreground colour rendering)
In text mode (VDU4), characters will be printed on screen in the current text foreground colour.

In graphics mode (VDU5), characters will be printed on screen in the current graphics foreground colour. Using the GCOL extensions in the Graphics Extension ROM, or Master 128, the graphics colour can be a pattern rather than a solid colour, so this could be used to an extent to plot multi-coloured characters:
vlcsnap-2024-04-06-23h18m39s159.png
Any pixel on the screen can be any colour the current mode supports, so by plotting the individual pixels of a text character, a multi-coloured character could be displayed.
Image
wiggy
Posts: 508
Joined: Fri Feb 12, 2021 12:19 pm
Contact:

Re: Restoring ROM character data after VDU 23

Post by wiggy »

SparkyNZ wrote: Sat Apr 06, 2024 9:20 pm I guess the BBC must render characters to a sort of framebuffer (as it does with lines etc) ...
Correct - at least for Modes 0 through 6: these do indeed draw everything to a framebuffer.

(Mode 7 is character mapped, though, using the '5050 to generate the characters).
User avatar
1024MAK
Posts: 12780
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Restoring ROM character data after VDU 23

Post by 1024MAK »

SparkyNZ wrote: Sat Apr 06, 2024 9:20 pm Now why do my Image links never work when I use the Picture button?? It just displays "Image" in text above.
Because that's a link to a web page and not to an image format that the forum software recognises.

It is possible to attach an image in-line. Use the Attachments tab below the text edit box.

Mark
SparkyNZ
Posts: 68
Joined: Tue Feb 06, 2024 5:05 am
Contact:

Re: Restoring ROM character data after VDU 23

Post by SparkyNZ »

1024MAK wrote: Mon Apr 08, 2024 11:15 pm Because that's a link to a web page and not to an image format that the forum software recognises.
I could have sworn I'd used this method of attaching screenshots in the past on this website. Not to worry. I'll try pasting the actual image next time or using an attachment.
Post Reply

Return to “8-bit acorn software: other”