News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Duke

Amstrad CPC WiFi

Started by Duke, 07:36, 07 May 16

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

Duke

About Laser Squad @WildW & @dragon

Quote from: dragon on 12:32, 19 November 16
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.....

WildW

#1176
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

Joseman

Quote from: Duke on 15:00, 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?


Jamie Gunn (Gunni)

@Duke  I finally got some time to test out the board this weekend, works great! thanks for all your efforts!

Duke

Quote from: Joseman on 22:53, 08 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.

keith56

#1180
Quote from: Duke on 08:13, 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)?
Chibi Akumas: Comedy-Horror 8-bit Bullet Hell shooter!
Learn ARM, 8086, Z80, 6502 or 68000 with my tutorials: www.assemblytutorial.com
My Assembly programming book is available now on amazon!

SOS

Quote from: keith56 on 13:35, 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.

keith56

#1182
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/
Chibi Akumas: Comedy-Horror 8-bit Bullet Hell shooter!
Learn ARM, 8086, Z80, 6502 or 68000 with my tutorials: www.assemblytutorial.com
My Assembly programming book is available now on amazon!

Duke

Quote from: keith56 on 13:35, 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:

...

SOS

Quote from: keith56 on 14:05, 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 :)

Joseman

Quote from: SOS on 14: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).

Duke

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).

Joseman

Quote from: Duke on 15:10, 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!


SOS

Quote from: Duke on 15:10, 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)

Duke

Quote from: Joseman on 16:15, 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 :)

Joseman

Quote from: SOS on 16:16, 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 :(

SOS

Quote from: Joseman on 16:37, 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
[ot]
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
[/ot]

Joseman

About Kick Off:

Quote from: Duke on 15:00, 08 January 17
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!!

Joseman

#1193
Quote from: Duke on 09:09, 08 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?


Duke

Quote from: Joseman on 19:38, 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.

Joseman

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...



Duke

Quote from: Joseman on 21:35, 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).

Joseman

Quote from: Duke on 21:59, 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?


Duke

Quote from: Joseman on 22:05, 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.

Joseman

Quote from: Duke on 22:17, 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?

Powered by SMFPacks Menu Editor Mod