6502.org
http://forum.6502.org/

FPGA Uk101 - SD card possible ?
http://forum.6502.org/viewtopic.php?f=10&t=4917
Page 1 of 1

Author:  DenisMM [ Mon Sep 25, 2017 11:06 am ]
Post subject:  FPGA Uk101 - SD card possible ?

I built a UK101 back in 1980 from a kit and spent quite a while exploring all of it's features over the following years.
I did have a sound card operating and had attached twin floppy drives, via a Floppy controller card, and extended the memory to 40K with a memory card from a project published in Elektor magazine.

I'm retired now for several years and approaching 70 - still full of vigour, thankfully.

Last year, I resurrected it , now stripped back to it's single board again, and got it to work with it's basic 8K ram, by replacing various bits and pieces.

I have built Grant Searle's FPGA based UK01 http://searle.hostei.com/grant/uk101FPGA/index.html , for fun, with the 40k memory expansion based on a single static chip. Brilliant project ! I can now load programs from my PC using, hyperterm.

I looked at his generic FPGA project ( http://searle.hostei.com/grant/Multicomp/index.html ) on how to attach an SD card, for storage, but it seems to be focussed on Z80 only, using CP/M.

Has anybody built the SD card extension to the FPGA UK101 ? And what are the software demands for reading/writing program files ?

Author:  BigEd [ Mon Sep 25, 2017 11:32 am ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

Welcome - an excellent choice of first machine! (By which I mean, same as mine.)

I can't help directly with your question, but there are several SD Card projects for Acorn 8-bit micros, with sources available, which might help you if you were try to write your own. These projects bit-bang the interface using a few pins of a VIA, but any parallel port would do. I think my first tactic would be to ping Grant to see if he has any unpublished code to help get started.

See for example
https://github.com/hoglet67/MMFS

Note that there's the question of filesystems - both as to how the data on the card is organised, and how the 6502 accesses the data. In the case of MMFS, the card has a FAT filesystem, with a single file which contains a number of disk images. Once a disk image is selected, the Acorn MOS style of file system is used.

But for a UK101 you don't have a filesystem(*). The very minimal thing to do is to treat the card as a stream of bytes, with no filesystem, and to have just one file on each card. Somewhat like an audio tape. (But there's still work to do: the card is actually organised as blocks.)

(*) Oh, hang on, you had disks attached. So you do have a filesystem! Perhaps you can tweak the filesystem to use the SD Card instead of a disk controller.

Sorry I can't be more helpful... You could also try posting in the off-topic section on StarDot.
http://stardot.org.uk/forums/viewforum.php?f=11

Author:  DenisMM [ Mon Sep 25, 2017 11:44 am ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

Quote:
(*) Oh, hang on, you had disks attached. So you do have a filesystem! Perhaps you can tweak the filesystem to use the SD Card instead of a disk controller.


I'm afraid 'had' is the operative word. When resurrected, it was in a sad state and while I have a junk box of experimental bits, the controller is long since dissappeared. ( I could search some of the darked receses of my garage :).

Thanks for the info. You have given me a research path.

I will email Grant. I've long admired his projects.

Author:  BigEd [ Mon Sep 25, 2017 11:45 am ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

Please share your findings! My experience is that solid state storage makes an enormous difference and has reinvigorated retro computing.

Author:  Cray Ze [ Mon Sep 25, 2017 2:33 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

Multicomp has hardware support for SD Cards on all three CPU platforms, but no software support on anything but Z80 CP/M.

Another forum member had a go at 6502 SD support a few years back, but I'm guessing life got in the way and progress halted.
It has limited FAT16 support (read only, no directories, 8.3 filenams) so might be starting point.
viewtopic.php?f=2&t=3047

Author:  DenisMM [ Mon Sep 25, 2017 4:11 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

Good :)
I had spotted that earlier. It has SD reading, orientated towards boot loading.
I've downloaded that to look at it.

Author:  Cray Ze [ Mon Sep 25, 2017 4:52 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

The boot code from the C-ONE project has some interesting FAT12/16/32 handling code, read only again though.
https://sourceforge.net/projects/c1boot ... oot-alpha/

fat.s from the above archive.
https://pastebin.com/6bwqMjJv

Author:  DenisMM [ Tue Sep 26, 2017 7:35 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

I came across a 65C02 homebrew which uses a SD card for storage. It's a project on Hackaday @

https://hackaday.io/project/5789/logs

He drives the SD card interface from i/o pins of a 6522 PIA (Via?).

He also reveals all source code on the page.

Looking at the code , I got the impression he uses enhanced(?) opcodes from the Cmos version of the 6502.

Boy ! I've now got a mountain to climb to understand all that :)

Author:  BigEd [ Tue Sep 26, 2017 8:03 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

That's a great find! It's not too hard to put in short instruction sequences for a 6502 - especially perhaps if you have a macro assembler. So long as it's not space or timing critical, it's easy.

Author:  Cray Ze [ Tue Sep 26, 2017 8:55 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

That's an interesting project. It's 65C02 code (the CMOS version) as you suspected, which presents a bit of a hurdle. Multicomp uses the T65 core, which has incomplete 65C02 support and won't run the code.
I've never tried substituting a different 6502 core in multicomp, though it's certainly doable, and would probably be easier than rewriting the FAT16 routines for the NMOS 6502.

You'll likely need to adapt sdcard.s to talk to multicomp's SD card interface. You shouldn't need to touch sd_fs.s though.

Finally, you'll need to patch BASIC in order to LOAD from and SAVE to the SD card.
Microsoft BASIC, as used in multicomp is available online as source in a form that can be modified and reassembled.

Create your own Version of Microsoft BASIC for 6502
http://www.pagetable.com/?p=46
https://github.com/mist64/msbasic

Also a good follow up article.
http://www.pagetable.com/?p=774

Author:  BigEd [ Tue Sep 26, 2017 9:03 pm ]
Post subject:  Re: FPGA Uk101 - SD card possible ?

It mightn't be too hard to put a shim around Arlet's core and substitute that into the Multicomp. The advantage being that there's a 'C02 version of Arlet's core. (You need the shim to convert from the core's setup for synchronous RAM to the usual 6502 convention of asynchronous RAM.)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/