Skip to content

Commit

Permalink
Merge branch 'davidgiven:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iss000 authored Aug 5, 2024
2 parents 0661a06 + d0cdc10 commit 61a19cf
Show file tree
Hide file tree
Showing 38 changed files with 4,860 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
repository: 'davidgiven/cpm65'

- name: apt
run: sudo apt update && sudo apt install cc1541 cpmtools libfmt-dev fp-compiler moreutils mame
run: sudo apt update && sudo apt install cc1541 cpmtools libfmt-dev fp-compiler moreutils mame srecord

- name: install llvm-mos
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
path: 'cpm65'

- name: apt
run: sudo apt update && sudo apt install cc1541 cpmtools libfmt-dev fp-compiler moreutils
run: sudo apt update && sudo apt install cc1541 cpmtools libfmt-dev fp-compiler moreutils srecord

- name: install llvm-mos
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pet8032.d64
pet8096.d64
x16.zip
oric.dsk
kim-1-k1013.zip
kim-1-sdcard.zip
__pycache__
neo6502.zip
sorbus.zip
68 changes: 66 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ to the 6502. So far it runs on:

- Olimex' neo6502 6502-based computer.

- nano6502 6502-based SoC for the Tang Nano 20K FPGA board; TPA is 55kB.

- KIM-1 with K-1013 FDC, directly connected SD card module or 1541 drive.

Unlike the original, it supports relocatable binaries, so allowing unmodified
binaries to run on any system: this is necessary as 6502 systems tend to be
much less standardised than 8080 and Z80 systems. (The systems above all load
Expand All @@ -44,7 +48,7 @@ bigger the program.

No, it won't let you run 8080 programs on the 6502!

<div style="text-align: center">
<div style="text-align: left">
<a href="doc/bbcmicro.png"><img src="doc/bbcmicro.png" style="width:40%" alt="CP/M-65 running on a BBC Micro"></a>
<a href="doc/c64.png"><img src="doc/c64.png" style="width:40%" alt="CP/M-65 running on a Commodore 64"></a>
<a href="doc/x16.png"><img src="doc/x16.png" style="width:40%" alt="CP/M-65 running on a Commander X16"></a>
Expand All @@ -57,6 +61,8 @@ No, it won't let you run 8080 programs on the 6502!
<a href="doc/oric.png"><img src="doc/oric.png" style="width:40%" alt="CP/M-65 running on an Tangerine Oric 1"></a>
<a href="doc/sorbus.png"><img src="doc/sorbus.png" style="width:40%" alt="CP/M-65 running on the Sorbus Computer"></a>
<a href="doc/neo6502.png"><img src="doc/neo6502.png" style="width:40%" alt="CP/M-65 running on the Olimex neo6502"></a>
<a href="doc/nano6502.png"><img src="doc/nano6502.png" style="width:40%" alt="CP/M-65 running on the nano6502"></a>
<a href="doc/kim-1.png"><img src="doc/kim-1.png" style="width:40%" alt="CP/M-65 running on the KIM-1"></a>
</div>


Expand Down Expand Up @@ -98,7 +104,7 @@ disk images), libfmt (all the C++ tools use this), python3 (for the build
system), and FreePascal (because the MADS assembler is written in Pascal). Use
these Debian packages:

cc1541 cpmtools libfmt-dev python3 fp-compiler
cc1541 cpmtools libfmt-dev python3 fp-compiler srecord

There are also automated tests which use `mame` to emulate a reasonable number
of the platforms, to verify that they actually work. To use this, install
Expand Down Expand Up @@ -309,6 +315,64 @@ the same time.
- The console is 53x30. It has a SCREEN driver.
### nano6502 notes
- The [nano6502](https://github.com/venomix666/nano6502/) is a 65C02-based SoC for the Tang Nano 20K FPGA board.
- The CPU is running at 25.175 MHz (i.e. the pixel clock).
- It is using CPMFS directly on the microSD-card, with 15x1Mb partitions (drives `A` to `O`).
- The text output is over HDMI, with 640x480 video output and a 80x30 console. It has a SCREEN driver.
- The input is currently using the built in USB serial port. This way, this port can be run with only the Tang Nano 20K board without any specific carrier board.
- To use, write the `nano6502.img` file into the SD-card using `dd` or your preferred SD-card image writer. If you are updating the image and want to preserve the data on all drives except `A`, write the `nano6502_sysonly.img` instead.
- User area 1 on drive `A` contains utilities for setting the text and background colors, and a demo application which blinks the onboard LEDs.
### KIM-1 with K-1013 FDC notes
- To run this on an KIM-1, you need an MTU K-1013 Floppy Disk Controller with an
SSDD 8'' disk (or this [Pico based RAM/ROM/Video/FDC card](https://github.com/eduardocasino/kim-1-programmable-memory-card)) and full RAM upgrade, including the
0x0400-0x13ff memory hole.
- To use it, transfer the `diskimage.imd` image to an SSDD 8'' disk (or place it directly onto an FAT or exFAT formatted SD card and assign it to disk0 in the Pico card). Start the KIM-1 in TTY mode, load the `boot.pap` loader program into 0x0200 and execute it.
- Only 1 disk is supported. Multi-disk is not stable in CP/M-65 yet.
- Only TTY interface for now, no SCREEN driver.
### KIM-1 with directly attached SD card notes
- This port uses Ryan E. Roth's [sdcard6502 for the PAL-1](https://github.com/ryaneroth/sdcard6502), which in turn is based on George Foot's [sdcard6502 for Ben Eater's 6502 computer](https://github.com/gfoot/sdcard6502).
- You'll need an SDHC card of any capacity (only 32MB are used) and a generic Arduino SD card adapter **with 5V to 3.3V conversion**. See the links above for detailed requisites and connection instructions.
- To use it, transfer the `diskimage.raw` file to the SD card using `dd`. Balena Etcher also works in Windows, just ignore the "not a bootable image" warning. Start the KIM-1 in TTY mode, load the `bootsd.pap` loader program into 0x0200 and execute it.
- For KIM-1 clones, you can place the bootloader into the free space of the KIM-1 rom. Write the contents of the `bootsd-kimrom.bin` file at 0x1AA0 (or 0x2A0 relative to the KIM-1 rom). This romable loader has two entry points:
- 0x1AA0 is for cold start, that is, you can point the 6502 reset vector to 0x1AA0 if you want to start CP/M-65 at reset. In this case, the TTY is initialized to 9600 bauds, so make sure that your terminal is configured to that speed.
- 0x1AB2 is for booting from the KIM monitor
- For the KIM-1, at least a 32KB (56KB recommended) RAM expansion from 0x2000 is required, as well as RAM filling the 0x0400-0x13ff memory hole. The BIOS assumes that at least the required RAM is installed, and checks for extra RAM above 0xA000.
- Same requisites apply to the PAL-1 and, additionally, the second 6532 expansion board.
- 1 32MB disk supported.
- Only TTY interface for now, no SCREEN driver.
### KIM-1 with Commodore 1541 drive
- Based on the C64 port, so same notes apply.
- This port needs the [xkim1541 extensions for the KIM-1 installed at 0xF000](https://github.com/eduardocasino/xkim1541). The PAL-1 is also supported, and needs the same extensions but installed at 0xDA00, [as modified by Neil Andretti](https://github.com/netzherpes/xkim1541).
- If you also have [my modified xKIM monitor](https://github.com/eduardocasino/xKIM/tree/IEC_support), then load the `CPM` program and jump to address 0x6000.
- If not, load the `bootiec-kim` or `bootiec-pal` bootloader into 0x200 and execute it.
### Supported programs
Commands include `DUMP`, `STAT`, `COPY`, `SUBMIT`, `ASM`, `QE` and `BEDIT` plus
Expand Down
5 changes: 5 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"vic20.d64": "src/arch/commodore+vic20_diskimage",
"x16.zip": "src/arch/x16+diskimage",
"sorbus.zip": "src/arch/sorbus+diskimage",
"nano6502.img": "src/arch/nano6502+diskimage",
"nano6502_sysonly.img": "src/arch/nano6502+sysimage",
"kim-1-k1013.zip": "src/arch/kim-1+distro-k1013",
"kim-1-sdcard.zip": "src/arch/kim-1+distro-sdcard",
"kim-1-iec.zip": "src/arch/kim-1+distro-iec",
},
deps=[
"tests"
Expand Down
2 changes: 1 addition & 1 deletion build/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def zip(self, name, flags="", items: TargetsMap = {}):
for k, v in items.items():
cs += [
"cat %s | $(ZIP) -q %s {outs[0]} -" % (filenameof(v), flags),
"echo '@ -\\n@=%s\\n' | $(ZIPNOTE) -w {outs[0]}" % k,
"printf '@ -\\n@=%s\\n' | $(ZIPNOTE) -w {outs[0]}" % k,
]
ins += [v]

Expand Down
20 changes: 20 additions & 0 deletions diskdefs
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,23 @@ diskdef sorbus
boottrk 1
os 2.2
end

diskdef k-1013
seclen 256
tracks 77
sectrk 26
blocksize 2048
maxdir 128
boottrk 1
os 2.2
end

diskdef sdcard
seclen 512
tracks 4096
sectrk 16
blocksize 4096
maxdir 1024
boottrk 1
os 2.2
end
Binary file added doc/kim-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/nano6502.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions include/zif.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
.set zloopsp, 0
.set zifsp, 0

.macro zproc name, section=.text, binding=global
.section \section, "ax"
.macro zproc name, sect=.text, binding=global
.section \sect, "ax"
.\binding \name
\name:
.endm
Expand Down Expand Up @@ -111,6 +111,7 @@ _zmake_if cc, cs
_zmake_if cs, cc
_zmake_if pl, mi
_zmake_if mi, pl
_zmake_if vs, vc

.macro zelse
_zgetframe zifstack, %zifsp
Expand Down
24 changes: 24 additions & 0 deletions src/arch/kim-1/boot/boot-kimrom.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
MEMORY {
zp : ORIGIN = 0x00, LENGTH = 0xef
ram (rw) : ORIGIN = 0x1aa0, LENGTH = 0x1200
}

SECTIONS {
.zp : {
*(.zp .zp.*)
} >zp

.text : {
*(.text .text.*)
} >ram

.init : {
*(.init .init.*)
} >ram

}

OUTPUT_FORMAT {
TRIM(ram)
}

Loading

0 comments on commit 61a19cf

Please sign in to comment.