Well, the problem is not only related to games, for example the Home Runner Demo from the Welcome cassette:
startaddr=&9C40
length=&DAC
Which obviously overlaps with AMSDOS. The demo runs only for a short period of time, so that Home Runner doesn't run home ;D . When loaded from tape with no AMSDOS present he manages to run home.
Tape to disk copiers can copy the file, but don't care if the file is still usable.
I there a generic solution for this problem?
I found an answer in AA June 1993 p.21 (disable AMSDOS), but I think they want me to still load from tape, which is not what I want.
Relocating could help of course, but I don't know where the graphics start etc.
I'd love to run the Welcome demo from time to time on my real CPC, but this way it's not perfect...
Well this is the AA listing. It sounds interesting to have some more bytes free.
But unfortunately it does a reset, so loading program from disk, disabling AMSDOS: program gone :blank: [attachimg=1]
UPDATE: Just for the protocol: There is a typo in the Amstrad Action: Line 40: Replace 3E with 0E.
I bet they thought this was funny. Take this, bastards: It was not very challenging with a disassembler :P
Unfortunately I think the alternative is to disassemble and move it to where it won't overlap with AMSDOS. I think the easiest approach is to use the Winape disassembler, select the code from &9C40 to &A9EC, paste it to the Assembler. That should produce all the labels automatically I think. It should just be a matter of changing the ORG #9C40 to somewhere safe (e.g. ORG #8C40), save it. You will need to adjust the Execution Address in the Welcome program so the program doesn't crash.
Thanks, I wasn't aware that WinAPE has such a nice disassembler. The relocation unfortunately destroys some graphics, but up to now, this is the best relocator I have tried. I only tried some inside the CPC... seems I have a locked-in syndrome :)
Thanks for the great hint... I think this keeps me playing with some assembly code...
Perhaps use some sort of data compressor (like zip/rar¨-ish program). Not that the data actually needs to be compressed, but the idea is to store the data in a container .. then load that container normally using (amsdos intact) and then unextract (amsdos overeritten) & run.
Havnt looked much into compression programs but i recall there being both basic, image and disc compressors, so there is bound to be a bunch of binary/data compressors as well.
Yes, compression is probably the only way to get it running from the welcome demo, which is a large BASIC program.
So far I could manage to let home runner get home in a standalone program:
;; ldir program from &4000 to &9C40 (start) -- omitted --
ld c,&ff ;; disable all roms
ld hl,start
jp &bd16 ;; mc_start_program
I'm not sure why I overlooked that, maybe because I read that disabling AMSDOS / ROM 7 is not possible. (I have only tested in an emulator, so maybe it doesn't work on real CPC)
It is also possible to return to BASIC afterwards. (See http://www.cpcwiki.eu/forum/programming/stuck-with-run-basic-program-from-asm/ (http://www.cpcwiki.eu/forum/programming/stuck-with-run-basic-program-from-asm/))
Tested on my real CPC 464 with floppy drive... and... it works!! :D
So running the binary as standalone is possible.
Now I'm facing the problem to call it from the huge BASIC demo. Compression doesn't help: Not enough memory.
So the open question is: Is it possible to launch a BASIC program from DISK with AMSDOS disabled...?
Cut the binary into blocks, load the final block (the one that will overlap AMSDOS) into the screen RAM then copy it over and call the start. Should work unless you really need the screen preserved, in which case you may need to find another suitable chunk of "spare" memory somewhere.
Good idea... but in the meantime I solved it:
Now I disable AMSDOS, move the program to its correct location, restart the currently loaded BASIC program.
Previously I did almost the same, but also started the demo right before returning to the BASIC program, which failed because AMSDOS was now present again. Not sure if it was my fault (I must admit I'm a little bit dizzy after staring at the assembler code for so long) or the demo did it somehow...
I'm going to send my fix to cpc-power... probably there are many people desperately waiting for it... :P
Indeed I remember me watching the demo in a shop and my mum wanted to go home, but I wanted to see it again and again... :laugh:
The easiest way to run games which corrupt AMSDOS work space is to load them into banked memory and then after 64K has been loaded you execute a short routine to overwrite the main memory with what was loaded into the banked memory.
The executable to do the copying needs to also be in the same location as that copied into the banked memory since it will overwrite itself. For example in the screen memory near to very top; this will no doubt leave some screen corruption on copy but i think most people can live with that.
You of course need to know where to start the game and this is always the hard bit :'(
regards
rpalmer
Also a good idea, but I have only 64K...
The Welcome tapes are now available on disk without this nasty Home Runner bug. Thanks to kukulcan :)
http://www.cpc-power.com/index.php?page=detail&num=6397 (http://www.cpc-power.com/index.php?page=detail&num=6397)
The disk also contains my assembler source. Maybe it helps you transferring other programs to disk:
;; hrloader
;; start Home Runner Demo from disk
;; this is required, because it overlaps with AMSDOS
;; this example can be modified for any binary which overlaps with AMSDOS
org &8000
;; used code from:
;; http://www.cpcmania.com/Docs/Programming/Files.htm
;; http://www.cpcwiki.eu/forum/programming/stuck-with-run-basic-program-from-asm/msg65327/#msg65327
kl_rom_select equ &b90f
mc_start_program equ &bd16
ld c,&ff ;; disable all roms
ld hl,start ;; execution address for program
jp mc_start_program ;; start it
start:
;; move to &9c40 which overlaps with AMSDOS
;; assumes: load"hrdemo",&8100
ld hl,&8100
ld de,&9c40
ld bc,&dac
ldir
;; run BASIC
;; this executes the currently loaded BASIC program from the beginning
basic:
ld hl,(length)
ld bc,&170
add hl,bc
ld c,0
call kl_rom_select
ld a,(&c002)
cp 0
jp z,cpc464
ld (&ae66),hl
ld (&ae68),hl
ld (&ae6a),hl
ld (&ae6c),hl
cp 1
jp z,cpc664
jp &ea78 ;; run BASIC CPC6128
.cpc664
jp &ea7d ;; run BASIC CPC664
.cpc464
ld (&ae83),hl
ld (&ae85),hl
ld (&ae87),hl
ld (&ae89),hl
jp &e9bd ;; run BASIC CPC464
;; maximum length of currently loaded BASIC program
.length
defw &54FF