Date : Sat, 07 Jan 1984 15:35:13 EST
From : Keith Petersen <w8sdz@brl>
Subject: dBASE2'S RESET function
Thanks to Eric Stork for the following tip for users of DBASE2:
---
Subject: dBASE2's RESET function
dBASE2's RESET function does not work as it should. That can be a
serious problem. But there is a fix. A bit tricky, but it works. It
took so long to figure it out that it seems worthwhile to send this
note to the net to share the fix.
Over the holidays, I spent some time (quite a bit, it turned out)
helping a doctor friend of mine fix his accounting system by
interfacing it to dBASE2.
His application requires several disk changes. We duly inserted RESET
commands in the proper places, but the thing still would not work --
every effort to write to a changed disk bombed out with 'BDOS Error
R/O'
After a lot of study in various references from magazines, etc., we
finally realized why -- RESET simply does not reset the CP/M disk map
in memory, as it should. No way to make it work, either, by using SET
DEFAULT or so.
The solution is in an unpublicized feature of dBASE2 that permits the
user the write his own assembly language routines, POKE them into
memory above dBASE2's code, CALL them and RETURN from them. Above
dBASE2's memory means above A400h, which is used only for sorting
dBASE files.
The routine that finally did the trick was placed into a file called
RESETT.CMD (two t's to differentiate from dBASE2's RESET command). We
then inserted in the main command file the line:
DO RESETT
after every disk swap (we always swapped on B:)
* This command file is RESETT.CMD
SET CONS OFF
STORE 49152 to I
POKE I,0,17,2,0,14,37,205,5,0,201
* above line resets ONLY Drive B:
SET CALL TO I
CALL I
SET CONS ON
? "SOFT Warm Boot on B:"+CHR(7)
RETURN
Explanations (of non-obvious lines, only):
STORE 49152 TO I means variable I=C000h
(dBASE2 reqires all decimals)
POKE I,x,v,v,v,v,v,v,v,v,v (v=decimal value)
The 'I' is the address at which
the POKE is to store the following data.
The 'x' can be any value. After the CALL,
HL will point to a memory byte that will
contain whatever value is in the 'x'
position (could be length of string, if
that is useful)
The v,v,v,v are whatever routine you want
to execute. After the CALL, the
Program Counter is set to the first 'v'.
The last 'v' must be a RETURN to your
dBASE2 command file
In the illustration:
17D = 11H = LXI D
2,0 = 02h = 0000$0000$0000$0010B
(to reset Drive B:)
14D = 0EH = MVI C
37D = 25h = BDOS Function 37 (CP/M 2.2 only)
205D = CDh = CALL
5,0 = 0005= location 5 (i.e. CALL BDOS)
201D = C9h = RET (to dBASE2 cmd file)
SET CALL TO I {that's how you call the POKED routine
CALL I {
RETURN returns to the main dBASE command file
If anyone has an easier way of solving the problem, please post to net.
Eric Stork <STORK@MC>