Insanity #01
20 июля 1999

RAM Project - considerations Zetter'a of RAM Disk'e.

<b>RAM Project</b> - considerations Zetter'a of RAM Disk'e.
  (R) Surv! V0r



          EeЄєЇїЎў ° ∙ · √ № ¤ ■ RAM PROJECT ■ ¤ № √ · ∙ ° 
ўЎїЇєЄeE 



    Today in our room, we will present you with the opportunity
acquainted with the project Zetter'a (author's well-known and 
popular program SSO1.0) "Menedzher upper memory." The system 
contained the material is fairly spetsifichina and 
time-consuming for acquaintance with it. Published in the SC # 
1 article, and program Flying'a on the same issue will help you 
compare these two System Ram Disk'a. Their implementation of 
the program, or even possible say "core" nashlo (a) only on 
paper. In principle itself ideas should be ponyatnymi.Po 
Zetter'a own words, this tools will make soon a new version

program SSO.


  (C) Zetter


             Memory Manager for 128/1024k Mashines

              Project Version 0.5 (c) Zetter 1999

Technical info:
Max Memory: 1024k
Max Work Memory: 512k (inside VirtMem)
Max Special Memory: 512k (used for special bloks and free use)
Max Bloks: 256 bloks
Max Free Bytes: 512k bytes for programs and data + 480k for spe
                cial use
Max Continuous mem available: 16128 bytes
Max Continuous Mem available in special mode: 16384 bytes


                             Page Map

   49152 65408 65535


  n 16256 128


   Catalog page
65408: START CATALOGUE

      +0: ​​B - unit (LUN)

      +1: \ "MMv0.50"

      +7: /
65416: BLOK TABLE F

  (+0) +8: B - the block number (0 - free) / - ^ - \

  (+1) +9: B - blok flag: 0 - free

                        1 - (M) emory X V S P M

                        2 - (P) rogram

                        4 - (S) prite 7 6 5 4 3 2 1 0

                        7 - (F) ull blok

                     +128 - Fi (X) ed unit, fixed at this

                             page

                     + 64 - (V) irtual memory blok

              Program blocks are fixed on the page and fdresu

              Fixed units are fixed only on the page

  (+4) +10: W-addr in page

  (+2) +12: W-blok lenght (if flag = 4 then Xlen, Ylen)

  (+6) +14: W-Start addr:

             'Home' address for memory or program,

             Xzn_scr, Yzn_scr for sprite
Memory Types

  RAM512 - memory in computers 128-1024K, up to 512K, ie

           32 pages

           without considering the deleted pages (2,5, etc.)

  RAM1024 - memory in computers with 1024K remaining after

            create RAM512


                   In 48k Memory:
Memory Map: creating a function: InitMem 'AddPage
Mem_Map

        +000: B Unit / Full - 256 times

        + ...

        +255: B Unit / Full

          Unit / Full format: 7 6 5 4 3 2 1 0


                              F V U U U U U U


           U - logical page number 0-63

           F - Full: This block covers the entire page (16K) 1 
/ 0 

           V - Virtual page 1 - yes 0 - no

           # FF - to block this number is not fixed

          format block numbers: in order.

table of memory: (len 1024 bytes (512k available))

  creating a function: InitMem 'AddBloks
FreeTab; unit 0 - logical page 0

    +0: ​​W - start free bytes 1, the beginning of free space

             unit 0, free

              Block 0. '0 '- Not this block

    +2: W - lenght free bytes 1, length of free space in the 
unit 0, free 

              Block 0. '0 '-No this block

    ...

   +28: W - start free bytes 8

   +30: W - lenght free bytes 8

   ; Logical unit 1,2 ... 32 Repeat for all the logical page.

        Place under non-existent pages contain # FF

Table of logical pages (temporary)

  creating a function: TestMem

  broken up 'tables existing pages': TestMem
PageTab (serial number - the logical, the content - physical)

     +0: ​​B - '0 '

     +1: B - '1 '

     ...

    +63: B - '63 '
Table of existing pages RAM512

  creating a function: TestMem.
PageTab512 (serial number - a logical, content-physical)

     +0: ​​B - unit 0

     +1: B - unit 1

     ...

   **+?: B - the last physical page (bit 7-ON: Virtual Page)

     ** +? - The last logical page

     +?: # FF - end mark RAM512

Table of existing pages RAM1024
creating a function: TestMem.
PageTab1024 (serial number - a logical, content - the physical 
page) 


     +0: ​​B - page 0 (if this byte is 0 - not found memory 
RAM1024) 

     +1: B - page 1

     ...

     +?: B - the last physical page of a 512-1024k

     +?: # FF - end mark RAM1024

Table FULL blocks (if any RAM1024) 64 bytes

     +00: B - LUN RAM1024 straniitsy

     +01: B - 0 - empty, 1 - FULL blok, # FF - physical absence

        page

      ....

     +62: B

     +63: B



  FUNCTIONS


  1. Saving functions: functions of creating and writing blocks

       Standart Input:
A - blok flag MPSF
HL-Start addr (Xzn_scr, Yzn_scr) NOR 001 002 004 007
BC-Lenght (Xlen, Ylen) FIX 129130132 -


     Standart Output:

A - the block number (0-out of memory) VIR 065 066 068 071
[DE - block address in a page] * F + V 193194196 -

            (For the debug A = 255 - error i / o)

* Function returns the value

  1.1 ClearPage

          Input: none

          Output: A = any - ok; 0 - out of memory

          Cleans up some memory page from the blocks. Next
for ClearPage team Put??? put it on this block has already 
cleared the page in the address 49152. Need to download 
software in memory. Steps: 1. Clear page 2. Put???

(Took place under a piece of program code) 3. PutTo A = (Put???)
(Attached to the software unit) 4. Put???, Put ???... (Loads 
the data into the same page, where is the program) 5. PutTo A = 
0 (Disables snapping)


  1.2 PutTo

          Input: A - the block number to which to commit. 0 - 
undo command 

          Output: A = 0 - ok; # FF - not found; other - error i 
/ o Allows you to write blocks to a page which has a block A

Command action a long-term, defeated by the transfer 0 as the 
parameter. When the binding could plummet speed because of the 
need for frequent execution ClearPage as memory will be 
searched within a 16k page. For newly created units will 
automatically perform the function FixBlok 

  1.3 Put start_adres, lenght, flag

          Standart i / o *

          creates a block and returns all the parameters of the 
block 

  1.4 PutReal

          Standart i / o

          creates a block and moves it into RAM512


  2. Load Functions: reading function blocks

       Standart input: A - the block number

       Standart output: HL-block address in the page

                        DE-setting unit Start Addr

                        BC-block length

                        A - 0 - ok, # FF - Not Found,

                             Other - error i / o

  2.1 Get

          Standart i / o

          returns all the block parameters

  2.2 GetReal

          Standart i / o

          moves a block of memory in the 'Start Addr'


  3.Other functions

  3.1 DelBlok

         Input: A - the block number

         Output: A - 0 - ok, # FF - Not Found, Other - error i 
/ o Remove the block. number of the block is removed from the 
memory card MemoryMap 

  3.2 FixBlok

         Input: A - the block number

         Output: A - 0 - ok, # FF - Not Found, Other - error i 
/ o Commits block A on the page on which it is found by

affixing a flag Fi (X) ed in BlokFlag. With this unit will not
work function and MoveMem ClearPage

  3.3 AutoFlush

         Input: A = 1: ON; A = 0: OFF

         Output: none

         In the ON state attempt to deal with
Command error Put??? - Out of memory, not terrorizing an 
application of the above wild shouts. Working with functions 
and FlushMem MoveMem, trying to find a place to block. Failing 
this still gives an error, allowing the application to their 
own press the reset ;-) In this case, the program is 
recommended to have some unnecessary components such as undo 
buffer and retry Put??? In OFF state system makes no attempt to 
free up memory, giving it an honorable duty of a software 
program 


                                                               -

   WARNING !!!!!

                DO NOT abuse the fixation blocks
and software blocks! Remember that your program can be
running at 128k car! Probability-of-memory
is directly proportional to the number of Program and Fixed 
Blocks!! Use this option only if necessary! " APPLICATION 
VirtMem to increase the amount of available memory can cause a 
state of shock from the user of your program. If you are an 
all-yet decided on such a heroic deed, it is not Remember to 
use the PutVirt??? Only for those blocks that you plan to put 
on VirtMem. As a rule it should be blocks to be used very 
rarely, such as levels, loadable to the game or what that 
external functions in the system program 


  4. Memory Functions: the function of memory blocks (RAM512)

         Names pamati: RAM512 - 48-512k pages

                         RAM1024 - over 512k RAM pages

                         Virt - Virtual (disk) pages.

                         If the RAM> 128k, Virt mem NOT USED

  4.1 FreeMem

       Input: none

       Output: HL - Total free memory

               DE - Free RAM512

               BC - free RAM1024

               IX - free VirtMem

  4.2 MaxMem

       Input: none

       Output: HL - maximum continuous region in RAM512

  4.3 FlushMem

       Input: none

       Output: HL - maximum continuous region in RAM512
Not move PROGRAM blocks within a single page. Gives the maximum 
continuous memory RAM512 This function does not work with Virt 
memory. 

  4.4 MoveMem

       Input: none

       Output: HL - maksimalinaya continuous memory RAM512 not 
move PROGRAM and NOT FIXED blocks of pages in the page to get 
really possible contiguous memory. Performed in an emergency 
shortage of memory or when you call ClearPage This feature does 
not work with Virt memory. 

  4.5 FlushPage

       Input: A - number of the block, whose homepage you want 
to clean 

       Output: HL - maximum continuous memory in this page and 
not move PROGRAM IS NOT FIXED blocks except Block A of This 
page on other pages. Gives the maximum memory single page to 
accommodate the fixed blocks this function does not work with 
Virt memory. 

               A - 0 - ok, # FF - not found, other - error i / o

                                                               -

   5. Initialise Functions: initialization function

       These functions are used for the initial launch of the 
program * 5.1 TestMem ()


       Input: HL - sign PageTab (auto-installed)

       Output: HL - sign PageTab512

              DE - sign PageTab1024 (DE) = 0 - RAM1024 no

              A - total number of pages available, take in 
(ALLPAGES) 

       Determines the available memory kompyutera.Ne destroys 
data stranichkah.Ustanavlivaet (MEMTYPE) * 5.2 DelPage 
pagetab???, Page 

       Input: HL - Plate RAM512 or RAM1024

               A - the physical number of pages to delete

       Output: A - 0: ok; # FF - not found; other - error i / o
 5.3 AddBloks

       Input: A - logical page number to be added to
Directory structure blocks

       Output: A = 0: ok; A = other-This page does not contain
Block structure of A = # FF - not found page, or i / o error
Feature for programmers by Memory Manager. Adds manually 
creating a page with blocks in MemoryMap * 5.4 InitMem ()


       Input: HL - sign RAM512

       Output: A = 0: ok

               a = # FF: error i / o

           Create a directory structure on the free pages
RAM512 and puts them in MemoryMap. Skips pages occupied
Employed under the blocks page is defined by the signature "? 
MMv?." c 49152

 5.6 CreateVirtMem

       Input: HL - the beginning of the base name:

                   - 8 character file name

              B - number of added Virt Pages

       Output: A - 0 - ok, other-i / o error

        If you do not exist, writes files to disk Virtual Mem.
 5.5 AddVirtPage

       Input: A - the number added Virt pages

              HL-address structure:

                  0-7: name \

                  8: Virtual page number |

                  9: Start adres (49152) |

                  10: \

                  11: bytes len (16384) / 16 bytes TR-DOS name

                  1912: |

                  13: Sector len (64 |

                  14: Start track |

                  15: Start sector /

                  . . .

       Output: A - 0 - ok, other-i / o error

          Clears the directory and adds Virt pages in MemoryMap.

6. Internal functions
6.1 SearchByte: in - HL - Launch

                      A - B

                 out-HL - Address

                      A - B or # FF - not found

                 corrupt: B

            Search for bytes from HL to (A) or before the first 
# FF 

Variables:
 ALLPAGES.b - the total number of pages available
 MEMTYPE.b - the type of memory found 0 - no RAM1024, 1 - a
 PageTab512.w - a pointer to the beginning of the table RAM512.
 PageTab1024.w - a pointer to the beginning of the table 
RAM1024, if con                 contains 0 - no memory RAM1024

 BlokF.b - the flag of the current block
 BlokST.w - starting address of the current block
 BlokL.w - The length of the current block
 BlokLOG.b - logical page for the current block
 BlokNUM.b - number of the current block
 BlokPAGE.w - Place the current block on the page
 BlokFTab.w - address space for the current block





Other articles:

3d2f or 3d30 - TR-DOS journey into the world of delusions.

CC'999 Report - Report of Peter Sobolev's get-together scene.

Creditz - Hall of Fame.

Land of Promotion - the announcement of the impending adventyurnoy game.

Light Future News - News Group.

Now & Forever - little-known facts about stars.

RAM Project - considerations Zetter'a of RAM Disk'e.

Uni Hhrust Finder - a story about the utility Orc'a to search for files packed.

Amenities - Content.

Editor - The history of the newspaper.

Lecture Philologus - the story on "The floating of the Anglo-American streams" based on life experience and sense of humor.

Novella on the game "Land of Dark" - the author's novella.

pearls - column telling about the statements of famous people.

Application - Dessert at the seed.

Batting in the world - the critical exposure of the "Computer Dictionary for boys."


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

Similar articles:
Softinka - Updates to the image viewer: ANSI viewer, MCX viewer.
Likbez - Automatic creation of masks for sprites.
Interface - moran: "Why do I play."
Our news - Turbo copyist VooDoo Copyer from Paracels'a. Happy New Year!

В этот день...   28 April