USIfAC II:Convert a PC or USB stick to Amstrad HDD,access dsk's,and many more!

Started by ikonsgr, 08:17, 01 December 20

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

SkulleateR

The link is the answer to : "Is it possible to have a WiFi module USIfAC 2"

The case is in Post#1 in this thread and has to be altered (I guess) ;)

ikonsgr

For anyone with older USIfAC II firmware:
If you don't have, or don't want to buy a pickit programmer only for updating firmware of PIC MCU, and since i currently have a lot of PIC chips in stock,
i decide to offer a PIC Chip with the latest Firmware (6g) to replace it, for 5euros (including economy postage). Anyone interested, send pm to arrange.

ikonsgr

MAJOR FIRMWARE UPDATE (rev.7):

New Firmware can be found here. ("USIfAC II_REV7(with bootloader).zip" file is the one with the bootloader, which needs to be flashed ONLY ONCE using a PICKIT programmer, "18f47q10_7.zip" is for updating firmware using the new serial programming/PIC kit programmer) .

Updates include:

- New Firmware is now equipped with a Bootloader, meaning that you can use a free program utility and a simple USB2SERIAL cable adapter (for a couple of euros...) for updating/fixing firmware! Of course this new ability requires revision 7 (rev.7) firmware or newer to be installed on your board. So, you must program ONCE the PIC MCU chip, using a pickit programmer as before, or i can send you a replacement PIC chip with the new Firmware installed, and any future firmware update/fix needed, you can do it yourself, very easy and almost for nothing! ;-)
You will need a usb2serial cable adapter like this(PL2303TA) or adapter like this (CP2102,for this type you will also need 4 female to female DuPont cables). For the most common PL2303 usb2ttl adapter cables, you can find drivers here (also verify which chip version you need for the windows version you use)
Just, download and install the TinyMultiBootloaderPlus software (TBL), Connect the USIfAC II board to the usb2serial adapter AND THEN to a usb port of your PC:

You cannot view this attachment.

Start TBL utility, set com PORT & speed to 115200bps, and select firmware HEX file. Then just click "Write Device" button and immediately push 'Reset" button on USIfAC II board. Flashing Firmware should start:

You cannot view this attachment.

After completion of the process (in ~2minutes), disconnect usb2serial adapter , reconnect the USIfAC II card to Amstrad CPC and power up.
At the BASIC prompt enter: OUT &FBD2,5, Restart/Reset the Amstrad CPC and the USIfAC II message should now appear on the Startup Screen, that's it!  :)

- User's Guide updated: Add the new rsx commands and a new "Updating the Firmware" section is added.

New Rsx Commands:

-|EXT,"filename": Extract a file from a dsk image to USB storage device. This was an old request, but i recently found out a rather easy way to do it, although with some limitations. I simply use AMSDOS disk routines to load file on memory (exactly as with RUN/LOAD commands) and then disable FDC emulation and use again AMSDOS disk routines to save file on usb device. ;-)
This method works for most BAS/BIN files, except for some games that use a binary file (usually of more than 42kb) which loads data into system memory areas, causing Amstrad CPC to reset or hang. I've also noticed that with some binaries i got a "syntax error" message at the end, in that case, although file is extracted correctly, you need to reset Amstrad afterwards.

- |TYPE,"file":Displays on screen ascii/text files. For larger texts, use any key to pause printing.

Updated RSX commands:

- |FORMAT,"D/S","A/B": As with file extraction from dsk images, i think this was an old request too. So, instead of having repeated questions for each disk you want to format (Select Drive A/B and Format Type DATA/SYSTEM),i modify Format command to be more direct: Without arguments (|FORMAT) it will directly format a disk using Data Format in Drive A (it just give a msg "insert Disk and press any key"). For System format and/or use of Drive "B" you must give extra arguments, for example: |FORMAT,"S","B" will use System format on Drive B. After each format completion, you return in Basic prompt, as with every other RSX command.

- |HELP: An optional argument is added (|HELP,2  or |HELP,3) which shows directly 2nd or 3rd help page. So, if for example, you want to see something on 3rd page, you wont have to view all help pages from the start ;-)

Audronic

@ikonsgr

Hi John

Ok Flashed the PIC with the USIFACII_REV7.hex and it worked as soon as I set the ROM number to 5.
This is on my old BOMB CPC464 with Basic 1.0 Rom Fitted.

The AUTO USB Is Brilliant (I am Lazy - And Forgetful)

I tried 2 other roms (40022 - 664 Basic 1.1 and a 6128 Combo Rom Basic 1.1)
BUT they did not auto USB (Thats OK as the 464 ROM worked)

So far so good

Thanks for ALLLLLLL the work you have done on these devices

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.

Devlin

Once the update is done, will I still be able to use the pickit3 to update the firmware should I need to? or will reprogramming need to be done entirely by the serial link afterwards?

(probs an obvious question, but rather I know than accidentally shoot myself in the foot)
CPC464 & CPC6128 + USIfAC II + Revaldinho 512k(universal cpld ver) - Schneider CRT TV
Administrator of Amstrad Discord : https://discord.gg/ksWvApv

poulette73

Quote from: Devlin on 13:42, 23 August 23Once the update is done, will I still be able to use the pickit3 to update the firmware should I need to? or will reprogramming need to be done entirely by the serial link afterwards?
(probs an obvious question, but rather I know than accidentally shoot myself in the foot)

https://www.cpcwiki.eu/forum/amstrad-cpc-hardware/ulifacusb-mass-storage-wifi-512kb-ram32xrom-board256k-ram16x-rom-board!/msg230951/#msg230951

Devlin

CPC464 & CPC6128 + USIfAC II + Revaldinho 512k(universal cpld ver) - Schneider CRT TV
Administrator of Amstrad Discord : https://discord.gg/ksWvApv

ikonsgr

Quote from: Devlin on 13:42, 23 August 23Once the update is done, will I still be able to use the pickit3 to update the firmware should I need to? or will reprogramming need to be done entirely by the serial link afterwards?
(probs an obvious question, but rather I know than accidentally shoot myself in the foot)
Bootloader doesn't affect the ability to use any programmer, you can use ANY firmware and flash it with a PICKIT programmer.
BUT, if you want to use the much easier and simpler serial programming, you must flash ONLY ONCE, "USIfAC II_REV7(with bootloader).zip" firmware (which has both bootloader and rev3. firmware) using  a PICKIT programmer.
And, if you use PICKIT programmer you can flash directly the usual "18f47q10_7.zip" firmware too.

shacpc

Hi John, by including the bootloader do you think that it is possible that in the future ULIIfAC or USIfAC II can execute a startup file of the type "autoexec.bas" as it happens in M4, in order to start the devices with some kind of software or homebrew?

ikonsgr

Quote from: shacpc on 10:42, 24 August 23Hi John, by including the bootloader do you think that it is possible that in the future ULIIfAC or USIfAC II can execute a startup file of the type "autoexec.bas" as it happens in M4, in order to start the devices with some kind of software or homebrew?
Bootloader has nothing to do with  such  procedures, instead it requires extra code on initialization code of board's ROM.
 I've already did that with auto loading of roms function upon cold boot, with ULIfAC:
https://www.dropbox.com/scl/fi/upgici0jt1156vfulpvg1/VID_20230715_200034.mp4?dl=0&rlkey=f6hbxwkcb2js7u9gcipwjxc9m

Audronic

@ikonsgr 

Hi John

USIFAC II and a CPC464 With Various Roms (664 6128)

I was wondering if it is possible to Make the USB Stick be enabled Regardless of the 
Roms used.
I have tried the "Auto USB" Poke (out &fbd1,51) Which works well with the CPC464 rom Fitted

BUT it does not work with the other 2 roms (664 6128) that I have used ?

I would like to use the other 2 roms (664-6128) which contain BASIC 1.1
If it's possible to do it Then That would be Appreciated.

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.

ikonsgr

@Audronic "Auto usb" function, should work regardless of the roms, i've tested numerous times on both CPC6128 and CPC464, (i don't have a CPC 664, but i suppose it doesn't have any problems too).
Btw,you should give: OUT &FBD1,92 to enable automatic usb device activation upon boot (and OUT &FBD1,93 to disable)

Audronic

@ikonsgr

Ok I will try again With - out &FBD1,92 - and see how it goes

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.

Audronic

@ikonsgr 

This is using a Standard CPC6128

I have tried using out &FBD1,92 and I am unable to get the USB activated from " POWERUP " 

it will enable the usb if I press the reset button after power up.

I have tried some of the other out commands and am still unable to get the USB enabled at PowerUP ?

Any thoughts ?

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.

poulette73

Hello,

For me it works on my 2 CPC 6128 and my 2 USIfAC II (6g)

If I enable this feature with OUT &FBD1,92, the Auto-USB is working all the time, even on every cold start. 😉
The option remains memorized even after the CPC is turned off.


Audronic

@ikonsgr 
@poulette73 

Cancel my request.
The USB Stick I was using is too SLOW changed it for a Faster one now OK

The CPC6128 now enables the USB at POWERUP

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.

Fran123

Hello

Is it possible or is there a way to replace the games rom?    I have some ideas to implement but I need a rom where place my commands

Thank you

poulette73

Hello,

I've just received my new PIC chips for my two USIfAC II :



And after replacement here I am in V7 :



This is great!
Now I will be able to carry out future updates myself without a PIC programmer.
Thanks John!  :)

Devlin

Installed v7! All good on both 6128 and 464.
now, when's 7a coming out so i can test out the serial programmer :3
CPC464 & CPC6128 + USIfAC II + Revaldinho 512k(universal cpld ver) - Schneider CRT TV
Administrator of Amstrad Discord : https://discord.gg/ksWvApv

ikonsgr

Quote from: Fran123 on 13:02, 02 September 23Hello
Is it possible or is there a way to replace the games rom?    I have some ideas to implement but I need a rom where place my commands
Thank you
PIC's MCU Flash memory (where games are also written) can't be reprogrammed "on the fly", BUT there is also ~1K of EEPROM and i have implement a few RSX commands exactly for that: Add and save your own routines to the board! Quoting from user's Guide:

|WROM,'name': Write to Microcontroller‟s EEPROM,first 1022 bytes of 'name' file.
|WROM,adr,size: Write to EPPROM,'size' bytes,starting from RAM address 'adr' - (Size can't be more than 1022 bytes)
|LROM,addr: Loads EEPROM contents to RAM,at 'addr' address.Note also, that, you can use an RST3,&FC00 assembly command, in order to directly execute any code routine you have uploaded to EEPROM.(last 1kb of selected upper rom @ &fc000-&fffd is reserved for EEPROM, last 2 bytes are reserved for saving serial port speed and ROM number, thus you have 1022 instead of 1024 bytes available)


As you can see, you can load a binary from file or from a specific memory address to EEPROM, and then have access to the code either by loading at specific address or even directly using RST3 command
And if you want to develop larger code for your commands, it would be very easy to add them in PIC's flash memory by replacing any of the game (you will have to give me the  binary to add it to fw of course), thus create a new Custom FW for USIfAC II  ;)

Fran123

Hi!

My English is not very good and I'm not sure understand you well.
Could you put an example of how to add a custom rom command in the eeprom?
I would like to develop a wget program and math operations.

Thank you


ikonsgr

@Fran123 I use winape assembler, and then add a write directive, to produce the compiled binary code file, for example:
write"File.BIN" 
org &8000  ;; this is the start address of your code, you can use it with |LROM to load your code to ram from eeprom
;;Your actual source code

 If you assemble the above code, it will produce a "file.bin" binary file. Then you just copy this file to a usb stick, and with |WROM command mentioned before, directly load it in EEPROM.

Fran123

Quote from: ikonsgr on 10:19, 04 September 23@Fran123 I use winape assembler, and then add a write directive, to produce the compiled binary code file, for example:
write"File.BIN" 
org &8000  ;; this is the start address of your code, you can use it with |LROM to load your code to ram from eeprom
;;Your actual source code

 If you assemble the above code, it will produce a "file.bin" binary file. Then you just copy this file to a usb stick, and with |WROM command mentioned before, directly load it in EEPROM.

just a minimal rom command to start on the right foot?

ikonsgr

First give |WROM,"file.bin" to load binary into eeprom. Then you can access your code by giving a simple basic line:

10 |LROM,&8000:CALL &8000

Optionally you can also access your code from assembly, using an RST3,&FC00

Also, if you want to execute multiple functions, you can create a single binary file and use the output of compiler to determine what memory address to use for calling each function. For example lets say you have the following code:

WinAPE Z80 Assembler V1.0.13

000015  0000                write"FILE.BIN" 
000016  0000  (8000)        org &8000
000018  8000  47                ld    b,a
000019  8001  AF                xor    a
000020  8002  32 CD 84          ld    (tracks),a
000021  8005  3E FB                LD    A,&FB
000022  8007  DB DE                iN    A,(&De)
000023  8009  B7                or    a
000024  800A  CA 96 82          jp    z,usb_dis_err
000026  800D  78                ld    a,b
000027  800E  FE 01            cp    1
000028  8010  28 14            jr    z,continue_routine
000029  8012  FE 02            cp    2
000030  8014  28 03            jr    z,continue2_routine
000031  8016  C3 90 82          jp    no_file
000033  8019                continue2_routine
000034  8019  DD 6E 02          ld    l,(ix+2)            ;image name is on the 2nd argument
000035  801C  DD 66 03          ld    h,(ix+3)
000036  801F  CD D7 82          call    get_arg2
000037  8022  3E 41            ld    a,65
000038  8024  18 04            jr    cont5
000039  8026                continue_routine
------END OF 1st function/command-------------------------------------
000041  8026  CD D1 82          call    get_arg                ;e=image name size, hl=address of name
000042  8029  AF                xor    a
000044  802A                cont5
000045  802A  32 C4 84          ld    (multi_files),a
000046  802D  22 C5 84          ld    (image_name),hl
000047  8030  7B                ld    a,e
000048  8031  32 C7 84          ld    (image_name_size),a
000050  8034  3E FB            ld    a,&fb
000051  8036  DB D8            in    a,(&d8)                ;a=USIfAC II Rom number
000052  8038  32 91 83          ld    (set_dir+2),a
000054  803B                ;;------------------------------------------------
000055  803B                ;; find BIOS: READ SECTOR command
000056  803B                ;;-------------------------------------------
000057  803B  21 69 83          ld hl,cmd_bios_read_sector
000058  803E  CD D4 BC          call kl_find_command
000059  8041  D0                ret nc
000060  8042                ;; command found
000061  8042                ;; store address of command
000062  8042  22 66 83          ld (bios_read_sector),hl
000063  8045                ;; store "rom select" of command
000064  8045  79                ld a,c
000065  8046  32 68 83          ld (bios_read_sector+2),a
000066  8049                ;;------------------------------------------------
000067  8049                ;; find BIOS: move track command
000068  8049                ;;-------------------------------------------
000069  8049  21 6D 83          ld hl,cmd_bios_move_track

You use |LROM,&8000 to load all your code to ram, and then using CALL &8000 access the 1st function, and CALL &8026 ,access 2nd function. This is an easy way to develop multiple functions/commands using a simple piece of code ;-)

Powered by SMFPacks Menu Editor Mod