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
2011-08-17 19:13
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.
2011-08-18 04:36
doctorfargo

Registered: Aug 2011
Posts: 20
Thanks for the info - I'll try it out.
2011-08-18 08:25
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?
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: 2014
load "file",8
do the pokes
save "new file",8

Should work...
2011-08-19 08:56
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?
2011-08-19 09:31
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.
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: 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
2011-08-19 10:56
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.
2011-08-21 08:37
Graham
Account closed

Registered: Dec 2002
Posts: 990
CMD drives also have device numbers 12-15.
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
zscs
Jammer
rambo/Therapy/ Resou..
krissz
Mike
grass/LETHARGY
visionvortex
Holy Moses/Role
MWR/Visdom
Guests online: 103
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

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