トップ 差分 一覧 ソース 検索 ヘルプ RSS ログイン

ZX Spectrum

ZX Spectrum

 Memory Map

Address Size
$0000 $4000 ROM 0/1
$4000 $4000 Screen (Bank 5)
$8000 $4000 RAM (Bank 2)
$c000 $4000 Bank 0~7
LD      A,(0x5b5c)      ;Previous value of port
AND     0xf8
OR      4               ;Select bank 4
LD      BC,0x7ffd
DI
LD      (0x5b5c),A
OUT     (C),A
EI

Screen

Address Size
$4000 $1800 VRAM
$5800 $300 Attributes
$5b00 $100 Printer Buffer
$5c00 System Variables
$5cbb Micro Drive Map

48/+

Adres lub zmienna	Adres zmiennej	Pocz. wartość zmiennej	Obszar	Uwagi
0			 ROM	Adresy w zapisie dziesiętnym
14446			 ROM	"Dziura" - obszar wypełniony wartościami 255
15616			 ROM	generator znaków
16384			Pamięć ekranu
22528			Atrybuty
23296			Bufor drukarki
23552			Zmienne systemowe	Dokładny opis w osobnej tabelce
23734			Mapa microdrive'u
CHANS	23631	23734	Informacja o kanałach	Znacznik końca: 80h
PROG	23635	23755	Program w BASIC-u	Początek systemu BASIC
VARS	23627		Zmienne BASIC-a	Znacznik końca: 80h
E_LINE	23641		Obszar (bufor) edytora BASIC-a	Na końcu obszaru są 2 bajty: 0Dh i 80h
WORKSP	23649		Bufor instrukcji INPUT	Znacznik końca: 0Dh
Za nim jest chwilowa przestrzeń pracy
STKBOT	23651		Stos kalkulatora	
STKEND	23653		Wolny obszar pamięci	
rejestr SP
(wskaźnik stosu)			Stos maszynowy	Wykorzystwany przez mikroprocesor
ERRSP	23613		Stos instrukcji GO SUB	To jest ostatni obszar systemu BASIC
RAMTOP	23730	65367	Miejsce na kod maszynowy	Znacznik końca: 3Eh
UDG	23675	65368	Grafika definiowana	Np. na polskie znaki
P_RAMT	23732	65535	Koniec pamięci

 I/O

  • IN:Reads keys (bit 0 to bit 4 inclusive)
Address bit0 bit1 bit2 bit3 bi4
0x7ffe SPACE SYM SHFT M N B
0xbffe ENTER L K J H
0xdffe P O I U Y
0xeffe 0 9 8 7 6
0xf7fe 1 2 3 4 5
0xfbfe Q W E R T
0xfdfe A S D F G
0xfefe SHIFT Z X C V

 System Variables

System Variable Name Address Description Default
CHARS ($5c36) font data ($20~$ff) $3c00
CHANS $5C4F Channel Information
PROG ($5c53) Basic Program $5ccb
VARS $5C4B Variables
E_LINE $5C59 Command line being edited
WORKSP $5C61 Data being input
STKBOT $5C63 Calculator stack
STKEND $5C65 Spare
sp - Machine stack and Gosub stack
RAMTOP $5CB2 User machine-code routines
UDG $5C7B User-defined graphics
P_AMT $5CB4 End of Ram
N8  23552   KSTATE      Used in reading the keyboard.
N1  23560   LAST K      Stores newly pressed key.
1   23561   REPDEL      Time (in 50ths of a second - in 60ths of a second in N. America) that a key must be held down before it repeats. This starts off at 35, but you can POKE in other values.
1   23562   REPPER      Delay (in 50ths of a second - in 60ths of a second in N. America) between successive repeats of a key held down - initially 5.
N2  23563   DEFADD      Address of arguments of user defined function (if one is being evaluated), otherwise 0.
N1  23565   K DATA      Stores 2nd byte of colour controls entered from keyboard.
N1  23566   TVDATA      Stores bytes of colour, AT and TAB controls going to TV.
X38 23568   STRMS       Addresses of channels attached to streams.
2   23606   CHARS       256 less than address of character set (which starts with space and carries on to the copyright symbol). Normally in ROM, but you can set up your own in RAM and make CHARS point to it.
1   23608   RASP        Length of warning buzz.
1   23609   PIP         Length of keyboard click.
1   23610   ERR NR      1 less than the report code. Starts off at 255 (for -1) so PEEK 23610 gives 255.
X1  23611   FLAGS       Various flags to control the BASIC system.
X1  23612   TV FLAG     Flags associated with the television.
X2  23613   ERR SP      Address of item on machine stack to be used as error return.
N2  23615   LIST SP     Address of return address from automatic listing.
N1  23617   MODE        Specifies K, L, C, E or G cursor.
2   23618   NEWPPC      Line to be jumped to.
1   23620   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.
2   23621   PPC         Line number of statement currently being executed.
1   23623   SUBPPC      Number within line of statement currently being executed.
1   23624   BORDCR      Border colour * 8; also contains the attributes normally used for the lower half of the screen.
2   23625   E PPC       Number of current line (with program cursor).
X2  23627   VARS        Address of variables.
N2  23629   DEST        Address of variable in assignment.
X2  23631   CHANS       Address of channel data.
X2  23633   CURCHL      Address of information currently being used for input and output.
X2  23635   PROG        Address of BASIC program.
X2  23637   NXTLIN      Address of next line in program.
X2  23639   DATADD      Address of terminator of last DATA item.
X2  23641   E LINE      Address of command being typed in.
2   23643   K CUR       Address of cursor.
X2  23645   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.
2   23647   X PTR       Address of the character after the [?] marker.
X2  23649   WORKSP      Address of temporary work space.
X2  23651   STKBOT      Address of bottom of calculator stack.
X2  23653   STKEND      Address of start of spare space.
N1  23655   BREG        Calculator's b register.
N2  23656   MEM         Address of area used for calculator's memory (usually MEMBOT, but not always).
1   23658   FLAGS2      More flags.
X1  23659   DF SZ       The number of lines (including one blank line) in the lower part of the screen.
2   23660   S TOP       The number of the top program line in automatic listings.
2   23662   OLDPPC      Line number to which CONTINUE jumps.
1   23664   OSPPC       Number within line of statement to which CONTINUE jumps.
N1  23665   FLAGX       Various flags.
N2  23666   STRLEN      Length of string type destination in assignment.
N2  23668   T ADDR      Address of next item in syntax table (very unlikely to be useful).
2   23670   SEED        The seed for RND. This is the variable that is set by RANDOMIZE.
3   23672   FRAMES      3 byte (least significant byte first), frame counter incremented every 20ms.
2   23675   UDG         Address of first user-defined graphic. You can change this, for instance, to save space by having fewer user-defined characters.
2   23677   COORDS      x and y coordinate of last point plotted.
1   23679   P POSN      33-column number of printer position.
X2  23680   PR CC       Address of next position for LPRINT to print at (in printer buffer).
2   23682   ECHO E      33-column number and 24-line number (in lower half) of end of input buffer.
2   23684   DF CC       Address in display file of PRINT position.
2   23686   DFCCL       Like DF CC for lower part of screen.
X2  23688   S POSN      33-column number and 24-line numer for PRINT position.
X2  23690   SPOSNL      Like S POSN for lower part.
1   23692   SCR CT      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), the screen will scroll on and on without asking you.
1   23693   ATTR P      Permanent current colours, etc., (as set up by colour statements).
1   23694   MASK P      Used for transparent colours, etc. Any bit that is 1 shows that the corresponding attribute bit is taken not from ATTR P, but from what is already on the screen.
N1  23695   ATTR T      Temporary current colours, etc., (as set up by colour items).
N1  23696   MASK T      Like MASK P, but temporary.
1   23697   P FLAG      More flags.
N30 23698   MEMBOT      Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.
2   23728   NMIADD      Holds the address of the users NMI service routine. Will cause reset if zero and NMI activated by a peripheral. Logic reversed on Spectrum +3. Also used by Interface 1 to vary print width on RS232 text channel
2   23730   RAMTOP      Address of last byte of BASIC system area.
2   23732   P-RAMT      Address of last byte of physical RAM.

 Attributes

  • $5800~$5aff ($300)
bit7 bit6 bit5-3 bit2-0
flash bright color 0 color 1
0 1 2 3 4 5 6 7
Black Blue Red Magenta Green Cyan Yellow White

Last modified 2012-05-10 18:58:00