Special variables: Difference between revisions

Content deleted Content added
{{header|ZX Spectrum Basic}}
{{header|ZX Spectrum Basic}}
Line 350:
=== {{header|ZX Spectrum Basic}} ===
 
The ZX Spectrum uses single letter variables names. None of these are special variables. There are a set of system variables held at a fixed memory addresses, which can be accessed via PEEK and POKE functions. The system variables and addresses are:
 
23552 KSTATE - Keyboard state.
23560 LAST K - Newly pressed key.
23561 REPDEL - Delay (in 50ths of a second) before keyboard starts repeating.
23562 REPPER - Delay (in 50ths of a second) between keyboard repetions.
23563 DEFADD - Address of arguments for a user defined function.
23565 K DATA - Second byte of colour controls sequences from keyboard.
23566 TVDATA - Colour and location information for television set.
23568 STRMS - Addresses of channels attached to streams.
23606 CHARS - 256 less than the address of the current character set
23608 RASP - Length of the warning buzz.
23609 PIP - Length of the keyboard click.
23610 ERR NR One less than the error code and starts at 255 (for -1)
23611 FLAGS - Various flags to control the BASIC system.
23612 TV FLAG - Flags associated with the television output.
23613 ERR SP - Address of item on machine stack to be used as error return.
23615 LIST SP - Return address from automatic listing.
23617 MODE - Cursor type
23618 NEWPPC - Line number to be jumped to.
23620 NSPPC - Statement number in line to be jumped to
23621 PPC - Line number of statement currently being executed.
23623 SUBPPC - Statement number within the line that is currently being executed.
23624 BORDCR - Colour of the border (overscan area) and input area (times 8)
23625 E PPC - Current line number (for list editing)
23627 VARS - Address of the variables.
23629 DEST - Address of variable in assignment.
23631 CHANS - Address of channel data.
23633 CURCHL - Address of information being used for input and output.
23635 PROG - Address of the BASIC program.
23637 NXTLIN - Address of the next line in the program.
23639 DATADD - Address of terminator of the last DATA item.
23641 E LINE - Address of command being typed in.
23643 K CUR - Address of the cursor.
23645 CH ADD - Address of the next character to be interpreted
23647 X PTR - Address of the character after the syntax error marker.
23649 WORKSP - Address of temporary work space.
23651 STKBOT - Address of bottom of calculator stack.
23653 STKEND - Address of start of free space.
23655 BREG - The B register of the calculator.
23656 MEM - Address of area used for calculator memory.
23658 FLAGS2 - Miscellaneous flags.
23659 DF SZ - The number of lines in the input area.
23660 S TOP - The number of the top program line in automatic listings.
23662 OLDPPC - Line number to which CONTINUE jumps.
23664 OSPPC - Number within line of statement to which CONTINUE jumps.
23665 FLAGX - Various flags.
23666 STRLEN - Length of string type destination in assignment.
23668 T ADDR - Address of next item in the syntax table.
23670 SEED - The random number seed.
23672 FRAMES - A 3 byte frame counter incremented every 20ms.
23675 UDG - Address of the user defined graphics
23677 COORDS Coordinates of the last point plotted.
23679 P POSN - Column number for the position of the printer carriage.
23680 PR CC - Address of next free position in the printer buffer.
23682 ECHO E - Column and line number positions in the input buffer.
23684 DF CC - Display address for the current print position.
23686 DFCCL - Display address in the input area.
23688 S POSN - Column and row number of the print position.
23690 SPOSNL - Column and row number for the print position in the input area.
23692 SCR CT - Scroll counter - Number of lines left before stopping with Scroll?
23693 ATTR P - Permanent current colours attributes
23694 MASK P - Permanent current colour attribute mask
23695 ATTR T - Temporary current colour attributes
23696 MASK T - Temporary current colour attribute mask
23697 P FLAG - More flags.
23698 MEMBOT - Memory area address used by the calculator
23728 NMIADD - The address of the users Non Maskable Interrupt service routine. 23730 RAMTOP - Address of last byte of BASIC system area.
23732 P-RAMT - Address of last byte of physical RAM.
 
<lang zxbasic>10 PRINT "The border colour is "; PEEK (23624): REM bordcr