Difference between revisions of "OSBYTE &14"

From BeebWiki
Jump to: navigation, search
m (Added X>6.)
(Corrected description.)
Line 1: Line 1:
 
[[Category:OSBYTE]]
 
[[Category:OSBYTE]]
  OSBYTE &14 (20) - Explode/implode user defined character font RAM and reset font
+
{{PageTitle|OSBYTE &14 (20): Explode and reset font}}
 
   On entry:
 
   On entry:
    X=0: characters &80 to &9F only are redefineable (default without Tube)
+
    X=0:     characters &80 to &9F only are redefineable (default without Tube)
    X=1: characters &80 to &BF are redefineable
+
    X=1:     characters &80 to &BF are redefineable
    X=2: characters &80 to &DF are redefineable
+
    X=2:     characters &80 to &DF are redefineable
    X=3: characters &80 to &FF are redefineable
+
    X=3:     characters &80 to &FF are redefineable
    X=4: characters &20 to &3F, &80 to &FF are redefineable
+
    X=4:     characters &20 to &3F, &80 to &FF are redefineable
    X=5: characters &20 to &5F, &80 to &FF are redefineable
+
    X=5:     characters &20 to &5F, &80 to &FF are redefineable
    X=6: characters &20 to &FF are redefineable (default with Tube)
+
    X=6:     characters &20 to &FF are redefineable (default with Tube)
    X>6: as with X=6, all characters redefineable
+
    X>6:     as with X=6, all characters redefineable
 +
  Extension:
 +
    X>&80+n: ...
 
   On exit:
 
   On exit:
    X=&00: font permanently exploded (MOS 3 and later)
+
    X=&00:   font permanently exploded (MOS 3 and later)
    X=&FF: font explodable/implodable (before MOS 3, ie Electron, BBC, BBC B+)
+
    X=&FF:   font explodable/implodable (before MOS 3, ie Electron, BBC, BBC B+)
    Y=&00:  font permanently exploded (MOS 3 and later)
 
    Y<>&00: new value OSHWM (not returned across Tube)
 
 
      
 
      
    BBC:    X=return value from Service Call &11, &FF if call unclaimed, Y=new OSHWM
+
  BBC:    X=return value from Service Call &11, &FF if call unclaimed
    Master:  X=&00, Y=&00
+
  Master:  X=&00
    RISC OS: X=&01 (first font bank reset), Y=&03 (number of banks reset)
+
  RISC OS: X=&01 (first font bank reset)
    BB4W:    X=&20 (character under cursor), Y=&00
+
  BB4W:    X=&20 (character under cursor)
  
In the "imploded" state (X=0) only characters &80-&9F can be redefined with [[VDU 23]], as only 256 bytes is permanently allocated for font definition by the MOS. Other values of X "explode" the RAM and allocate 1 to 6 pages of font RAM pushing up host OSHWM, allowing more characters to be defined.
+
In the "imploded" state (X=0) only 32 characters can be defined as only 256 bytes is permanently allocated for font definitions. All calls reset the font for CHR$32-CHR$127 by setting them as "hard", and they are read from ROM, and set CHR$128-CHR$255 as "soft". The default and "imploded" state is that all soft font groups use the same 256-byte font RAM.
  
This OSBYTE must be used with care within a language, as it can reduce the language's memory allocation. [[Paged_ROM_service_calls|Service call &11]] is issued to notify ROMs of the change in OSHWM. BASIC does not respond to this, so the *BASIC command should be issued to get it to reset PAGE.  
+
Each group of 32 characters is a font group. Defining any character results in that definition being repeated for all soft font groups. For example, defining CHR$&80 results in that definition being used for CHR$A0, CHR$&C0 and CHR$E0. If you redefine a "hard" character the default font is copied for that font group and the character redefined. For example, in the "imploded" state, if you redefine CHR$21 its font group (CHR$&20-CHR$&3F) becomes soft and its definition will also be used for all the other soft font groups.
  
If unexploded, characters &20-&7F are taken from the ROM, and characters &A0-&FF are duplicates of &80-&9F.
+
Exploding the font allocates a separate page of memory for the specified number of font groups, so each font group can be uniquely defined. For example, exploding with X=1 allocates a page of memory for CHR$&A0-CHR$BF allowing those to be uniquely defined. Again, the unallocated font groups will share the initial default font memory.
 +
 
 +
Exploding the font allocates 1 to 6 pages of font RAM underneath the default OSHWM, allowing more characters to be defined, pushing up the host's OSHWM - which is read by BASIC to set PAGE.
 +
 
 +
This OSBYTE must be used with care within a language, as it can reduce the language's memory allocation. [[Paged_ROM_service_calls|Service call &11]] is issued to notify ROMs of the change in OSHWM. BASIC does not respond to this, so if OSHWM changes the *BASIC command needs to be issued to get it to reset PAGE.  
  
 
When a Tube coprocessor is fitted, the font is fully exploded by default, as this does not take up language memory, but it can be imploded if desired.
 
When a Tube coprocessor is fitted, the font is fully exploded by default, as this does not take up language memory, but it can be imploded if desired.
Line 34: Line 38:
  
 
You should not examine the returned Y value, as OSBYTE calls <128 are defined to only return information in the X register, and only the X register is returned to the user in some environments (such as across the Tube).
 
You should not examine the returned Y value, as OSBYTE calls <128 are defined to only return information in the X register, and only the X register is returned to the user in some environments (such as across the Tube).
 +
 +
===Extension===
 +
  On entry: X=&80+state
 +
placeholder
  
 
==See Also==
 
==See Also==
Line 39: Line 47:
 
* http://mdfs.net/Docs/Comp/BBC/Osbyte00
 
* http://mdfs.net/Docs/Comp/BBC/Osbyte00
  
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 00:00, 24 November 2022 (CET)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 14:13, 31 August 2015 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 14:13, 31 August 2015 (UTC)
 
[[User:Jgharston|Jgharston]] 21:30, 26 May 2009 (UTC)<br>
 
[[User:Jgharston|Jgharston]] 21:30, 26 May 2009 (UTC)<br>
 
[[User:KJBracey|KJBracey]] 15:04, 5 December 2009 (UTC)
 
[[User:KJBracey|KJBracey]] 15:04, 5 December 2009 (UTC)

Revision as of 01:00, 24 November 2022

OSBYTE &14 (20): Explode and reset font
 On entry:
    X=0:     characters &80 to &9F only are redefineable (default without Tube)
    X=1:     characters &80 to &BF are redefineable
    X=2:     characters &80 to &DF are redefineable
    X=3:     characters &80 to &FF are redefineable
    X=4:     characters &20 to &3F, &80 to &FF are redefineable
    X=5:     characters &20 to &5F, &80 to &FF are redefineable
    X=6:     characters &20 to &FF are redefineable (default with Tube)
    X>6:     as with X=6, all characters redefineable
  Extension:
    X>&80+n: ...
 On exit:
    X=&00:   font permanently exploded (MOS 3 and later)
    X=&FF:   font explodable/implodable (before MOS 3, ie Electron, BBC, BBC B+)
   
 BBC:     X=return value from Service Call &11, &FF if call unclaimed
 Master:  X=&00
 RISC OS: X=&01 (first font bank reset)
 BB4W:    X=&20 (character under cursor)

In the "imploded" state (X=0) only 32 characters can be defined as only 256 bytes is permanently allocated for font definitions. All calls reset the font for CHR$32-CHR$127 by setting them as "hard", and they are read from ROM, and set CHR$128-CHR$255 as "soft". The default and "imploded" state is that all soft font groups use the same 256-byte font RAM.

Each group of 32 characters is a font group. Defining any character results in that definition being repeated for all soft font groups. For example, defining CHR$&80 results in that definition being used for CHR$A0, CHR$&C0 and CHR$E0. If you redefine a "hard" character the default font is copied for that font group and the character redefined. For example, in the "imploded" state, if you redefine CHR$21 its font group (CHR$&20-CHR$&3F) becomes soft and its definition will also be used for all the other soft font groups.

Exploding the font allocates a separate page of memory for the specified number of font groups, so each font group can be uniquely defined. For example, exploding with X=1 allocates a page of memory for CHR$&A0-CHR$BF allowing those to be uniquely defined. Again, the unallocated font groups will share the initial default font memory.

Exploding the font allocates 1 to 6 pages of font RAM underneath the default OSHWM, allowing more characters to be defined, pushing up the host's OSHWM - which is read by BASIC to set PAGE.

This OSBYTE must be used with care within a language, as it can reduce the language's memory allocation. Service call &11 is issued to notify ROMs of the change in OSHWM. BASIC does not respond to this, so if OSHWM changes the *BASIC command needs to be issued to get it to reset PAGE.

When a Tube coprocessor is fitted, the font is fully exploded by default, as this does not take up language memory, but it can be imploded if desired.

OSBYTE &14 with any value of X also resets characters &20-&7F to the ROM font. Characters &80-&FF are not altered, contrary to some manuals.

MOS 3 and later ignores the input value of X. The font is always fully exploded, and the definitions do not take up user memory. The only effect of OSBYTE &14 is to reset characters &20-&7F. Characters &80-&FF are not altered, contrary to some manuals. To reset all characters, OSBYTE &19 should be used.

You should not examine the returned Y value, as OSBYTE calls <128 are defined to only return information in the X register, and only the X register is returned to the user in some environments (such as across the Tube).

Extension

 On entry: X=&80+state

placeholder

See Also

Jgharston (talk) 00:00, 24 November 2022 (CET) Jgharston (talk) 14:13, 31 August 2015 (UTC) Jgharston 21:30, 26 May 2009 (UTC)
KJBracey 15:04, 5 December 2009 (UTC)