News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)

Started by ikonsgr, 19:20, 05 January 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ikonsgr

Quote from: Targhan on 18:01, 29 July 20
The double ReadSectors of the track 1 should be A1/A2. My code receives something else, so consider this is wrong. Can you trace what your read sector returns?
YES! You are right! My code returned in both read_id requests the same "A1" sector_id, because from what i've read in the 765FDC manual noted before, read_id returns H,C,R,N of the 1st valid sector of current track so, i always returned the 1st sector of current track. So,i revised the code, to respond with next sector_id each time a read_id is requested, and now, it responded with A1 and then with A2 as expected,thus it FINALLY  worked! Thank you VERY MUCH for the hint, as it helped me to make the emulation a bit more accurate!

p.s. Loading is indeed VERY fast even with the emulation, at least 2 or maybe 3 tracks/sec, and as each track has 10 sectors, it surely loads up to ~15kb/sec, you really "bit bang' the "Granny" 765FDC!  :)

GUNHED

READ ID read the first valid ID, that's right. But not from the tracks beginning. It read the very next valid ID. And since the drive is spinning this can be any ID of any sector. Which does it read? It only depends on the position of the head over the track, and the track is constantly moving.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Targhan

In order to be sure to read the first sector of a track, a trick consists in reading a non-present sector, then perform the Read ID.
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

GUNHED

And the only situation I an imagine to do that is to scan the array of sectors on a track.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Targhan

Or reading/writing a tricky format where all the sectors have the same ids in a stable order. Not something you do every day :).
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

CraigsBar

I am just learning of this interface today. Is the Serial port side of things compatible with the MiniBooster standard?
IRC:  #Retro4All on Freenode

TotO

Sorry, I misunderstood the question (edited). You can plug any TTL things on it too.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

ikonsgr

Quote from: GUNHED on 09:19, 29 July 20So now to the great thing about the Vortex controller. Everything is the same like with the CPCs FDC765, the only differences are the addresses and the fact that the Vortex FDC765 can physically connect four drives - and that's awesome, that way one can use 3", 3.5" and 5,25" at the same time.
Now the FDC status for Amstrad is &FB7E, and for Vortex it is &FBF6
The FDC data port for Amstrad is &FB7F, and for Vortex it is &FBF7

Well,in that case, i think that board will work with Vortex without needing any modifications at all!  :o
You see, the address decoding i'm using (at least for serial port & FDC emulation), is based in checking ONLY specific address bits, and NOT the hole 16bit address (the hole address is needed only for the ROM emulation, which is activated by a different logic: check"ROMenable"=rom read signal, along with address bit 14)!
I'm doing this, mainly to maximize speed and efficiency,as the execution of an Address bit check in PIC's MCU code, is made  in ~0,12uS, whereas, checking specific full address it would need ~1uS! Moreover,Address bit check, defines address ranges and NOT specific addresses, which makes finding of the device (for which the I/O request occures), MUCH easier and faster!
To be more specific,according to this , whenever an I/O request occures, i only need to check Address bit10 (=&FBxx), in order to define if the request is intended for Expansion Peripherals (which, fortunately includes BOTH serial interfaces AND FDC controller!  ;) ) .
After that, i check A5 (Address bit5) to determine if the request is intended for the 765 FDC (&FBFx=> A5='1') or the serial port (&FBDx=>A5='0') , and if I/O request is for 765FDC, i finally check A0 ,to see if its status register port (&FB7E=>A0='0') or data register port (&FB7F=>A0='1'). Note also that all the above bit checks, are executed in ONLY ~1/3 of a microsecond!
And now, here is the "MAGIC":
If you check the address ports of the vortex, you will see that EXACTLY the SAME logic can be applied for Vortex too:
Vortex FDC status register port= &FBF6 => A10='0', A5='1', A0='0' EXACLTY like with 765 FDC!
Vortex FDC data register  port= &FBF7  => A10='0', A5='1', A0='1' EXACLTY like with 765 FDC!
So, most probable USIfAC II will emulate Vortex floppy controller too:D ;)


[UPDATE] I 've modified the circuit to include A5 bit in address decoding logic, so now, only one bit check is required in the code ,and Amstrad doesn't pause at all when FDC emulation is disabled! With previous code+circuit there was a minor delay ~0,5-1%, in Disk drive function, because of the 3bit checks made in software, which cause ~0.5us delay for every FDC I/O request, also some copy protected game had dfficulties loading from gotek/floppy drive (for example, original dragon ninja image nedded ~33sec to load instead of normal ~23secs needed)  ,obviously because of this minor delay, but now everything is fixed + overall performance was slightly increased too!  ;)

GUNHED

Thanks for the detailed information.  :)  As I did read too, you can switch on/off your FDC emulation. That's great so we can work with read FDC and FDC emulation at the same time.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Actually ,there are 3 modes of operation:
- Direct mode, for run/load/save files directly from PC
- Floppy disk controller emulation, for accessing dsk images
- Usb device mode which is for enabling the use of  CH376 usb storage deivce host module (instead of a direct link to PC).
All these are enabled/disabled through simple BASIC RSX commands, but also by giving simple "out &FBD1,x" requests, for use in basic or assembly programs! ;-)
And all the above modes can function in various combinations:
- Direct mode ON, FDC & USB OFF, access files to a connected PC hard drive (through, direct USB2TTL cable, bluetooth module or Wifi module)
- FDC ON, Direct mode & USB OFF, access  dsk images to to a connected PC hard drive
- USB & Direct mode ON, access files in usb storage device (through CH376 host module shown before)
- USB & FDC ON,Direct mode OFF, access dsk images in usb device (not finished yet, but i think i'll manage to make it work at least for most dsk images :-) )
Finally, if all modes are OFF, you can access disk/gotek drive, BUT at the same time, using RSX commands: |CAT, |CD and |DEL you can catalogue,navigate and  delete  files from a connected device to USIfAC II! For example:
- If you give "CAT" ,you will get the contents of a floppy drive disk or gotek drive image,but...
- If you give "|CAT" you will get the contents of the selected PC directory (all modes OFF) or even usb device(USB ON, others OFF)! ;)

In reality, there are two separate ROMS for file/disk access, one is the AMSDOS ROM, and the other is the virtual ROM on USIfAC II. In normal operation, all AMSDOS commands directed to AMSDOS ROM, and extra RSX commands are used to access USIfAC Rom. But, when you enable direct mode, AMSDOS is practically replaced by USIfAC II ROM. And  because only a few routines (for load/save/cat) are actually implemented by USIfAC ROM, a copy of the entire AMSDOS IMAGE ROM is placed in PIC's flash memory, in order to service all other AMSDOS routines too! ;-)
So now, practically, more than 90% of all file games can run directly at super fast loading speeds, and only games using sector loaders, need access to dsk images (in much slower... "drive speeds")!  ;)

GUNHED

This is just awesome!


Maybe somebody should split the topic now?
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

When i will have it ready for presentation i'll make a new topic for it  :)
And for a small update,i've finished dsk image loading from usb device, most of images seem to work ok, also i've added PARADOS image to pic's flash memory too, and with a simple RSX command you can select if you want to use AMSDOS or parados! Thus, you will be able to use parados functionality (for accessing large dsk images) not only on cpc6128/664 but even with a cpc464!  ;)

CraigsBar

Quote from: TotO on 20:44, 31 July 20
Sorry, I misunderstood the question (edited). You can plug any TTL things on it too.


I was meaning can the Arkos Rom SUite be used with this new Serial device like they can with the Minibooster.

IRC:  #Retro4All on Freenode

TotO

Oups.. So, I understood well the first time. :-\ 

The Mini Booster is based around the CPC Booster custom ports while the USIfAC use the standard Amstrad ports, so the softwares are not compatibles without patching them.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

Skunkfish

Quote from: TotO on 07:15, 15 August 20
The Mini Booster is based around the CPC Booster custom ports while the USIfAC use the standard Amstrad ports, so the softwares are not compatibles without patching them.
Sounds like a challenge for you there Craig!  ;D
An expanding array of hardware available at www.cpcstore.co.uk (and issue 4 of CPC Fanzine!)

GUNHED

Quote from: ikonsgr on 20:54, 14 August 20
When i will have it ready for presentation i'll make a new topic for it  :)
And for a small update,i've finished dsk image loading from usb device, most of images seem to work ok, also i've added PARADOS image to pic's flash memory too, and with a simple RSX command you can select if you want to use AMSDOS or parados! Thus, you will be able to use parados functionality (for accessing large dsk images) not only on cpc6128/664 but even with a cpc464!  ;)


To have Parados too is great. Could it be possible to add a "switch" of one byte in the Parados ROM to activate the Vortex format? That would be awesome. Around here Vortex is the standard for 0,7 MB formats. Parados can do this but needs to be put in Vortex-mode (format menu). There is a Varados ROM out there which has Vortex format enabled by default. It would be great to have this too! Varados and Parados are different only in few bits.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Quote from: GUNHED on 00:35, 18 August 20
To have Parados too is great. Could it be possible to add a "switch" of one byte in the Parados ROM to activate the Vortex format?

I believe this is not needed. As i explained in previous msg, UsiFAC II Floppy controller emulation, should be able to respond in BOTH vortex and 765 ports in EXACTLY the same way, thus most probable it should work directly with any program uses Vortex instead of 765!

GUNHED

Quote from: ikonsgr on 11:28, 05 September 20
I believe this is not needed. As i explained in previous msg, UsiFAC II Floppy controller emulation, should be able to respond in BOTH vortex and 765 ports in EXACTLY the same way, thus most probable it should work directly with any program uses Vortex instead of 765!
The case with Parados is the following. It supports lot of formats. And one need to set up the format selection. It either works with Vortex format or a Romdos format. This can be changed in the format setup. Or a byte in the ROM can be changed to select either the one or the other format.From Parados ROM the Varados ROM was made, the only difference is one byte. Parados has ROMDOS format enabled and VaraDOS has the Vortex format enabled.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Well, if thst's the case,i could place varados instead of parados as the 2nd ROM DOS (both ROMS will be embedded into PIC's flash memory), and choose between Amsdos or Varados with a simple RSX command! ;-)

GUNHED

Quote from: ikonsgr on 15:50, 07 September 20
Well, if thst's the case,i could place varados instead of parados as the 2nd ROM DOS (both ROMS will be embedded into PIC's flash memory), and choose between Amsdos or Varados with a simple RSX command! ;-)
To offer an option for the customer to decide between ParaDOS or VaraDOS would be great indeed.  :) :) :) :) :)

For the Plus computers you need to either install Amsdos 0.7 (intead of 0.5 from CPC range). Or a patched 0.5 Amsdos which ist 6128 Plus compatible.

Also I remember there were Parados/Varados for 6128 Plus and CPC6128 in different versions.

Maybe it would be possible to update the ROM slots from the CPC side, but this can be too much effort?
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

I'm afraid my knowledge about 6128plus is rather limited (i don't even now if Usifac ,older or new one, even works on 6128+, unfortunately i dont have a plus model to make any tests...). 
Do you know the differences  between 0.5 and 0.7 Amsdos?  Is there any new to offer or just some bug fixing? And what about compatibility?
In any case, in theory i could place 2,3 or even more Roms in PIC's flash memory, the only limitation is the size of flash (128kb in total) .
More than half is the actual code for all supported functions (Serial I/O, Rom Emulation, FDC emulation & Usb device utilization) plus ~15kb is Usifac's II virtual ROM (including mainly code for all the RSX commands supported). I've also included 2 small games (pacman and Galachip) you can load driectly using RSX commands, which also take ~20-22kb of flash mem. This left around ~45-50kb of free space to add various ROMS e.g. 2-3 extra roms (excluding the default Amsdos rom) . My thought was to add  at least Parados, but most probable i could add 1 or 2 more roms, if it's worth it!  ;)

Btw, i've finished code for Dsk image read/write from usb device, which seems to function much better than initially expected, almost all images i've tried, can now be loaded  from usb stick too! I've even tried loading the 800kb dsk image of orion prime from usb stick, and worked fine, along with the ability to save the game too!
Also, file support is now fully functioning, e.g. read/write/delete BAS, BIN and ASCII files either from PC or usb stick!
Coming next, copying files between 3"/3.5" disk drive and usb device (e.g. like the previous PC2CPC and CPC2PC functions) ,and maybe an upgrade of the current Amsdos based DSK image transfer function ,using a custom "low level" code that would surely improve speed and ability to write much more disk formats! ;-)

Skunkfish

I can confirm that the older Usifac does indeed work with the 6128+ as is what I use it on. I'm using a C4CPC rather than the original Burning Rubber/AMSDOS cartridge, not sure if that makes a difference......
An expanding array of hardware available at www.cpcstore.co.uk (and issue 4 of CPC Fanzine!)

GUNHED

Yes, the USIfAK does work with all CPCs and Plus.

The Amsdos 0.7 compared to 0.5 only has some additional commands like !JUEGO to start the Burnin Rubber game on the cartridge. It's no advantage over regular 0.5 Amsdos.
The problem is that the CPC464-6128 Amsdos will crash the Plus computer. However there is a patch for the old Amsdos from the Inicrons to run with the 6128 Plus (and of course the CPCs).

Congratulations to be able to load Orion Prime and all other DSKs - that's really amazing!!!  :) :) :)

Well, if the PIC has more space... then... what's about offering a small ROM box? In this case you don't have to care about the ROMs and everybody can add the own desired DOS versions. On the other hand this may be way too much effort.

Great to see USIfAK II advancing!!!  :D :D :D
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

LizWiz

As Linux user I'd like to replace the Windows program. Maybe with something with a web interface, so that I could use e.g. a Raspberry to serve the disk images/files.
Is the serial protocol the USlfAC is using documented somewhere? Or is the source code of the Windows program available?

GUNHED

Ah, you're going to make that software? Great!
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Powered by SMFPacks Menu Editor Mod