Difference between revisions of "OSBYTE &A2"

From BeebWiki
Jump to: navigation, search
m (1 revision)
m (Added page title.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:OSBYTE]]
 
[[Category:OSBYTE]]
==Enable/Disable GXR==
+
{{PageTitle|OSBYTE &A2 (162): Write non-volatile memory}}
  On entry:
 
    X=0  Disable GXR (version 1.xx), Enable GXR (version 2.xx)
 
    X=128 Enable GXR (version 1.xx), Disable GXR (version 2.xx)
 
 
 
The Graphics Extension ROM for the BBC B and BBC B+ can be enabled and disabled
 
with OSBYTE &A2. See also [[Talk:OSBYTE &A2]].
 
 
 
==Write configuration RAM/EEPROM==
 
 
   On entry:
 
   On entry:
     X=index of byte to write
+
     X=offset to byte to write
 
     Y=byte to write
 
     Y=byte to write
 
   On exit:
 
   On exit:
     undefined
+
     If unsupported: X=&FF
 +
                    Y=preserved
 +
    If offset within non-volative memory exists:
 +
                    X=absolute offset within memory
 +
                    Y=preserved
 +
    If offset within non-volatile memory does not exist (past last location):
 +
                    X=preserved
 +
                    Y=preserved
  
OSBYTE &A2 reads a byte to the configuration RAM/EEPROM. There are typically
+
OSBYTE &A2 writes a byte to non-volatile memory used to store configuration data.
50 locations but implementations can have more. The Master 128 uses 50 bytes
+
There are typically 50 locations but implementations can have more. The Master 128
of nonvolatile CMOS RAM, the Master Compact uses a 128-byte or a 256-byte EEPROM,
+
uses 50 bytes of non-volatile CMOS RAM, the Master Compact uses a 128-byte or a
the Master Extension ROM for the BBC B uses a block of memory or a file on disk.
+
256-byte EEPROM, the Master Extension ROM for the BBC B uses a block of memory or
 +
a file on disk.
  
 
Location zero holds the local station number and is protected from being written
 
Location zero holds the local station number and is protected from being written
 
with OSBYTE &A2. It can only be changed with a utility such as <tt>'''*SetStation'''</tt>.
 
with OSBYTE &A2. It can only be changed with a utility such as <tt>'''*SetStation'''</tt>.
  
Some implementations of configuration RAM have a limited write-cycle time, so
+
Some implementations of non-volatile memory have a limited write-cycle time, so
 
it is best to only write a value if it is not already the same. The following
 
it is best to only write a value if it is not already the same. The following
 
code will write a block of configuration data:
 
code will write a block of configuration data:
Line 30: Line 30:
 
   REM mem%=block of configuration data
 
   REM mem%=block of configuration data
 
   FOR X%=1 TO max%
 
   FOR X%=1 TO max%
   A%=161:Y%=((USR&FFF4)AND&FF0000)DIV256
+
   A%=161:Y%=((USR&FFF4)AND&FF0000)DIV65536
 
   IF mem%?X%<>Y% THEN Y%=mem%?X%:A%=162:CALL &FFF4
 
   IF mem%?X%<>Y% THEN Y%=mem%?X%:A%=162:CALL &FFF4
 
   NEXT X%
 
   NEXT X%
 +
 +
==Enable/Disable GXR==
 +
  On entry:
 +
    X=0  Disable GXR (version 1.xx), Enable GXR (version 2.xx)
 +
    X=128 Enable GXR (version 1.xx), Disable GXR (version 2.xx)
 +
 +
The Graphics Extension ROM for the BBC B and BBC B+ can be enabled and disabled
 +
with OSBYTE &A2. See also [[Talk:OSBYTE &A2]].
  
 
==See Also==
 
==See Also==
* Read configuration data [[OSBYTE &A1]]
+
* Read non-volatile memory [[OSBYTE &A1]]
 
* [[CMOS configuration RAM allocation]]
 
* [[CMOS configuration RAM allocation]]
 
* [http://mdfs.net/Docs/Comp/BBC/Osbyte80 mdfs.net OSBYTE list]
 
* [http://mdfs.net/Docs/Comp/BBC/Osbyte80 mdfs.net OSBYTE list]
  
 
[[User:Jgharston|Jgharston]] 16:06, 31 October 2010 (UTC)
 
[[User:Jgharston|Jgharston]] 16:06, 31 October 2010 (UTC)

Latest revision as of 22:57, 26 August 2024

OSBYTE &A2 (162): Write non-volatile memory
 On entry:
   X=offset to byte to write
   Y=byte to write
 On exit:
   If unsupported: X=&FF
                   Y=preserved
   If offset within non-volative memory exists:
                   X=absolute offset within memory
                   Y=preserved
   If offset within non-volatile memory does not exist (past last location):
                   X=preserved
                   Y=preserved

OSBYTE &A2 writes a byte to non-volatile memory used to store configuration data. There are typically 50 locations but implementations can have more. The Master 128 uses 50 bytes of non-volatile CMOS RAM, the Master Compact uses a 128-byte or a 256-byte EEPROM, the Master Extension ROM for the BBC B uses a block of memory or a file on disk.

Location zero holds the local station number and is protected from being written with OSBYTE &A2. It can only be changed with a utility such as *SetStation.

Some implementations of non-volatile memory have a limited write-cycle time, so it is best to only write a value if it is not already the same. The following code will write a block of configuration data:

 REM max%=number of locations -1
 REM mem%=block of configuration data
 FOR X%=1 TO max%
 A%=161:Y%=((USR&FFF4)AND&FF0000)DIV65536
 IF mem%?X%<>Y% THEN Y%=mem%?X%:A%=162:CALL &FFF4
 NEXT X%

Enable/Disable GXR

 On entry:
   X=0   Disable GXR (version 1.xx), Enable GXR (version 2.xx)
   X=128 Enable GXR (version 1.xx), Disable GXR (version 2.xx)

The Graphics Extension ROM for the BBC B and BBC B+ can be enabled and disabled with OSBYTE &A2. See also Talk:OSBYTE &A2.

See Also

Jgharston 16:06, 31 October 2010 (UTC)