Author Topic: USIfAC II:Convert a PC or USB stick to Amstrad HDD,access dsk's,and many more!  (Read 38053 times)

Vokgear and 1 Guest are viewing this topic.

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
A thousand of thanks for your support!

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
A thousand of thanks for your support!

Well, i'm thinking to improve disk2image function by making it completely automated:

- Use GET_SECTOR_DATA Amsdos routine to automatically determine the type of inserted disk (System,Data or IBM), so no need to ask for disk type.
- Use BIOS_READ_SECTOR routine to automatically determine the number of sectors/track (9 or 10) and automatically use the appropriate image file.
- Use BIOS_MOVE_TRACK routine to automatically determine the number of tracks of the disk (i suppose i can use 42 track image files for all disks, normal disks will just not use the last couple of tracks).
- Add mutliple DATA and CPM disk images to folder (with names like DATA1.DSK, DATA2.DSK etc), and modify BASIC program to choose automatically one image after the other,program will inform you for the name of image used for each disk! So,if i add 10 disks, you will be able to take back up of 10 floppy disks in a row!  ;) And the good thing is, that you can copy these images from usb flash drive to your PC, laptop etc and then re-use them directly for taking backup images of another 10 disks!

So practically the only thing you will need to do is to change disks and press a key!  ;D


btw, i'm in a process of creating a "get file size" routine that will help adding file size information to the name catalogues even with file manager too!  :)
« Last Edit: 10:11, 21 June 21 by ikonsgr »

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
I was going to tell you the first point.Another question, is it possible to create an empty file without headers. I guess it must be done from the chip on board.

On the other hand, I want to improve the file explorer, but I need some easy routines (for you). I need execute |stat command, but I need the results in memory address, not as console output.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
0
I was going to tell you the first point.Another question, is it possible to create an empty file without headers. I guess it must be done from the chip on board.
You can save headerless(=ascii) files using Basic's openout command. From assembly, you can use all Firmware routines to create a headerless file too, using CAS_OUT_OPEN, CAS_OUT_CHAR and CAS_OUT_CLOSE. This way you can create headerless custom made files, and read them using CAS_IN_CHAR. Only drawback is that read/write would be rather slow (comparing to the CAS_DIRECT routines which give you the maximum speed).

I need execute |stat command, but I need the results in memory address, not as console output.
That's easy. Just give OUT &FBD1,30. You will get the results char by char, by reading USIfAC II buffer:
Code: [Select]
10 DIM STATUS(200):I=1:OUT &FBD1,1:OUT &FBD1,30  (&FBD1,1 is for clearing buffer before getting report)
20 WHILE INP(&FBD1)=255
30 STATUS(I)=INP(&FBD0):i=i+1
40 WEND

 After executing the above program, you will have the status report saved into STATUS array!  ;)
« Last Edit: 10:39, 21 June 21 by ikonsgr »

Offline issalig

  • CPC464
  • **
  • Posts: 47
  • Country: es
  • Liked: 29
  • Likes Given: 47
I am taking a look at the schematics and I have seen that microcontroller pin 37 (RB4)  is not connected but in my board (green with usb soldered and no SWAP) it is connected to A5.
Looking the PIC code it is only set as an input ( DIR portB.4 IN ) but it looks like it is not used.
Maybe this schematic is for new boards (white ones)?
« Last Edit: 15:00, 21 June 21 by issalig »

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
I just update the file manager,it now includes an alternative one (fsm) which gives you also size of each file next to filename: 

  [ You are not allowed to view attachments ]  

Appart from having a bit slower respond (due to extra proccess), the 2 managers are working with exact the same way. You can check FSMANAG.BAS to see how exactly i did it (this is the source code for making FSMANAG.BIN binary, using turbo basic compiler).

I am taking a look at the schematics and I have seen that microcontroller pin 37 (RB4)  is not connected but in my board (green with usb soldered and no SWAP) it is connected to A5.
Looking the PIC code it is only set as an input ( DIR portB.4 IN ) but it looks like it is not used.
Maybe this schematic is for new boards (white ones)?
This pin is connected to A.5 pin (which is actually A5 bit of the address bus). It's a result of a restriction in the pins you can use as inputs, for the CLC modules. 
 
« Last Edit: 21:43, 21 June 21 by ikonsgr »

Offline Devlin

  • CPC664
  • ***
  • Posts: 139
  • Country: gb
    • Magicbane
  • Liked: 66
  • Likes Given: 22
I just update the file manager,it now includes an alternative one (fsm) which gives you also size of each file next to filename: 

 

Appart from having a bit slower respond (due to extra proccess), the 2 managers are working with exact the same way. You can check FSMANAG.BAS to see how exactly i did it (this is the source code for making FSMANAG.BIN binary, using turbo basic compiler).
 This pin is connected to A.5 pin (which is actually A5 bit of the address bus). It's a result of a restriction in the pins you can use as inputs, for the CLC modules.


Oh my. That's ace!
It seems also that the issue from before where certain games would fail to load from the file manager was fixed too. thank you for saving my 464 keyboard <3
Amstrad fan! | CPC464 + USIfAC II | Administrator of Amstrad Discord : https://discord.gg/ksWvApv

Offline Audronic

  • 6128 Plus
  • ******
  • Posts: 1.458
  • Country: au
  • I know RST3 . I now know a little More.
  • Liked: 322
  • Likes Given: 748
I just update the file manager,it now includes an alternative one (fsm) which gives you also size of each file next to filename: 
Hi John
The Readme.txt  Mentions "Check with |STAT if you board has rev_4c firmware or newer"

I can only find Revision 4B Firmware ??
Is there a link to rev-4c or above ?

Keep Safe 
Ray
« Last Edit: 02:27, 22 June 21 by Audronic »
Procrastinators Unite,
If it Ain't Broke PLEASE Don't Fix it.
I keep telling you I am Not Pedantic.
As I Live " Down Under " I Take my Gravity Tablets and Wear my Magnetic Boots to Keep me from Falling off.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
I can only find Revision 4B Firmware ??
Is there a link to rev-4c or above ?

 I haven't upload this version yet,i want first to make the modifications to the disk2image routine, and see if i can also add it as an extra RSX command, along with |MAN for getting the directory filenames into ram. This most probable, would be the final firmware version, there is no space left for anything else, and besides, i don't think there is anything else to add anymore!  :)

Offline Audronic

  • 6128 Plus
  • ******
  • Posts: 1.458
  • Country: au
  • I know RST3 . I now know a little More.
  • Liked: 322
  • Likes Given: 748
Ok Thanks
 I will await the update


Thanks
Keep Safe
Ray
Procrastinators Unite,
If it Ain't Broke PLEASE Don't Fix it.
I keep telling you I am Not Pedantic.
As I Live " Down Under " I Take my Gravity Tablets and Wear my Magnetic Boots to Keep me from Falling off.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
I've upload the new version of disk2image routine with a few enhancements:
- Automatically recognize System,Data or IBM Disk format.
- Transfer up to 9 disks in a row by automatically selection of ready made image files.
- Support up to 42 tracks.

Inside zip file, you will find 9 dsk images for each format (DATx.DSK , CPMx.DSK, IBMx.DSK), program informs you which image file is used for each floppy disk:

  [ You are not allowed to view attachments ]  

All image files are reusable,meaning that you can overwrite them with backups of new disks, without needing to use "empty" images.
I'm also planing to add this "disk2image" routine as a new RSX commamnd into firmware, and along with the addition of RSX command |MAN for filemanager, would probably be the last firmware update  :)
« Last Edit: 22:04, 23 June 21 by ikonsgr »

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
Hello
I think the utilities dsk2image and image2dsk mustn't be as RSX command using ROM memory. If there was memory to spare, yeah.
I dont't know why you need a DSK file previously, I think you can create it on execution time.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
I think the utilities dsk2image and image2dsk mustn't be as RSX command using ROM memory. If there was memory to spare, yeah.
Image2disk is an rsx command (|DSK)  even from the first firmware release. I manage to make ~1kb of free space in microcontroller program memory, which i can use to add the recent reverse "Disk2image" utility as an rsx command too.

I dont't know why you need a DSK file previously, I think you can create it on execution time.
You need to have a ready made proper dsk image (e.g. of DATA, SYSTEM or IBM format, which use different sector code numbers) because,
 the Disk2image utility only copies the raw sector data to the corresponding positions of the image file, it DOESN'T create a NEW image!
This would require a lot more code and effort, as structure of a dsk image is rather complex: https://www.cpcwiki.eu/index.php/Format:DSK_disk_image_file_format
But even so, you can just copy all the pre-made dsk images to your usb flash drive, run the utility, and make up to 9 backups of disks in a row, in just a few minutes (it takes only 40seconds to get each disk image)! Then, you can copy your backup images from the usb stick and rewrite the same images to backup other disks.
Practically this might be even easier and faster compared to giving an image file name for each disk (if utility could create one)...  ;D

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
And the last utility we need is a copier for files inside usb, maybe something like that |COPYUSB,"src","dest", and the program (.bin) for older boards (I got one two weeks ago).
The copier program must ask SRC and DEST.
 ;)


At the end Usifac will be very complete extension ;)

« Last Edit: 22:04, 24 June 21 by Fran123 »

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
by reading USIfAC II buffer:
Code: [Select]
10 DIM STATUS(200):I=1:OUT &FBD1,1:OUT &FBD1,30  (&FBD1,1 is for clearing buffer before getting report)
20 WHILE INP(&FBD1)=255
30 STATUS(I)=INP(&FBD0):i=i+1
40 WEND

 After executing the above program, you will have the status report saved into STATUS array! 

I get 165 zeros :(
I added   35 print status(i)

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
Strange, on my amstrad works fine. Check again your listing maybe you have some type error somewhere.
What exactly you mean by copy files inside usb? Move a file to another directory perhaps?
Anyway,i manage to modify the disk2image routine to an rsx command (|DISK,"name") which also creates a dsk image file, without needing a pre-existed one  ;D
I'll see to make it as a stand alone program and upload it in the weekend.

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
What exactly you mean by copy files inside usb? Move a file to another directory perhaps?

just copy, like "COPY A B" or "copy /dir1/dir2/A /dir3/dir4/B"

and as you say, a MOVE too.

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
Hello
I have just got and ESP01 and adaptor from Aliexpres. Can I plug directly to the UsifacII board?  Or have I flash the ESP01?

Offline Skunkfish

  • Supporter
  • 6128 Plus
  • *
  • Posts: 709
  • Country: gb
  • Editor of Colour Personal Computing
    • CPCSTORE.CO.UK - Dedicated to the Amstrad CPC
  • Liked: 523
  • Likes Given: 1411
Hello
I have just got and ESP01 and adaptor from Aliexpres. Can I plug directly to the UsifacII board?  Or have I flash the ESP01?


I think it's good to go. I assume the adaptor is the the one with the 3.3V LDO regulator?
An expanding array of hardware available at www.cpcstore.co.uk (and issue 3 of CPC Fanzine!)

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
just copy, like "COPY A B" or "copy /dir1/dir2/A /dir3/dir4/B"
and as you say, a MOVE too.
Filecopy between different dirs in usb device, might sound easy in theory, but it would be rather difficult to make it in practice. The problem is that, you can't have 2 files ,one to read and one to write, both openned at the same time.So it would require to use a buffer in Amstrad's ram, and manage access of read & write files sequentially. As for MOVE, is nothing but a file copy that deletes the source file in the end. I will have to give it a thought and see if and how can be done.

Now, i just upload a new version of image2disk function!
This time, it creates the image file by the given name, so no need to have premade images in flash drive.
 Again, it supports data,system/cpm and ibm formats and up to 42 tracks. It usually takes ~40seconds for each disk transfer.
I have also developed it as a new RSX command: |DISK,"name",(1) . The optional 2nd argument '1', is for automatically creating new image files, based on the name you give ,by adding a letter at the beginig of the name. If for example you give name: "BACKUP.DSK" ,with the extra argument '1', program will  name  images: "ABACKUP.DSK", "BBACKUP.DSK","CBACKUP.DSK" etc. So you could take many backups in a row, by only changing disks and pressing a button  ;)

 From this point, it could be possible to develop a more complex (and of course slower ) routine, to support non standard disks, like with more than 9sectors/track or various formats for each track, but i really don't know if it's worth the trouble, as this function would be mostly needed to back up old 3" disks which 99,9% chances are they would be
 standard data or system/cpm format disks. Besides, non standard disks where in most cases copy protected games that would be practically impossible to produce a working image from them...  ::)


p.s. @FRAN123, you really have become a... "motivation engine" for further USIfAC development  :laugh:
« Last Edit: 19:18, 25 June 21 by ikonsgr »

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
p.s. @FRAN123, you really have become a... "motivation engine" for further USIfAC development

Thank you, I'm programmer and I think a lot of things, but with your device, you'll always be one step in front of me (obviously).  I would like help more, but I have my asm and basic rusty.

Sometimes I have had an idea, and later I have seen you hast post my idea or similar.

I hope you give me a unit because mine is going to be very outdated ;)

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
  • Liked: 11
  • Likes Given: 0
More...


I used Arduino and ESP01 some years ago and I got to do a request to a web server and receive the page.


I don't know how ESP01 is configured with UsifacII and if it is possible to make request to servers (using AT commands), because with |wifi  command it ask about a server and a port (I guess the server and port used by windows application), and it gets the network configuration with DHCP.

Offline kolleykibber

  • CPC664
  • ***
  • Posts: 50
  • Country: gb
  • Liked: 40
  • Likes Given: 31
Hi @ikonsgr


If you're thinking of doing more..!

I wonder if there could be a way to use the serial port and the usb without relying on cpc side code. So if the cpc requested files then enable the usb or if it requested the serial port then enable the port. From the schematic I think they share the same tracks, so I imagine this may require a change to the hardware?


Thanks again for all the inspiration!






Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
More...
I used Arduino and ESP01 some years ago and I got to do a request to a web server and receive the page.
I don't know how ESP01 is configured with UsifacII and if it is possible to make request to servers (using AT commands), because with |wifi  command it ask about a server and a port (I guess the server and port used by windows application), and it gets the network configuration with DHCP.
For manually configuring Esp modules you can use |COM, it's a small terminal desgined exactly for that purpose.  :)

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 561
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 564
  • Likes Given: 110
Hi @ikonsgr
If you're thinking of doing more..!
I wonder if there could be a way to use the serial port and the usb without relying on cpc side code. So if the cpc requested files then enable the usb or if it requested the serial port then enable the port. From the schematic I think they share the same tracks, so I imagine this may require a change to the hardware?
Thanks again for all the inspiration!
Usb module can be activated or deactivated on demand (using the |USB command). Also the direct serial connection to a pc can be activated/deactivated with |EN command.
In any case, the serial port is completely independant, and you can use it directly by giving OUT or IN commands to ports &FBD0 and &FBD1.