Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Hacking Questreader to work from any drive number
2011-08-17 02:28
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
 
... 2 posts hidden. Click here to view all posts....
 
2011-08-18 08:25
JackAsser

Registered: Jun 2002
Posts: 1989
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?
2011-08-18 09:49
j0x

Registered: Mar 2004
Posts: 215
Indeed. Not 100% safe, but good enough for most applications.
2011-08-18 19:37
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?
2011-08-19 05:55
JackAsser

Registered: Jun 2002
Posts: 1989
load "file",8
do the pokes
save "new file",8

Should work...
2011-08-19 08:56
Frantic

Registered: Mar 2003
Posts: 1627
@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?
2011-08-19 09:31
Krill

Registered: Apr 2002
Posts: 2839
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.
2011-08-19 09:55
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

2011-08-19 10:13
Krill

Registered: Apr 2002
Posts: 2839
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
2011-08-19 10:56
Frantic

Registered: Mar 2003
Posts: 1627
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.
2011-08-21 08:37
Graham
Account closed

Registered: Dec 2002
Posts: 990
CMD drives also have device numbers 12-15.
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
AnonymousMOS
ptoing
Apollyon/ALD
Guests online: 112
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Graphicians
1 Sulevi  (10)
2 Mirage  (9.8)
3 Lobo  (9.7)
4 Mikael  (9.7)
5 Archmage  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.056 sec.