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 6 Guests are viewing this topic.

KaosOverride

Sure that as a SymbOS app, it uses SymbOS API, not AMSDOS/CAS. Will do the job, but I was thinking about a non-SymbOS, bare CPC native app
KaosOverride · GitHub
MEGA Amstrad Public Amstrad folder

WildW

Quote from: Duke on 10:49, 17 November 16
As for lasersquad the only proper cracked version I found was for 128KB ram

I definitely had a version I used to run on my 664 as a kid.

Thanks for the links to better sources, I will give those places a try. Meanwhile I will collect any dsk I find that fails for me and share them - I know some of them at least should not be 128k only.

Prodatron

Many original software used their own loaders (of course all the copy protection ones in any case). They all won't run on the M4. Unfortunatly that's probably the same for some newer productions.

IMHO it would be a great thing, if developers of new games like "Imperial Mahjong" or "Pinball Dreams" could provide AMSDOS friendly versions of their software in the future (like Shining did with "Defence")! Would be really cool to start them on the M4 or with AcmeDOS directly from SD/IDE! An own loader feels cool, but since we have the M4 and IDE with AcmeDOS it would be much more user friendly to use the native DOS routines.

Quote from: KaosOverride on 14:17, 17 November 16
Sure that as a SymbOS app, it uses SymbOS API, not AMSDOS/CAS.
Yes, that's true indeed :)

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

dragon

Quote from: WildW on 07:50, 17 November 16
Got my M4 board this week, very nice indeed  :D

Sorry if this has been asked before (this is a really long thread) - does anyone have any tips for improving compatibility? I've tried various DSK files (many that I've been using with emulators for ages) and lots of them have failed to work correctly on a real CPC. Mostly I've been able to eventually find alternate versions that do work, but some games just refuse to work. I can't find a working Laser Squad at all! :(   Mostly games that fail to work just freeze up halfway through loading and never get further. Others finish with some fancy screen corruption.

I have a 464, which I can believe may be some of the issue. As recommended I've moved the M4 rom to sit in slot 7 instead of the default 6. Anyone have any other bright ideas?

Laser squad have her own subrutine to read from the disk, i know it because time ago i ported it to  cartridge.

To load it from m4, you need made a new routine in the place of the cartridge loader that load the levels from m4. That i not sure if is possible as laser squad kill firmware in ram and uses all 64k.

At the finish i dismantle a litte the game and i load spectrum russian maps in the amstrad, but they  majority need sprite rework, and i not know the spectrum so  i drop it :D .

In the way tryng modify the game i made incredible effets as the bad guy autoinmole in the fisrt turn and other strange things when modifiy the number of the players/database weapon ammo.

These are my findings in these time. Very very chaotic notes :) . As i write things with not sense when i try things in the emulator only to remember it  a few minutes.

And  level of spectrum running in amstrad. "return to moon base"


Duke

Quote from: dragon on 16:51, 17 November 16
To load it from m4, you need made a new routine in the place of the cartridge loader that load the levels from m4. That i not sure if is possible as laser squad kill firmware in ram and uses all 64k.

If one could replace the "read sector" function with below, it could load from .dsk image. It takes about &90 bytes with my clumsy code ;) - that does not rely on any firmware functions.


            ; M4 board
            ; DSK read sector example
            ; Duke 2016
           
            org    &4000
            nolist

DATAPORT        equ &FE00
ACKPORT        equ &FC00           

C_READSECTOR    equ &430B                       

start:        di
            ld    bc,&7F85                        ; GA select upper rom, and mode 1
            out    (c),c
            ld    a,(m4_rom_num)
            cp    &FF
            call    z,find_m4_rom    ; find rom (only first run)
            cp    &FF
            call    nz,read_sec
            ld    bc,&7F8D                        ; GA deselect upper rom, and mode 1
            out    (c),c
            ei
            ret
               
read_sec:        ld    bc,DATAPORT                    ; data out port
            out (c),c
            ld    a,&0B
            out    (c),a                        ; command lo
            ld    a,&43
            out    (c),a                        ; command    hi
           
            ; parameters hardcoded for now
           
            ld    a,0                            ; track 0
            out    (c),a                        ;
            ld    a,&c1                        ; sector 0
            out    (c),a                        ;
            ld    a,0                            ; drive 0
            out    (c),a                        ;
            ld    bc,ACKPORT
            out (c),c                            ; tell M4 that command has been send
         
            ld    a,(m4_rom_num)
            ld    bc,&DF00
            out    (c),a                        ; select M4 rom
            ld    hl,&FF02                        ; get response buffer address
            ld    e,(hl)
            inc    hl
            ld    d,(hl)
            ex    de,hl
            ld    de,sector_buf
            ld    bc,#512
            ldir
            ret
           
            ;
            ; Find M4 ROM location
            ;
               
find_m4_rom:
            ld    iy,m4_rom_name    ; rom identification line
            ld    d,127        ; start looking for from (counting downwards)
           
romloop:        push    de
            ld    bc,&DF00
            out    (c),d        ; select rom
           
            ld    a,(&C000)
            cp    1
            jr    nz, not_this_rom
           
            ; get rsxcommand_table
           
            ld    a,(&C004)
            ld    l,a
            ld    a,(&C005)
            ld    h,a
            push    iy
            pop    de
cmp_loop:
            ld    a,(de)
            xor    (hl)            ; hl points at rom name
            jr    nz, not_this_rom
            ld    a,(de)
            inc    hl
            inc    de
            and    &80
            jr    z,cmp_loop
           
            ; rom found, store the rom number
           
            pop    de            ;  rom number
            ld     a,d
            ld    (m4_rom_num),a
            ret
           
not_this_rom:
            pop    de
            dec    d
            jr    nz,romloop
            ld    a,255        ; not found!
            ret


m4_rom_name:    db    "M4 BOAR",&C4        ; D | &80
m4_rom_num:    db    &FF
sector_buf:    ds    512

dragon

i
Quote from: Duke on 18:53, 17 November 16
If one could replace the "read sector" function with below, it could load from .dsk image. It takes about &90 bytes with my clumsy code ;) - that does not rely on any firmware functions.


            ; M4 board
            ; DSK read sector example
            ; Duke 2016
           
            org    &4000
            nolist

DATAPORT        equ &FE00
ACKPORT        equ &FC00           

C_READSECTOR    equ &430B                       

start:        di
            ld    bc,&7F85                        ; GA select upper rom, and mode 1
            out    (c),c
            ld    a,(m4_rom_num)
            cp    &FF
            call    z,find_m4_rom    ; find rom (only first run)
            cp    &FF
            call    nz,read_sec
            ld    bc,&7F8D                        ; GA deselect upper rom, and mode 1
            out    (c),c
            ei
            ret
               
read_sec:        ld    bc,DATAPORT                    ; data out port
            out (c),c
            ld    a,&0B
            out    (c),a                        ; command lo
            ld    a,&43
            out    (c),a                        ; command    hi
           
            ; parameters hardcoded for now
           
            ld    a,0                            ; track 0
            out    (c),a                        ;
            ld    a,&c1                        ; sector 0
            out    (c),a                        ;
            ld    a,0                            ; drive 0
            out    (c),a                        ;
            ld    bc,ACKPORT
            out (c),c                            ; tell M4 that command has been send
         
            ld    a,(m4_rom_num)
            ld    bc,&DF00
            out    (c),a                        ; select M4 rom
            ld    hl,&FF02                        ; get response buffer address
            ld    e,(hl)
            inc    hl
            ld    d,(hl)
            ex    de,hl
            ld    de,sector_buf
            ld    bc,#512
            ldir
            ret
           
            ;
            ; Find M4 ROM location
            ;
               
find_m4_rom:
            ld    iy,m4_rom_name    ; rom identification line
            ld    d,127        ; start looking for from (counting downwards)
           
romloop:        push    de
            ld    bc,&DF00
            out    (c),d        ; select rom
           
            ld    a,(&C000)
            cp    1
            jr    nz, not_this_rom
           
            ; get rsxcommand_table
           
            ld    a,(&C004)
            ld    l,a
            ld    a,(&C005)
            ld    h,a
            push    iy
            pop    de
cmp_loop:
            ld    a,(de)
            xor    (hl)            ; hl points at rom name
            jr    nz, not_this_rom
            ld    a,(de)
            inc    hl
            inc    de
            and    &80
            jr    z,cmp_loop
           
            ; rom found, store the rom number
           
            pop    de            ;  rom number
            ld     a,d
            ld    (m4_rom_num),a
            ret
           
not_this_rom:
            pop    de
            dec    d
            jr    nz,romloop
            ld    a,255        ; not found!
            ret


m4_rom_name:    db    "M4 BOAR",&C4        ; D | &80
m4_rom_num:    db    &FF
sector_buf:    ds    512


jeje, honestly i not know how works the subrutine disk of the game and where is located the read function. My aproach in these day was ¿Are you the  subrutine that made i can't play the game?.  I kill you ->>> And change it with mine :) (after i interrogated it what memory ranges load in each level :).

The subrutine is located in &52d2, i made call to the rom where it find the asm in the rar. Then i simply look the level the user select in memory (&02f4) . And load the rom designated from cartridge.

Then i can add the levels of expansion disk adding more entry.

You can take a look if you want at asm.



Duke

Quote from: dragon on 19:26, 17 November 16
i
jeje, honestly i not know how works the subrutine disk of the game and where is located the read function. My aproach in these day was ¿Are you the  subrutine that made i can't play the game?.  I kill you ->>> And change it with mine :) (after i interrogated it what memory ranges load in each level :) .

The subrutine is located in &52d2, i made call to the rom where it find the asm in the rar. Then i simply look the level the user select in memory (&02f4) . And load the rom designated from cartridge.

Then i can add the levels of expansion disk adding more entry.

You can take a look if you want at asm.
Very nice, I guess with your work, the easist method would be to find the track/sector offsets for the disk image and make similar loader, reading the level from 0x2f4 and point to the right track, sector.

Maybe I will take a look just for fun, though I shouldn't, got so much other stuff I should do :)

dragon

#1057
That if they not made decription or something else.


Always you can made a.bin for each level  from memory after the call. And load your .Bin from the sd :)


Ah another thing, game permit load/save. But i ignore It in the cartridge, because you can't save in rom. :)

anyway I will try. take a look at disc subrutine.

dragon

#1058
Quote from: Duke on 18:53, 17 November 16
If one could replace the "read sector" function with below, it could load from .dsk image. It takes about &90 bytes with my clumsy code ;) - that does not rely on any firmware functions.


            ; M4 board
            ; DSK read sector example
            ; Duke 2016
           
            org    &4000
            nolist

DATAPORT        equ &FE00
ACKPORT        equ &FC00           

C_READSECTOR    equ &430B                       

start:        di
            ld    bc,&7F85                        ; GA select upper rom, and mode 1
            out    (c),c
            ld    a,(m4_rom_num)
            cp    &FF
            call    z,find_m4_rom    ; find rom (only first run)
            cp    &FF
            call    nz,read_sec
            ld    bc,&7F8D                        ; GA deselect upper rom, and mode 1
            out    (c),c
            ei
            ret
               
read_sec:        ld    bc,DATAPORT                    ; data out port
            out (c),c
            ld    a,&0B
            out    (c),a                        ; command lo
            ld    a,&43
            out    (c),a                        ; command    hi
           
            ; parameters hardcoded for now
           
            ld    a,0                            ; track 0
            out    (c),a                        ;
            ld    a,&c1                        ; sector 0
            out    (c),a                        ;
            ld    a,0                            ; drive 0
            out    (c),a                        ;
            ld    bc,ACKPORT
            out (c),c                            ; tell M4 that command has been send
         
            ld    a,(m4_rom_num)
            ld    bc,&DF00
            out    (c),a                        ; select M4 rom
            ld    hl,&FF02                        ; get response buffer address
            ld    e,(hl)
            inc    hl
            ld    d,(hl)
            ex    de,hl
            ld    de,sector_buf
            ld    bc,#512
            ldir
            ret
           
            ;
            ; Find M4 ROM location
            ;
               
find_m4_rom:
            ld    iy,m4_rom_name    ; rom identification line
            ld    d,127        ; start looking for from (counting downwards)
           
romloop:        push    de
            ld    bc,&DF00
            out    (c),d        ; select rom
           
            ld    a,(&C000)
            cp    1
            jr    nz, not_this_rom
           
            ; get rsxcommand_table
           
            ld    a,(&C004)
            ld    l,a
            ld    a,(&C005)
            ld    h,a
            push    iy
            pop    de
cmp_loop:
            ld    a,(de)
            xor    (hl)            ; hl points at rom name
            jr    nz, not_this_rom
            ld    a,(de)
            inc    hl
            inc    de
            and    &80
            jr    z,cmp_loop
           
            ; rom found, store the rom number
           
            pop    de            ;  rom number
            ld     a,d
            ld    (m4_rom_num),a
            ret
           
not_this_rom:
            pop    de
            dec    d
            jr    nz,romloop
            ld    a,255        ; not found!
            ret


m4_rom_name:    db    "M4 BOAR",&C4        ; D | &80
m4_rom_num:    db    &FF
sector_buf:    ds    512


I dont't know exatly how he works. i lost one call dependant of three unknown variables in memory appear set outside  the subrutine. and what he does in the bucle

But he appears the read sector are located in &58c9.but it create the commands reading from disk :D .

I made a level 1 tracing until first loop  commented in english.


Duke

Quote from: dragon on 21:16, 18 November 16
But he appears the read sector are located in &58c9.but it create the commands reading from disk :D .

I made a level 1 tracing until first loop  commented in english.
Good work, looks like a bit of nightmare to get through all that code.

dragon

#1060
I don't think is so dificult, but i not know how he distinguis between levels.

Anyway the call in &58ce is very strange, is never used, depend from &57fd in memory.

edit:i know what he do 0=read from disk 1=save to disk :) .

O.k resumely, left apart interrputs cheking and that thigs of the fdd this is how laser squad read the levels on disk:

You press a number (1-6) we apart 4 now, is load saved game, for the rest.

---------------------------------------------------------------------------------------------------
subrutine recieve number equivalent to the number pressed. (level 1 example)

Initial_cylinder=(number_pressed*6)+2=08
Finish_cylinder=initial_cylinder+5=0D

Then we park the head of the fdd in the initial_cylinder (08)
We read the id, and after cheking we have in the correct cylinder with Initial_cylinder

we have this predifined array

Read_sector_table=46,00,00,00,00,00,49,2a,ff :

command_read_sector,status,cylinder,head,sector_number,sector_size,track_lenght_,lenght_gap_3,data_lenght. [0-9]

now we have another array, the result of read id:

Id_table=statusregister0,statusregister1,statusregister2,cylinder,head,sector_number,sector_size. [0-6]

Now, we take:

Read_sector_table[3]=id_table[3]
Read_sector_table[4]=id_table[4]
Read_sector_table[5]=((id_table[5] and f0)+1)
Read_sector_table[6]=id_table[6]
Read_sector_table[7]=Read_sector_table[5]+07

Rest of parameter Read_sector_table default.

And we send read sector :) we begining store it in &6367 after read sector we add +1000 this.

When initial_cylinder=Finish_cylinder we go out, if not. initial_cylinder=initial_cylinder+1 and we repeat procedure.



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








Duke

M4 Board firmware v1.1.0 beta 8 download here:
http://www.spinpoint.org/cpc/M4FIRM_v110b8.zip

Many changes to match AMSDOS behaviour, like seperate in/out headers, using 2k buffer for cas_out_char too and more.
(ie. now amsdos cas_in/out_char "fast copy" is possible with header manipulation, see example: https://github.com/M4Duke/M4examples/blob/master/fastcopy.s)

Hopefully all will gain better compatiblity, if I haven't introduced new bugs :)

Also I recommend anyone that cannot replace AMSDOS (rom 7) to use my modified lower rom (here: http://www.cpcwiki.eu/index.php/M4_Board).
Set M4 rom to pos to 6. Upload your original AMSDOS (or parados) rom to slot 6 (yes both 6!).
This way you will have more himem as you wont have two DOS' at the same time and better compatiblity.
If you want to use AMSDOS (floppy disk, HXC etc), just type |M4ROMOFF.

@dragon: I will re-visit that game soon, when I get a bit more time :)

Joseman

#1062
Hi @Duke

I was going to post an extrange error with an amsoft game "alm. Graf Spee", but i saw the b8 update, and now it works!.

Anyway i'm going to relate the extrange error:

with b7, if i don't load the modified lower rom, the game runs well. but if i use the modified lower rom, the game doesn't work, when the ship is about to be displayed on the map, the game enters and endless loop and don't work.

With b8 and the lower rom, it works.

by the way, is possible to have a spanish lower rom modified?  :-[

UPDATE1:

Another extrange behaviour, another game from Amsoft (i think all in basic), Sultan's Maze (spanish version), without M4 it works, with M4 it throws an error in line 210, "improper argument", this line has the symbol command in it... what can be this extrange error?

Duke

Quote from: Joseman on 20:14, 03 December 16
by the way, is possible to have a spanish lower rom modified?  :-[

I patched the Spanish lower rom aswell. You can get it here: http://www.cpcwiki.eu/index.php/M4_Board#Various_files

Quote from: Joseman on 20:14, 03 December 16
UPDATE1:
Another extrange behaviour, another game from Amsoft (i think all in basic), Sultan's Maze (spanish version), without M4 it works, with M4 it throws an error in line 210, "improper argument", this line has the symbol command in it... what can be this extrange error?

Can you give me a link to the dsk/files in question so I can check it out?
Thanks for the feedback.


Joseman

Thankyou for the spanish rom!!!

here is the link for the game:

http://s000.tinyupload.com/index.php?file_id=67162882071074664148


Duke

Thanks, will take a look tomorrow.

Don't suppose anyone has a link for German cpc6128 lowerrom?
I have one called 6128w, but no idea what country that is, the extra characters don't look german atleast...

Joseman

@Duke

Here another game with the same problem with the symbol command...

http://www.cpc-power.com/index.php?page=detail&onglet=dumps&num=2034

SOS

Quote from: Duke on 23:39, 03 December 16
Don't suppose anyone has a link for German cpc6128 lowerrom?
I have one called 6128w, but no idea what country that is, the extra characters don't look german atleast...
There are no German-Lowerrom exists.
So the German-CPC's uses the english ROM.

Duke

Quote from: Joseman on 23:43, 03 December 16
@Duke

Here another game with the same problem with the symbol command...

http://www.cpc-power.com/index.php?page=detail&onglet=dumps&num=2034
Ok, quick fix for now, delete your autoexec.bas file and they should work fine.
Will investigate further...

Joseman

Hi @Duke

Today I'm installing a M4 board that i bought you some months ago...

The board itself works, read the microsd, load games...

but if i try to upgrade the board, it just stays with the red light on and nothing happens...

if i reset the board happens the same, i just need to remove the microsd and erase the firmware files... then the board works again!!

the strange thing is that "m4firm.bin" gets erased by the M4, but "ESPFIRM.BIN" stays there and until its removed the m4 won't start...

what can be happening?


Duke

Hi @Joseman

Not sure, try using this upgrade http://www.spinpoint.org/m4diag.zip

It should make report.txt in the root. Maybe the ESP8266 just needs full chip erase or if something wrong, hopefully it will be in the report file.

Joseman

Quote from: Duke on 19:03, 07 December 16
Hi @Joseman

Not sure, try using this upgrade http://www.spinpoint.org/m4diag.zip

It should make report.txt in the root. Maybe the ESP8266 just needs full chip erase or if something wrong, hopefully it will be in the report file.

Hi @Duke , already tried this, the same scenario, the m4 lights the red led and keeps going this way, report.txt is blank

More strange is: i have 3- M4 bought in the same order... 2 of then acts the same... the third i didn't try...


Duke

Quote from: Joseman on 21:04, 07 December 16
Hi @Duke , already tried this, the same scenario, the m4 lights the red led and keeps going this way, report.txt is blank

More strange is: i have 3- M4 bought in the same order... 2 of then acts the same... the third i didn't try...
In that case, try reformatting the microSD. Also be patient when running m4diag it takes a lot longer than usual. Do you power it via USB ?
Whats reported when you do |version?

Joseman

Quote from: Duke on 06:55, 08 December 16
In that case, try reformatting the microSD. Also be patient when running m4diag it takes a lot longer than usual. Do you power it via USB ?
Whats reported when you do |version?

Yes, i tried several microSD and several formats, allways the same...

Yes, I power it via USB

I let the M4 about 20 minutes, but nothing...

Perhaps the problem is that it needs the upgrades one by one?

i know that the upgrade is not done because in that M4 the wildcards doesn't works...

Duke

Quote from: Joseman on 15:34, 08 December 16
Perhaps the problem is that it needs the upgrades one by one?

i know that the upgrade is not done because in that M4 the wildcards doesn't works...
If more recent version of M4 (with newer ESP-12F modules) you should only use v1.0.9 upwards. Wildcards are implemented on the M4 MCU side, and it seems it upgrades if it erases the M4FIRM.BIN file, but please check with |version. Another failure could be bad CRC of the firmware file, in which case it would not be flashed, but I'd expect the unzip to complain about that.
Please try this method for upgrading to ie. latest beta, remove the M4 from the CPC insert the microSD with both firmware files in root, and connect USB only.
If this still fails, I will try to do another diagnostics firmware for you, to determine the problem - most strange thing is you have 2 boards doing it and both ESP's have been flashed using this method by me. Otherwise I would think I had made a dodgy board.

Powered by SMFPacks Menu Editor Mod