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.

panagiotis1974

How to make Ictrup, "xxxx" in 464 basic 1.0?

CraigsBar

Quote from: panagiotis1974 on 12:03, 07 January 22
How to make Ictrup, "xxxx" in 464 basic 1.0?


a$="xxxx":|ctrup,@a$

IRC:  #Retro4All on Freenode

panagiotis1974


panagiotis1974

#2703
When I try to run .cpr files with M4 many times I have black screen or several errors.




When I try to run .cpr files with M4 many times I have black screen or several errors.
I have tried many .cpr files and in all I face the same problem.
I have tried with two 6128 and one 464. As you can see in photos I have the same result. :doh:
I suspect that M4 has died. I have tried with firmware 2.05, 2.06, 2.07 with no luck.
I hadn't tried .cpr files before.
update:It seems that if I give the command to run the .cpr file from the pc browser it works normally without errors and black screens.





CraigsBar

Quote from: panagiotis1974 on 13:55, 07 January 22
When I try to run .cpr files with M4 many times I have black screen or several errors.




When I try to run .cpr files with M4 many times I have black screen or several errors.
I have tried many .cpr files and in all I face the same problem.
I have tried with two 6128 and one 464. As you can see in photos I have the same result. :doh:
I suspect that M4 has died. I have tried with firmware 2.05, 2.06, 2.07 with no luck.
I hadn't tried .cpr files before.
update:It seems that if I give the command to run the .cpr file from the pc browser it works normally without errors and black screens.


Erm, I suspect frmo the pictures provided, you are missing the Plus for the CPR files. I have not tried but I would imagine a CPR image... being a Plus machine cartridge image would require a 6128plus or 464plus to work.

IRC:  #Retro4All on Freenode

panagiotis1974

#2705
Please read again my post .
Same cpr files run perfect from pc browser and some times directly from Ictr

panagiotis1974

It seems that with 2.0.4 it works perfectly on all three of my machines, the only thing I lost is the hack menu :)

Takis Kalatzis

Hello,


Is there any way to set/unset Modified Lower Rom (in slot 31) without using the web interface? I know there is the IROMUP command that can upload a ROM and the IROMSET that can make it active, but can they be used for setting/unsetting the modifed lower rom?


I am experimenting with M4 in Slot 6 and PARADOS in Slot 7. If I want to play around with SD/Disks, I have to go and disable the modified lower rom. If I want to play a game, I have to re-enable it. Just looking for a quicker way to do this...


Appreciate any help about this,


Takis

Duke


Quote from: Takis Kalatzis on 15:58, 21 January 22
Is there any way to set/unset Modified Lower Rom (in slot 31) without using the web interface? I know there is the IROMUP command that can upload a ROM and the IROMSET that can make it active, but can they be used for setting/unsetting the modifed lower rom?


I am experimenting with M4 in Slot 6 and PARADOS in Slot 7. If I want to play around with SD/Disks, I have to go and disable the modified lower rom. If I want to play a game, I have to re-enable it. Just looking for a quicker way to do this...
Sorry for late reply.
I haven't added a command for disabling the lower-rom, but you could upload Parados or Amsdos to slot 6, then when you use |m4romoff it should become active instead of the M4 rom.

GUNHED

Yes, that works. I use X-DDOS in ROM slot 6 (for B-drive Vortex format of 704 KB and HD20 hard-disc support) the way you described it.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Animalgril987

Hi @Duke . Is there a simple m/c code way to detect if an M4 is connected to the CPC?

Prodatron

You can search for the RSX command "M4 BOARD".

Or search for the string

db "M4 BOAR","D"+#80

starting at #c004 in any rom.

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

Animalgril987

Quote from: Prodatron on 20:44, 05 March 22You can search for the RSX command "M4 BOARD".

Or search for the string

db "M4 BOAR","D"+#80

starting at #c004 in any rom.
Yes, I could  :D , but I want to do the check using code in another ROM...

pelrun

&BCD4 KL FIND COMMAND should work fine called from ROM.

Duke

@Animalgril987  Another simple method, is to enable the HACKMENU lowerrom, using C_ROMLOW command (http://www.spinpoint.org/cpc/m4info.txt) and check some value/offset. Ie. 0x100 would always contain "MV - SNA" (see https://github.com/M4Duke/m4hackmenu/blob/master/nmirom.s line 80 ->) or even the mapped rom can be read at 0x0.

GUNHED

Hi Duke!

Eventually I'm going into the programming of M4 SD card usage,
To retrieve and use a DIRectroy is working very well now.
Thanks for your example. :-D

But how to read (write) a file?
Do you please have some simple Z80 code for that?
(By looking at the ROM upload source I'm not sure what does what).

Well, I ask here, because I assume it's of common interest for most M4 users :-)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Duke

#2716
@GUNHED
Cool!
Lets start with reading a file... As you mention I already referenced https://github.com/M4Duke/M4examples/blob/master/romup.s
If you extract the functions from the source of romup.s
fopen, fread, fclose
Then you have whats needed to read a file.

First use fopen to open the file and retrieve a file descriptor (fd) Input/Output parameters are commented just above each file function.
You need to set the mode for reading with the flag FA_READ and OR it with 0x80 (M4 real mode).
Using the file descriptor (fd), one can now read contents of the file using fread . However as the M4 works by making the data available through its "rom" buffer, there is only room to read 2048 bytes (0x800) at a time. So anything bigger than 2048 needs to be read in chunks and copied to the desired memory location, that is what my loop is for in the function of fread.
Finally when done reading, you gracefully close the file (to free up internal structures), using fclose function.
The functions are just wrappers for the hardware calls C_OPEN, C_READ & C_CLOSE.
So I'd suggest copying out those 3 functions for a start and try to get them working first. If any questions (there is not much actual code in the functions) let me know, I'll be happy to walk through them.
Once you got those working, I will write you a seperate f_write function if needed.

Animalgril987


GUNHED

Quote from: Duke on 05:24, 08 March 22So I'd suggest copying out those 3 functions for a start and try to get them working first.
Great! And thanks a lot for your easy way of explaining it :-)))  :) :) :)

One more quick question, the M4 has the following modes:
FA_READ
FA_WRITE
FA_CREATE_NEW
FA_CREATE_ALWAYS
FA_OPEN_ALWAYS

The  FA_READ is probably for reading files, is it for both, ASCII and binary files?
FA_WRITE is probably for writing data (I'll have a closer look soon anyway).

But... What are the other four FA_ functions doing exactly?
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Duke

Quote from: GUNHED on 15:21, 09 March 22
Quote from: Duke on 05:24, 08 March 22So I'd suggest copying out those 3 functions for a start and try to get them working first.
Great! And thanks a lot for your easy way of explaining it :-)))  :) :) :)

One more quick question, the M4 has the following modes:
FA_READ
FA_WRITE
FA_CREATE_NEW
FA_CREATE_ALWAYS
FA_OPEN_ALWAYS

The  FA_READ is probably for reading files, is it for both, ASCII and binary files?
FA_WRITE is probably for writing data (I'll have a closer look soon anyway).

But... What are the other four FA_ functions doing exactly?
Taken from the FATFS (underlaying FAT driver) documentation:
FA_READSpecifies read access to the file. Data can be read from the file.
FA_WRITESpecifies write access to the file. Data can be written to the file. Combine with FA_READ for read-write access.
FA_OPEN_EXISTINGOpens a file. The function fails if the file is not existing. (Default)
FA_CREATE_NEWCreates a new file. The function fails with FR_EXIST if the file is existing.
FA_CREATE_ALWAYSCreates a new file. If the file is existing, it will be truncated and overwritten.
FA_OPEN_ALWAYSOpens the file if it is existing. If not, a new file will be created.

You can combine flags, like FA_READ|FA_WRITE so you can read and write to the file with the same descriptor.
Also when you create a new file it would typically be FA_CREATE_ALWAYS | FA_WRITE

GUNHED

Thanks a lot! That's very helpful.  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

GUNHED

Hi Duke!

Well, I got some problems with reading a file...

1. To open file using fopen only works with 'read mode' &01. 
Using read mode 1 the M4 card returns the file-descriptor byte &04.
Using the read mode &81 the M4 returns byte &FF (error).

2. Using fread I get the result byte &09. But there's no data available.

The used code is attached at this post. Please have a look at it and point me to the error if possible.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Duke

Quote from: GUNHED on 14:55, 10 March 22Hi Duke!

Well, I got some problems with reading a file...

1. To open file using fopen only works with 'read mode' &01.
Using read mode 1 the M4 card returns the file-descriptor byte &04.
Using the read mode &81 the M4 returns byte &FF (error).

2. Using fread I get the result byte &09. But there's no data available.

The used code is attached at this post. Please have a look at it and point me to the error if possible.  :)

Please use &81 when opening the other is mode is pretty much for inside DSK files (CPC AMSDOS compatible).
The return of 0xFF indicates that the file is not found. If the "FILENAME" is in root, try  "/FILENAME".

GUNHED

#2723
I'll try using the "/" in front of the name and let you know... Thanks!  :) :) :)

EDIT: Well it doesn't work.
I tried to open an ASCII file with the name "A" by using filename "/A" + 0 byte to open.
Using read mode &81 it returns &FF (error) as status. The same for a BASIC file.

Can you please take another  look a my code?
Maybe there is a working example code somewhere?
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Duke

#2724
Quote from: GUNHED on 18:01, 11 March 22I'll try using the "/" in front of the name and let you know... Thanks!  :) :) :)

EDIT: Well it doesn't work.
I tried to open an ASCII file with the name "A" by using filename "/A" + 0 byte to open.
Using read mode &81 it returns &FF (error) as status. The same for a BASIC file.

Can you please take another  look a my code?
Maybe there is a working example code somewhere?

I just made a new example for you. Stripped as much away, as I could, to make it clean and easy to read.
The example first creates a file with the contents "Hello world!". Reads it back to a buffer and displays it on screen.
It also uses the C_ROMLOW to detect the M4 rom number (quicker than looping through roms).
Also included the binary (with AMSDOS HEADER), so you can verify it works for you too (run"wr-rd.bin").
Hope this helps.

EDIT:
As I cannot attach files (?) to the post, I have put them on github:
https://github.com/M4Duke/M4examples
https://github.com/M4Duke/M4examples/blob/master/wr-rd.s
https://github.com/M4Duke/M4examples/blob/master/wr-rd.bin

Powered by SMFPacks Menu Editor Mod