| |
doctorfargo
Registered: Aug 2011 Posts: 20 |
Hacking Questreader to work from any drive number
Hello everyone,
I'm working on updating some of my old Questwriter text adventures. Questwriter is a Text Adventure Construction Set published on Loadstar #77.
While QuestWriter is used to make the games, a smaller one-file ML program called QuestReader is used. My question is this - like most older programs, QuestReader only works on drive #8 - would it be possible for someone who is ML savvy to hack/modify the program so that it will run from any drive number?
Here's one of my old QuestWriter games - the QuestReader file is on the disk:
http://gamebase64.com/game.php?id=19357&d=18&h=0 |
|
| |
j0x
Registered: Mar 2004 Posts: 215 |
Yes, that is possible.
After loading the questreader, but before running it, type:
poke 2375,166
poke 2376,186
poke 2574,166
poke 2575,186
poke 2970,166
poke 2971,186
run
This doesn't fix the Loadstar intro, but enables you to play the game from the drive from which you loaded the questreader.
|
| |
doctorfargo
Registered: Aug 2011 Posts: 20 |
Thanks for the info - I'll try it out. |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Yes, that is possible.
After loading the questreader, but before running it, type:
poke 2375,166
poke 2376,186
poke 2574,166
poke 2575,186
poke 2970,166
poke 2971,186
run
This doesn't fix the Loadstar intro, but enables you to play the game from the drive from which you loaded the questreader.
ldx #$08 => ldx $ba I suppose? |
| |
j0x
Registered: Mar 2004 Posts: 215 |
Indeed. Not 100% safe, but good enough for most applications.
|
| |
doctorfargo
Registered: Aug 2011 Posts: 20 |
Is there any way that it could be patched in a monitor and then saved as a new file? |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
load "file",8
do the pokes
save "new file",8
Should work... |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
@j0x: When you say it is not 100% safe, do you refer to the fact that $ba may be uninitialized under some (unusual?) circumstances (i.e. it may be $00 or such) or are you thinking about something else? |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Frantic: Yes, this may happen. Think of loading a program, then resetting the computer and running the program afterwards.
This is the code to find the current drive in my loader's init routine:
; try the drive as denoted by FA (current drive) first
lda FA
cmp #MIN_DEVICE_NO
bcc :+
cmp #MAX_DEVICE_NO + 1
bcc :++
: lda #MIN_DEVICE_NO; FA does not contain a drive address (MIN_DEVICE_NO..MAX_DEVICE_NO), try MIN_DEVICE_NO first
:
FA is $ba. |
| |
j0x
Registered: Mar 2004 Posts: 215 |
Frantic: Yes, that was what I was referring to. Even Krill's example code (which is probably one of the best ways of going about it bar querying the user) will fail when loading from drive 9, resetting and running. You may say that resetting before running (well, before "sys"ing or "old:run"ing) is non-standard behaviour, but the user may also use some fastloader which does not leave the value of $ba representing the current drive no.
Other (apparently harmless) examples (assuming the second files loaded won't overwrite questreader) that will fail even using Krill's code:
load"questreader",9
load"monitor.9000",8,1
run
load"questreader",9
load"$",8,1
run
|
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Yes, that's why there will be some functionality to load the file from the first drive it's found on some future day. But EVEN THAT may fail if you happen to have different files with the same name on two inserted disks.. :D |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Yeah, so that's what I thought. This is how I do it in some code somewhere btw:
lda $ba
and #%00001011 ;Restrict range of the current device number.
ora #%00001000 ;Make sure it is at least $08 (i.e. in the range $08-$0b)
sta $ba
In effect, if the current device number is between $8-$b, it will remain unaffected. If it is outside this range, it will be forced into this range. In the particular case that the current device number is set to $00 (typical when uninitialized), it will be forced to $08 instead, which is good, since $8 is the default device number in most circumstances of course.
Works good enough for my purposes and seems to be a simpler version of more or less the same thing that Krill's code does (well..). Does not solve issues like the "special cases" spelled out by Krill+J0x here, of course. Substitute "and #$b" for "and #$9" if you only want to allow device 8 and 9. |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
CMD drives also have device numbers 12-15. |