Switching memory.
ZXNet echo conference «code.zx»
From 812/01.14 → To Andrey Senichkin 29 August 1997
A huge friendly greeting to you, Andrey!!!
One day, rattling the keys, numbers somewhere
08/27/97 exactly at 20:47 Andrey Senichkin
wrote to All:
AS> Greetings, dear ALL !!
AS> Since we don’t have echo for dummies
AS> have to write here.
So where else, if on the topic of echo???
AS> Maybe someone can help me: describe the ports
AS> to switch memory on Scorp and write-
AS> there is a program for this.
============ bite line ===================
So, yes. Scorpion's upper memory
distributed next way: eight pages
16 kB in size (16384 bytes), connect-
transferred to the 3rd bank of the processor (address simple
space 0c000h..0ffffh) via standard
port ZX Spectrum-128 07ffdh. Purpose
bit of this port:
D0..D2 - RAM page number;
D3 - switching the address of the start of the screen
areas: 0 - 04000h, 1 - 0c000h;
D4 - ROM switching: 0 - ZX128, 1 - ZX48;
D5 - 0 - does not change anything, 1 - blocks
further port configuration.
Now more details. Page numbers change -
from 0 to 7, with page 2 always
displayed in the 2nd CPU bank (08000h..0bfffh),
and page 5 is in the 1st CPU bank (04000h..07fffh).
In total, we have at our disposal the following
pages: 0, 1, 3, 4, 6, 7.In page 7, the first 6912 bytes may
position the picture, turn on the display
which can be changed by setting bit D3 of port 07ffdh.
Bit D4 is cleared when the extended
BASIC-128 interpreter, so when
the work of user programs this bit
must be installed (sometimes, however,
sometimes it is necessary to use some
other advanced interpretation routines
tator, then this bit is reset).
Bit D5 is set if it is expected
block output to port 07ffdh for pre-
preventing its reconfiguration. This is necessary
for example, for programs that use a buffer
printer (usually a BASIC-128 interpreter
uses the printer buffer as an additional
area for the interrupt routine).
Connect any memory page
very simple:
LD BC,#7FFD ;enter the port address in BC
LD A,%00010000 ;connect
; page number
; 0 and turn it on
; ROM ZX-48
OUT (C),A ;actually output to the port
Before outputting to port 07ffdh, you must
disable interrupts with the DI command, and then
do not forget to resolve them - EI (if, of course,
Yes, they were allowed before).
In hexadecimal number system
the above action is even more
clearly implementable:
LD BC,#7FFD
LD A,#10 ;0th page
OUT(C),Awhile the remaining pages are connected
outputting the following numbers:
#11 - 1st
#13 - 3rd
#14 - 4th
#16 - 6th
#17 - 7th
And in order to “rigidly” switch to the 48th mode,
you need to write the number %00110000 to the port
or 48 in decimal - it’s immediately clear what is needed
48th mode...
Now - "Scorpio" pages. They
all connected to the same address simple-
0c000h..0ffffh, there are also eight of them, but
now they can all be used. Pe-
Switching Scorpion's pages makes a port
01ffdh:
D0 - ROM blocking in the area of the 0th bank of the CPU;
D1 - select Expansion ROM;
D2 - used for output via RS-232C;
D4 - RAM expansion: 0 - pages 0..7,
1 - pages 8..15;
D5 - CENTRONICS strobe.
Bit D0 controls the connection of the ROM to the ad-
in the natural space of the 0th CPU bank
(00000h..03fffh). Installation - and instead of ROM
one of the RAM pages is installed (using
provided by the iS-DOS Chic system).
D1 also controls the ROM, connecting in place
previously located "Scorpio" ROM.
Used, for example, to determine
versions of the Shadow Service Monitor.
D4. Now we have reached this level.
It connects in place of the 3rd CPU bank
page with number "pg+8", where pg - country
nitsa established earlier by output to the port
07ffdh. In other words, to establish
for example, the tenth bank of RAM, you need to execute
next program:
LD BC,#7FFD
LD A,#12 ;10 - 8 = 2OUT(C),A
LD B,#1F ;BC = #1FFD
LD A,#10
OUT(C),A
and to remove the standard configuration,
you need to do:
LD BC,#7FFD
LD A,#10
OUT(C),A
LD B,#1F
XOR A ;A = 0
OUT(C),A
And don't forget about interruptions!
============ bite line ===================
AS> Thanks in advance!!!
You're welcome... ;-)
Best regards, Yuri.
-+- iS-DOS v4.5 with macro
From 812/03.08 → To Andrey Senichkin 29 August 1997
Hello Andrey!!!
One hot summer evening,
like 08/27/97, exactly at 20:47 Andrey Se-
nichkin wrote to All on the topic 'Perek-
Losing memory.':
AS> Maybe someone can help me: describe the ports
AS> to switch memory on Scorp and write-
AS> there is a program for this.
Yes, in general, there’s nothing to switch here,
just take and set the D4 bit to
port #1FFD, and you get a page-
the one with the number 8 is larger than it was. Hap-
For example, there was 0 page, now - 8; was -
2, became 10.
For example, you need to set page 10:
PAGE LD A,#12 ; turns on 2 pages.
LD BC,#7FFD
OUT(C),A
LD B,#1F ; turns on 10 pages.
LD A,#10
OUT(C),A
RET
That's all ;)
AS> Thanks in advance!!!
Yes please ;)
With best wishes, Dmitry.
-+- Board 4.5 meters long