Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Correct way to read/write to M4 from ASM?

Started by Anthony Flack, 23:00, 08 January 24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Anthony Flack

Apologies if this has been covered a million times.

So my game runs fine in an emulator with Parados and from a Gotek with regular Amsdos. I assume it will also work fine playing from a real disc. I have also been testing on an M4 and it runs great from a .dsk file; near-instantaneous loading, it's very cool.

Trouble is, I have recently implemented high score saving (at last!) and so inevitably I discover that M4 support for .dsk format is read only ("for now"...?), so that breaks the high score saving.

I tried extracting the files into a folder and running it that way. The BASIC loader works and loads the game, but any subsequent loading and saving from inside the game code fails. So I guess I am accessing the firmware calls incorrectly. I keep the firmware undisturbed with the hope of maintaining compatibility with whatever you might have hanging out the back of your CPC. But I really don't know anything about the firmware and don't touch it otherwise. I'm just using the CAS_IN/OUT calls like it says in the firmware manual. Am I supposed to be calling to a jumpstack somewhere else maybe? I don't know. I want to do whatever is most compatible.


You can take a look at my ROM M for FutureOS, it contains lot of OS functions for the M4 SD card. Also there is a documentation. Since this forum doesn't allow any kind of file types / sizes - please have a look at (Downloads).  :) --> Get the revolutionary FutureOS (Update: 2023.11.30) --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)


Quote from: Anthony Flack on 23:00, 08 January 24I'm just using the CAS_IN/OUT calls like it says in the firmware manual.

I am using these calls as well:

cas_in_open    equ #bc77
cas_in_close    equ #bc7a
cas_in_direct  equ #bc83

and it would be strange, if they make issues with the M4 board.

I didn't use the cas_out functions, also not the in/out_char variant.
Do all cas_... make issues on your side?
I wonder if the M4Rom could be reinitialized within your application in a wrong way? But as DSK is working, that doesn't make sense.


Anthony Flack

Yeah I'm using those calls, with in_direct and out_direct. 

"Do all cas_... make issues on your side?" - yeah, I haven't looked deeply into it but it does seem to break the CAS_IN load routines. Or at least, the BASIC loader works and everything beyond that doesn't. It shouldn't be reinitialising at all, since I call the game from BASIC and don't disturb the firmware or ROMs (it seemed like the best idea).

I agree it is strange, and the fact that it works from disk image doesn't make sense to me either. Unless the process of extracting the files has screwed things up somewhere... I used the built-in command on the M4. 

Powered by SMFPacks Menu Editor Mod