Skip to content

Commit

Permalink
Initial (#2)
Browse files Browse the repository at this point in the history
* Initial commit

* Remove project files

* Tidy up

* Corrected two bugs when flushing buffers

* Corrections

* Clean up

* Correct capitalisation

* Change target cpu to 68000

* Initial readme (#1)

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Added image boot image

* Added boot instruction and images

* Added contributions.

* Update README.md
  • Loading branch information
dwildie authored Mar 5, 2020
1 parent 56bfb44 commit aff2a2a
Show file tree
Hide file tree
Showing 48 changed files with 4,145 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/obj/
/.project
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SUBDIRS := boot bios cpmfs

all: $(SUBDIRS)

$(SUBDIRS):
$(MAKE) -C $@

.PHONY: all $(SUBDIRS)
91 changes: 90 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
# cpm-68k
# CP/M 68K for the S100 68000/68010 Board

This project provides:
* Boot loader/monitor
* CP/M 68K BIOS
* CP/M file system images

This code assumes, and has been tested with, the following hardware:
* [68000/68010 Board](http://www.s100computers.com/My%20System%20Pages/68000%20Board/68K%20CPU%20Board.htm)
* [Propeller Console IO Board](http://www.s100computers.com/My%20System%20Pages/Console%20IO%20Board/Console%20IO%20Board.htm)
* [16MB Static RAM Board](http://www.s100computers.com/My%20System%20Pages/16MG%20RAM%20Board/16MG%20RAM%20Board.htm)
* [IDE/CF Board](http://www.s100computers.com/My%20System%20Pages/IDE%20Board/My%20IDE%20Card.htm)

# Release

The release contains the following files:
* boot.srec - This is the boot loader / monitor in SRecord format and must be burnt into the board's EPROMS,normal even/odd configuration.
* bios.srec - This is the bios in SRecord format.
* boot400.sr - This is the patched cpm400.sr and bios.srec concatenated into a single SRecord file
* disk1.img Single partition image using the 4mb-hd format containing boot400.sr and the contents of DISK1 of the CP/M 68K V1.3 binary distribution
* disk10.img Ten partition image using the 4mb-hd format, paritions 0 to 8 contain DISK1 - DISK9 of the CP/M 68K v1.3 binary distribution. boot400.sr is in partition 0, partition 9 is empty.
* diskAll.img Ten partition image using the 4mb-hd format, paritions 0 contains all files from DISK1 - DISK9 of the CP/M 68K v1.3 binary distribution plus boot400.sr. Partitions 1 - 9 are empty.

# Executing

1. Burn the boot.srec file into the boards EPROMS. Copy one of the file system images to a CF card using your preferred tool, dd, balenaEtcher, etc.
1. Boot the 68000 into the boot loader/monitor. Type `help<ENTER>` for a list of available commands.
1. Select the appropriate disk drive, a or b.
1. Type `boot boot400.sr<ENTER>` and the loader will start reading the file into memory.
1. When loading is complete, you will be prompted to continue, enter `y`.

You should now see the CP/M `A>` prompt.

![boot](cpm_boot_b.png)

# Building

Requires git, make, gnu 68000 cross tools, cpmtools to be installed.

Alternatively, use the following docker image which provides all the necessary tools:

`docker run -it --rm --name 68k-tools -v {my project directory}:/opt/work dwildie/68k-tools:0.0.1 bash`

The [Dockerfile](https://github.com/dwildie/68k-tools/blob/master/docker/Dockerfile) documents the required tool installation.

Clone the repository: `git clone https://github.com/dwildie/cpm-68k.git`

To build: In the top level directory, type `make`

## Boot loader/monitor
The Boot loader/monitor is build for the standard memory configuration:
+ 32KB RAM at 0xFD8000
+ 32KB ROM at 0xFD0000

For a different memory configuration modify the MEMORY section in the `boot.rom.lnk` file.

Once built, the target directory will contain `boot.srec` which should be burnt to the EPROMs, normal even/odd config.

## CP/M 68K BIOS
The BIOS is configured for a full populated 16MB static RAM board. For a different memory configuration, modify the MEMORY section in the `bios.lnk` file. The CP/M memory region table's entry is derived from the `bios.lnk` configuration so it must reflect the target hardware.

This BIOS delegates all console and disk IO to the boot loader/monitor. Therefore, it will not function with another monitor.

The BIOS has a tuneable LRU disk buffer. The tuning parameters are in `buffer.i`:
+ `BUFFER_COUNT` - The number of available buffers. Buffers are reused based on a LRU algorithm.
+ `BUFFER_SECTORS` - The size of each buffer in HDD sectors (512 bytes). The maximum size is 32 sectors, ie. 16KB per buffer.

The current configuration is:
+ `BUFFER_COUNT = 4`
+ `BUFFER_SECTORS = 8`

The BIOS is configured to support a maximum of 10 drives mapped to a single multi-partitioned disk image. This can be increased by modifying the `DISK_COUNT` value in `bios.i` and allocating additional Disk Parameter Headers in `main.s`.

The BIOS is configured to work with the CPM400.SR system from DISK9 of the [CP/M 68K V1.3 distribution disks](http://cpm.z80.de/download/68kv1_3.zip). The BIOS `_init` entry point has been moved from the original 0x6000 to 0x6200. This shifts the BIOS out of the CPM400.SR BSS segment. CPM400.SR is patched to suit.

Once built, the target directory will contain `bios.srec`.

## CP/M file system images
Each of the file system images contain the boot400.sr file in the first partition. This file:
+ Contains the patched cpm400.sr and the bios.sr
+ Is the file that must be loaded and executed to start CP/M


Three file system image are built:
+ disk1.img Single partition image using the 4mb-hd format containing boot400.sr and the contents of DISK1 of the CP/M 68K V1.3 binary distribution
+ disk10.img Ten partition image using the 4mb-hd format, paritions 0 to 8 contain DISK1 - DISK9 of the CP/M 68K v1.3 binary distribution. boot400.sr is in partition 0, partition 9 is empty.
+ diskAll.img Ten partition image using the 4mb-hd format, paritions 0 contains all files from DISK1 - DISK9 of the CP/M 68K v1.3 binary distribution plus boot400.sr. Partitions 1 - 9 are empty.

# Contributions
The IDE code used in the boot loader/monitor was originally written by John Monahan who also designed the S-100 cards being used. Thank you John.
2 changes: 2 additions & 0 deletions bios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/obj/
/target/
36 changes: 36 additions & 0 deletions bios/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
AS = m68k-elf-as
ASFLAGS += -m68000
ASFLAGS += -alms

CC = m68k-elf-gcc
CCFLAGS += -Wall
CCFLAGS += -m68000
#CCFLAGS += -ggdb
CCFLAGS += -nostdlib
CCFLAGS += -nodefaultlibs

LD = m68k-elf-ld

all: target/bios.srec

%.s: %.c
$(CC) $(CCFLAGS) -S $<

# --------------------------------------------------------------------------------
# M68K CPM Bios
# --------------------------------------------------------------------------------
obj/%.o: %.s
$(AS) $(ASFLAGS) -a=$(@:.o=.lst) -o $@ $<

obj/bios.srec: obj/main.o obj/buffer.o
$(LD) -T bios.lnk obj/main.o obj/buffer.o -Map $(@:.srec=.map) -o $@

target/bios.srec: obj/bios.srec
srec_cat $< -fill 0x00 -over $< -header="CP/M-68K S100 Bios" -o $@
srec_info $@

clean:
rm -rf obj/* target/*
mkdir -p obj target


40 changes: 40 additions & 0 deletions bios/bios.lnk
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
OUTPUT_FORMAT(srec)

MEMORY
{
ram : ORIGIN = 0x6200, LENGTH = 0x80000
}

SECTIONS
{
.text : {
__text_start__ = .;
*(.text*)
__text_end__ = .;
} > ram

.data : {
__data_start__ = .;
*(.data*)
__data_end__ = .;
} > ram

.bss : {
__bss_start__ = .;
*(.bss*) *(COMMON)
__bss_end__ = .;
} > ram

__bss_length__ = __bss_end__ - __bss_start__;

. += 1;
. = ALIGN (0x100);
__memory_region_start__ = .;
__memory_region_end__ = 0x00FCFFFF;
__memory_region_length__ = 1 + (__memory_region_end__ - __memory_region_start__);

/DISCARD/ : {
*(.eh_frame);
*(.comment);
}
}
Loading

0 comments on commit aff2a2a

Please sign in to comment.