		Casio BASIC card OM-53B system variables

The names of equivalent PB-1000 variables and part of the description taken
from the "Casio PB-1000 technical handbook".
The list is incomplete yet.

address #bytes	name	description
=======	======	====	===========

Screen Data
&H0000	256	INTOP	Intermediate code buffer
&H0100	257	EDTOP	Input buffer
&H0201	1536	LEDTP	Display dot buffer
&H0801	192	LPFTP	4th line of the display dot buffer
&H0801	6	CSRDT	Cursor data buffer, shares space with LPFTP, perhaps
			the address should have been &H08C1 ?
&H08C7	3		contrast data
&H08CA	1	LCDST	LCD state
			Bit 0: At key input / PRINT
			Bit 1: Cursor display enable
			Bit 2: Virtual screen / Actual screen
			Bit 3: Cursor movement range setting
			Bit 4: Cursor on/off
			Bit 5: Reverse field display
&H08CB	1	EDCSR	Cursor position
&H08CC	1	SCTOP	Actual screen top
&H08CD	1	TOEDB	Logical line top
&H08CE	1	BOEDB	Logical line bottom
&H08CF	1	MOEDB	Logical line top (at INPUT)
&H08D0	1	TOARE	Cursor movement range top
&H08D1	1	BOARE	Cursor movement range bottom
&H08D2	1	EDCNT	location after the last character in the logical line,
			number of shifted or cleared character positions
&H08D3	1	DSPMD	&H00 = Normal display
			&H01 = PF display
			&H03 = MENU display
&H08D4	1	SCROL	&H80 = 4-line scroll, &H60 = 3-line scroll
&H08D5	2	ELVAD	pointer to the contrast data
&H08D7	1	CSRCN	cursor flash counter
&H08D8	1		cursor flash rate, default value &H5F
&H08D9	1	APOCN	APO counter, current value of the auto power-off timer
&H08DA	1		default value of the auto power-off timer, to be used
			when waiting for a key press
&H08DB	1	RS1	Bit 0: MT/RS232C
			Bit 1: Odd/Even parity
			Bit 2: OFF/ON
			Bit 3: 7/8 data length
			Bit 4: 1 / 2 stop bit
			Bit 5-7:
				000=9600 baud
				001=4800 baud
				010=2400 baud
				011=1200 baud
				100=600 baud
				101=300 baud
				110=150 baud
				111=75 baud
&H08DC	1	RS2	Bit 0: Output while XOFF in progress
			Bit 1: Input while SO in progress
&H08DD	1	RS3	Bit 0: SI/SO control
			Bit 1: XON/XOFF control
			Bit 2: CTS control
			Bit 3: DSR control
			Bit 4: CD control
			Bit 5: Output SO in progress
			Bit 6: Input XOFF in progress
&H08DE	1	RS4	Bit 0: Buffer overflow
			Bit 1: Parity/Overrun
			Bit 2: Framing
			Bit 3: Not ready
&H08DF	1	INTCK	&H01=data receive
&H08E0	258	RXCNT	RS232C, MT receive buffer
			1 Byte = number of received bytes
			1 Byte = input pointer
			256 Bytes = buffer

Keyboard
&H09E2	2	KANA1
&H09E4	1	KEYMD	bit 5: ENG/JAP
			bit 6: CAPS mode
			bit 7: S mode
&H09E5	1	KYSTA	bit 1: keyboard beep enabled
			bit 2: repeat on/off
			bit 4: contrast preset mode
&H09E6	1	CHATA	keyboard debounce counter
&H09E7	1	KEYCM	KO
&H09E8	2	KEYIN	KI
&H09EA	1	KYREP	Key repeat count time
&H09EB	1
&H09EC	1	KYCNT	current number of characters in the keyboard buffer
&H09ED	1		last read position in the keyboard buffer (&H00..&H0F)
&H09EE	1		last write position in the keyboard buffer (&H00..&H0F)
&H09EF	1		size of the keyboard buffer (fixed value &H10)
&H09F0	2		address of the keyboard buffer (fixed value &H09F2)
&H09F2	16		circular keyboard buffer

&H0A02	1	ANSFG	Post calculating flag (1=After calculation, 0=Other)
&H0A03	1	ANGFL	Angle mode (0=DEG, 1=RAD, 2=GRAD)
&H0A04	1		"integer cheating" flag, (1=cheating disabled)
&H0A05	1		tabulation setting (1 to 8)
&H0A06	96	CGRAM	&HF0-&HFF display dot pattern
&H0A66	2		card ROM ID
&H0A68	32	BSYWK	Work
&H0A88	2		counter incremented at every pulse/key interrupt
&H0A8A	9	RND	Random data
&H0A93	5		unused

Pointers to main memory areas
&H0A98	2	IOBF	I/O buffer
&H0A9A	2	SSTOP	begin of the character operation stack, grows upwards
&H0A9C	2	SBOT	end of the character operation stack, grows upwards
&H0A9E	2	FORSK	top of the FOR stack, grows downwards
&H0AA0	2	GOSSK	top of the GOSUB stack, grows downwards
&H0AA2	2	TONDT	top of contents of numeric variables, grows downwards
&H0AA4	2	DTTB	top of variable table, grows downwards
&H0AA6	2	TOSDT	fixed value defined with CLEAR
&H0AA8	2	PDSTD	end of contents if string variables, grows upwards
&H0AAA	2	HIMEM	begin of BASIC files, fixed value defined with CLEAR
&H0AAC	2	BASEN	end of BASIC files, begin of data files, grows upwards
&H0AAE	2	MEMEN	end of data files, grows upwards
&H0AB0	2	DATDI	top of data directory, grows downwards
&H0AB2	2	BASDI	top of BASIC directory, grows downwards
&H0AB4	2	DIREN	end of the directory
&H0AB6	2		begin of the user memory area

&H0AB8	2		default values for RS1, RS3
&H0ABA	2	PRNFG	printer flags tested before and after output of
			character
			Bit 0: BUSY
			Bit 1: ERROR
			Bit 2: ACK
&H0ABC	1	OPTCD	option code
&H0ABD	1	OUTDV	output device, 0=LCD, 2=printer, 4=file
&H0ABE	1	IOSTS	Bit 0: send open
			Bit 1: receive open
&H0AC0	8	ANSAD	ANS data
&H0AC8	1
&H0AC9	2	ONFIL1	preset file address
&H0ACB	2	ONFIL2	preset file address
&H0ACD	2	ONFIL3	preset file address
&H0ACF	2	ONFIL4	preset file address
&H0AD1	12	INPST	Work
&H0ADD	1		bit 0: switch on mode Calc/Menu
&H0ADE	256	CALC	Calc buffer

&H0BE1	257	USPBT	user stack area
&H0CE2	0	USPTP
&H0CE2	2	ACJMP	jump address for BREAK
&H0CE6	32	WORK1

BASIC variable work area
&H0D06	1	VAR1	number of dimensions for an indexed variable
&H0D07	1	VAR2	variable type
			Bit 3:	set if numerical variable
				cleared if string variable
			Bit 7:	set if indexed variable
&H0D08	1	VAR3	variable name length
&H0D09	2	VAR4	pointer to the variable name

&H0D0B	1	MODE	Bit 0: BASIC
			Bit 1: EDIT
			Bit 2: MEMO
			Bit 3: INPUT
			Bit 4: CALC
			Bit 5: SAVE/LOAD
			Bit 6: MENU
&H0D0C	1		Bit 6,5: select sub-menu
				00: [basic ][data  ]...
				01: [name  ][kill  ]...
				10: [set   ][memory]...
&H0D0D	1		During BASIC execution:
				&H00: interactive mode
				&H01: RUN mode
				&H02: STOP mode, CONT possible
			In MENU mode:
				&H00: main menu
				&H06: sub-menu "load"
				&H08: sub-menu "save"
				&H0A: sub-menu "disk"
&H0D0E	2	NOWFL	pointer to the directory entry of currently used file
&H0D10  2	NOWLN	current execution line number
&H0D16	1	NBX1	DRAW-statement work area
&H0D17	1	NBY1	DRAW-statement work area
&H0D18	1	NBX2	DRAW-statement work area
&H0D19	1	NBY2	DRAW-statement work area
&H0D1A	2	ERRFL	Dir adress for ON ERROR enable file
&H0D1C	2	EJPDE	ON ERROR jump destignation pointer
&H0D1E	2	ERRLN	Line number containing error generation
&H0D20	2	ERRDE	Address of statement containing error generation
&H0D22	1	ERRN	Error number
&H0D23	1	EJPFG	&H00=Normal processing, &H01=ON ERROR handling routine
&H0D24	1	TRAFG	&H00=TROFF, &H01=TRON
&H0D25	2	INPER	Return address for INPUT error
&H0D26	72	STAT	STAT data, shares space with INPER
&H0D6E	15	MENUC

&H0D6E (1 byte) - when the screen shows the file list: index of the selected
 file on the screen, 0 when top left item
&H0D6F..&H0D7B (6 words) - when the screen shows the ramdisk file list:
 pointers to the 6 directory entries of the files shown on the screen

&H0D85	2	NOWFC	start adress of current object FCB
&H0D88	35	IOBFO	save/load FCB
&H0D9E	258	IOBUF	SAVE/LOAD I/O buffer
&H0EAD	35		buffer for an I/O control block header
&H0ED5	16	FDDFL
&H0EE5	2	LOADB	Work
&H0EE7	1	MTFL2	segment checksum

&H0EEE	257	SSPBT	system stack area
&H0FEF	0	SSPTP


For each opened file, a control block of following structure is allocated in
the I/O buffer:
&H0000	291		block size in bytes
&H0002	1		handle in range 0..15
&H0003	1		access mode
			&H30 = OUTPUT, &H31 = RANDOM, &H32 = INPUT,
			&H34 = APPEND
&H0004	1		device type
			0 = ramdisk, 1 = FDD, 2 = COM port, 3 = tape
&H0005	11		file name
&H0010	2		pointer to the begin of the data buffer
&H0012	2		pointer to the end of the data buffer
&H0014	1		counter of bytes in the data buffer
&H0015	1		memory overflow flag
&H0016	1		EOF flag (0 = not EOF, &HFF = EOF)
&H0017	2		pointer to the current position in the data buffer
&H0019	1
&H001A	2		record number
&H001C	1		file type
&H001D	2		starting address of the RAM file
&H001F	2		ending address of the RAM file
&H0021	2		pointer to the current position in the RAM file
&H0023	256		data buffer


Memory map of the area between the address &H1000 and the end of RAM

 =========================================	<- pointer &H0AB6
| reserved area for machine code programs |
 =========================================	<- pointer IOBF
| I/O buffer                              |
 -----------------------------------------	<- pointer SSTOP
| character operation stack               |
| (work area for strings)                 |
 -----------------------------------------	<- pointer SBOT
| ...                                     |
| system work free area                   |
| ...                                     |
 -----------------------------------------	<- pointer FORSK
| FOR stack                               |
 -----------------------------------------	<- pointer GOSSK
| GOSUB stack                             |
 -----------------------------------------	<- pointer TONDT
| contents of numeric variables           |
 -----------------------------------------	<- pointer DTTB
| variable table                          |
 =========================================	<- pointer TOSDT	
| contents of string variables            |
 -----------------------------------------	<- pointer PDSTD
| ...                                     |
| character data free area                |
| ...                                     |
 =========================================	<- pointer HIMEM
| BASIC files                             |
 -----------------------------------------	<- pointer BASEN
| data files                              |
 -----------------------------------------	<- pointer MEMEN
| ...                                     |
| file free area                          |
| ...                                     |
 -----------------------------------------	<- pointer DATDI
| data directory                          |
 -----------------------------------------	<- pointer BASDI
| BASIC directory                         |
 =========================================	<- pointer DIREN
