Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Kernel/dev/cpc/albireosme.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COMMON_MEMORY
void ch375_rblock(uint8_t *p) __naked
{
__asm
.globl a_map_to_bc
#ifdef CONFIG_BANKED
pop bc
pop de
Expand All @@ -35,9 +36,9 @@ void ch375_rblock(uint8_t *p) __naked
#endif
or a ; test is_user
jr z, doread ; map user memory first if required
ld bc,#0x7fff
ld a, (_td_page)
out (c),a
call a_map_to_bc
out (c),c
doread:
ld bc,#0x7f10
out (c),c
Expand Down Expand Up @@ -79,6 +80,7 @@ void ch375_rblock(uint8_t *p) __naked
void ch375_wblock(uint8_t *p) __naked
{
__asm
.globl a_map_to_bc
#ifdef CONFIG_BANKED
pop bc
pop de
Expand All @@ -104,9 +106,9 @@ void ch375_wblock(uint8_t *p) __naked
#endif
or a ; test is_user
jr z, dowrite ; map user memory first if required
ld bc,#0x7fff
ld a, (_td_page)
out (c),a
call a_map_to_bc
out (c),c
dowrite:
ld bc,#0x7f10
out (c),c
Expand Down
10 changes: 6 additions & 4 deletions Kernel/dev/cpc/cpcidesme.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COMMON_MEMORY
void devide_read_data(uint8_t *p) __naked
{
__asm
.globl a_map_to_bc
#ifdef CONFIG_BANKED
pop bc
pop de
Expand All @@ -35,9 +36,9 @@ void devide_read_data(uint8_t *p) __naked
#endif
or a ; test is_user
jr z, doread ; map user memory first if required
ld bc,#0x7fff
ld a, (_td_page)
out (c),a
call a_map_to_bc
out (c),c
doread:
ld bc,#0x7f10
out (c),c
Expand Down Expand Up @@ -78,6 +79,7 @@ doread1: ; transfer 512 bytes
void devide_write_data(uint8_t *p) __naked
{
__asm
.globl a_map_to_bc
#ifdef CONFIG_BANKED
pop bc
pop de
Expand All @@ -103,9 +105,9 @@ void devide_write_data(uint8_t *p) __naked
#endif
or a ; test is_user
jr z, dowrite ; map user memory first if required
ld bc,#0x7fff
ld a, (_td_page)
out (c),a
call a_map_to_bc
out (c),c
dowrite:

ld bc,#0x7f10
Expand Down
20 changes: 9 additions & 11 deletions Kernel/platform/platform-cpcsme/README
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Amstrad CPC with Standard Memory Expansions

Currently, standard 512K RAM expansions are supported using the thunked memory model, alternating complete 64K blocks in the RAM space visible to the CPU. This gives a total amount of 576K of usable RAM on all Amstrad CPC models.

This port is in a very early and immature state. It is still unstable and suffers from random crashes. Sometimes it needs to be loaded several times before it manages to complete the boot process.
Currently, standard RAM expansions up to 1024KiB are supported using the thunked memory model, alternating complete 64K blocks in the RAM space visible to the CPU. This gives a total amount of 1088K of usable RAM on all Amstrad CPC models.

The memory model from the Cromemco port has been adapted to the Amstrad CPC hardware, and the drivers from the CPC 6128 port have been modified to work with this memory model.

The first 64K, which are the only ones accessible by the video hardware, have been reserved for VRAM. For now, the video driver from the CPC 6128 port has been extended to handle two simultaneous terminals (accessible with CTRL+SHIFT+F1 and CTRL+SHIFT+F2), using the 16K pages located at 0x4000 and 0x8000, by configuring the memory mode corresponding to value 0xC1 in the Gate Array's MMR register. The 0x0000 page hasn't been used yet, as it interferes with the RST call execution area, and the 0xC000 page hasn't been used so far because it's not accessible with the 0xC1 MMR value. It could probably be used by switching to 0xC3, as done in the CPC 6128 port. In any case, since each user process occupies a full 64K block and each terminal runs its own instance of the sh interpreter, the use of the remaining pages to implement four terminals is left for the future, when larger RAM expansions are supported.
The first 64K, which are the only ones accessible by the video hardware, have been reserved for VRAM. For now, the video driver from the CPC 6128 port has been extended to handle two simultaneous terminals (accessible with CTRL+SHIFT+F1 and CTRL+SHIFT+F2), using the 16K pages located at 0x4000 and 0x8000, by configuring the memory mode corresponding to value 0xC1 in the Gate Array's MMR register. The 0x0000 page hasn't been used yet, as it interferes with the RST call execution area, and the 0xC000 page hasn't been used so far because it's not accessible with the 0xC1 MMR value. It could probably be used by switching to 0xC3, as done in the CPC 6128 port. The use of the remaining 16K pages of VRAM to implement four terminals is left for the future.

The kernel reserves the second 64K block, leaving up to 15 blocks of 64K available for up to 15 user processes with a 1024KiB RAM expansion.

The kernel reserves the second 64K block, leaving 7 blocks of 64K available for up to 7 user processes.
The upper 4K of each block are used as common memory so 60KiB are available for each process.

The video driver has been extended to support two simultaneous terminals, using the 16K RAM blocks accessible by the CRTC as video memory.

## Memory Model

Expand All @@ -23,7 +22,7 @@ Bank 0 Video RAM
Bank 1 Kernel
0000-00FF, F200-FFFF are propogated into the other banks

Bank 2-8 User
Bank 2-16 User
0000-00FF start with shared vectors
FIXME: we need to clean this up in program_vectors
from the kernel copy ????
Expand All @@ -38,11 +37,11 @@ Video mode 2 is used. The video driver configures the CRTC in 64x32 characters t
The floppy driver seems to work. /dev/fd0 is drive A and /dev/fd1 is drive B. fd0 is hard coded to one side and fd1 to double side. A minimal system
root disk image is generated to boot from fd1. Format is 9 sectors per track with sector ID from 1 to 9.

The IDE driver works and the USB mass storage of the Albiero using the ch375 driver used in other platforms also works. It should be easy to get it working with the Usifac/Ulifac.
The IDE driver works and the USB mass storage of the Albireo using the ch375 driver used in other platforms also works. It should be easy to get it working with the Usifac/Ulifac and a second Albireo with alternate I/O ports.

There isn't a proper loader, for now a snapshot is generated.
The Makefile generate a dsk image (fuzix.dsk) to load Fuzix form basic with run"fuzix" command. Also a snapshot is generated as alternative load method.

To test it burn disk.img on your mass storage media. Load an run the snapshot.
To test it burn disk.img on your mass storage media. Load an run the snapshot or use fuzix.dsk image to run it from basic.

Added support for the USIFAC serial port. If CONFIG_USIFAC_SERIAL is defined in config.h, the tty3 device is added. To use the console on this device,
modify the following line in /etc/inittab:
Expand All @@ -55,7 +54,6 @@ This has been tested with Putty conecting the usifac to a linux box using a USB-

## TODO

Write a proper loader.
Configurable screen, at least add 80x25, maybe also change the video mode and routines to manage 6x8 fonts.
Support more hardware: M4 Board (storage, network and RTC), Ulifac/Usifac storage, networking with wifi module plugged in the usifac, sdcard in the
Albireo.
Expand Down
12 changes: 8 additions & 4 deletions Kernel/platform/platform-cpcsme/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
#define CONFIG_VT
/* Keyboard contains non-ascii symbols */
#define CONFIG_UNIKEY
/* 8 64K banks, 1 is kernel */
#define MAX_MAPS 7
/* 16 64K banks, 1 is kernel */
#define MAX_MAPS 15
#define MAP_SIZE 0xF000U

/* Banks as reported to user space */
#define CONFIG_BANKS 1

/*
#define MAP_TRANS_8TO16(M) (uint16_t)(M) + (((M) & (1 << 6)) ? 0x7F00 : 0x7E40)
#define MAP_TRANS_16TO8(M) (uint8_t)(((M) - (((M) & 0x7F00) == 0x7F00) ? 0x7F00 : 0x7E40))
*/
/* Vt definitions */
#define VT_WIDTH 64
#define VT_HEIGHT 32
Expand Down Expand Up @@ -67,7 +70,8 @@


#define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */
#define NBUFS 5 /* Number of block buffers */
#define NBUFS 5 /* Number of block buffers MUST be big enough to push discard above 0xC000*/
/*Remember to set it also in kernel.def*/
#define NMOUNTS 4 /* Number of mounts at a time */

#define CONFIG_DYNAMIC_BUFPOOL
Expand Down
Loading
Loading