MTX and RUN files to COM?

Include new and ported/converted games, and old games/tools. Subjects about CP/M software goes in the CP/M Forum.
Post Reply
wyerd
Posts: 93
Joined: 13 May 2013 23:16
Location: Upstate New York. USA.

MTX and RUN files to COM?

Post by wyerd »

Is it possible to convert MTX and RUN files to COM files so that they can run directly from CP/M?

Thanks,
David.
User avatar
Dave
Posts: 1280
Joined: 11 Aug 2012 18:16
Contact:

Re: MTX and RUN files to COM?

Post by Dave »

You could try run.com as described on this page

http://www.nyangau.org/memu/formats.htm#run

regards
Dave
wyerd
Posts: 93
Joined: 13 May 2013 23:16
Location: Upstate New York. USA.

Re: MTX and RUN files to COM?

Post by wyerd »

Thanks. I'll check it out.
Martin A
Posts: 799
Joined: 09 Nov 2013 21:03

Re: MTX and RUN files to COM?

Post by Martin A »

Interesting idea, given how much faster the CFX loads COM files than their RUN equivalents.

The contents .MTX files could be anything, it's a tape image so no hard and fast rules.

A .RUN however is just a data dump with 4 bytes added to the start containing the load/run address, and then the size.

This short bit of assembly code should do it.

Code: Select all

0100              ORG &0100
0100 ED 4B 11 01 LD BC,(LOAD+2) ;get the length for the block transfer
0104 21 13 01    LD HL,LOAD+4   ;source for block transfer is the start of the data block
0107 ED 5B 0F 01 LD DE,(LOAD)   ;destination is the load/run address
010B D5          PUSH DE        ;stack the run address
010C ED B0       LDIR           ;block move everything up 
010E C9          RET            ;use ret as an indirect jump to the start of the code
010F             LOAD:          ;start of the run file is here
010F             END

I ran a quick test on REVERSI.RUN, and it seems to be quite happy as REVERSI.COM with those 15 extra bytes tacked onto the beginning

As it's using the incrementing block move it wont work on a RUN file the is big enough to overlap the start address. However given that most of the RUN files load into the top 32k to fit on the MTX500 it's not a major issue
wyerd
Posts: 93
Joined: 13 May 2013 23:16
Location: Upstate New York. USA.

Re: MTX and RUN files to COM?

Post by wyerd »

Martin A wrote:Interesting idea, given how much faster the CFX loads COM files than their RUN equivalents.

The contents .MTX files could be anything, it's a tape image so no hard and fast rules.

A .RUN however is just a data dump with 4 bytes added to the start containing the load/run address, and then the size.

This short bit of assembly code should do it.

Code: Select all

0100              ORG &0100
0100 ED 4B 11 01 LD BC,(LOAD+2) ;get the length for the block transfer
0104 21 13 01    LD HL,LOAD+4   ;source for block transfer is the start of the data block
0107 ED 5B 0F 01 LD DE,(LOAD)   ;destination is the load/run address
010B D5          PUSH DE        ;stack the run address
010C ED B0       LDIR           ;block move everything up 
010E C9          RET            ;use ret as an indirect jump to the start of the code
010F             LOAD:          ;start of the run file is here
010F             END

I ran a quick test on REVERSI.RUN, and it seems to be quite happy as REVERSI.COM with those 15 extra bytes tacked onto the beginning

As it's using the incrementing block move it wont work on a RUN file the is big enough to overlap the start address. However given that most of the RUN files load into the top 32k to fit on the MTX500 it's not a major issue
This is great! Thanks for investigating Martin. It's a bit beyond my current assembly knowledge on how to do this, but I'm more than willing to give it a go if you could post instructions on how it's done, or something to get me going. I'd very much appreciate it.
Martin A
Posts: 799
Joined: 09 Nov 2013 21:03

Re: MTX and RUN files to COM?

Post by Martin A »

I used a small BASIC program to do the test conversion, it would just need the names changing to do other files.

The machine code is the same in all instances, so that's in the data statements, I've laid them out in the same format as the assembly code snippet, that's just cosmetic they can all go on one line.

It basically pokes in the 15 bytes, loads in the RUN file immediately after, and then saves out the extended file. (Line 60 gets the file length from the RUN file)

The code uses the SDX extensions to BASIC so needs:
A real SDX
Rememoriser running in BASIC/SDX
Memu in SDX mode.

It ought to work on an FDX using FDXB, with the 180xx references changed to 340xx

Not every RUN file will convert, as I found out while doing the Magrom that some of the games call parts of the basic rom, and that's not available in COM mode.

This is where Andy's RUN.COM does a better job at it will page in the roms before calling the code.
Screenshot of the small BASIC program
Screenshot of the small BASIC program
tooCom.jpg (28.07 KiB) Viewed 7749 times
wyerd
Posts: 93
Joined: 13 May 2013 23:16
Location: Upstate New York. USA.

Re: MTX and RUN files to COM?

Post by wyerd »

Thanks for the listing Martin. I'll give it a bash!
Post Reply