Author Topic: Amstrad CPC WiFi  (Read 329449 times)

0 Members and 3 Guests are viewing this topic.

Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1175 on: 20:48, 08 January 17 »
About Laser Squad @WildW & @dragon

Now we need a program do these with sector  routine from duke (save/load is another history to look).

Finally re-visited this game.
Version attached that works on M4 (only) and supports 64KB computers.
run"ls"

@dragon
I took a simpler approach, when single stepping with WinApe (so nice to hack these days, thanks to this wonderful debugger!).
sub_routine &57FE  = load or save tracks.
D = Last track
E = First track
HL = destination address
Memory address (&57FD) = read or write.

It will read sectors c1 to c8 of each track.

I replaced &57FE with M4 sector reading & writing (requires M4 v1.1.0 beta 11).
And added a little startup function to retrieve the rom number of M4 and init M4 rom to setup its workspace.

Here is the patch, maybe useful for another time. I didn't clean it up (could be optimized):
        ; init
    org &260
    ld    a,1
    call    &bc0e        ; set mode 1
    ld    hl,(&BC78)
    inc    hl
    inc    hl
    ld    a,(hl)
    ld    (rom_no+1),a
    ld    c,a
    ld    hl,&260        ; himem
    ld    de,&40        ; lomem
    call    &bcce        ; init m4 rom (just needs 272 bytes without amsdos)
    jp    &363            ; jump to game init
   
        ; track read/write replacement

    org &57FE
    ld    bc,&7F85        ; upper rom sel + mode 1
    out    (c),c
               
    ld    bc,&DF00
rom_no:
    ld     a,&6            ; set on startup
    out    (c),a        ; select rom
    ld c,&c1        ; start sector
read_loop:
    push    de
    push    bc
    ld    d,e        ; track
    ld     e,0        ; drive
    push    hl
    ld    a,(&BC78)
    push af
    ld    a,&a4
    ld    (&BC78),a    ; force m4 "current" device detection
    ld    a,(&57FD)    ; read or write ?
    or    a
    jr    nz,write_sec
    call    &c03c    ; bios sector read
    jr    over
write_sec:
    call &c03f    ; bios sector write
over:
    pop    af
    ld    (&BC78),a    ; restore real value
    pop    hl
    ld    bc,&200    ; size
    add    hl,bc    ; increase addr
    pop    bc        ; c = sector
    pop    de
    ld    a,e        ;  current track
    cp    d        ; last track?
    jr    nz, not_last
    inc    c        ; increase sector?
    ld    a,&c9
    cp    c        ; last sector ?
    jr    nz,read_loop
    jr    done
not_last:
    inc    c        ; increase sector
    ld    a,&c9
    cp    c        ; C9 = last sector of track ?
    jr    nz, read_loop
    inc    e        ; increase current track
    ld    c,&c1    ; re-start sector
    jr    read_loop
done:
   
    ld    bc,&7F8D    ; deselect m4 rom, mode 1
    out    (c),c
    ret

I haven't tested all levels or saving, I am not really much into games (and have no idea what this is about) ;)

A nice improvement would be to do my patch ONLY if run from M4 and leave the FDC code, but since I patched it up already.....

Offline WildW

  • CPC464
  • **
  • Posts: 3
  • Country: gb
  • Liked: 1
  • Likes Given: 0
Re: Amstrad CPC WiFi
« Reply #1176 on: 23:33, 08 January 17 »
That's awesome =)  If I can get it to work. . .

I notice it needs the updated firmware. I downloaded this and started the update process via the web interface. As others noticed, the upgrade is removed from the web interface now, and I can't figure out how to perform the second upgrade.

I'm stuck with M4 v1.0.9 and ESP v1.1.0 . . . how do I do the M4 upgrade now? The |UPGRADE command just freezes the CPC and draws a little junk on screen. I copied the M4FIRM.BIN and ESPFIRM.BIN to the SD card but don't know how to make it upgrade now.

EDIT: Sorry, figured it out now, files in root of SD card, not in M4 folder!

Yay, game works great. You continue to be an absolute legend  :D
« Last Edit: 00:00, 09 January 17 by WildW »

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1177 on: 23:53, 08 January 17 »
@BC77 and the other redirected cas_* functions
RST <memory ptr>
which points to
<romhandler>, rom number

What are you telling is that CNGsoft doesn't rely on that amsdos is always the rom that is managing the floppy? I mean, on all CPC's amsdos is always on rom 7, init this rom guarantee that the floppy is accesible on all the cpc range, we really don't need to ask if amsdos is number 7... but as i see in the code,  CNGsoft consider that not always will ROM 7 be the floppy / mass storage manager? hence he "asks" to the firmware what is the disc rom?

am i right?


Offline Jamie Gunn (Gunni)

  • Speccy
  • *
  • Posts: 1
  • Liked: 1
  • Likes Given: 1
Re: Amstrad CPC WiFi
« Reply #1178 on: 01:58, 09 January 17 »
@Duke  I finally got some time to test out the board this weekend, works great! thanks for all your efforts!

Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1179 on: 09:13, 09 January 17 »
What are you telling is that CNGsoft doesn't rely on that amsdos is always the rom that is managing the floppy? I mean, on all CPC's amsdos is always on rom 7, init this rom guarantee that the floppy is accesible on all the cpc range, we really don't need to ask if amsdos is number 7... but as i see in the code,  CNGsoft consider that not always will ROM 7 be the floppy / mass storage manager? hence he "asks" to the firmware what is the disc rom?

am i right?
You are correct, it's good way to do it.

Offline keith56

  • ちび悪魔!
  • Supporter
  • 6128 Plus
  • *
  • Posts: 550
  • Country: jp
  • Part Ma, Part Aku... All Chibi!
    • Chibi Akuma(s)
  • Liked: 898
  • Likes Given: 206
Re: Amstrad CPC WiFi
« Reply #1180 on: 14:35, 09 January 17 »
You are correct, it's good way to do it.


That's a very useful bit of info

I'm modifying ChibiAkuma(s) to work on 64k, and need to flush out the firmware to free up enough memory, but I need to get it back for disk loading - so this thread's a big help for making sure I'm doing it in a 'compatible' way


I'm basing my code on this:
http://cpctech.cpc-live.com/source/firmsave.html
so please feel free to point out anything in there that will annoy the M4 -

Update:
Just reading through this thread, I'm a bit confused as to whether the M4 is replacing the disk-rom or in a separate bank (I'm seeing maybe there are multiple options?)

Can you advise? Should I be using KL_Rom_Walk to init all the roms? or can I just init the Disk one in bank 7 (or wherever it is - I'll use the code above to check that)?
« Last Edit: 14:57, 09 January 17 by keith56 »
Chibi Akumas: Comedy-Horror 8-bit Bullet Hell shooter!
Learn to program Assembly with my Text+Videos Tutorials for Z80, 6502, 68000
My Livestreaming Channel: ChibiAkimas Live

Offline SOS

  • Supporter
  • CPC6128
  • *
  • Posts: 298
  • Country: de
  • Identity lost
    • index.php?action=treasury
  • Liked: 201
  • Likes Given: 178
Re: Amstrad CPC WiFi
« Reply #1181 on: 15:02, 09 January 17 »
Can you advise? Should I be using KL_Rom_Walk to init all the roms? or can I just init the Disk one in bank 7 (or wherever it is - I'll use the code above to check that)?
Please, use the Firmware-based Version KL_ROM_WALK, so ACMEDOS can be used, maybe Alberio-DOS can be used, and maybe other configuration, which we can't imagine in Januar 2017.

Offline keith56

  • ちび悪魔!
  • Supporter
  • 6128 Plus
  • *
  • Posts: 550
  • Country: jp
  • Part Ma, Part Aku... All Chibi!
    • Chibi Akuma(s)
  • Liked: 898
  • Likes Given: 206
Re: Amstrad CPC WiFi
« Reply #1182 on: 15:05, 09 January 17 »
Understood! I will use the ROM WALK!

I was a little scared of it, because during my 'beginner' days of coding, I tried it and it did strange things - but I think that was probably a bad peice of example code... as you say, anything we can do to be as compatible is possible helps people use the game - and probably saves me a lot of debugging at some point!

Don't want to go off-topic here,so Moving my programming questions to this thread:
http://www.cpcwiki.eu/forum/programming/what-is-the-lowest-memory-method-of-reading-from-disk/
« Last Edit: 00:17, 10 January 17 by keith56 »
Chibi Akumas: Comedy-Horror 8-bit Bullet Hell shooter!
Learn to program Assembly with my Text+Videos Tutorials for Z80, 6502, 68000
My Livestreaming Channel: ChibiAkimas Live

Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1183 on: 15:56, 09 January 17 »

That's a very useful bit of info

I'm modifying ChibiAkuma(s) to work on 64k, and need to flush out the firmware to free up enough memory, but I need to get it back for disk loading - so this thread's a big help for making sure I'm doing it in a 'compatible' way


I'm basing my code on this:
http://cpctech.cpc-live.com/source/firmsave.html
so please feel free to point out anything in there that will annoy the M4 -

Update:
Just reading through this thread, I'm a bit confused as to whether the M4 is replacing the disk-rom or in a separate bank (I'm seeing maybe there are multiple options?)

Can you advise? Should I be using KL_Rom_Walk to init all the roms? or can I just init the Disk one in bank 7 (or wherever it is - I'll use the code above to check that)?

M4 rom does not need amsdos, so will save much memory if you do not init amsdos also, but both is no problem.
Depending on how much memory you have available, ROM_WALK is fine, but at the risk of taking up a lot of memory (depending on whatever roms the user has).

Maybe this is a better solution. Always init rom 7 (amsdos, if present) and only init. the rom that started the game, this could be M4, ACME or maybe something new.

Ie.
; on init

ld hl,(&bc78)
inc hl
inc hl
ld a,(hl)
ld (disc_start_rom+1),a
; maybe save AMSDOS drive too




; on re-init of firmware

....

ld c,7            ; init amsdos
ld de&40
ld hl,&b0ff
call &BCCE
ld    a,7
disc_start_rom:
ld    c,6       ; overwritten by init
cp    c         ; is it rom 7?
jr    z,only_amsdos
call &BCCE     ; init 2nd rom
only_amsdos:

...

Offline SOS

  • Supporter
  • CPC6128
  • *
  • Posts: 298
  • Country: de
  • Identity lost
    • index.php?action=treasury
  • Liked: 201
  • Likes Given: 178
Re: Amstrad CPC WiFi
« Reply #1184 on: 15:58, 09 January 17 »
I was a little scared of it, because during my 'beginner' days of coding, I tried it and it did strange things - but I think that was probably a bad peice of example code.
Please ask in the programming-forum or PM, when you have troubles with e.g. the ROM-Walking :)

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1185 on: 16:02, 09 January 17 »
Please, use the Firmware-based Version KL_ROM_WALK, so ACMEDOS can be used, maybe Alberio-DOS can be used, and maybe other configuration, which we can't imagine in Januar 2017.

Hi

@Duke, @keith56 , i want to talk about retrieve the firmware and use again the firmware routines for disc access after flush the entirely firmware...

some time i made a (unprotected) version of U.N.Squadron that use only one side of a disk, and a special loader that load every level (without corrupt the screen in every level)...

With floppy, all goes like a charm... the game itself destroy de firmware (even it uses de second bank on 128k machines), but with a routine that i found to restore the firmware the load of the levels work in floppy and the game is 100% free error.

The problem is that i made this version not only to work on floppy but in mass storages too... because of this i use KL_ROM_WALK, to activate AMSDOS and the ROM of the expansion that handles the mass storage... but there is an error...

is not enough to activate the roms... we need to tell in what directory where working and make the rom know that... but with ACMEDOS i never achieve this (and i'm afraid that this works in different ways on other mass storage managers)... i don't release this version of U.N.Squadron because of this...

my question is:

there is really a compatible way to make a multiload game compatible with ALL mass storage versions (past & future)?.

I'm very interested in this subject... i want to release U.N.Squadron (and other games).

Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1186 on: 16:10, 09 January 17 »
Quote from: Joseman
is not enough to activate the roms... we need to tell in what directory where working and make the rom know that... but with ACMEDOS i never achieve this (and i'm afraid that this works in different ways on other mass storage managers)... i don't release this version of U.N.Squadron because of this...
With M4 such things is not stored CPC memory, so it wont have that problem. I reckon (but dont know) with ACMEDOS it will be stored in its ram workspace or somewhere in AMSDOS workspace, so you would have to locate where it's store, take a backup and restore it later.


Quote from: Joseman
my question is:

there is really a compatible way to make a multiload game compatible with ALL mass storage versions (past & future)?.
Probably not, without detecting each device and do specifics to them (like restoring a directory).

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1187 on: 17:15, 09 January 17 »
with ACMEDOS it will be stored in its ram workspace or somewhere in AMSDOS workspace, so you would have to locate where it's store, take a backup and restore it later.

trust me, i tried to save like crazy all the memory i can... i don't remember well but, &a000 to &bfff, but NOTHING worked ever!! (this version doesn't work on m4 by the way)...

when you have time (if you want), i can send you a copy and we can sort out the problem, but please, don't distribute the dsk until i upload the final version!


Offline SOS

  • Supporter
  • CPC6128
  • *
  • Posts: 298
  • Country: de
  • Identity lost
    • index.php?action=treasury
  • Liked: 201
  • Likes Given: 178
Re: Amstrad CPC WiFi
« Reply #1188 on: 17:16, 09 January 17 »
do specifics to them (like restoring a directory).
E. G. interesting are the differences how to get the actual path and restore them:
For M4DOS you can |getpath - save the reult and use it later for the restore with |CD,....
in ACMEDOS you can only do: patch &bb5a,  do an "|CD" and analyze the Output - BUT you can't do the result for a path-restore!
=> In ACMEDOS you can easy save the 16Bit value on &BE9D and restore them (very unusual, but very fast & very easy)

Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1189 on: 17:23, 09 January 17 »
when you have time (if you want), i can send you a copy and we can sort out the problem, but please, don't distribute the dsk until i upload the final version!

I can't help with ACMEDOS, as I don't have xmass, but if you want me to take a look at something np. but it seems @SOS has a solution for you :)

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1190 on: 17:37, 09 January 17 »
=> In ACMEDOS you can easy save the 16Bit value on &BE9D and restore them (very unusual, but very fast & very easy)

Yes i know that (i spent an evening to understand how ACMEDOS works!, i tried to save all the memory from #A000 to #BFFF (that include #BE9D) but nothing worked :(

Offline SOS

  • Supporter
  • CPC6128
  • *
  • Posts: 298
  • Country: de
  • Identity lost
    • index.php?action=treasury
  • Liked: 201
  • Likes Given: 178
Re: Amstrad CPC WiFi
« Reply #1191 on: 18:16, 09 January 17 »
Yes i know that (i spent an evening to understand how ACMEDOS works!, i tried to save all the memory from #A000 to #BFFF (that include #BE9D) but nothing worked :(

Ok , we are OT here, so we should please go to the XMASS-Thread, or PM
Off-Topic:
After the following program, loading a game with BASIC is no Problem:

org &4000
di
ld hl,&8000
ld de,&c000
ld bc,&3fff
ldir
ld hl,&8000
ld (hl),&CC
ld de,&8001
ld bc,&3ffe
ldir
ld de,&8000
ld hl,&c000
ld bc,&3fff
ldir
ei
ret

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1192 on: 18:46, 09 January 17 »
About Kick Off:

Tbh. I don't know if it needs the disc rom(can you maybe save/load data ingame?).

Yes, there is a league option that can save & load the classification and the matchs results at any time... and with your patch it works on M4!!!

thankyou!!

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1193 on: 20:38, 09 January 17 »
Works fine here with my regular CPC6128, with lowerrom mod2 / without lowerrom mod, as rom6 and as rom7...

Sorry to say that for me the last beta11 (rom6) don't work with ghost n goblins (original), it reset and it doesn't work with laser squad too, it hangs on "wich scenario?" selection, sometimes it show garbage on screen, sometimes resets (like ghost n goblins), but i doesn't work :(

UPDATE:

with lower rom V2 & B11: Ghost n goblings (original) works, laser squad: keeps hanging...


I have a theory: perhaps the B11 take up more ram than B9 and some games overwrite some code on B11 than didn't overwrite on B9?

« Last Edit: 20:46, 09 January 17 by Joseman »

Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1194 on: 21:32, 09 January 17 »
Sorry to say that for me the last beta11 (rom6) don't work with ghost n goblins (original), it reset and it doesn't work with laser squad too, it hangs on "wich scenario?" selection, sometimes it show garbage on screen, sometimes resets (like ghost n goblins), but i doesn't work :(

UPDATE:

with lower rom V2 & B11: Ghost n goblings (original) works, laser squad: keeps hanging...


I have a theory: perhaps the B11 take up more ram than B9 and some games overwrite some code on B11 than didn't overwrite on B9?

For me (just tested again):

CPC6128 + M4 V1.1.0 B11 mounted as ROM 6.
Both games work.

CPC6128 + M4 V1.1.0 B11 mounted as ROM 6 and modified lowerrom (v2).
Both games work.

Maybe you have other roms that cause problems?

Also beta 11 uses same ram as before, 272 bytes without amsdos and 128 bytes with amsdos.

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1195 on: 22:35, 09 January 17 »
hi again!

tested again, again same results...

My cpc is a spanish 6128 with the X-Mem attached...

the x-mem has the rom option disabled...

no other roms loaded...

strange...



Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1196 on: 22:59, 09 January 17 »
My cpc is a spanish 6128 with the X-Mem attached...

the x-mem has the rom option disabled...

no other roms loaded...
Very strange indeed, just tried with X-Mem attached aswell, both games works fine in both configs.
Are you sure you are using beta 11 and not beta 10 (that would explain alot).
Also for Laser Squad you need to run"ls   (not any of the other bas files).

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1197 on: 23:05, 09 January 17 »
Very strange indeed, just tried with X-Mem attached aswell, both games works fine in both configs.
Are you sure you are using beta 11 and not beta 10 (that would explain alot).
Also for Laser Squad you need to run"ls   (not any of the other bas files).

i think is beta 11, the zip was loaded from this thread... but maybe i download the wrong version or in the zip is  b10 by mistake?

can you point me to  a link that has the "correct" b11 version?


Offline Duke

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.138
  • Country: dk
    • spinpoint.org
  • Liked: 1225
  • Likes Given: 918
Re: Amstrad CPC WiFi
« Reply #1198 on: 23:17, 09 January 17 »
i think is beta 11, the zip was loaded from this thread... but maybe i download the wrong version or in the zip is  b10 by mistake?

can you point me to  a link that has the "correct" b11 version?
www.spinpoint.org/cpc/M4FIRM_v110b11.zip

Also getting goblins reset now when removing lower rom mod, could've sworn it worked fine just a bit ago... But laser squad is solid.
Will check what happens with goblins.

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 780
  • Country: es
  • Liked: 628
  • Likes Given: 429
Re: Amstrad CPC WiFi
« Reply #1199 on: 23:36, 09 January 17 »
Also getting goblins reset now when removing lower rom mod, could've sworn it worked fine just a bit ago... But laser squad is solid.
Will check what happens with goblins.

Sometimes with the rom part of the M4 (loading or unloading some roms - lower rom,etc..): if i reset the M4 it just not work... the rom is not correctly loaded or if it is... something goes wrong... but, if i turn off the CPC, turn off the M4 (not reset), turn on the CPC and turn on the M4, then all work correctly!.

Maybe is that what happens with goblins and your configuration?