Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

CP/M-65 for the KIM-1/PAL-1

360 views
Skip to first unread message

Eduardo Casino

unread,
Jul 9, 2024, 3:51:53 PM7/9/24
to PAL 6502 computer
Hi,

I've made a port of David Given's CP/M-65 for the KIM-1 which 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).

It should also work with the PAL-1 with the following requirements:

- A PAL-1 with at least the 32K RAM and second 6532 expansion boards. The BIOS expects this memory to be present and checks is there is additional RAM above 0xA000

- 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.

More RAM would be advisable, but I don't know if the PAL-1 ROM can be replaced with RAM.

Source code and binary distribution at https://github.com/eduardocasino/cpm65/tree/kim-1

To use it, download the `kim-1-sdcard` release, unzip 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 PAL-1 in TTY mode, load the `bootsd.pap` loader program into 0x0200 and execute it:

kim-1.png

Cheers,
Eduardo

Greg Holdren

unread,
Jul 9, 2024, 4:51:26 PM7/9/24
to PAL 6502 computer
Very nice! I'll try it out on my Briel Micro-KIM.

Greg

Neil Andretti

unread,
Jul 10, 2024, 5:36:37 AM7/10/24
to PAL 6502 computer
Wonderful,
and yes, the PAL-1 can be expanded to 48 KB RAM with a 2nd modded RAM Card: https://netzherpes.de/post/more-ram-for-the-pal-1

I'll get the SD Card reader asap...


Nils

Eduardo Casino

unread,
Jul 10, 2024, 6:27:05 AM7/10/24
to PAL 6502 computer
The issue is that, even with 48K, it is not always enough. For example, I haven't be able to self compile the Pascal compiler unless the RAM goes up to 56K

Anyway, I think that even 32K is enough for a lot of fun stuff :)

@Greg, I did not mention it here because the PAL has it by default, but you also need RAM in the 0x0400-0x1400 range.

GN Liu

unread,
Jul 10, 2024, 9:36:16 AM7/10/24
to PAL 6502 computer
I feel it's time for some new expansions

Ryan Roth

unread,
Jul 10, 2024, 9:47:57 AM7/10/24
to PAL 6502 computer
Well done. I have tried porting this myself in the past, to no avail.
Message has been deleted

Eduardo Casino

unread,
Jul 10, 2024, 11:14:11 AM7/10/24
to PAL 6502 computer
The bootloader can be easily ROMable. It is a little less than 512 bytes, what would be a good location that does not trash any of the more typical expansions? 0xFE00, I guess?

Neil Andretti

unread,
Jul 11, 2024, 10:06:21 AM7/11/24
to PAL 6502 computer
AFAIK Exxx to FFFF cannot be decoded. so 0xDE00 would be the correct place.....

Eduardo Casino

unread,
Jul 12, 2024, 4:28:00 AM7/12/24
to PAL 6502 computer
Ah, OK, then I think it is not worth it. because I'd rather have the extra RAM. In any case, I'm doing it for the KIM-1 and I'll make the address configurable.

Ryan Roth

unread,
Jul 13, 2024, 3:19:27 PM7/13/24
to PAL 6502 computer
I can confirm this is working on my fully expanded PAL-1. Edurado, what SD card adapter are you using on your KIM-1?

Eduardo Casino

unread,
Jul 13, 2024, 4:11:13 PM7/13/24
to PAL 6502 computer
Great, thanks for the confirmation!

I'm using this cheap one:


Even cheaper on Aliexpress, but those had next day delivery.

Ryan Roth

unread,
Jul 14, 2024, 11:19:40 AM7/14/24
to PAL 6502 computer
OK, and you just wired it directly to your KIM-1. I have a handful of these around, I'll have to try it.
Thanks

Hans Otten

unread,
Jul 16, 2024, 7:56:22 AM7/16/24
to PAL 6502 computer
There is some room in the KIM ROM at 1A96 to 1BFA, now filled with 0's.  Can be used with the KIM clones! 
Less than 512 bytes though ...

Eduardo Casino

unread,
Jul 16, 2024, 8:21:09 AM7/16/24
to PAL 6502 computer
The size of the boot prom for the sdcard version is exactly 487 bytes. I haven't really tried to optimize it for size, but 356 bytes sound very challenging :)

Hans Otten

unread,
Jul 16, 2024, 8:23:19 AM7/16/24
to PAL 6502 computer
I also feared it was too little,  seeing your code, not much room for improvement. Lets keep wozmon in it!

Eduardo Casino

unread,
Jul 16, 2024, 2:25:12 PM7/16/24
to PAL 6502 computer
Well, still have to test it because I'm away for a few days, but I think I've been able to squeeze it into 354 bytes :) 

Greg Holdren

unread,
Jul 17, 2024, 2:29:02 AM7/17/24
to PAL 6502 computer
Eduardo,

Thanks for the info. I will try out in the next few weeks and report back on the progress.

Greg

Eduardo Casino

unread,
Jul 20, 2024, 3:31:26 PM7/20/24
to PAL 6502 computer
After a bit of tweaking, I have reduced it to just 345 bytes, because my KIM-1 ROM is modified to add the 'X' command, which launches the xKIM monitor, and I only have 346 bytes left.

There are now three bootloader files in the distribution:

* bootsd.bin, which is the binary meant to be loaded at 0x200
* bootsd.pap, same file in PAP format
* bootsd-kimrom.bin, which is the romable version and has to be placed at 0x1AA0 (or 0x2A0 relative to the KIM-1 rom)

The romable version 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

If there is an error initialising or reading the SD card, a "00" or "01" will be displayed on the terminal, respectively, and the boot loader will give control to the KIM monitor.

Hans Otten

unread,
Jul 23, 2024, 6:15:46 AM7/23/24
to PAL 6502 computer
Awesome! 
CP/M-65 is a capable OS, with not too much tools and programs yet.
It is gaining more users since the ports to various systems.

One of these is the Olimex Neo6502,  a 65C02 system at > 5 MHz with a Raspberry Pi Pico for memory, video, USB keyboard, flash USB etc. 
I have both Neo6502 SBC as the Neo6502PC (a small computer with LCD screen). Fast as lightning!

Hans

Eduardo Casino

unread,
Jul 26, 2024, 4:02:26 PM7/26/24
to PAL 6502 computer
OK, this is the last one, I promise ;-D

New release for KIM-1 and PAL-1 with a 1541 drive.

Limitation: It only currently works for 1541 drives (or pi1541 with 1541 personality). Other drives or SDIEC are not supported.

There are images and boot loaders for the KIM-1 with the xkim1541 extensions installed at 0xF000 and for the PAL-1 with the same extensions at 0xDA00, as modified by @netzherpes.

* Burn the appropriate image into a floppy (or load it into the pi1541 SD card) NOTE: You must burn a binary image, just copying the CPM.PRG file wont work, because the CPM file system is in a hidden file.
* If you also have my modified xKIM monitor, 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

Note: It is really, really slow. I've done it just for fun and because it was trivial once I had David Given's C64 version and my xkim1541 extensions, but it is mostly useless. You can see your beard grow if you compile anything with the assembler.


Mandatory screenshot:

Captura de pantalla 2024-07-26 220009.png

Eduardo

Nils Andreas

unread,
Jul 27, 2024, 1:56:37 AM7/27/24
to Eduardo Casino, PAL 6502 computer
Wohooooo
I can copy it works on my PAL-1 with a real 1541  
image0.jpeg

Brilliant Job as always Eduardo!
🙏 

¡Gracias!


Von meinem iPhone gesendet

Am 26.07.2024 um 22:02 schrieb Eduardo Casino <eduardo...@gmail.com>:

OK, this is the last one, I promise ;-D

New release for KIM-1 and PAL-1 with a 1541 drive.

Limitation: It only currently works for 1541 drives (or pi1541 with 1541 personality). Other drives or SDIEC are not supported.

There are images and boot loaders for the KIM-1 with the xkim1541 extensions installed at 0xF000 and for the PAL-1 with the same extensions at 0xDA00, as modified by @netzherpes.

* Burn the appropriate image into a floppy (or load it into the pi1541 SD card) NOTE: You must burn a binary image, just copying the CPM.PRG file wont work, because the CPM file system is in a hidden file.
* If you also have my modified xKIM monitor, 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

Note: It is really, really slow. I've done it just for fun and because it was trivial once I had David Given's C64 version and my xkim1541 extensions, but it is mostly useless. You can see your beard grow if you compile anything with the assembler.


Mandatory screenshot:

<Captura de pantalla 2024-07-26 220009.png>


Eduardo

On Saturday, July 20, 2024 at 9:31:26 PM UTC+2 Eduardo Casino wrote:
After a bit of tweaking, I have reduced it to just 345 bytes, because my KIM-1 ROM is modified to add the 'X' command, which launches the xKIM monitor, and I only have 346 bytes left.

There are now three bootloader files in the distribution:

* bootsd.bin, which is the binary meant to be loaded at 0x200
* bootsd.pap, same file in PAP format
* bootsd-kimrom.bin, which is the romable version and has to be placed at 0x1AA0 (or 0x2A0 relative to the KIM-1 rom)

The romable version 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

If there is an error initialising or reading the SD card, a "00" or "01" will be displayed on the terminal, respectively, and the boot loader will give control to the KIM monitor.


On Tuesday, July 16, 2024 at 8:25:12 PM UTC+2 Eduardo Casino wrote:
Well, still have to test it because I'm away for a few days, but I think I've been able to squeeze it into 354 bytes :) 

On Tuesday, July 16, 2024 at 2:23:19 PM UTC+2 h.o...@hansotten.com wrote:
I also feared it was too little,  seeing your code, not much room for improvement. Lets keep wozmon in it!

On Tuesday, July 16, 2024 at 2:21:09 PM UTC+2 eduardo...@gmail.com wrote:
The size of the boot prom for the sdcard version is exactly 487 bytes. I haven't really tried to optimize it for size, but 356 bytes sound very challenging :)

On Tuesday, July 16, 2024 at 1:56:22 PM UTC+2 h.o...@hansotten.com wrote:
There is some room in the KIM ROM at 1A96 to 1BFA, now filled with 0's.  Can be used with the KIM clones! 
Less than 512 bytes though ...
 

--
You received this message because you are subscribed to the Google Groups "PAL 6502 computer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pal6502+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pal6502/3e394f3d-4bbe-40c2-aef8-55a53a3ab8can%40googlegroups.com.

Neil Andretti

unread,
Aug 1, 2024, 7:13:57 AM8/1/24
to PAL 6502 computer
I finally got my SD card module today, so I am ready to test my 48 K ROM setup with CPM65 on the PAL1.

While on the research about CPM65 I came to an interesting project called SORBUS, a minimalistic 6502 system consistion only of an 65C02 and a pico Pi.
The project by "svolli"  seems easy enough for my soldering skills :D Svolli provided all gerber files needed to order all PCBs.
I think this will be my next project \o/

Nils

Neil Andretti

unread,
Aug 1, 2024, 3:20:25 PM8/1/24
to PAL 6502 computer
SD Module wired, result is
"Abnormal termination. Error Code: 00"

I will try another SD card the next days. Right now it's a 8GB micro SDHC from sandisk
Without an SD card inserted, the program just hangs.... so it seems to be an issue with the SD card.

Eduardo Casino

unread,
Aug 1, 2024, 3:33:00 PM8/1/24
to PAL 6502 computer
Hi Nils,

Code 00 means initialization error. If you were able to write the image from your PC, then I would double-check the wiring.

Can you please share which module are you using and how is it wired?

Eduardo

Neil Andretti

unread,
Aug 2, 2024, 1:58:47 AM8/2/24
to PAL 6502 computer
I wrote the image with Balena Etcher, will also try dd later.
The sd module is the cheap Pollin one with volatage regulator onboard.
IMG_7470.jpg

Eduardo Casino

unread,
Aug 2, 2024, 3:37:08 AM8/2/24
to PAL 6502 computer
I can't be 100% sure from the picture, but the wiring seems OK to me:

MISO -> PA1
MOSI -> PA2
SCK -> PA3
CS -> PA4

I think the problem may be in the adapter. Although it has a voltage regulator to provide 3.3V to the SD, it doesn't have a lever shifter for the I/O pins, so the 6530 is frying the SD card data and clock lines with 5V!

This is the one I'm using:


They can be found cheaper on Aliexpress.

Eduardo Casino

unread,
Aug 7, 2024, 9:43:28 AM8/7/24
to PAL 6502 computer
Just FYI, David Given has already merged my KIM-1 ports into the main branch in his repository: https://github.com/davidgiven/cpm65

Neil Andretti

unread,
Aug 7, 2024, 2:44:01 PM8/7/24
to PAL 6502 computer
Soooo. finally with a new adapter and a new sd card my setup is working.
hooray \o/
I can max the freem mem from 3000-E000  (I guess from 2000-3000 is the OS located).
why ot 2000.png

Thanks Eduardo for helping getting this stuff running. I wonder how many programs will be ported to CPM65

More l8r!
Nils

GN Liu

unread,
Aug 8, 2024, 10:53:07 AM8/8/24
to PAL 6502 computer
Congratulations Nils!!

I have always had a dream of writing a UNIX-like operating system for the KIM-1, and that dream still exists.

Neil Andretti

unread,
Aug 8, 2024, 12:12:23 PM8/8/24
to PAL 6502 computer
Hey Liu, 
the most promising OS is surely GeckOS... I wonder if we can bribe Andre Fachat somehow to assist :D

GN Liu

unread,
Aug 8, 2024, 9:31:32 PM8/8/24
to PAL 6502 computer
OMG, this is far away advanced than my dream ~~~

Ryan Roth

unread,
Aug 14, 2024, 5:06:48 PM8/14/24
to PAL 6502 computer
Where does the CP/M-65 for the KIM-1 banner come from, the boot loader, or the image on the SD card? I'm trying to debug why it just exits on my KIM-1 reproduction. Thanks.

0200 D8 G

CP/M-65 for the KIM-1

KIM
EDF1 1E 


Eduardo Casino

unread,
Aug 14, 2024, 5:19:35 PM8/14/24
to PAL 6502 computer
It comes from the image on the SD card, from the BIOS, to be exact.

What is your memory configuration?

Ryan Roth

unread,
Aug 14, 2024, 5:39:34 PM8/14/24
to PAL 6502 computer
I have 2000-FFFF all set to RAM on my RAM/ROM board. What I am trying to do is hack in a SD card reader, so I was mostly curious if the KIM-1 was reading from it or not. Don't laugh :)

Sdcardhack.jpg

Eduardo Casino

unread,
Aug 14, 2024, 5:44:46 PM8/14/24
to PAL 6502 computer
0400-13FF must be also present. The disk buffer is at 0200-03FF and the the BIOS relocates itself from 0400.

Love the Frankencard! :-D

Ryan Roth

unread,
Aug 14, 2024, 5:50:25 PM8/14/24
to PAL 6502 computer
Thanks, I figured it worked for a good prototype. I turned on 0400-13FF, but I still see the same behavior. The memory in this area passes the glitchworks memory test.

Eduardo Casino

unread,
Aug 14, 2024, 6:34:34 PM8/14/24
to PAL 6502 computer
I've just tested with (I think) your exact setup and I can't reproduce the problem. The BIOS occupies just a few sectors at the beginning of the SD card. It could be that the image is not completely transferred to the SD card or that the card is faulty.

Ryan Roth

unread,
Aug 14, 2024, 7:06:48 PM8/14/24
to PAL 6502 computer
I'll make another franken-adapter as this SD card works in my PAL-1 using another one of these adapter

Ryan Roth

unread,
Aug 14, 2024, 7:33:58 PM8/14/24