MTX and RUN files to COM?
Posted: 01 Sep 2015 18:04
Is it possible to convert MTX and RUN files to COM files so that they can run directly from CP/M?
Thanks,
David.
Thanks,
David.
The world's first? Memotech MTX Forum
http://www.mtxworld.dk/memorum/
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
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 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