Difference between revisions of "OSBYTE &A1"
m (1 revision) |
m (typo) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:OSBYTE]] | [[Category:OSBYTE]] | ||
− | + | {{PageTitle|OSBYTE &A1 (161): Read non-volatile memory}} | |
On entry: | On entry: | ||
− | X=byte to read or 255 | + | X=offset to byte to read or 255 to read memory size |
On exit: | On exit: | ||
− | X | + | If unsupported: X=&FF |
− | Y=byte read or | + | Y=preserved |
+ | If offset within non-volative memory exists: | ||
+ | X=absolute offset within memory | ||
+ | Y=byte read | ||
+ | If offset within non-volatile memory does not exist (past last location): | ||
+ | X=preserved | ||
+ | Y=preserved | ||
+ | If reading size of non-volatile memory: | ||
+ | X=&FF (ie, preserved) | ||
+ | Y=maximum offset (ie size-1), or zero if call supported and | ||
+ | no memory present, or preserved if call unsupported | ||
− | OSBYTE &A1 reads a byte from | + | OSBYTE &A1 reads a byte from 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 | + | 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. | ||
+ | |||
+ | The presence and size of the non-volatile memory can be read with the following code: | ||
+ | |||
+ | A%=161:X%=0:U%=USR&FFF4 | ||
+ | X%=(U%AND&FF00)DIV256 | ||
+ | This will set X% to <>&FF if non-volatile memory access via OSBYTE &A1 exists, or &FF if absent. | ||
− | |||
A%=161:X%=255:Y%=49:U%=USR&FFF4 | A%=161:X%=255:Y%=49:U%=USR&FFF4 | ||
− | |||
Y%=(U%AND&FF0000)DIV65536 | Y%=(U%AND&FF0000)DIV65536 | ||
− | This | + | This will set Y% to the memory size minus 1, typically 49, 127 or 255, or 0 for not present. |
The following code will read all the configuration data. | The following code will read all the configuration data. | ||
Line 23: | Line 38: | ||
DIM mem% max% | DIM mem% max% | ||
FOR X%=0 TO max% | FOR X%=0 TO max% | ||
− | mem%?X%=((USR&FFF4)AND&FF0000) | + | mem%?X%=((USR&FFF4)AND&FF0000)DIV65536 |
NEXT X% | NEXT X% | ||
==See Also== | ==See Also== | ||
− | * Write | + | * Write non-volatile memory [[OSBYTE &A2]] |
* [[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]] 22:15, 26 May 2009 (UTC) | [[User:Jgharston|Jgharston]] 22:15, 26 May 2009 (UTC) |
Latest revision as of 23:05, 26 August 2024
OSBYTE &A1 (161): Read non-volatile memory
On entry: X=offset to byte to read or 255 to read memory size On exit: If unsupported: X=&FF Y=preserved If offset within non-volative memory exists: X=absolute offset within memory Y=byte read If offset within non-volatile memory does not exist (past last location): X=preserved Y=preserved If reading size of non-volatile memory: X=&FF (ie, preserved) Y=maximum offset (ie size-1), or zero if call supported and no memory present, or preserved if call unsupported
OSBYTE &A1 reads a byte from 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.
The presence and size of the non-volatile memory can be read with the following code:
A%=161:X%=0:U%=USR&FFF4 X%=(U%AND&FF00)DIV256
This will set X% to <>&FF if non-volatile memory access via OSBYTE &A1 exists, or &FF if absent.
A%=161:X%=255:Y%=49:U%=USR&FFF4 Y%=(U%AND&FF0000)DIV65536
This will set Y% to the memory size minus 1, typically 49, 127 or 255, or 0 for not present.
The following code will read all the configuration data.
A%=161:X%=255:Y%=49 max%=((USR&FFF4)AND&FF0000)DIV65536 DIM mem% max% FOR X%=0 TO max% mem%?X%=((USR&FFF4)AND&FF0000)DIV65536 NEXT X%
See Also
- Write non-volatile memory OSBYTE &A2
- CMOS configuration RAM allocation
- mdfs.net OSBYTE list
Jgharston 22:15, 26 May 2009 (UTC)