Home » RBC Forums » General Discussion » Plasmo's 68k pathfinder projects (68K, 68000, 68020, 68030, 68040, 100mm x 100mm pc board)
|
Re: Plasmo's 68k pathfinder projects [message #3159 is a reply to message #3154] |
Tue, 04 July 2017 23:11   |
norwestrzh
Messages: 196 Registered: November 2015
|
Senior Member |
|
|
Hi Bill,
>> I really like "A Simple Approach" described in section 5.3.1 of CP/M-68K System Guide, but the author discouraged the method!
Not sure what you mean. The simple approach is what I used (I think). Full track, and other caching methods would take a lot more work.
> I'm also interested in how you created 4 (or more) drives on a CF.
What I did was to create a filesystem for the first drive, mount the CF, and initialize (with INIT) the other 3 drives. Then you can copy (with PIP?_) the A: filesystem to B:, C:, or D:. Then repeat to load up the other non-A: filesystems. You can also use cpmtools to build B:, C:, or D: and then write a little C code to move over the first "disk" and copy to another. I'm a Linux guy, so this is pretty easy to do. dd will also work, but is more dangerous.
> My truly burning question was how to transfer files to/from PC (Windows Vista) to CP/M.
I wrote a little utility that reads S-record files, and saves them to "disk" (the CF). I convert source files to S-records and move them over that way. Works most of the time.
>> I have absolutely no idea how to transfer CP/M back to FAT16--I'm just not smart enough today to write a FAT16 driver in CP/M.
No need. Most terminal emulators have a capture function. You can "type" ascii material and capture it with your terminal emulator (assembly listings, for example). 68k CP/M also has a DUMP application, and one called "SENDC68" (I think I remembered that name correctly?_) you can use to display binary, and again capture it with your emulator. I wrote a little application that I call "eatdmp" that converts dump format back to binary, and there are a number of applications you can find on-line to work with S-records (the output from "SENDC68").
Hope this helps.
I'm really interested in your work with 68020, 68030, etc. Would love to get a CPU like that going. *grin*
Roger
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3164 is a reply to message #3159] |
Wed, 05 July 2017 10:13   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
Roger,
Got your BIOS. Many thanks!
It is interesting that we started with the same sample BIOS, and CPM15000.SR, use the same 68681 DUART and CompactFlash, yet our codes are so different. I put my BIOS code as it stands today in here for your reference.
https://www.retrobrewcomputers.org/lib/exe/fetch.php?media=b uilderpages:plasmo:tiny68k:tinybios.txt
Thanks for the suggestions of using S Record file transfer & terminal screen capture to move data to/from CP/M and PC. That may well be the solution in the near term.
From what I have read in the past year on the subject of retrocomputing, A Linux machine appeared to be a critical tool. Somehow I need to find space on my cluttered desk to accommodate another box and monitor & learn another operating system. heavy sigh!
Thank you for your interests in the 68020 & 68030. I designed them to make sure that parts & tools I have on hand are working. These designs are simple and limited in capabilities. I want to explore the world of DRAM, IDE, VGA, Ethernet and Operating Systems with cheap 68000 designs and then migrate the hardware designs into 020, 030 and even 040.
Bill
[Updated on: Wed, 05 July 2017 10:15] Report message to a moderator
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3171 is a reply to message #3165] |
Wed, 05 July 2017 13:10   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
Roger,
I also do not initialize the DUART in the BIOS since it is already initialized in my monitor.
Both our drives are the same size, 8 megabyte. Since I defined my drive with 256 sectors per track and 255 tracks per drive and furthermore each drive is offset by multiple of 256 tracks (drive B is offset 256 track, drive C is offset 512 tracks, and drive D is offset 768 tracks), I don't do any translation between CP/M sector/track/drive to CF sector/track--just copy track & sector values provided by CP/M into CF registers and execute read or write commands. It won't be quite this simple when block/deblock algorithm is implemented.
I gather your CF is bus connected with 16-bit data bus, just like mine. You may noticed that I don't do byte swap when I read the 16-bit data. This is because when I processed the CP/M image created by cpmtools, I did the byte swap and then copy the byte-swapped image back into a CF starting from sector 0, thus creating a CP/M disk partition with bytes already swapped. In the back of my mind I expect to be burnt by this little trick sooner or later...
Retrobrew forum member 'will' has designed a USB FIFO for file transfer. It is based on FTDI's FT232H.
https://www.retrobrewcomputers.org/doku.php?id=boards:ecb:us b-fifo:start
It is another reference design for adding high speed transfer capability.
On a different topic, are you the same Roger on comp.os.cpm a few months ago who was having trouble running CPM400.SR? I want you to know that I have problem with CPM400.SR as well. I used the same procedure as CPM15000.SR and make sure the BIOS is linked correctly. When I go to 0x400, I'll get the >A prompt, but next keystroke will hang up the CPU with the CF disk access light turned on forever. I have 16 megabyte of memory so I'm not concerned about throwing away 128K byte of memory but I'm curious, did you figured out what's the problem was?
Bill
[Updated on: Wed, 05 July 2017 13:13] Report message to a moderator
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3172 is a reply to message #3171] |
Wed, 05 July 2017 15:06   |
norwestrzh
Messages: 196 Registered: November 2015
|
Senior Member |
|
|
Hi Bill --
>> It won't be quite this simple when block/deblock algorithm is implemented.
No, but the way I did it is a little more complicated than it needs to be. I wanted to use the lba bits carefully, so as to allow for future expansion to more "drives". That's why only lba0 and lba1 are used.
>> I gather your CF is bus connected with 16-bit data bus, just like mine.
Yes, and I wonder why you are not having the problems that I'm having. As I told you, my 68k boards are completely TTL, and I find that the direct interface has very tricky timing. I experimented with using an 8255 for the interface, but it is horribly slow. A friend in Norway came up with a way to get the timing right using a dual multivibrator chip, but calibrating that circuit is quite tricky as well. It seems to be speed limited too, maybe 6 or 7 MHz, on top of that. I'm experimenting with using delay lines now to get the timing right, and it seems to work most of the time. I'm running with DTACK* grounded at 12 MHz, but I cannot get the Digital Research BASIC compiler to work properly. It compiles an application OK, but when I try to run the result I get exceptions. I have it working on another of my 68k boards with the multivibrator interface and slower clock, so I'm pretty sure that the BASIC compiler pushes my direct interface to the point of failure. Haven't figured out why.
So, what is the secret of your CF interface? Is the difference programmable logic?
>> Retrobrew forum member 'will' has designed a USB FIFO for file transfer. It is based on FTDI's FT232H.
Yep, that's the one. Well, very similar to what I was suggesting. There are a number of parallel to USB devices out there (one very expensive one is made by FTDI). USB transfer can be very fast!!
> ... are you the same Roger on comp.os.cpm a few months ago who was having trouble running CPM400.SR?
Yep, that's me. I was never able to figure out why that wouldn't work. But the CPM15000.SR image works fine. Maybe some day I'll work on relocating an image a little lower in memory, but as you say with all that memory, is it worth worrying about? I haven't even come close to pushing the limits of 2 MB memory on my boards, so your 16 MB seems HUGE to me! *grin*
Roger
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3173 is a reply to message #3172] |
Wed, 05 July 2017 17:06   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
Roger,
Somewhere in the CF spec is the requirement that nIORD or nIOWR assert 70ns after nCS0 or nCS1 asserts. It needs to assert for 165ns before negating. After that nCS0 or nCS1 may negate and address change. I meet the timing spec with one wait state when accessing CF. The output of the DTACK gates nIORD or nIOWR thus giving it a delay of 70ns after the assertion of CF chip select. nIORD, nIOWR and nIDECS negate when nAS negates. The design file is here but the logic is scattered over two sheets.
https://www.retrobrewcomputers.org/lib/exe/fetch.php?media=b uilderpages:plasmo:tiny68k:tiny68kcpld.pdf
Here is the same logic redrawn.

At 12MHz I don't believe you can meet the timing spec with DTACK grounded. You need to add at least one wait state, two wait states give you more margin considering you are using analog circuits.
-------------------------------------
Well, it is good to review my circuit. As I go through the timing to explain how it works, I find out it DOESN'T! The wait state generator does not generate one wait state as I've thought. I'm in fact accessing the CF with zero wait. At 8MHz I barely meeting the timing spec of 70ns setup time. I'm meeting the 165ns hold time comfortably. The circuit should works as is, but I'll need to add one more stage of flip flop if I want to raise the clock to 12MHz.
edit: Measure the actual timing with my scope. Yes, I'm accessing the CF with zero wait state. The time from nIDECS0 assert to nIORD asserts is 124ns. nIORD asserts for 194ns and negates the same time as nIDECS0. All works out OK. One more example of "luck beats skill any day!"
[Updated on: Wed, 05 July 2017 17:39] Report message to a moderator
|
|
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3180 is a reply to message #3177] |
Thu, 06 July 2017 09:36   |
norwestrzh
Messages: 196 Registered: November 2015
|
Senior Member |
|
|
>> CF and SD cards are not designed to expect a lot of rewrites of the same block except in the FAT area with a DOS style fs.
>> From a performance and a card life point of view you may well be better off just using 128 bytes of each block rather than
>> being clever in the BIOS code.
Actually, the block/deblock described here will *reduce* the writes/rewrites to the CF. Blocking delays writes/rewrites that are not critical ( non-directory I/O_)_wherever possible.
[Updated on: Thu, 06 July 2017 09:37] Report message to a moderator
|
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3197 is a reply to message #3177] |
Fri, 07 July 2017 17:00   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
etchedpixels wrote on Thu, 06 July 2017 06:11plasmo wrote on Sun, 02 July 2017 16:52Some performance specs:
- I have not figured out how to block/deblock 128 byte/sector of CP/M into 512 byte/sector of the CF, so each 128-byte CP/M sector takes a full 512-byte CF sector--very wasteful, something to work on in the near term.
CF and SD cards are not designed to expect a lot of rewrites of the same block except in the FAT area with a DOS style fs. From a performance and a card life point of view you may well be better off just using 128 bytes of each block rather than being clever in the BIOS code.
CP/M 3 supports other sizes including 512 byte blocks but this never made CP/M 68K as far as I know because CP/M 68K had a rather brief and very unsuccessful life, being slaughtered in the market by OS/9 68K, and turning into Atari TOS.
The current blocking/deblocking algorithm is not sophiscated. The main saving is CF disk space, but it can be argued that the CF disk is cheap and the saving is not worth the complexity, a point well taken. In term of performance, blocking has faster CF reads, but deblocking has slower CF writes because of the extra reads-before-writes. The number of writes are the same between the two algorithms so same amount of wear on CF. The CF should have wear-leveling of the entire disk, but life expectancy of CF is always a concern and this simple algorithm is not helping nor hurting.
I did a couple quick performance comparisons. Copying entire disk A: to disk C: (2200 Kbytes, 126 files) takes 190 seconds for BIOS with blocking/deblocking and 248 seconds for BIOS without blocking/deblocking; executing the reloc1.sub batch file (SUBMIT RELOC1) takes 28 seconds for BIOS with blocking/deblocking and 34 seconds for BIOS without. It is 20-30% faster.
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3214 is a reply to message #3200] |
Thu, 13 July 2017 09:13   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
rhkoolstar wrote on Fri, 07 July 2017 23:21.
Besides, I would not worry too much about excessive writes. Compared to more modern OSes CP/M disk writes are sparse.
Rienk
I modified the BIOS and added a 8 meg RAM drive to drive E. https://www.retrobrewcomputers.org/lib/exe/fetch.php?media=b uilderpages:plasmo:tiny68k:tinybios_rd.txt
The size of TPA is reduced to 7 meg. The RAM drive algorithm is quite small, only about a dozen or so instructions--no blocking/deblocking, no wait on CF interface, just simple read/write to memory. Yet, when I did a benchmark copying entire disk A: to E: (2200kbytes, 126 files), it takes 137 seconds compare to 190 seconds CF to CF copy. execute the RELOC1.SUB in RAM drive takes 24 seconds instead of 28 seconds in CF. The improvement is much smaller than my recollection of the RAM drives speed-up. It is hardly worth the efforts except for the saving on CF write wearing. Perhaps CF accesses are particularly efficient and perhaps CP/M does the minimum disk I/O as you've pointed out.
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3218 is a reply to message #3214] |
Thu, 13 July 2017 17:03   |
mikemac
Messages: 250 Registered: March 2017
|
Senior Member |
|
|
plasmo wrote on Thu, 13 July 2017 09:13The improvement is much smaller than my recollection of the RAM drives speed-up. It is hardly worth the efforts except for the saving on CF write wearing. Perhaps CF accesses are particularly efficient and perhaps CP/M does the minimum disk I/O as you've pointed out.
Since all accesses are being gated by the 8MHz clock of your CPU, I'd expect both your slow SDRAM and your fast CF to have a similar speed. I'm guessing that if you added up the cycles for accessing the DRAM that they'd come out pretty close to the number of cycles accessing the CF. Looks like the DRAM wins by one or two cycles.
RAM disks really made a difference when our 486/Pentiums running at 66MHz were trying to access our really slow MFM drives. Or even worse, floppy drives!
At 8MHz, everything is equally slow.
Mike
[Updated on: Thu, 13 July 2017 17:06] Report message to a moderator
|
|
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3231 is a reply to message #3224] |
Sun, 16 July 2017 04:33   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
All these discussions about compactflash make me wonder has anyone designed a computer system that boot out CF? Another word, no boot ROM, the first instruction fetch out of reset is from CF? Sure, the CF needs prior initializations to point to the right head/track/sector and a read command, but that can be easily handled with a state machine. In addition, there needs to be some temporary 'magic decoding' so the first few hundred instruction fetches after a reset all go to the CF's data register; once a simple bootstrap is copied from CF into memory and executing, it can restore normal memory map and load CP/M or a monitor software. It is a bit convoluted and needs a modest CPLD (such as my favorite EPM7128) to pull it off, but it seems do-able. Then again, if it is so do-able, someone may have done it already. Though?
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3232 is a reply to message #3231] |
Sun, 16 July 2017 08:56   |
mikemac
Messages: 250 Registered: March 2017
|
Senior Member |
|
|
Isn't that what you're essentially doing with your SPI flash? You could have just as easily read the boot sector off of the CF and copied it to 0x0 before releasing RESET.
Or you could memory map the CF's boot sector. But the difference in read sizes between memory (1,2, or 4 bytes) and the CF (128, 512 bytes) usually means you're going to have a "copy" of the boot sector in some memory anyway. So just as well use RAM and do the copy. If you REALLY wanted to avoid the use of any kind of memory buffer, I guess you could reread the boot sector each and every time you wanted to read a word during boot. Obviously that would be a tad slow.
Mike
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3233 is a reply to message #3232] |
Sun, 16 July 2017 09:02   |
mikemac
Messages: 250 Registered: March 2017
|
Senior Member |
|
|
Oh, one other thing. With your SPI flash, you set up the initial read commands and then sequentially do one read after another. That works great for copying the whole boot image. But executing the boot image does not access the image sequentially. Someplace in the boot image will be a loop or jump of some kind. So trying to set up the CF so that you issue a CF read command to it once and read sequentially as the processor executes the image won't work.
At least I don't see how it'd work. If someone better at this knows a trick to do that, I'd love to hear it too!
Mike
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3238 is a reply to message #3232] |
Mon, 17 July 2017 15:54   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
mikemac wrote on Sun, 16 July 2017 08:56Isn't that what you're essentially doing with your SPI flash? You could have just as easily read the boot sector off of the CF and copied it to 0x0 before releasing RESET.
The method you suggested (hardware copying boot sector to DRAM) is a more intuitive approach but that wasn't what I've in mind when I wrote about booting off CF. I may try that if my original idea failed. The original idea is using hardware to initialize a CF so it behaves like a 256-word deep FIFO in address range 0x0 - 0x7FFF immediately after powering up. The first 2 long words of the FIFO is stack pointer and reset vector (0x8) followed by a series of move immediate instructions and ended with a jump instruction to 0x8000. When 68000 comes out of reset and starts program execution at 0x0, the FIFO feeds it the stack pointer, reset vector, then a stream of move immediate which initialize the area starting from 0x8000 with the actual boot strap code and finishes with a jump to 0x8000. At this point it is about where you are suggesting with hardware copying of boot sector to DRAM. It still needs to restore normal memory map to 0x0 - 0x7FFF and copy the monitor or CP/M from CF into memory to complete the booting process.
It occurs to me that my existing board can be easily modified to boot off CF, so I think I should just go do it and see if the idea really works.
Edit: thank you, etchedpixels, that's exactly the code I have in mind.
[Updated on: Mon, 17 July 2017 15:56] Report message to a moderator
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3246 is a reply to message #3239] |
Thu, 20 July 2017 17:02   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
These are valid points. In fact, the encoding of the move immediate data is a pain. I haven't figured out how to do it using assembler directives so I ended up cut & paste the bootstrap opcodes from the assembled listing.
What I am concerned with is the complexity of data transfer from CF to DRAM using the hardware state machine. I want to simplify the hardware and push complexity to software. I was hoping I can design both approaches and provide a quantitative measurement of the complexity, but that didn't work out so far. I'm having problems getting the CF initialization to work in hardware. I can initialize CF reliably in software, but something is different with the hardware state machine that the CF is responding differently.
Well, there are too many (non-electronic) tasks waiting, so I'll put this off to another days.
Edit:
The CF initialization for both hardware state machine & software looks like this:
After negation of the Power-on Reset
read CF Status register bit 7 (BSY) & bit 6 (DRDY) until (BSY==0 AND DRDY==1)
Write 0x1 to CF SectorCount register
Write 0x1 to CF Sector register
Write 0x0 to CF Cylinder Low register
Write 0x0 to CF Cylinder High register
Write 0x0 to CF Drive/Head register
Write 0x20 (Read) to CF Command register
Read CF Status register bit 7 (BSY) & bit 3 (DRQ) until (BSY==0 AND DRQ==1)
Remap 0x0 - 0x7FFF to CF Data register and Release 68000 nRESET
If anyone see flaws in CF initialization, please let me know.
Edit-Edit,
The problem I'm having is that I don't see DRQ==1 after writing 0x20 (Read) to CF Command register with hardware state machine, but no problem with software initialization routine.
[Updated on: Thu, 20 July 2017 17:14] Report message to a moderator
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3252 is a reply to message #3250] |
Fri, 21 July 2017 20:48   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
The IDE spec I referenced to is ANSI X3T10 dated 1994 that specified status needs to be valid within 400nS for the READ command. My state machine has an access recovery time (from negation of CF chip select to assertion of the next CF chip select) of 500nS. I was concerned about that and lengthened it to 1.5uS, but it makes no difference.
The CPLD I used only have 128 flip flops, too small to contain a boot ROM. That's why I needed an external memory, like CF, to provide the boot code. I looked up Amstrad PCW boot sequence and it sounded like what mikemac is suggesting--copying 256 bytes of boot strap code from printer controller ROM into RAM and executing it, which then load & execute the program from drive A. I may have sufficient logics in the CPLD to do that, but the first step is to initialize the CF correctly so it can supply the necessary data to the CPU.
[Updated on: Fri, 21 July 2017 20:48] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3271 is a reply to message #3269] |
Tue, 25 July 2017 14:34   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
It is good to walk away from a problem for a while and come back with fresh eyes: The problem with CF initialization is due to a mix-up of the CF addresses. For the state machine to work its magic, it needs to control the CF address lines, so the existing hardwired A1-A3 are cut & re-wired to the CPLD. Well, I made a mistake in wiring the 3 address lines such that A2 & A3 are swapped. This explained fully the weird behaviors of the CF during its initialization. With A2 & A3 fixed, the CF initialized correctly and the bootstrap code loaded the monitor and monitor executed as expected. So now I can throw away the serial EEPROM and boot out of CF--well, not quite, success with one brand of CF does not mean it will work with all brands of CF. I plan to have two version of the 68000 boards, one boots out of serial EEPROM while that other boots out of CF. My preference is booting out of a CF because the state machine is quite simple: 2 cascaded 3-bit counters, 3 registered outputs, and 3 state variables for a total of 12 flip flops, compare that to well over 50 flip flops for the serial EEPROM loader. The CPLD is only 66% utilized whereas the serial EEPROM booting CPLD is 90+% utilized. I need the spare capacity in CPLD to add more features, but at 50 cents per board or $5 per run, it is hardly worth the effort to decide which design to proceed--just do both of them.
|
|
|
|
|
Re: Plasmo's 68k pathfinder projects [message #3647 is a reply to message #3636] |
Tue, 24 October 2017 07:48   |
plasmo
Messages: 916 Registered: March 2017 Location: New Mexico, USA
|
Senior Member |
|
|
Thanks! It works quite well as well. I've started a board wiki page under the "boards/sbc" directory:
https://www.retrobrewcomputers.org/doku.php?id=boards:sbc:ti ny68k
There are a number of things I want to check out:
- Software to program the 2nd serial EEPROM in-situ and boot from the 2nd serial EEPROM
- Auto boot to CP/M68K, perhaps I can boot directly to CP/M when boot out of the 2nd serial EEPROM
- All my tests were done at 8MHz system clock, I want to move up to 12MHz
- Build a CF disk from scratch & document it. I've tried so many different things, I forgot how to do it from the beginning!
Are there interests in this board? I've already built up 2 boards and both are working well. I want to build the third one with sockets for 68000 & 68681 so I can do speed test. The remaining 7 boards are available for anyone interested. The bare board is $1.50 each, I can assemble & program the Altera EPM7128 and program the 24C256 and sell the partial assembly for $8, or I can sell the assembled & tested board for $25 (as shown in the picture but without the CF disk). The socketed parts are SIMM module, 68000, 68681, oscillator, and 24C256 so if you already have these parts, let me know and I'll take them off the $25.
|
|
|
Current Time: Sun Mar 16 02:07:42 PDT 2025
Total time taken to generate the page: 0.01036 seconds
|