Studies - Program - cataloger of disks.

ZX Review #7-8-9-10
(C) Kettle, Len.obl., P.Sovetsky


   I have long hesitated to write
you. But here is at an impasse, I
simply no one with whom to consult.
Everyone I know and who has the Spectrum, not moving
more toys. I took Basic and now trying his hand at
assembler. I subscribed to the second year of your magazine 
"ZX-Revue" and I think that your face has found a better 
companion and teacher. AND Now I ask to help.


   The fact that I have long sought
normal cataloger. But to no avail - one "hangs", the other does 
not sort, and the third is not looking program does not mark 
the fourth, etc. Then I undertook to write himself. Program I 
wanted to do as convenient and as they say, friendly, moreover, 
with auto-search on the disk. That even a first grader could it 
unprompted use. 

   The point seems to be gone. I have guides on memory, written 
procedures, designated buffer, almost finished

logical part of ... But I
found that 48 KB of memory (with program) I have enough for
processing only a 16-20 drive. Want to be treated not
BASIC-only blocks, and all the files, or to choose from - 
whatever. And I should add that I have more 50 floppy disks 
(bought wholesale from the former sinklerista, peresevshego on 
IBM), and on this I'm not going stop.


   But, you see, it's funny -
load data from disk in parts and not use all the memory - 256 
KB! Yes, yes, yes. I went to the chief - I

Scorpion! But I, to my great shame and to the great chagrin,
do not know how to use this miracle machine, "one hundred 
percent." Neither BASIC, no codes. Read

a bunch of literature and everywhere ran to the mysterious 
hints of port # 7FFD. Sorry, the experiment failed - my GENS-4D 
is not accepts commands with full decoding of the output port. 
There have I still TASM 4.0, but the reason not to ship the 
object code. Through shadow monitor too

tried to encode directly to memory, but disassemble their
Codes can only see OUT (# FD), A.
What should I do? The books and pamphlets
This theme is so concise and contradictory, that I utterly 
confused. In addition, there are three mode 128beysika 
podprogrammki sharing of memory pages, but here

question - how to use them?

   Dear Editors, I hope you
understood my difficulties and will not disregard my question.
I would greatly appreciate it. Tell me whether you can organize 
data processing in a loop from one bank of RAM to the transfer 
of results to another? Which banks and at what addresses can be 
set? How is it done from BASIC and from native code? What 
Conflicts provide? Of course, I was primarily interested in the 
Scorpion-256. 

   Now some will tell you about
my idea Autosearch files
data. When you log into the program directory it asks for the 
current date: 6 digits, or you can organize a menu interface

and obvious choice of dates, having as a result all the same 6 
digits. When you reset the data file on disk

These figures will be included in the file name automatically. 
The next time you start the program will not have to remember 
the file name or date - The program itself will find it by

the principle of "more-less", the only - after 1999 must
will replace the floppy.

   Well, perhaps that's all. I will
hopefully waiting for your response
as well as help other readers best magazine "ZX-REVIEW!


   Prim Ed.: Yes, sooner or later someone
had to ask a similar question. And now
finally have a reason to fully illuminate the pages of our 
magazine to work with pages. Let's start from the beginning. In

all machines with 128 KB of RAM is present
expansion port with address # 7FFD. Its structure is as follows:

Bits

 7 - not used
 6 - not used
 5 - latch. When writing to this bit 1 port

     blocked. This is necessary for the transition
     water machine in the 48 kb mode. Currently locked
     SC can only be removed to reset button

     Reset.
 4 - Select ROM. When recorded there 0 -

     imprinted ROM BASIC-48. If there

     record 1, then the imprinted ROM Bay
     Sika-128 and simultaneously blocked

     the inclusion of there ROM TR
     DOS. This is needed because at addresses

     # 3D00 - # 3DFF in this ROM is

     program. When the ROM Basie
     ka-48 lock TR-DOS withdrawn.
 3 - selection screen. These machines have two

     screen area. 0 - is the standard

     screen with the address # 4000. 1 - second equivalent
     wounds, located in the bank 7. It can

     be printed with the address # C000. His

     structure is identical to the usual
     nym.
 2 - Selection of pages of RAM. Page with a given
     nym number (0-7) is imprinted with

     Address # C000. But! Pages with index
     ramie 2 and 5 are also fixed on
     hodyatsya addresses: 2 - # 8000, 5 -

     # 4000. Ie 0 screen essentially

     is in page 5. Thus,
     Thus, when dealing with the extended parameter
     myatyu should circumvent these pages

     because they already used.


   But, as you may have noticed, 8 pages
16 KB - is 128 KB. But Scorpio 256 KB.
What about the rest of memory? To do this in Scorpio introduced 
yet another expansion port, which was not in the 128th 
machines. His address - # 1FFD. That's what its structure:


Bits

 7 - not used
 6 - not used
 5 - gating Centronix. This signal

     used with the printer.

     Short-term setting it to 1 st
     vorit printer that it tread
     whether the data.
 4 - The most important bit. With his help and yn
     ravlyaetsya additional memory. If

     it is set to 0, then by port # 7FFD

     switch to page 0 - 7, when

     it is set to 1, then switch

     page 8 - 15. Total 256 KB. Only

     it should be noted that the eighth page

     used shadow monitor. If

     zaportit its contents, the monitor

     will not work, and pressing
     tiyu Magic machine just freezes.
 3 - output RS232, through the bit transfer
     data are available for some types of prints
     moat.
 2 - not used
 1 - setting this bit to 1 causes

     that bit 4 port # 7FFD stops

     work, and is imprinted with the address 0

     Shadow ROM monitor. Setting this
     th bit to 0 will return all the places.
 0 - A very interesting thing. When filed

     there 1 with address 0 is imprinted zero
     curve page of RAM. Very useful for

     test your ROM version as well
     same with it, you can not get
     mediocre access to ports VG93!

     The idea of ​​this. We set this bit

     to 1 and make the transition to the address in the range
     tral range # 3D00 - # 3DFF. Work logs
     spacecraft controller, which should substitutions
     Thread ROM TR-DOS, and then switch
     you. Ports of a switch, and a ROM

     does not work ... And before we get into
     preliminarily prepared program

     which has full access to ports

     VG93 as long as management does not

     leaves the address # 3FFF. In the transition

     this limit, the ports on the switch
     versa. Setting this bit to 0 ver
     not all in order.


   So, give an example of the procedure are imprinted with the 
address # C000 page number where (0-15) you put in the register 
A: 140.


        PUSH AF; save the page number

        AND # 07; distinguish the lower bits

        OR # 10, to include ROM 3beysika-48

        LD BC, # 7FFD; install the port # 7FFD

        OUT (C), A

        POP AF; restore the page number

        AND # 08; distinguish the MSB.

                      And He is the number of pages.

        RLA; in the port it will be 4 bits, not 3.

        LD B, # 1F; change the port address at # 1FFD

        OUT (C), A; set the port # 1FFD.
2

   Naturally, the stack and the procedure itself is not
should be higher than # C000. Please
attention to the command OUT (C), A! Obviously,
have you tried to dial OUT (# 7FFD), A. This
teams do not. Port address in this command -
only one byte. To access the port,
whose address is specified by two bytes, we must
use the command OUT (C), A, downloading
pre-addressed to a port in BC.

   Now, how to work from BASIC.
Exactly the same. In principle, BASIC generally not suited for 
working with pages. BASIC-128 uses them only as Ram-drive and 
an additional buffer. Those routines, which you mentioned, it 
is absolutely useless. They are used by BASIC-128 for the 
exchange of ROM when calling routines from BASIC-48. Attention! 
These routines control is transferred also to interrupt, if 
enabled ROM beysika128. So, do not type in it at interrupt 
enable, if you're not sure their presence. This can occur if you

ran from 48 th BASIC. A better
do not touch it, because there is nothing useful there.

   For the same reason there is another nuance.
If you switch ports from BASIC, then
before you send value to port
# 7FFD, sure to put him in a cell
# 5B98. Without it, you can not switch
page - the first returns on the same interrupt
place the old one. The same applies to
assembler, if you decided to get into
ROM 128 of BASIC at interrupt enable. Though it better not mess
when working with the port # 1FFD. ROM BASIC-128
unaware of its existence and very
surprised when the on-site 7 page which uses it to store some
its variables, suddenly turns out to be 15. Here
like all we can say on this
occasion.


          *