APPLICATIONSDIVERS ★ The alternative bank manager!|Amstrad Action) ★

BankRSXApplications Divers
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

DAVID HOLMES helps you get more from the 6128's 64k extra RAM.

A major feature of the CPC 6128 is the extra 64k of RAM. Unfortunately this memory is not easily accessible from BASIC and requires additional software to enable its use. Amstrad supply the Bank Manager program which allows the memory to be used for the storage of screens or string data. The screen handling commands have several limitations:

  • To store a screen it must be first loaded into the visible screen and then copied into the extra RAM.
  • It is not possible to write to a stored scrcen without moving it into the visible screen area other than by simply copying a whole existing screen with |SCREENCOPY
  • Displaying a screen from store is rather slow and the process involves a 'Venetian blind' effect as the memory is moved.

In addition to these deficiencies the Bank Manager does not allow the storage of machine code programs which can be called in as required. As the extra banks are not cleared when the system is reset, if programs could be stored in this way they would not be lost unless the power supply was switched off. Only the software to retrieve them needs to be loaded again.

The program below sets up an alternative bank management system which attempts to overcome these limitations. (It does not attempt to replace the string storage facilities of Bank Manager.)

Screenplay

Firstly it is necessary to explain how the screen and extra RAM banks on the CPC6128 may be handled. The 128k of memory consists of eight banks of 16k numbered 0-7. In normal use only banks 0-3 are switched in and bank 3 contains the screen memory from &C000 to &FFFF (see fig.l). This will be referred to as the high screen. It is possible to use bank 1 (&4000 to &7FFF) as an alternative screen (referred to as the low screen) and also to write to one area of screen memory while displaying the other. This is an important feature of the system. The appearance of the screen is determined by two factors:

  • The screen base. This may be set at either &C000 or &4000 which then causes either the high or low screen respectively to be displayed.
  • The screen offset. If the screen is rolled by printing or listing for example, the star: of the screen memory block will not be at the top left corner of the screen. The screen offset tells Hie hardware where to position the screen memory on the physical screen.

If several screens are to be stored for display it is easier if all are set up with an offset of zero. This avoids the complication of setting different offsets for each screen before displaying it. The Z80 microprocessor can only address 64k of memory at one time, so to allow the use of banks 4-7 some of the existing memory must be exchanged with the bank which is required. This process is called bank switching.

Seeing is believing

The CPC6128 ROM has a routine at &BD5B called KL_BANK_SWITCH which allows one of banks 4-7 to be switched into position 1. This block of memory can Then be manipulated. The price of being able to manipulate the extra banks more freely than with Bank Manager is that only bank 0,the lower 16k of memory up to &3FFF, can be used for BASIC, although potentially 64k of extra machine code and pictorial memory are released. The program sets up a number of RSX's which allow the banks to be moved, displayed and written to. The new commands are as follows:

Figure 1: dotted lines show possible paths of memory flow >>

|GETBANK, n where n is 4-7 corresponding to the bank required.

This command switches BANK n into position 1 (from &4000 to It may then have a screen loaded into it from disk or tape or be written to as described below. It may also have a machine code program loaded into it or assembled into it directly.

|PUTBANK switches out the bank and restores the memory map to normal.

This should be used to store the screen or machine code immediately after the loading or writing operation has been completed.

|VIEWBANK, n displays bank n on the high screen instantly. This should be executed when the high screen is being displayed. To avoid the 'Venetian blind' effect the screen at &C000 is firstly copied down to &4000. The screen base is then switched to &4000. At this stage the visible screen is not affected. Bank n is then switched in to &4000.

At first thought one might expect bank n to be instantly visible, but this does not oocur so simply. Although it is not obvious from the Firmware Manual only hardware banks 1 and 3 are capable of displaying the screen. If an extra bank is switched in when the low screen is being displayed this screen is still visible but disabled, (iputbank will re-enable the low screen in this situation). To display the selected bank the information is first copied up to bank 3. The new screen is then seen instantly by displaying the high screen Bank n is switched out again without being modified. If required tlie original high screen (currently at &4000) may be recovered by switching to the low screen with |scl or by using icopyhigh (see below). The contents of the original low screen are lost.

|COPYSCREEN. n copies the high screen to bank n. This is used if it is wished to store a newly created or updated visible screen. If the scrcen has been called from store by iviewbank the original screen is still in its bank (from where it was copied). The modified screen can be stored in place of it or in another bank by choosing appropriate values of n.

Take command

To achieve this, bank n is switched in to &4000. the information in the screen is copied into it and then the bank is switched out.

|SCH displays the screen starting at &C000 |SCL displays the screen starting at &4Q00

These two commands use the ROM routine SCR_SET_BASE at 4BC08 to tell the hardware which block of memory to use for the screen.

|WRH allows writing only to the high screen.

|WRL allows writing only to the low screen. These two commands use the ROM routine SCR_set_position at &BD55. They also set the screen offset to zero for consistency with other screens. This routine does not inform the hardware of the change in screen position but allows printing, drawing etc. to the relevant block of screen memory even if this is not currently visible. When the screen is constructed it can be displayed instantly by executing either |SCH or |SCL as appropriate. These commands cancel the effect of |WRH and |WRL and allow writing to both screens. It is possible to create smooth animation effects by changing one screen while displaying the other.

|WIPE clears the screen to ink 0 and zeros the screen offset. It is important that the screen offset is set to zero before a screen is con

structed (either visibly or invisibly) or displayed using |VIEWBANK. If this is not done the screen image may be disrupted either on display or following any attempts at further manipulation. A CLS command will not zero the screen offset after rolling.

|WIPE ensures that the screen starts at the correct point and should be used if the screen has or may have rolled. A mode command may be used instead of |WIPE but this destroys any windows that may have been set up. If an invisible screen is being constructed for storage in a bank, or for instantaneous display after issuing a |WRL or |WRH command, CLS must be used if the screen is to be cleared.

(|wrh or |wrl have already set the offset to zero). If |wipe is used it informs the hardware of the screen base and displays the wrong screen. This also occurs if a screen being constructed invisibly is rolled. Rolling a visible screen during construction alters the offset and cause the invisible screen to be disrupted if it is then displayed with |SCL or |sch alone.

Provided that the currently invisible screen was set up with a zero offset it can be rescued by displaying it with |WRL : : |SCL or |WRH : |SCH. If |WRH or |WRL are used alone in this situation to write to the invisible screen without displaying it. the offset is set to zero and this screen can be successfully written to.

Unpredictable results

The visible screen however is being constructed with an unknown offset and attempts to modify or manipulate it lead to unpredictable results when other commands notify the hardware that the offset has been zeroed. These complications make it worth taking care to avoid rolling during screen development! If a rolled visible screen must be cleared to a paper colour other than 0, cls may be used following the |WIPE command, |copyhigh copies the contents of the low screen to the high screen.

To recover a high screen after |viewbank has moved it down to the low screen or to allow storage of a constructed low screen, first use |SCL to make it visible, |copyhigh to move it and |SCH to display the high screen. It is possible to use |COPYHIGH without using |SCL first but this brings back the 'Venetian blind'!

Once in the high position the screen can be modified if required and stored with |COPYSCREEN.

These commands may 'be used to write invisibly to a stored bank as follows:-

10 |GETBANK, n :REM Where n is the bank to be written to
20 |WRL :REM Allow writing to lower invisible memory block
30 CLS :REM If the screen is to be cleared
40 GOSUB 100:REM Program to construct screen
50 |PUTBANK :REM Store bank
60 |WRH :REM Allow writing to the high screen if required
70 END
100 REM Screen Construction Program
200 RETURN

Avoiding loads of trouble

To load a binary screen file from disk or tape to a bank without it being visible: -

10 |GETBANK,n
20 LOAD "SCREEN",&4000
30 |PUTBANK

Machine code may be loaded as above or assembled anywhere into the &4000 to &7FFF block by using |GETBANK before entering the assembler. The code is assembled and then l putbank is issued. It may then be fetched with |GETBANK and CALLed when required.

To save a stored screen to disk or tape:

10 |GETBANK,n
20 SAVE"Screentitle",b,&4000,&4000
30 |PUTBANK

Machine code may be saved in the same way by modifying the start and length values as required

To save the high or low screen to disk or tape:

10 SAVE"Screentitle",b, &4000 (low screen) or &C000 (high screen),&4000

Screens may be saved and loaded in any mode but the original mode must be set before a screen is displayed.

To set up the RSXs type in the listing and save it. ron it and correct any errors in the DATA statements, save a final corrected version. Delete the program with not and the commands are available to test the imagination' If any parameter errors are made all banks are put back to normal, the screen being written to is made visible, a message is displayed and a warning tone sounded. Pressing esc returns to BASIC.

I'm interested to hear of improvements to the Alternative Bank Manager: a follow-up article is planned.

AA

★ PUBLISHER: Amstrad Action
★ YEAR: 1989
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: DAVID HOLMES
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» BankRSX    (Amstrad  Action)    ENGLISH    LISTINGDATE: 2021-02-06
DL: 194
TYPE: PDF
SiZE: 67Ko
NOTE: 1 page/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Bankswap (Computer Schau)
» Applications » MBM: Memory Bank Manager (Happy Computer)
» Applications » Bankgeschäfte (CPC Amstrad International)
» Applications » Rsx - Bankcat - Screencopy (The Amstrad User)
» Applications » Tri pour BankManager
» Applications » PD Bank Manager (Amstrad Action)
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 435 millisecondes et consultée 1263 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.