Hi, I am having with the "load saved game" function of a jump and run game...

The game modifies the timer speed, hooks int 8, 9, 60, 61, 23 and 24,
calls functions (ax) 0..6 of int 60 (int 61 is used quite a lot but does
not seem to have "function number in ax" properties), uses functions 0 and 1
of int 16 ...
Graphics modes are numbers 2, 5, 6, 9, 13 (i.e. when you exit to DOS you
end up in 80x25 mono, CGA uses cyan/magenta 320x200 (and - when? - 640x200),
Tandy uses 320x200x16 (? - there are also "std" (speaker), Adlib and PCjr
sound and music drivers and "mt" (port 330/331 - MIDI?) music drivers),
MCGA is supported and EGA is upported (640x350 I think). Palette access is
done with int 10 functions 1002 / 1010. There is direct access to ports and
memory for graphics and sound and timer.
As far as I can tell, the only other used DOS resource are int 21 functions:
02 06 0d 09 10 1a 25 30 35 3c 3d 3e 3f 40 42 48 49 4b 4c 4e 4f

putchar-stdout, getchar-stdin, putstring-stdout (9), disk reset (d),
... ah, just found: EGA mode used is E, 640x200x16 ...
fcb-close (10), set dta (1a), setintvec, getver (will exit through int 20
if DOS version is < 2, otherwise the game is happy with all versions),
getintvec, create/truncate file (for save games only I think, 3c), open
file (several selectable .bin and .drv, but most "files" are stored as
areas in the 3 main overlay files, and of course save games / configuration:
the config tool does not work but the config file luckily is text format...),
close file, read file, write file, seek in file (42), alloc ram (48),
free ram, exec (used only for "mtinit" I think), exit, findfirst (4e),
findnext.

Some code fragments: mov ah,0d int 21 mov dx,... mov ah,10 int 21 jmp ...
mov ah,0d int 21 mov dx,... mov ah,10 int 21 stc ret
(in the 4k small "stick.bin" which seems to contain global user interface)
mov dx,... mov ah,1a int 21 lds dx,[...] mov cx,dx mov ah,4e int 21 jc ...
  push cs pop ds les di,[...] add di,201 mov cx,fe push cx push di
  mov bx,[...] incb [es:bx] mov si,... (then scan 8 chars to copy string
  up to but excluding the dot) pop di pop cx mov ah,4f int 21 jc ...
  add di,9 loop ... pop ds ret
(in the same stick.bin: find first 254 *.usr save game files)
Memory allocation is 256k, once, I think (plus the main file is an exe),
and exec only seems to be used once, too (for mtinit).
The alloc thing happens in the initial exe, as well as the exec, when the
sound, music and graphics drivers are loaded. Then, stick.bin, game.bin and
stdply.bin are loaded, too. The latter is probably initial game status,
similar to a save game file (which are only 256 bytes each, nice for cheats).

Notice that the game is calling findfirst the wrong way:
should set AH=4e AL=append flags (0 or non-0) DSDX=pointer CX=attrib mask.
But it fails to set AL (will be the low byte of the last pointer to the
array of 255 8+1 byte strings which holds the found savegame names), and
it sets CX to some more or less random value (the offset of the pointer).
I get the PROBLEM that only the volume label is listed in the list of found
save games. RBIL tells that this should only happen if CX (I assume only CL
is used and bits 0 and 5 are ignored) equals 8.


A quick test in DOSEMU tells me that at ((61a)):a16, the "mov ah,4e"
place, CX and DX are both 77a8. And the funny thing is: It WORKS in
DOSEMU! However, I tried in a redir-drive in DOSEMU but on a real FAT16
drive in plain FreeDOS.

When using a diskimage-drive in DOSEMU, I get the SAME PROBLEM again:
Only the label - and because this drive has none, not even that, only
the "restart game pseudo save game" - shows up on the list.

So I would like to report a kernel findfirst bug:
FreeDOS 2035 treats CX value 77a8 like CX value 0008, and returns only
the volume label, for a findfirst for "*.usr" on a local disk. On a
redir disk, no problems happen. Notice that the volume label does not
need to be *.usr to show up - it only has to exist - and that the game
does not need to be in the root directory to trigger this bug!

For now, I can use a patch: "replace mov cx,dx by mov cl,0" - but
unless FreeDOS accidentally caused the load location & 00de (bits 0
and 5 of CX are ignored in findfirst), the CONCLUSION for the kernel
should be: ONLY return only the volume label if cx & ffde equals 8.
Current situation seems to be "return only the volume label if cx & 00de
equals 8".

Checking sources... DosFindFirst... network_redirector_fp REM_FINDFIRST...
dos_findfirst -->

  if ((attr & (D_VOLID|D_DIR))==D_VOLID)
              --------------- this is biased too much towards entering the
"return only the volume label" mode. It should be:
First apply some mask - e.g. 00de - to the search attribute, then:
  if (attr == D_VOLID)
...

Notice that dos_findfirst contains TWO lines
  if ((attr & (D_VOLID|D_DIR))==D_VOLID)
and one line which already does a similar check as the suggested one:
      if ((fnp->f_dir.dir_attrib & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID &&
          fnp->f_dir.dir_name[0] != DELETED)
...
The above line is from the "search for volume, not dir, found entity is
non-deleted volume, no other attribs except readonly / archive allowed ->
return this entity and leave the root directory again" case.

I think if D_VOLID is set but attr & ~(D_RDONLY | D_ARCHIVE) is not EXACTLY
D_VOLID, the "redirect search to the root dir" (i = 3; line) should not happen.
In addition, DosFindNext refuses to work if:
  /* findnext will always fail on a device name device name or volume id */
  if (dmp->dm_attr_fnd & (D_DEVICE | D_VOLID))
    return DE_NFILES;
... where D_DEVICE is 0x40, as in DOS 3+ to indicate that a findfirst-without-
wildcards matched a device name (and therefore no findnext hit can exist).
This is again too picky: The search should NOT end after the volume label
unless the desired attributes & ~(D_RDONLY | D_ARCHIVE) are exactly D_VOLID.

Happy fixing ;-).

Eric

PS: I remember that, aeons ago, the game worked fine in MS DOS 4.01/6.xx X-).



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to