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

0 Members and 5 Guests are viewing this topic.

Offline llopis

  • Supporter
  • CPC6128
  • *
  • Posts: 299
  • Country: es
    • Noel's Retro Lab
  • Liked: 183
  • Likes Given: 145
Ok, here is an "advance" trick,to find out if a USIfAC II board is installed (even if it doesn't show boot msg e.g. give a non initiliazed rom number):
 out &fbd1,30: if inp(&fbd0)=83 then print "USIfAC II board is installed" 
kids don't try it at home!  :laugh:
In theory there's nothing that USIfAC does that should be causing that. So I'd rather figure out what's going on than add a detection and disable it. It's just an upper ROM, right? I can't imagine why it would be causing the program to hang like that.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
@llopis, if it helps, this is the starting part and initialization code of the USIfAC II rom code:
Code: [Select]
ORG #C000 ;Start of ROM
DEFB 1 ;Background ROM
DEFB 0 ;Mark 0
DEFB 5 ;Version 5
DEFB 0 ;Modification 0
DEFW NAME_TABLE ;Address of name table

JP initialize
JP terminal
JP help
JP galachip
JP pacman
JP kgor
JP setwifi
JP format
JP change_dir
JP enable
JP enable2
JP topc
JP frompc
JP catalogue
JP comm
JP image
JP fdc
JP setspeed
JP dsk
JP delete
JP cpc464
JP status
JP usbset
JP filecopy
JP writerom
JP readrom
JP rootdir
JP deleteroutine
JP dos
JP makedir
JP disable
JP image2
JP image3
JP image4
JP showimage
JP snap

NAME_TABLE:

DEFB ' IREC','T'+#80
DEFB 'TE','R'+#80
DEFB 'HEL','P'+#80
DEFB 'GAL','A'+#80
DEFB 'PACMA','N'+#80
DEFB 'KGO','R'+#80
DEFB 'WIF','I'+#80
DEFB 'FORMA','T'+#80
DEFB 'C','D'+#80
DEFB 'E','N'+#80
DEFB 'EN','2'+#80
DEFB '2P','C'+#80
DEFB '2CP','C'+#80
DEFB 'CA','T'+#80 
DEFB 'CO','M'+#80
DEFB 'M','G'+#80
DEFB 'FD','C'+#80 
DEFB 'SE','T'+#80
DEFB 'DS','K'+#80
DEFB 'DE','L'+#80
DEFB '46','4'+#80 
DEFB 'STA','T'+#80
DEFB 'US','B'+#80
DEFB 'COP','Y'+#80
DEFB 'WRO','M'+#80
DEFB 'LRO','M'+#80
DEFB 'CD','R'+#80
DEFB 'DEL','D'+#80
DEFB 'DO','S'+#80
DEFB 'M','D'+#80
DEFB 'DI','S'+#80
DEFB 'MG','2'+#80
DEFB 'MG','3'+#80
DEFB 'MG','4'+#80
DEFB 'SM','G'+#80
DEFB 'SN','A'+#80

DEFB 0 ;End of table marker

; ######################################----initialize----##################################################
initialize:
push de
push hl
ld bc,&fbd1
ld hl,init_message
call printmessage

ld bc,&fbd9
ld a,1
out (c),a
ld a,&FB
        in a,(&D3)
cp "/"
jr z,no_clear_path

ld bc,&fbd1
ld a,53
out (c),a    ;start of sub dir, 0=no sub dir

no_clear_path:

ld bc,&FBD4
ld hl,&0006
ld a,(hl)
cp 128 ;128=cpc 464, 145=cpc6128
jr nz,cpc6128

ld a,&FB
        in a,(&DC)
cp &83
jr z,con464

cp 120
jr z,set464

LD a,120
out (c),a
ld bc,&FBD1
ld a,5
out (c),a
call 0

set464:
LD a,&83
out (c),a
ld bc,&FBD1
ld a,4
out (c),a
call 0

con464:
ld hl,&be7d
ld a,&ff
ld (hl),a
ld a,&FB
        in a,(&De)
cp 0
jr z,end3_init
call enable
jr end3_init

cpc6128:
LD a,&66
out (c),a

end3_init:
pop hl
pop de
scf
ret

init_message:
defb " USIfAC II Enhanced",13,10,13,10,0

As you said, is nothing more than a "usual" upper rom, and in compliance with register usage for background roms:
http://cpctech.cpc-live.com/docs/manual/s158se09.pdf
Entry:
DE contains the address of the lowest byte in the memory pool.
HL contains the address of the highest byte in the memory pool.
Exit:
If the initialization was successful:
Carry true.
DE contains the new address of the lowest byte in the memory pool.
HL contains the new address of the highest byte in the memory pool.  (HL ,DE returned unchanged)
If the initialization failed:
Carry false.
DE and HL preserved.
 Always:
A, BC and other flags corrupt.
All other registers preserved.

« Last Edit: 23:13, 20 April 21 by ikonsgr »

Offline issalig

  • CPC464
  • **
  • Posts: 38
  • Country: es
  • Liked: 19
  • Likes Given: 43
I was going to check that FW but the file appears not to be available anymore. :(

[EDIT] [SOLVED] You can get it from here https://www.dropbox.com/sh/ezzga2dppm6jlm7/AACwFC_rv2QatWh_ndKc9fhma?dl=0

I have fought a lot in order to flash the ESP-07, thus I leave here some recipes that I hope it will help you (if you try in Linux you should be in dialout group  and maybe you will require root privileges)
Before start flashing I recommend to back up the existing fw, so you can always go back.
#backup
esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x100000 backup.bin
#flash
esptool.py --port /dev/ttyUSB0 write_flash --flash_size 1MB --flash_mode dout 0x00000 YOUR_NEW_FW.bin

Esptool can be installed with  "pip install –upgrade esptool"


Download this: https://www.dropbox.com/s/bt29v0a32ucktvv/ESP8266_flasher.zip?dl=0
Just run "esp8266_flasher.exe", click "BIN" button and select the included: "HS06F014 ESP-01S.bin", set your com port number and press "download".
This must be the easiest way to flash a wifi module.
Btw, i found out why mysteriously all my wifi modules stopped working: firewall blocked access to windows utility TCP server (i suspect the antivirus involved in this...)
So, if your Wifi module can't connect to PC check windows firewall settings, if there is any inbound rule that block access of the Amstrad utility.
« Last Edit: 21:10, 01 May 21 by issalig »

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 650
  • Country: au
  • aka Vorax
    • 8bitology
  • Liked: 266
  • Likes Given: 260
Please - everybody - consider to also support the 0,7 MB Vortex format. In Gemany (at least) it still is/was the 80 track standard format for floppy discs. The big companies like Dobbertin, Vortex ... all did support it.  :) :) :)


Please everyone support the Vortex CP/M format too, that is super popular here in Australia and we usually use the SUPER formatter on the SUPER ROM which is easily available online.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
@issalig, link is working again  :)
@zhulien, most probable Vortex is directly supported as explained to Gunhead some time ago

Offline Philippe Lardenois

  • CPC464
  • **
  • Posts: 19
  • Liked: 8
  • Likes Given: 8
Great - now Everything is working well after reflashing my ESP Wifi Module.


fully opérationnal.


Thanks for your help mates


+

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.591
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1226
  • Likes Given: 2886
@zhulien, most probable Vortex is directly supported as explained to Gunhead some time ago
Let's be careful. One is a disc format - the other one is a disc drive. But I'm confident they both work.  :)
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.05.24)

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 650
  • Country: au
  • aka Vorax
    • 8bitology
  • Liked: 266
  • Likes Given: 260
has anyone tried a USB floppy drive with USIfAC II?

Offline Audronic

  • 6128 Plus
  • ******
  • Posts: 1.448
  • Country: au
  • I know RST3 . I now know a little More.
  • Liked: 321
  • Likes Given: 731
@zhulien


Yes, it does not work


I tried 5 external USB Drives


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: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
Major Update:

Firmware update (ver. 4):
- Bug fix: When saving a file, Dsk Image name in slot 1, changed to name of saved file.
- Code optimization of Board's Rom assembly code.
- |CD & |CAT arguments, now support lower case letters too.
- New Command: |SNA, for loading SNA snapshot files (note that snapshot files must be uncompressed)!

Update Amstrad CPC Loader creator program: Add support for sna snapshot files, along with direct files & dsk images. Also Subfolders inside main folder,can now have multiple .dsk or .sna files  (previous version supported only one dsk image in each subfolder)!

Update User's Guide: Many additions and changes to match the new board with extra features.

Add a new "inner working" section: Here: https://www.dropbox.com/sh/ua4vgf6qjjmqlnq/AACT6kqTr-sst-iqDeBnE9gRa?dl=0], you can find all assembly code used in the Usifac II project, along with board schematics, and hex file/assembly source code for PIC18F47Q10 mcu.

Now, this one (loading snapshot files),as easy as it may sound (just copy mem dump to amstrad's memory and set all registeres), was really tough to make it work right, to get an idea, here is the code for the routine:
Code: [Select]
snap:
cp 0
jp z,no_file_sel
ld b,a
call check_usb_en
ld a,b
cp 1
jr z,sna_def_addr
cp 2
jr z,sna_load_addr
jp error_ucd ;error more than one parameters!

sna_def_addr:
ld a,220
ld bc,&fbde ;next_in=220
out (c),a
ld c,&d7 ;with no address argument set fix address=&ffa6
ld a,&a6 ;low byte of final code address
out (c),a ;put it to buffer(220)
ld a,&ff ;high byte of final code address
out (c),a ;put it to buffer(221)
call get_arg ;e=snapshot name size, hl=address of name
jr continue_1

sna_load_addr:

ld a,220
ld bc,&fbde ;next_in=220
out (c),a
ld c,&d7
ld a,(ix+0) ;low byte of final code address
out (c),a ;put it to buffer(220)
ld a,(ix+1) ;high byte of final code address
out (c),a ;put it to buffer(221)

ld l,(ix+2) ;image name is on the 2nd argument
ld h,(ix+3)
call get_arg2

continue_1:
call set_directory
ld bc,&fbd0
ld a,&57
out (c),a
ld a,&ab
out (c),a
ld a,&2f
out (c),a

ld c,&d9
ld a,1
out (c),a
ld c,&d0
ld a,&FB
        in a,(&D3)
cp 0
jp nz,continue_snaopen
ld a,"/"
out (c),a

continue_snaopen:
inc b
outi ; ld a,(hl)->out (c),a->hl=hl+1
dec e
jr nz,continue_snaopen

xor a
out (c),a

call clear_buffer
ld a,&57
out (c),a
ld a,&ab
out (c),a
ld a,&32
out (c),a

call check_responce2
ld A,&FB
        in A,(&D0) 
cp &14
jp z,continue_snaload
inc c
ld a,5
out (c),a
jp no_file_sel

continue_snaload: ;; &1f2 first 7 bytes checksum fro snapshot files!

ld hl,0
ld de,0
call seek
in a,(c)
cp &14
jp nz,error_ucd
ld e,8
call fetch
ld b,8
ld hl,0
ld de,0
crc_sum:
ld a,&FB
        in a,(&D0)
ld e,a
add hl,de
djnz ,crc_sum
; dec b
; jr nz,crc_sum

ld a,l
cp &f2
jp nz,no_file_sel
ld a,h
cp 1
jp nz,no_file_sel

ld bc,&fbd0
ld hl,&6b
ld de,0
call seek
in a,(c)
cp &14
jp nz,error_ucd
ld e,1
call fetch

in a,(c) ;;byte &6b, MEMORY DUMP SIZE:&80=128kb else 64kb
ld c,&dc
out (c),a

ld c,&d0
ld hl,&180 ;set sna file pointer to 1st byte of 1st 64k memory dump
ld de,0
call seek
in a,(c)
cp &14
jp nz,error_ucd

;#######################----------------------------------------------------------------------------------
di

ld bc,&7f84
out (c),c ;disable lower rom

sna_ram_code:
ld hl, sna_code
ld de, 0
ld bc, 102
ldir
ld hl,&7f
ld sp,hl ;set temporary stack pointer to &7f

ld hl,&80 ;#####
ld bc,&fbd1
ld a,40 ;empty data buffer=0
out (c),a
dec c
jp ;call routine to transfer all 64K except first 128bytes
inc c
ld a,41 ;empty data buffer=1
out (c),a
;--------------------------------------------------
ld hl,&bff0 ;temporary stack pointer @ &bff0
ld sp,hl ;set temporary stack pointer
dec hl ;hl=sp-1 address position

ld bc,&fbde
ld a,210
out (c),a ;next_in=210

ld e,10
ld c,&d7
stack_save:
ld a,(hl) ;save 5 postions of temp stack pointer to buffer(210-219)
out (c),a
dec hl
dec e
jr nz,stack_save
;--------------------------------------------------
ld c,&d0 ;bc=&fbd0
ld a,&FB
        in a,(&D7) ;if inp(&fbd7)=128 then copy 2nd 64k dump
cp 128
jr z,large_sna
cp 100 ;if inp(&fbd7)=100 then copy of 2nd 64k dump is finished proceed
jr nz,normal_sna ; else
ld de,1
call sna_copy_128
ld hl,&bfef ;hl=sp->-1 address position &bff0-1
ld bc,&fbdb
ld a,210
out (c),a ;next_out=210
ld e,10
ld c,&d0
stack_load3: ;restore 5 postions of temp stack pointer from buffer(210-219)
in a,(c)
ld (hl),a
dec hl
dec e
jr nz,stack_load3

ld b,&7f
ld a,192
out (c),a ;change to 1st 64k RAM bank

jp end_sna_routine

normal_sna:
ld de,0
call sna_copy_128
ld hl,&bfef ;hl=sp->-1 address position &bff0-1
ld bc,&fbdb
ld a,210
out (c),a ;next_out=210
ld e,10
ld c,&d0
stack_load: ;restore 5 postions of temp stack pointer from buffer(210-219)
in a,(c)
ld (hl),a
dec hl
dec e
jr nz,stack_load
jr end_sna_routine

large_sna:
ld de,0
call sna_copy_128
ld hl,&bfef ;hl=sp->-1 address position &bff0-1
ld bc,&fbdb
ld a,210
out (c),a ;next_out=210
ld e,10
ld c,&d0
stack_load2: ;restore 5 postions of stack pointer to buffer(210-219)
in a,(c)
ld (hl),a
dec hl
dec e
jr nz,stack_load2

ld b,&7f
ld a,194
out (c),a ;change to 2nd 64k RAM bank
ld bc,&fbdc
ld a,100 ;from now on inp(&FBD7) will return 100
out (c),a

ld c,&D0
ld de,1
ld hl,&180 ;set file pointer to 1st byte of 1st 64k memory dump
call seek
in a,(c)
cp &14
jp nz,error_ucd
jp sna_ram_code

;-----------------------------####################################---------------------------------------------------

sna_copy_128:
ld hl,&100 ;set file pointer to 1st byte of 1st 64k memory dump
call seek
in a,(c)
cp &14
jp nz,error_ucd
ld e,128
call fetch
ld hl,0
ld bc,&fbd0
 load_data_loop2:
inc c
 check_sna:
in a,(c)
cp 1
        JR Z,check_sna
dec c
ini
inc b
dec e
jr nz, load_data_loop2
ret

;--------------###############################################-----------------------

end_sna_routine:


ld bc,&fbde ;set next_in=150
ld a,150
out (c),a

ld hl,temp_code
ld d,5
ld c,&d7
save_bytes:
ld a,(hl) ;buffer(next_in)=(hl) ;save the 5bytes where temp_code goes,to restore them in final code
out (c),a
inc hl
dec d
jr nz,save_bytes

ld hl,temp_code+4
ld sp,hl ;put temporary stack pointer at address (temp code+4)

ld bc,&fbd0
ld de,0
ld hl,0 ;set file pointer to 1st byte of 1st 64k memory dump
call seek
in a,(c)
cp &14
jp nz,error_ucd

ld e,115
call fetch

ld bc,5000
call delay_loop ;give time to recieve 115 bytes from header snap file

ld bc,&fbd0
ld a,&57 ;close file
out (c),a
ld a,&ab
out (c),a
ld a,&36
out (c),a
xor a
out (c),a

;##############################--------------snap_registers---------------------------############################

call get_final_addr
ld e,l
ld d,h

ld hl, final_code      ;this is the final code & executed from ram just before jump to PC
ld bc, 41
ldir

ld bc,&fbdb
ld a,&1b              ;buffer pointer to &19 position R register
out (c),a

ld a,&FB ;R register
        in a,(&D0)
ld r,a
ld a,&FB ;I register
        in a,(&D0)
ld i,a

ld a,&FB ;interrupt Flip flop
        in a,(&D0)
cp 0
jr z,cont_sna_2
call get_final_addr
ld bc,37             ;offset +37 for save interrupt FLIP-FLOP state at final code
add hl,bc
ld a,&fb ;&FB=EI
ld (hl),a 


cont_sna_2:

; out (c),a

ld a,&FB ;IFF2=IFF1 pass to next byte
        in a,(&D0) 

ld a,&FB
        in a,(&D0)  ;a=X
ld l,a
ld a,&FB
        in a,(&D0)  ;a=I
ld h,a
push hl
pop IX

ld a,&FB
        in a,(&D0)  ;a=Y
ld l,a
ld a,&FB
        in a,(&D0)  ;a=I
ld h,a
push hl
pop IY

ld bc,&fbde ;next_in=200
ld a,200
out (c),a

ld a,&FB ;Save Stack pointer at buffer(200+201)
        in a,(&D0)  ;a=P
ld c,&d7
out (c),a

ld a,&FB
        in a,(&D0)  ;a=S
out (c),a

call get_final_addr
ld bc,&27 ;offset for placing Program counter to final code
add hl,bc
ld a,&FB
        in a,(&D0) 
ld (hl),a
inc hl
ld a,&FB
        in a,(&D0) 
ld (hl),a

ld a,&FB ;interrupt mode
        in a,(&D0)

cp 0
jr nz, not_im0
im 0
jr cont_sna_1
not_im0:
cp 1
jr nz, not_im1
im 1
jr cont_sna_1
not_im1:
im 2

cont_sna_1:

ld a,&FB
        in a,(&D0)  ;a=F'
ld l,a
ld a,&FB
        in a,(&D0)  ;a=A'
ld h,a
push hl
pop af
ex af,af'

ld a,&FB
        in a,(&D0)  ;a=C'
ld c,a
ld a,&FB
        in a,(&D0)  ;a=B'
ld b,a
ld a,&FB
        in a,(&D0)  ;a=E'
ld e,a
ld a,&FB
        in a,(&D0)  ;a=D'
ld d,a
ld a,&FB
        in a,(&D0)  ;a=L'
ld l,a
ld a,&FB
        in a,(&D0)  ;a=H'
ld h,a
exx

ld bc,&fbdb ;+2 offset for all bytes from buffer
ld a,&43 ;buffer pointer to &1a position R register
out (c),a
ld a,&FB ; ram config
        in a,(&c0) ;&FBC0=REVERSE order next_out=next_out-1!
or &c0 ;set bit 7&6 to '1'->setup ram configuration
ld bc,&7f00
out (c),a

call get_final_addr
ld bc,&12
add hl,bc ;place GA multi configuration byte to final code
ld a,&FB ;GA multi configuration byte, screen mode & roms upper/lower en/dis
        in a,(&C0)
set 7,a
res 6,a ;bit 7=1, bit 5,6=0
res 5,a

ld (hl),a ;place GA multi configuration byte to final code
inc hl
ld a,&7f
ld (hl),a


ld bc,&7F10

SNA_SetupGA:
out (c),c
ld a,&FB
        in a,(&C0)
set 6,a
out (c),a
dec c
jp p,SNA_SetupGA

; Select last active pen
ld a,&FB
        in a,(&C0)
out (c),a 
; CRTC setup

ld bc,&fbdb ;+2 offset for all bytes from buffer
ld a,&57 ; current rom selection and then CRTC registers
out (c),a

call get_final_addr ;;place upper rom selection byte to final code
ld bc,&17
add hl,bc
ld a,&FB
        in a,(&C0)
ld (hl),a
inc hl
ld a,&df
ld (hl),a

ld bc,&BC00+17
SNA_SetupCRTC: ;out &bcxx select register out &BDXX WRITE REGISTER

out (c),c
ld a,&FB
        in a,(&C0)
inc b
out (c),a
dec b
dec c
jp p,SNA_SetupCRTC
; Select active CRTC register
ld a,&FB
        in a,(&C0)
out (c),a

ld bc,&f782
out (c),c ;set PSG PORT A to output for writing registers first!

ld bc,&fbdb ;+2 offset for all bytes from buffer
ld a,&6c ;buffer pointer to &1a position R register
out (c),a
ld e,15
SNA_SetupAY3:
ld bc,&F4C0
out (c),e
ld b, &F6
out (c),c
defb &ED, &71
dec b
dec b
ld a,&FB
        in a,(&C0)
out (c),a

ld bc,&F680
out (c),c
defb &ED, &71

dec e
jp p,SNA_SetupAY3
; Select last active AY3 register
ld bc,&F4C0
ld a,&FB
        in a,(&C0)
out (c),a
ld b,&F6
out (c),c
defb &ED, &71

ld bc,&f700
ld a,&FB ;PPI control port byte
        in a,(&C0)
out (c),a

ld l,a
ld b,&F6
ld a,&FB ;set PORT C byte
        in a,(&C0)
out (c),a

ld a,l
cp &82
jr nz,no_set_porta
ld a,&FB ;PORT B byte, always input-no use
        in a,(&C0)
ld a,&FB ;set PORT A byte
        in a,(&C0)
ld b,&F4
out (C),a

no_set_porta:
;------end of routine

ld bc,&fbdb
ld a,&13 ;buffer pointer to &12 position F register
out (c),a

ld a,&FB
        in a,(&D0)  ;a=F
ld l,a
ld a,&FB
        in a,(&D0)  ;a=A
ld h,a
push hl

ld bc,&fbde ;next_in=202
ld a,202
out (c),a
ld c,&d7 ;save A register to buffer(202)
out (c),h

call get_final_addr
ld bc,&1c ;place BC to final code
add hl,bc

ld a,&FB
        in a,(&D0)  ;a=C
ld (hl),a
inc hl
ld a,&FB
        in a,(&D0)  ;a=B
ld (hl),a

ld a,&FB
        in a,(&D0)  ;a=E
ld e,a
ld a,&FB
        in a,(&D0)  ;a=D
ld d,a

inc hl
inc hl

ld a,&FB ;place HL to final code
        in a,(&D0)  ;a=L
ld (hl),a
inc hl
ld a,&FB
        in a,(&D0)  ;a=H
ld (hl),a


cont_sna_end:

pop af ;restore flag register from temporary stack@address temp_code+4

ld bc,temp_code
ld a,&ed ;ED 79= OUT(C),A
ld (bc),a
inc bc
ld a,&79
ld (bc),a
inc bc
ld a,&c3 ;JUMP TO
ld (bc),a

ld l,c
ld h,b
ld bc,&fbde
ld a,220
out (c),a ;next_in=220
ld c,l
ld b,h
inc bc
ld a,&fb        ;a=buffer(next_in)
in a,(&c1)
ld (bc),a
inc bc
ld a,&fb        ;a=buffer(next_in)
in a,(&c1)
ld (bc),a

ld bc,&fbdb        ;restore SP from buffer(200-201)
ld a,200
out (c),a
ld a,&fb
in a,(&d0)
ld l,a
ld a,&fb
in a,(&d0)
ld h,a
ld sp,hl

ld bc,&7f00
ld a,&8c   ;disable both upper+lower roms!
ld hl,temp_code

jp temp_code ;last instruction!

final_code:

defb 1,222,251,62,150,237,121,6,5,62,251,219,193,119,35,16,248,1,0,0,237,73,1,0,0,237,73,1,0,0,33,0,0,62,251,219,208,0,195,0,0

sna_code:

defb 30,128,205,95,0,62,87,237,121,62,171,237,121,62,58,237,121,237,89,175,237,121,205,88,0,237,120,205,95,0,62,87,237,121,62,171,237,121,62,39,237,121
defb 205,88,0,237,120,202,144,245,95,12,237,120,40,252,13,237,162,4,29,32,244,205,95,0,62,87,237,121,62,171,237,121,62,59,237,121,205,88,0,124,181
defb 32,171,195,144,245,12,237,120,40,252,13,201,12,62,1,237,121,13,201

 The main problem i encountered was placement of the Stack and a small final code  that needs to be executed from ram (GA rom configuraton and final jump to PC along with restoring of a few bytes). Using spare parts in video memory (for example: &FFD0-&FFFF) is not working all the time, because tests revealed that games often use these parts for placing code! So in order to find a way to overcome this problem, i designed |SNA command with an optional memory address argument (|SNA,"name",&xxxx) to place final code into the specific address instead of the deafult @&FFA6 (e.g. some screen bytes at right bottom corner,which prooved to have better results than using a spare part).
But where will that address be, you may ask?
Well, in order to find out that,i  expand the Basic loader creator utlity, to include sna files, that, apart from creating the required commands in the Basic listing, it also searches the entire snapshot memory dump to find an "empty" place (search for 40 sequnetial bytes that have same value) for the final code. Using this method, i've have tested more than 100 sna files and all seem to load fine!
The only "problem" i still have is that sna files need to be uncompressed, but the sna archive in cpc wiki have all files in compressed form. Is there any easy way to create uncompressed sna files from compressed ones?
« Last Edit: 21:18, 16 May 21 by ikonsgr »

Offline issalig

  • CPC464
  • **
  • Posts: 38
  • Country: es
  • Liked: 19
  • Likes Given: 43
Wow, this is a great update. I am gonna flash the new FW ASAP

And thanks a lot @ikonsgr for sharing the "Inner Workings".
There is a lot of interesting stuff there. In the beginning I was surprised you coded the PIC directly in ASM  :o , but then I have realized that GBC generates those files before linking them into  the hex file. Now struggling to generate flash from asm file. It looks that pic18f47q10.inc is missing in GBC distribution, maybe mpasm has it.
« Last Edit: 01:15, 05 May 21 by issalig »

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
Wow, this is a great update. I am gonna flash the new FW ASAP

And thanks a lot @ikonsgr for sharing the "Inner Workings".
There is a lot of interesting stuff there. In the beginning I was surprised you coded the PIC directly in ASM  :o , but then I have realized that GBC generates those files before linking them into  the hex file. Now struggling to generate flash from asm file. It looks that pic18f47q10.inc is missing in GBC distribution, maybe mpasm has it.

This is an intermediate file generated by cowbasic compiler so i doubt you can find it anywhere. :)
Anyway, i've added the GCB source code too (18f47q10_gcb_source), so you can install cowbasic (use the latest RC from here: https://sourceforge.net/projects/gcbasic/files/Release%20Candidates/ ) and compile it from there  ;)

Offline ajcasado

  • Supporter
  • CPC464
  • *
  • Posts: 20
  • Country: es
  • Liked: 14
  • Likes Given: 61
Anyway, i've added the GCB source code too
Thanks for the source!!!, it's a great contribution.

Offline eto

  • Supporter
  • CPC6128
  • *
  • Posts: 277
  • Country: de
  • Liked: 186
  • Likes Given: 164
"no USB Device found"
« Reply #263 on: 22:47, 05 May 21 »
what am I doing wrong if I get that message after typing |USB?

USB Stick is 4GB Fat32, USB 2.0


Update:
I tried with 2 more sticks: USB 3.0, 32GB and 64GB

First the 32GB stick didn't work. I could type |USB, but then it said it would be empty. As I had to format with the 64GB stick with a third party tool, I recognized  that this stick was accepted and showed the contents. I then also formatted the 32GB stick with the same tool, and then the stick was recognized and worked also.
 

Unfortunately the 4GB sticks still don't work, even if formatted with the same tool.

Is there any known limitation regarding which sticks will not be accepted?
« Last Edit: 23:29, 05 May 21 by eto »

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
Re: "no USB Device found"
« Reply #264 on: 23:39, 05 May 21 »
what am I doing wrong if I get that message after typing |USB?
USB Stick is 4GB Fat32, USB 2.0
Update:
I tried with 2 more sticks: USB 3.0, 32GB and 64GB
First the 32GB stick didn't work. I could type |USB, but then it said it would be empty. As I had to format with the 64GB stick with a third party tool, I recognized  that this stick was accepted and showed the contents. I then also formatted the 32GB stick with the same tool, and then the stick was recognized and worked also.
Unfortunately the 4GB sticks still don't work, even if formatted with the same tool.
Is there any known limitation regarding which sticks will not be accepted?

Indeed, some usb host modules seem to be a bit "picky", regarding the flash drive you will use, but i have found an easy solution to that: Just create a small (like 256mb or so) FAT partition:
https://www.diskpart.com/articles/how-to-partition-usb-drive-3889.html
I've try this method with 4gb and 32gb usb sticks and worked, so i guess this "trick" most probable will solve the problem.
« Last Edit: 23:44, 05 May 21 by ikonsgr »

Offline eto

  • Supporter
  • CPC6128
  • *
  • Posts: 277
  • Country: de
  • Liked: 186
  • Likes Given: 164
so i guess this "trick" most probable will solve the problem.


unfortunately not. They don't work :-( Too sad.

Offline ikonsgr

  • 6128 Plus
  • ******
  • Posts: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
Ok, does the usb host module lights up when you give |USB?
If not, and you get an error message all the time (eve if you have a small fat partition) , then the usb stick you are using is probably... "too incompatible" for the module to recognize it at first place.
You can also try a real small usb drive (of less than 512mb), as they are still available at very cheap prices

Offline eto

  • Supporter
  • CPC6128
  • *
  • Posts: 277
  • Country: de
  • Liked: 186
  • Likes Given: 164
I've try this method with 4gb and 32gb usb sticks and worked, so i guess this "trick" most probable will solve the problem.

So none of my sticks worked in the first place but I could get ALL the USB 3.0 sticks to work with their full size by doing the following:
- delete partition and then create a new partition in Windows Computer Management, assign a drive letter (e.g. X), BUT do not format it here. (Windows will assign the drive letter and immediately moan about the non-formatted stick. DO NOT FORMAT!)
- then run command line tool "h2format.exe X:" (http://www.heise.de/software/download/h2format/40825 - German, just use Google translate, pretty straight forward)

After this, the USB stick will be accepted.

The USB 2.0 sticks do still not work. The USB host module lights up, but then I get the "no USB Device found" error message.

Offline Audronic

  • 6128 Plus
  • ******
  • Posts: 1.448
  • Country: au
  • I know RST3 . I now know a little More.
  • Liked: 321
  • Likes Given: 731
@ikonsgr


John I will do a test with Version 4 on my old boards and see what happens


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 eto

  • Supporter
  • CPC6128
  • *
  • Posts: 277
  • Country: de
  • Liked: 186
  • Likes Given: 164
Two further issues:

1) One of my USIfAC II doesn't do anything. It's connected and nothing happens. Any idea what I could check?

UPDATE: out &fbd2,5 fixed this issue. It probably was because I was trying it on both the 6128 and the 464 and then on the 464 I also typed |FDC. After a reset, the Usifac was inactive. As this can easily happen, it might be good to add that to the hints section.


2) My other UsiFac works fine on my 6128, but on the 464 it behaves differently. When turning on, the 464 stops when displaying the start up screen, just before the USIFAC message should appear. After pressing reset, it boots fully to the READY prompt (at least most of the times, but not always). Then I can navigate through the USB directories and start something - but when I then press RESET, the startup screen will again stop in between and a reset will no longer help. I have to turn off the computer for a few seconds, then I can start it again.

UPDATE: added screenshot
« Last Edit: 15:20, 06 May 21 by eto »

Offline Audronic

  • 6128 Plus
  • ******
  • Posts: 1.448
  • Country: au
  • I know RST3 . I now know a little More.
  • Liked: 321
  • Likes Given: 731
@eto


Perhaps the edge connection on the Motherboard is dirty ?


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 eto

  • Supporter
  • CPC6128
  • *
  • Posts: 277
  • Country: de
  • Liked: 186
  • Likes Given: 164
Perhaps the edge connection on the Motherboard is dirty ?

Unlikely. The second USIfAC works without problems.

Also the non-working USUfAC also doesn't work on a 6128 with Centronics connector.

UPDATE: non working usifac fixed. See post above
« Last Edit: 15:21, 06 May 21 by eto »

Offline Audronic

  • 6128 Plus
  • ******
  • Posts: 1.448
  • Country: au
  • I know RST3 . I now know a little More.
  • Liked: 321
  • Likes Given: 731
@ikonsgr

John I will do a test with Version 4 on my old boards and see what happens



Version 4 appears to be Ok with the old Boards, |USB OK, files OK. .DSK OK


Thanks


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: 507
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 515
  • Likes Given: 97
2) My other UsiFac works fine on my 6128, but on the 464 it behaves differently. When turning on, the 464 stops when displaying the start up screen, just before the USIFAC message should appear. After pressing reset, it boots fully to the READY prompt (at least most of the times, but not always). Then I can navigate through the USB directories and start something - but when I then press RESET, the startup screen will again stop in between and a reset will no longer help. I have to turn off the computer for a few seconds, then I can start it again.

This is most likely a connection problem, usually with the ribbon cable. I had such erratic behavior some time ago, boot problems, hang ups and crashes for no apparent reason etc.  Finally i discover that the culprit was the edge connector ribbon cable i was using. When i've change it with a new one, all problems solved!  :)
« Last Edit: 20:04, 06 May 21 by ikonsgr »

Offline Philippe Lardenois

  • CPC464
  • **
  • Posts: 19
  • Liked: 8
  • Likes Given: 8
Whaou. huge update.
Will test it on sunday..
Thanks for the SNA add-on


Phil