Changes

Jump to: navigation, search

CP/M 3.0

1,741 bytes added, 21:06, 22 June 2023
/* Memory layout */
</gallery>
==== Console Input ====
Console input (via BDOS functions) uses firmware functions and returns firmware key codes when a key is pressed. i.e. &f0 is cursor up.
ESC 1 - enable status line
ESC 2 - set language
ESC 3 - set screen mode?
ESC A - cursor up
ESC B - cursor down
PCW and Spectrum support viewports. This is not supported on CPC. CPC assumes a single viewport covering the entire screen and it is moved up/down using software when using insert line or delete current, but moved up using hardware otherwise.
 
==== ESC 2 - set language ====
 
ESC 2 <language>
 
<language> is 0 based. The value is anded with 7. Internally this will transfer language specific character graphics into the font for display.
 
 
==== ESC 3 - set display mode ====
 
Set the display mode:
 
ESC 3 <mode number>
 
<mode number> is 0 based. The value is anded with 3.
 
e.g. to set mode 0:
 
ESC,3,0
 
==== ESC b - set foreground ====
 
Set the foreground (pen 1) colour:
 
ESC b <colour>
 
Colour is 0 based with 32 added. It is a 2 bits per pixel %00rrggbb colour.
 
==== ESC c - set background ====
 
Set the background (pen 0 and border) colour:
 
ESC c <colour>
 
Colour is 0 based with 32 added. It is a 2 bits per pixel %00rrggbb colour.
 
 
==== ESC Y - set cursor position ====
 
Set the cursor position:
 
ESC Y <y> <x>
 
Coordinates are relative to top-left and are 0 based with 32 added.
 
e.g. for x,y of 2,10:
 
ESC,'Y',10+32,2+32
=== Memory layout ===
* 1st 64KB has Amstrad's XBIOS (callable using 'userf'), CCP, BDOS, BIOS, screen and firmware. Screen is at &4000-&7fff. Firmware is used. AMSDOS is not used.
* ## &c1/&c2 are used, so that there is common code at &c000-&ffff. This common code has a small BDOS and BIOS. Most of the functions use trampoline code to transition to bank 0 and call into the XBIOS.
* 2nd 64KB has the TPA and the shared code.
a) ## Page C4 has WBOOT and BDOS jump + &100-&3f00 of the TPA. This calls to functions in Page c7.b) ## Page C5 has &4000-&7fff of the TPA.c) ## Page C6 has &8000-&bfff of the TPA.d) ## Page C7 has &c000-&f2fb of the TPA. From &f2fc to &ffff is the trampoline code which transitions * to 1st bank of 64KB.
=== Extra memory ===
Using "drvtable" gets the list of DPH addresses for each drive. This is actually fixed at FE2F and is referenced by the XBIOS.
Amstrad have extended implemented the extended DPH (these appear before in the Digital Research sample BIOS. The ten bytes before a DPH)give the addresses of read/write functions: * -10,-9 - address of a DD WRITE SECTOR (XBIOS) compatible sector write function* -8,-7 - address of a DD READ SECTOR (XBIOS) compatible sector read function* -6,-5 - unknown address of drive select function, but does call DD LOGIN (XBIOS) if successful* -4,-3 - unknown function, seems to be address of drive init, calls RETfunction (never called)* -2,- physical drive number (for B: this is 0 on a single-drive system and 1 on a two-drive system)* -1 - unknown usedrive type
The XBIOS calls these and assumes bank 0 is active. If you write a driver in TPA space you will need to transition to and from bank 1 using selbnk etc.
 
The parameters for the read / write functions are at 0BEF0h:
DB @adrv ;Selected logical drive
DB @rdrv ;Selected physical drive (from the byte at DPH-2)
DW @trk ;Track passed to SETTRK.
DW @sect ;Sector passed to SETSEC.
DW @dma ;DMA address passed to SETDMA.
DB @cnt ;Multiple I/O count passed to MULTIO
DB @dbnk ;DMA bank passed to SETBNK
 
=== PALETTE.COM ===
 
PALETTE is a COM program written by Locomotive Software and allows the colours to be changed.
The syntax is:
 
PALETTE <background> <foreground>
 
<background> and <foreground> are r,g,b colour codes with 2 bits for each colour defined in binary as r1 r0 g1 g0 b1 b0. Therefore black is 000000, bright white is 111111, white (grey) is 010101 and bright red is 110000.
=== Links ===
897
edits