Nicron #20
14 февраля 1997

Programming - a course of study assembler Wlodek Black, continued. Organization of memory.

<b>Programming</b> - a course of study assembler Wlodek Black, continued. Organization of memory.
                                                           z80


[Continued]

(C) WLODEK BLACK

Hello, friends! Ended with the main "course" of assembler
including a description of the CPU and the system's commands, 
and ... showered with questions and requests. And it is 
remarkable, because the presence of response confirms being 
wanted rubric "assembler"; mean, you my friends find it useful 
to himself; hence will continued. And then, why yes I am I? 
Maybe someone from the experienced programmers also willing to 
share fresh "secrets"? Then write or call. And users are - also 
write! Your questions - our answers. And for today's busy you 
are, my friends my chosen topic:


    Organization of memory in your computer "Spectrum 128K.

With the proposal to consider this topic has received 4 bids. 
(3 questions came on the device monoblock loader, when the 
whole program outwardly looks like a BASIC file nemerenoe length

and data compression - how to shrink the digital DeMouy, for 
example). About monozagruzchike talk in a week!




                                          7
                                        $ 6
                                      4
    -------- 3
65535 FFFF 1
                 RAM 16K 0 <- port # 7FFD
49152 C000 (bits 2 .. 0)
    ------- BFFF
                 RAM 16K 2
32768 8000
    ------- 7FFF
                 RAM 16K 5
16384 4000 $
    ------- 3FFF 0 <- port # 7FFD
                 ROM 16K 1 * (bit 4)
0 0000 *
    -------
This diagram shows the distribution of address space
128K, or, equivalently, a map of 128-th machine. Computer 
memory is divided into fragments with a volume of 16K, called 
pages. Pages 2 and 5, always included at the addresses, and in 
the range of addresses # C000 .. # FFFF may be one of 6 pages - 
0,1,3,4,6 or 7B address range # 0000 .. # 3FFF includes one of 
two ROM - BASIC-48 or Beysik128. Switches to the memory card by 
using the system configuration register included software as an 
output port with address # 7FFD (32,765). That the appointment 
of its digits: 


                                                         Port

  - - Block. ROM Display page number RAM # 7FFD

               48K 48/128 in # C000 ... # FFFF <----

   D7 D6 D5 D4 D3 D2 D1 D0

D0 .. D2 - RAM page number to be included at the following 
addresses # C000 .. # FFFF; D3 - the location of the screen: 0 
- with # 4000 at page 5,                  1 - with # C000 at 
page 7; D4 - which ROM is included with # 0000 to # 3FFF: 0 - 
BASIC-128;                         1 - BASIC-48;

D5 - Bit Block 48K.

Now the explanation: bits D4 sets displayed on the screen area -
at 0 normal screen, as in the 48 th car, with a displayed page 
7, and the "top" as they say, the screen is displayed, even 
when the 7 th page is not included in the memory card! Bit D5 - 
lock mode "48K." It is necessary to set this bit to 1, the 
computer will turn into a 48-car, and back have not come back 
(only RESET)! If you call "USR" in port # 7FFD recorded the 
number of 16 - bit by bit is% 00010000, that is included ROM 
48K, 0-th page and main screen. This configuration is 
considered fundamental, and when you happen to hear the 
expression "to include the main memory, it would mean just 
that, in the language BASIC, OUT 32765,16. If the active 
BASIC-128 switch card through OUT not succeed, since the 
BASIC-128 itself operates with it. To obtain freely manipulate 
the pages you want to get rid 128 th BASIC that can be 
achieved, for example, start the computer via the reset mode TR 
DOS, or issue the command from the USR 0 128 th BASIC. But the 
best fit for this purpose a special procedure, native, which is 
"on track" defang 128 th Basic and translate the program 
execution in the 48 th mode, but without blocking the system 
configuration register. Here is its text: 

    DI
    LD SP, (23613); ERR_SP - a stack of return by mistake
    POP HL; remove the old value
    LD HL, 4867, addressed to the entrance to the main loop 
BASIC-48     PUSH HL; record in the stack to its original 
location     LD HL, 7030, the return address of the USR in the 
48 th BASIC     PUSH HL

    LD HL, 23611; FLAGS - a system variable
    RES 4, (HL)
    LD HL, (23631); address information channels
    LD BC, 15; offset to address channel klav. / screen
    ADD HL, BC
    LD DE, 5556, and the address of the sample channel 
information in the 48K     EX DE, HL

    LD C, 4; BC = 4 - number of bytes sent
    LDIR; channel keyboard / screen is initialized to 48K
    EI
    RET; there will already be working BASIC-48.

The fact, which may require such "otvyazka, we'll talk
The next time you pack together and ozagruzchim DeMouy from 
under DIGITAL STUDIO. An example would be a bright and 
distinctive! Mail us!


[To be continued].






Other articles:

Entry - the epigraph and maintenance facilities.

BBS - list of stations BBS ZXNet.

Iron - an overview of the microprocessor Zilog Z380, continued.

Programming - a course of study assembler Wlodek Black, continued. Organization of memory.

Humor - anecdotes.

Humor - Small Encyclopedia of Computer beings, Antonov and Maverick, a sequel.

Search - search for game programs.

Humor - State man, history.

Humor - 1001 question about it.

Advertising - advertising and announcements.

Feedback - contact the publisher.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Polygon - On a computer Sprinter.
Fun Top'98 - Notes party.

В этот день...   21 November