CpcAlive is a
programming
environment
Amstrad CPC

compatible
for graphics
 animations
creation.







operation

SmallAsm is a Z80 assembler
for Dos

Cpc basic key words
( English - Español )

Cpc basic error messages

The memory

The Cpc system vectors

Diskettes management

CpcAlive installer for
Windows and DosBox


CpcAlive Documentation






Français

* Cpc memory access from X86 environment *


The Cpc computer use 128Ko of memory divided into two banks of 64Ko each one called bank 0 and bank 1. Bank 0 is consisted with four blocks of 16Ko numbered from 0 to 3. Bank 1 uses the blocks numbers 4 to 7. The emulator supplements these two banks with 248 additional blocks available thus numbered from 8 to 255. The Cpc memory access depends of the module size. Indeed, the modules are loaded and executed in the same area as the Cpc memory (Ems segment). The first accessible Cpc address is indicated to the address 0216h of the X86 installation table. In the case of a module using four blocks, value 0 indicates that no address are accessible.

Note: The number of blocks used by the last module loaded can be obtained with the following BASIC command:

info$=string$(18,"X"):|INFO,@info$:NbrBlocs=val("&"+mid$(info$,17,2)):PRINT NbrBlocs

It is possible to choose the bank to connect with the module using the byte
located to the address 0215h of the X86 installation table. Value -1 indicate that there is nothing to connect with the module, value 0 connects bank 0 of Cpc in the blocks available, value 1 connects bank 1 of Cpc in the blocks available. For example, if you want to connect bank 1 following the module by putting value 1 in the byte located to the address 0215h of the X86 installation table, and if the first accessible Cpc address indicated is 08000h, the last two last blocks of bank 1 will be connected following the module. It is also possible to choose the number of module blocks to connect using the byte located to the address 0228h of the X86 installation table. For example, if you use this byte with the value 1, the last three blocks of the chosen bank will be connected after the module connected part. Changes will be effective at the next call of the module or with a call of the function 4 of the interruption 018h (value 4 in register AH).

Value 2 in the byte located to the address 0215h of the X86 installation table connects the banks following the module by indicating the number of the first block of the bank to be connected in the byte located to the address 0213h of the X86 installation table. For example if one puts value 3 in the byte located to the address 0213h of the X86 installation table and if the first accessible Cpc address indicated is 04000h, blocks 3,4 and 5 of the banks 0 and 1 will be connected following the module. Value 7 in the byte located to the address 0213h of the X86 installation will connect the last block of bank 1 follow-up of the blocks 8 an 9 of the additional Ram. It is also possible to use the byte offset 0228h of the X86 installation table to change the size taken by the module. Changes will be effective at the next call of the module or with a call of the function 4 of the interruption 018h.

Value -2 in 
the byte located to the address 0215h of the X86 installation table connects the blocks of another module. The higher blocks of the module to connect will then be connected following the calling module. It is enough for that to indicate the complementary module number through the byte located to the address 0213h of the X86 installation. It is also possible to use the byte offset 0228h of the X86 installation table to change the size taken by the calling module. Changes will be effective at the next call of the module or with a call of the function 4 of the interruption 018h.

The emulator treats with a particular way the management of bank 0 because amongst other things the Cpc screen management. It is thus better to use the Dos system interruption 018H reprogrammed for this purpose for the writing accesses. Through this interruption, read/write accesses are possible in the totality of the memory, independently of the size of the connected module.

The AH values to transmit to acced of the various functions of this interruption are
detailed here.