Created
May 3, 2024 09:48
-
-
Save shadwork/450ad97258508f76170844255d929b6d to your computer and use it in GitHub Desktop.
ZX-Spectrum System variables C header for Ghidra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct SYS_VAR { /* STANDARD 48K SPECTRUM SYSTEM VARIABLES */ | |
| byte KSTATE[8]; /* Used in reading the keyboard. */ | |
| byte LASTK; /* Stores newly pressed key. */ | |
| byte REPDEL; /* Time (in 50ths of a second that a key must be held down before it repeats. This starts off at 35,but you can POKE in other values. */ | |
| byte REPPER; /* Delay (in 50ths of a second between successive repeats of a key held down - initially 5. */ | |
| word DEFADD; /* Address of arguments of user defined function (if one is being evaluated), otherwise 0. */ | |
| byte K_DATA; /* Stores 2nd byte of colour controls entered from keyboard. */ | |
| word TVDATA; /* Stores bytes of colour,AT and TAB controls going to TV. */ | |
| word STRMS[19]; /* Addresses of channels attached to streams &FD to &0F. */ | |
| word CHARS; /* 256 less than address of character set (which starts with space and carries on to (C)). Normally in ROM,but you can set up your own in RAM and make CHARS point to it. */ | |
| byte RASP; /* Length of warning buzz. */ | |
| byte PIP; /* Length of keyboard click. */ | |
| byte ERRNR; /* 1 less than the report code. Starts off at 255 (for -1 so 'PEEK 23610' gives 255. */ | |
| byte FLAGS; /* Various flags to control the BASIC system. b7 b6 String/numeric variable b5 New key in LASTK b4 [32 char display/64 char display] b3 Input in K mode/L mode b2 Print in K mode/L mode b1 Output to printer [text/raw centronics] b0 Leading spaces/no leading spaces */ | |
| byte TVFLAG; /* Flags associated with the TV. b7 b6 b5 Clear lower screen on keypress b4 Automatic listing b3 Mode changed b2 b1 b0 */ | |
| word ERRSP; /* Address of item on machine stack to be used as error return. */ | |
| word LISTSP; /* Address of return address from automatic listing. */ | |
| byte MODE; /* Specifies 'K','L','C','E' or 'G' cursor. */ | |
| word NEWPPC; /* Line to be jumped to. */ | |
| byte NSPPC; /* Statement number in line to be jumped to. Poking first NEWPPC and then NSPPC forces a jump to a specified statement in a line. */ | |
| word PPC; /* Line number of statement currently being executed. */ | |
| byte SUBPPC; /* Number within line of statement currently being executed. */ | |
| byte BORDCR; /* Border colour multiplied by 8; also contains the attributes normally used for the lower half of the screen. */ | |
| word E_PPC; /* Number of current line (with program cursor). */ | |
| word VARS; /* Address of variables. */ | |
| word DEST; /* Address of variable in assignment. */ | |
| word CHANS; /* Address of channel data. */ | |
| word CURCHL; /* Address of channel currently being used for input and output. */ | |
| word PROG; /* Address of BASIC program. */ | |
| word NXTLIN; /* Address of next line in program. */ | |
| word DATADD; /* Address of terminator of last DATA item. */ | |
| word E_LINE; /* Address of command being typed in. */ | |
| word K_CUR; /* Address of cursor. */ | |
| word CH_ADD; /* Address of the next character to be interpreted - the character after the argument of PEEK,or the NEWLINE at the end of a POKE statement. */ | |
| word X_PTR; /* Address of the character after the [] marker. */ | |
| word WORKSP; /* Address of temporary work space. */ | |
| word STKBOT; /* Address of bottom of calculator stack. */ | |
| word STKEND; /* Address of start of spare space. */ | |
| byte BREG; /* Calculator's B register. */ | |
| word MEM; /* Address of area used for calculator's memory (usually MEMBOT,but not always). */ | |
| byte FLAGS2; /* More flags. b7 [Default tokeniser ignore case] b6 [Default tokeniser no abbreviations] b5 [Default tokeniser enforce separators] b4 Output using channel 'K' b3 CAPS LOCK on b2 Parsing within quotes b1 Printer buffer not empty b0 Screen is clear */ | |
| byte DFSZ; /* The number of lines (including one blank line in the lower part of the screen. */ | |
| word S_TOP; /* The number of the top program line in automatic listings. */ | |
| word OLDPPC; /* Line number to which CONTINUE jumps. */ | |
| byte OSPPC; /* Number within line of statement to which CONTINUE jumps. */ | |
| byte FLAGX; /* Various flags. b7 INPUT LINE b6 String result b5 INPUT b4 b3 b2 b1 New variable b0 Sliced string/simple string */ | |
| word STRLEN; /* Length of string type destination in assignment. */ | |
| word T_ADDR; /* Address of next item in syntax table, with file operations set to 0=SAVE,1=LOAD,2=VERIFY,3=MERGE */ | |
| word SEED; /* The seed for RND. This is the variable that is set by RANDOMIZE. */ | |
| byte FRAMES[3]; /* 3-byte (least significant byte first), frame counter incremented every 20ms. */ | |
| word UDG; /* Address of first user-defined graphic. You can change this,for instance,to save space by having fewer user-defined characters. */ | |
| byte COORDX; /* X-coordinate of last point plotted. */ | |
| byte COORDY; /* Y-coordinate of last point plotted. */ | |
| byte P_POSN; /* 33-column number of printer position. [Current default device,'T' or '1'-'8'] */ | |
| word PRCC; /* Full address of next position for LPRINT to print at (in ZX printer buffer). Legal values 5B00 - 5B1F. [Not used in 128K mode or when certain peripherals are attached] [NMIADD on some systems] */ | |
| word ECHO_E; /* 33-column number and 24-line number (in lower half of end of input buffer. */ | |
| word DFCC; /* Address in display file of PRINT position. */ | |
| word DFCCL; /* Like DFCC for lower part of screen. */ | |
| byte S_POSNX; /* 33-column number for PRINT position. */ | |
| byte S_POSNY; /* 24-line number for PRINT position. */ | |
| word SPOSNL; /* Like S_POSNX S_POSNY but for lower part. */ | |
| byte SCRCT; /* Counts scrolls - it is always 1 more than the number of scrolls that will be done before stopping with 'scroll?'. If you keep poking this with a number bigger than 1,say 255, or with SET 7,(IY+82),the screen will scroll on and on without asking you. */ | |
| byte ATTRP; /* Permanent current colours,etc.,(as set up by colour statements). */ | |
| byte MASKP; /* Used for transparent colours,etc. Any bit that is 1 shows that the corresponding attribute bit is taken not from ATTRP,but from what is already on the screen. */ | |
| byte ATTRT; /* Temporary current colours,etc.,(as set up by PRINT colour items). */ | |
| byte MASKT; /* Like MASKP,but temporary. */ | |
| byte PFLAG; /* Print flags. b7 PAPER 9 permanent setting b6 PAPER 9 current setting b5 INK 9 permanent setting b4 INK 9 current setting b3 INVERSE permanent setting b2 INVERSE current setting b1 OVER permanent setting b0 OVER current setting */ | |
| byte MEMBOT[30]; /* Calculator's memory area - used to store numbers that cannot conveniently be put on the calculator stack,and as miscellaneous workspace. */ | |
| word NMIADD; /* Holds the address of the user's NMI service routine. NOTE - On previous machines,this did not work correctly and these two bytes were documented as 'Not used.' Programs that use these two bytes for passing values may need to be modified. With the Interface 1 this has been reused as: 1,5CB0,23728,IY+118 PRCOL,RS232 text output column 1,5CB1,23729,IY+119 WIDTH,RS232 text output width */ | |
| word RAMTOP; /* Address of last byte of BASIC system area. */ | |
| word PRAMT; /* Address of last byte of physical RAM. */ | |
| word CHANS_ST; /* Start of CHANS when no Interface 1 active. */ | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment