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

0 Members and 1 Guest are viewing this topic.

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
I got some problems:


I executed run"getimg.bas", wrote the disk name, but I didn't find the DSK file.  Where does the program save the DSK file?

I turned off and on the CPC and run"getimg.bas" doesn't work. If I want to use it again, I have to copy to usb again. Not useful :(


The board version is 4a


I attach a image where I load first the BAS file and then run. It seems BIN file got corrupted. That happened twice.


like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
I just test 4a firmware and worked fine. I even test it with an old 2a firmware and program also worked fine.
You should also place program files to root dir of usb flash drive, i haven't test it inside a subdir to see if it works ok too (|DISK command works ok though)
Anyway, this kind of behavior, running a Basic program resulting in corruption of the basic code itself,  is something highly irregular, that usually is not caused by software.
Try using a different usb flash drive, or make a small fat partition and see if the problem solves.
Also, if you experience and other strange behaviors with the board, there might be a connection problem somewhere (usually it's bad contact with edge connector or in rare cases,a  bad contact of ribbon cable).
Finally, if you still have such problems,i'm afraid something is wrong with your amstrad...  ::)
« Last Edit: 02:26, 27 June 21 by ikonsgr »
like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
Well


If I have that files (GETIMG.*) in root directory it works, but it is a mess having many files in root.



like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
Another trouble,


When I boot with usb and wifi, and I write |usb sometimes the response is "unexpected error" or "CH376 USB module not found" or something similar.  And sometimes it is resolved reseting.
like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
Another trouble,
When I boot with usb and wifi, and I write |usb sometimes the response is "unexpected error" or "CH376 USB module not found" or something similar.  And sometimes it is resolved reseting.

  This might be a power problem. Esp 8266 Wifi modules draw quite a lot of current (especially at start), and if you add the power needs of the usb host module + USIfAC board and the connected usb flash drive (which also might draw a lot of extra current), 5v supply pin from amstrad might not be enough.
Try use bigger 5v psu that can supply more current, or a smaller (with less power needs) usb flash drive, this might solve the problem.
like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
I use one of 5V/3A.  CPC needs 1.7V, the rest is for Usifac2, USB module and ESP01.  I think it is enough.  ESP01 needs 100mA at start up.
like
0
No reactions

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.828
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
    • Awards
I use one of 5V/3A.  CPC needs 1.7V, the rest is for Usifac2, USB module and ESP01.  I think it is enough.  ESP01 needs 100mA at start up.

Get an Y cable, and measure what you really measure when everything is ON and running (Volts!).
Often they drop to 4,5 Volts of so, when being used even at half the Amps they offer. Sad, but true.
like
0
No reactions
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
Get an Y cable, and measure what you really measure when everything is ON and running (Volts!).
Often they drop to 4,5 Volts of so, when being used even at half the Amps they offer. Sad, but true.

Exactly! Judging from my rather large experience with many different small 5v/12 psu's, in almost all cases, Amperage advertized, is the MAX, and not the RMS (=Sustained) Amperage!
This means that in practice, a psu rated @ 3Amps can only provide ~half of it (or even less...), and if load, needs to draw more than that, you will have a voltage drop => problems!  ;)
 Now, i have measured the power consumption of an Amstrad CPC which is ~1000mA. USIfAC II board+usb host module can draw another ~100-200mA, and Esp Wifi module needs ~200mA sustained (but it can peak to 500mA in some cases, especially when it powers up). Finally, if you add the power needs of a typical USB flash drive (which is usually rated at few 100's mA when you access it), you can easily have a total draw of more than 1500mA. IMO, if you want to have all these together, you should get a psu with advertized current of 4A (or even 5A) . Also it's good to avoid cheap ones, their actual amperage might be even less than half! One good and cheap psu i have tested and worked ok is this:
https://www.ebay.ie/itm/324101244457?var=513150090529
The 5V/5A costs less than 7euros, and it can surely provide more than 2Amps without problems (i've test it with Amstrad+usifac+usb host module+ old 3.5" Pc Floppy drive which draws ~500mA and 1000mA@peak)
« Last Edit: 13:10, 02 July 21 by ikonsgr »
like
0
No reactions

Offline ajcasado

  • Supporter
  • CPC664
  • *
  • Posts: 70
  • Country: es
    • Awards
To get a stable 5V output in the whole 3A working range you can use a regulated buck chopper like https://www.ebay.com/itm/402847202305?hash=item5dcb907c01:g:gAsAAOSwkkxgn5pj.
Feed it with a supply that can deliver 15W at 9V or 12V (maybe anything higher than 7.5V could do the job) and adjust the output to 5V with the potentiometer screw.
EDIT: It's wise to put a 3A FUSE in series with this kind of stuff.
« Last Edit: 13:31, 02 July 21 by ajcasado »
like
0
No reactions
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Offline eto

  • Supporter
  • 464 Plus
  • *
  • Posts: 451
  • Country: de
    • Awards
Flashing firmware.... will a Pickit2 also work? Or does it need to be a Pickit3?
like
0
No reactions

Offline DoctorCPC

  • CPC664
  • ***
  • Posts: 62
  • Country: tr
  • CPC464 & CPC6128
    • My Blog
    • Awards
Hi Dear Firends,
My usifacII came to me. I will start using on Amtrad CPC 464. I have got some questions about USIFACII. Do you have USIFACII 3d models? I want to use my USIFACII device in own case. Also, if we add a wifi card to the wifi section, can we use the internet features on symbos?
like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
Do you have USIFACII 3d models? I want to use my USIFACII device in own case.
I don't, but i think others have made 3d models for cases.

Also, if we add a wifi card to the wifi section, can we use the internet features on symbos?
You should ask symbos creators for that  :)
like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
MAJOR UPDATE:

- Add new RSX command: |DISK,name,(1). Creates a dsk image file from Floppy disk. Supports DATA/SYSTEM/IBM formats and up to 42 tracks. The optional 2nd argument '1', is for auto creating new image filenames, based on the name you give, by adding a letter at the begining of the name. For example,if 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.
- Add new RSX command: |MAN. This resembles |CAT, but instead of getting the list of files/subfolders of a usb device to screen,it outputs the list of files/subfolders into RAM, starting from &2b00 and using '1' as separator,'2' to mark end, e.g.: 1NAME1NAME1NAME...1NAME2
Function is used by filemanger utility, but it would also be useful for anyone want to develop it's own programs.
- Add new RSX command: |UCOPY,"name1","folder path",("name2").With this command you can copy a file into usb device, named "name1", from it's current position, into another folder. Optionally you can give "Name2" to copy file with a new name.For example,command: |UCOPY,"GAME.BAS","/DIR1/GAMES","GAME2.BAS" will copy GAME.BAS file to /DIR1/GAMES subfolder with name "GAME2.BAS". If you omit the last argument, then file will be copied with same name. Function can be used with any file, regardless the size. Actual copy speed is ~5-10kb/sec (depending on the speed of usb flash drive you are using),so large files like DSK images, will need some time to be copied.
- Better Respond & Error handling, to minimize crashes,hang-ups and erroneous messages. For example,until now, giving |CAT or |DEL without serial connection or usb device enabled, Amstrad hangs up and needed reset.Now, it will try to get respond for a couple of seconds,and then gives you an error message.Also, using |COPY or |DEL commands repeatedly, sometimes caused problems with |CAT,after.All these weird responds, should be now fixed.
- Bug Fix: Swapping dsk images didn't function in some stituations.
- Bug fix: Loading eeprom (|WROM) from usb device file,didn't work right.
- Overall optimization of Board's main ROM code.
- Update |HELP to include the new RSX commands.
- Update user's manual and "inner workings" folder too.

And this, most probable, would be the last firmware update (Rev 5).
Btw, soon,i will upload an |UCOPY version for older boards (like with disk2image and file manager)  :)

« Last Edit: 12:51, 03 July 21 by ikonsgr »
like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
will be those improvements/utilities as binary files?
like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
- Add new RSX command: |MAN. This resembles |CAT, but instead of getting the list of files/subfolders of a usb device to screen,it outputs the list of files/subfolders into RAM, starting from &2b00 and using '1' as separator,'2' to mark end, e.g.: 1NAME1NAME1NAME...1NAME2
Function is used by filemanger utility, but it would also be useful for anyone want to develop it's own programs.

What happens if there is a file called "mifile.tx2".  Does it mean the end of the list?
like
0
No reactions

Offline eto

  • Supporter
  • 464 Plus
  • *
  • Posts: 451
  • Country: de
    • Awards
AWESOME update!

Add new RSX command: |MAN. This resembles |CAT, but instead of getting the list of files/subfolders of a usb device to screen,it outputs the list of files/subfolders into RAM, starting from &2b00 and using '1' as separator,'2' to mark end, e.g.: 1NAME1NAME1NAME...1NAME2

What happens if the filename contains "1" or "2"? Like Who dares Wins II (wdw2).

btw: would it be possible to get long filenames too? It would be great if the filemanager could show long filenames (but of course then execute the short filenames).

like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
What happens if the filename contains "1" or "2"? Like Who dares Wins II (wdw2).
What happens if there is a file called "mifile.tx2".  Does it mean the end of the list?

Well,i'm afraid you both forgot one thing: A file name is translated to the ASCII code for each character, so if you have '1' in the name, you will actually get a value of 49, or for '2' a value of 50  ;)
So, using values 1 and 2 for name separator and end marking, causes no conflict, whatever is the name!  ;D

btw: would it be possible to get long filenames too? It would be great if the filemanager could show long filenames (but of course then execute the short filenames).
I'm afraid it can't, as this is a restriction of the CH376 usb host module it doesn't support long filenames. Although the old 8.3 name type, is what Amstrad use either in  Basic or Amsdos, so using 8.3 names seems more compatible  :)
« Last Edit: 23:10, 03 July 21 by ikonsgr »
like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
will be those improvements/utilities as binary files?
File manager and disk2image are already available as binaries for use with older firmware boards. |UCOPY will be added soon too  :)
like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
Have you thought about writing a program like wget, something like |wget,"<url>",["output_file"]  ??
like
0
No reactions

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
Have you thought about writing a program like wget, something like |wget,"<url>",["output_file"]  ??
You mean download directly a file from an ftp/tcp/http server using esp 8266 wifi modules?
Well, first, it's impossible to add anything else anymore, there is literally no room left in Microcontroller's  program memory  ::) (btw, last |UCOPY command was really a tough one that needed quite room too:
Code: [Select]
ucopy:
;;     UCOPY,"name","dest directory",1 for delete source

ld e,a
xor a
ld b,100 ;reset all used variables
ld hl,source_path_buffer
init_values:
ld (hl),a
inc hl
djnz ,init_values

call check_usb_en
jp z,usb_dis_err
ld a,e
cp 1
jp z,error_4
cp 2
jr z,no_delete_file
cp 3
jp z,rename_file
jp error_4

no_delete_file:
ld h,(ix+1)
ld l,(ix+0)
ld (dest_path_addr),hl

ld h,(ix+3)
ld l,(ix+2)
ld (copy_file_addr),hl
ld (copy_new_file_addr),hl
jr cont_copy_file

rename_file:
ld h,(ix+1)
ld l,(ix+0)
ld (copy_new_file_addr),hl

ld h,(ix+3)
ld l,(ix+2)
ld (dest_path_addr),hl

ld h,(ix+5)
ld l,(ix+4)
ld (copy_file_addr),hl
jr cont_copy_file

cont_copy_file:

ld hl,(dest_path_addr)
call get_arg2 ;hl=dir path address; e=size
ld b,0
ld c,e
ld de,dest_path_buffer ;store destination path to buffer
ldir
inc de
xor a
ld (de),a

ld hl,(copy_file_addr)
call get_arg2
ld b,0
ld a,e
ld de,copy_file_name
ld (de),a
ld c,a
inc de
ldir

ld hl,(copy_new_file_addr)
call get_arg2
ld b,0
ld a,e
ld de,copy_new_name
ld (de),a
ld c,a
inc de
ldir

continue_copy:
ld bc,&fbd9 ;store source path to buffer
ld a,1
out (c),a
ld b,27
ld hl,source_path_buffer
store_path:
        ld a,&fb
        in a,(&d3) 
ld (hl),a
inc hl
djnz ,store_path

ld hl, ucopy_to_ram
ld de, &1e60
ld bc, 138
ldir
di
;--------------------------------------------------------------------------------------------------------
next_copy:
ld a,(file_state)
ld (file_state_temp),a
ld a,1
ld (file_state),a
ld hl,source_path_buffer
call place_directory
call set_directory
ld e,0
call set_filename
jp nz,error_ucd
ld hl,data
ld a,(file_state_temp)
ld (file_state),a
call copy_file_to_ram

ld (buffer_pos),hl
call close_files ;close source file
ld hl,dest_path_buffer
call place_directory
call set_directory
ld e,1
call set_filename
jp nz,error_ucd
cont_save_file:
ld hl,(buffer_pos)
ld a,h
sub &20
add a,a
ld h,a ;h has number of 128byte packets to send to save file
ld a,l
or h
jr z,end_saving2

ld a,l
or a
jr z,remove_chunk
sub 128
jp m,no_extra_chunk
jr z,no_extra_chunk
inc h
ld l,a
jr no_extra_chunk
remove_chunk:
dec h
ld l,128

no_extra_chunk:
ld d,h
ld e,l
ld hl,data
call write_bytes

ld a,1
ld (file_state),a
ld hl,(buffer_pos)
ld a,h
sub &20
ld h,a
call calculate_position ;add hl bytes to save file pointer
call end_saving
jp next_copy
;-------------------------------------------------------------------------------------
end_saving2:
ld hl,source_path_buffer
call place_directory
ei
end_saving:
ld bc,&fbd0
call usb_cmd
ld a,&36
out (c),a
ld a,1
out (c),a
jp check_responce2
;-----------------------------------------------------------------------------------------
set_filename:
ld bc,&fbd0
call usb_cmd
ld a,&2f
out (c),a
ld a,d
or a
jp z,continue_a
out (c),a ;put "/" in front of name
continue_a:
ld hl,copy_new_name
ld a,e
or a
jr nz,continue_b
ld hl,copy_file_name
continue_b:
; ld bc,&fbd0
ld e,(hl) ;size of name
inc hl
name_to_copy_loop:
call upper_case
out (c),a
inc hl
dec e
jr nz,name_to_copy_loop
xor a
out (c),a
call clear_buffer
call usb_cmd
ld a,(file_state)
or a
jr z,make_new_file
ld a,&32
jr cont_save_1
make_new_file:
ld a,&34
cont_save_1:
out (c),a
call check_responce2
in a,(c)
cp &14
jr z,seek2
jp error_4
;---------------------------------------------------------------------------------------
calculate_position: ;add hl to save file pointer
or a
ld a,(file_pos)
adc a,l
ld (file_pos),a
ld a,(file_pos+1)
adc a,h
ld (file_pos+1),a
ret nc
ld a,(file_pos+2)
inc a
ld (file_pos+2),a
ret
;---------------------------------------------------------------------------------------
seek2:
ld a,(file_pos)
ld l,a
ld a,(file_pos+1)
ld h,a
ld a,(file_pos+2)
ld e,a
ld d,0
seek:
call usb_cmd
ld a,&39
out (c),a
out (c),l
out (c),h
out (c),e
out (c),d
call check_responce2
in a,(c)
cp &14
ret
;---------------------------------------------------------------------------------------
place_directory:
ld bc,&fbd1
ld a,53
out (c),a ;clears path directory into PIC
ld c,&d6
place_dir_loop:
ld a,(hl)
or a
jr z,end_loop11
out (c),a
inc hl
jr place_dir_loop
end_loop11:
out (c),a
; call set_directory
; call set_filename
ret

;-----------------------------------------------------------------------------------------

ucopy_to_ram:

defb 30,128,205,175,30,123,183,32,1,201,205,226,30,237,162,4,29,32,247,205,211,30,62,59,237,121,205,226,30,124,254,158,200,24,221,30,128,1,208,251,205,211
defb 30,62,60,205,199,30,62,45,237,121,205,226,30,237,120,4,237,163,29,32,250,205,211,30,62,61,237,121,205,226,30,122,183,200,21,24,212,205,211,30,62
defb 58,205,199,30,62,39,237,121,205,226,30,237,120,95,183,200,205,226,30,201,237,121,237,89,175,237,121,205,226,30,237,120,12,62,1,237,121,13,62,87,237
defb 121,62,171,237,121,201,12,237,120,61,40,251,13,201
And keep in mind that inside the above code, they are not included ~half a dozen of other routines used (check "Usifac_ii_main_rom.asm" inside innerworkings folder, for more details)
Of cousre you can always develop anything you want as an independant binary/Basic file, like with disk2image and file manager utilities.
Now,in theory, if you first use |WIFI to establish a direct connection with a tcp server ( which is enabled when you run the PC windows utility) it would be rather easy to do such a thing, as you can use directly Amsdos routines to either load or save files from/to the tcp server. But, if you want to connect to an ftp server (or through http,udp etc) you will need a different firmware for esp8266 module that supports such protocols.
Maybe you are interested to develop such a function?  :)
« Last Edit: 14:35, 04 July 21 by ikonsgr »
like
0
No reactions

Offline Fran123

  • CPC664
  • ***
  • Posts: 60
  • Country: es
    • Awards
You mean download directly a file from an ftp/tcp/http server using esp 8266 wifi modules?
Well, first, it's impossible to add anything else anymore, there is literally no room left in Microcontroller's  program memory


maybe you could remove the games
like
0
No reactions

Offline issalig

  • CPC464
  • **
  • Posts: 47
  • Country: es
    • Awards
True, these games could be just in the USB together winth the utility programs (file managers, etc)  and the extra space will make USIFAC2 even more powerful.

Compression would be another solution but I do not think it's worth. Maybe it will be free 25% of game space and I do not know any fast compression routines for  Great Cow Basic. Surely @ikonsgr will now about what is available in GBC.
like
0
No reactions

Offline Devlin

  • CPC664
  • ***
  • Posts: 149
  • Country: gb
    • Magicbane
    • Awards

maybe you could remove the games


Seconded. The games don't add anything being in ROM, and could be included in a "starter pack" for copying to usb to start off.
like
0
No reactions
Amstrad fan! | CPC464 + USIfAC II | Administrator of Amstrad Discord : https://discord.gg/ksWvApv

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 565
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
    • Awards
Well IMHO, games in rom does have a "quick start" value, because they give you the chance to load a few classic games immediately after you power on your Amstrad, without even needing to connect a usb flash drive! It's litterally a PLUG & PLAY feature!  :D
Besides, i don't think there is anything valuable left to add as RSX command, where any extra "special" requests, can be always made as binary files loaded from usb device like disk2image or filemanager.
« Last Edit: 12:21, 05 July 21 by ikonsgr »
like
0
No reactions

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.828
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
    • Awards
Just out of curiosity... how much KB of ROM do the 'internal' games occupy in the chip?
like
0
No reactions
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)