Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to BDOS from the DOS2 driver ends nowehere #59

Closed
Eugeny1 opened this issue Jun 10, 2020 · 2 comments
Closed

Call to BDOS from the DOS2 driver ends nowehere #59

Eugeny1 opened this issue Jun 10, 2020 · 2 comments
Assignees
Labels
bug Something isn't working fixplemented This bug has already been fixed/this feature has already been implemented in a released version

Comments

@Eugeny1
Copy link

Eugeny1 commented Jun 10, 2020

I am trying to create new file from the driver code (page 7), to be exact within the CALL statement handler:

ld	c,16h
ld	de,FCB
call	_BDOSC			; call BDOS - create file

...

_BDOSC:
	exx
	ld	hl,XF37D
	ld	(CODE_ADD),hl
	exx
	jp	CALLB0

This code causes Nextor calling driver in the page 7 routine LUN_INFO a number of times, looking like it tries to get statuses of all the devices attached (like Nextor does during initialization). LUN_INFO returns A=1 (error), and at the end Nextor kernel "returns" to the address 0ffffh without restoring the stack.

Note: CODE_ADD in the driver template I use has address of 0F1D0h, while online documentation states that must be at 0F84Ch. Tracing the code I see that 0F1D0h must the correct address though.

More technical information: driver returns A=1 for DRV_CONFIG (as real hardware is not available in emulation), and Nextor allocates no drives for its driver (mode is DOS2). When I perform SAVE"A:ASD" in BASIC, it accesses machine's built-in floppy drive, thus Nextor is operational through another disk ROM from BASIC. Nextor is in slot 3.1, built-in DOS1 controller is in slot 3.3.

Update: if I move code from the "JP CALLB0" location to 0c000h, and perform CALL F37D from this location (thus call has the same input data), the call returns properly with error (A=1) as expected. Thus there's something wrong with the CALLB0 mechanism, or I do something wrong.
No, I am wrong, It performs the same and execution ends up in the same nowhere place even if BDOS is called from RAM and with pages 0/1 switched in the Nextor mapper (ASCII8 mapper). I can not believe it as this function "create file [fcb]" must be used very frequently by the system or applications.

Update:. when I perform SAVE"file" from BASIC with Nextor kernel in effect it uses function 44h "create file handle" rather than function 16h.

Update: if I invoke this function in the binary using BLOAD it works properly creating the file on the functional device or returning expected 0xff for missing device. Would the problem be caused because I invoke it from DRV_BASSTAT?

Some progress here. I am using openMSX to troubleshoot the problem. My setup is Nextor in slot 3.1, and internal disk ROM in slot 3.3. Nextor's BASSTAT returns error (0x01), as well as all other routines return error as storage microcontroller is not available.
A: is being attached to the the internal disk drive (driver in slot 3.3), no letters are attached to Nextor (this is normal).

Now to the tech details:

  • if internal drive is having diskette in it when I invoke function 016h with drive identifier 01h (drive A:), then file is being properly created on the diskette.
  • if internal drive does NOT have a diskette when I invoke function 016h, Nextor kernel ends up in its internal driver routines (for non-existent device attached to the Nextor) after trying to access the inaccessible floppy media.

Thus the problem has something about error handling for the inaccessible device (in this case - floppy).

This has been tested on another driver, behavior is the same: as soon as function 016h is invoked for internal driver-attached device returning error (e.g. missing disk in the floppy drive), call ends nowhere inside the Nextor kernel, causing machine to crash.

Final general test for the the issue: running the driver invoking function 016h from BASSTAT I inserted floppy disk into internal drive, and it properly created target file on the floppy.

@Konamiman Konamiman added bug Something isn't working due in next version This will be fixed/implemented in the next version labels Jul 11, 2020
@Konamiman Konamiman self-assigned this Jul 11, 2020
Konamiman added a commit that referenced this issue Jul 26, 2020
- Fix: broken RAM disk (introduced in RC1).
- Fix: disk errors for old MSX-DOS 1 file functions in BASIC crash the computer (#59).
- Add: new flag returned by LUN_INFO allows to instruct Nextor to ignore devices when searching devices for automatic device to drive mapping (#54).
- Fix: files can't have 3 or 4 in their names in DOS 1 mode (#55).
- Fix: after booting directly yo BASIC by pressing 3, CALL SYSTEM doesn't work.
- Fix: slot disable keys don't work on real MSX computers (#49).
- Add: new boot key, pressing N at boot time disables all the Nextor kernels present.
- Add: default DPB gets a fixed address of 7BAAh in banks 0 and 3, so it can be customized reliably.
- Add: PROMPT routine made available to drivers at address 41E8h (#42).
- Fix: the DOS 1 variables "data buffer changed" and "redirect console output to printer" were not zeroed when switching to DOS 1 mode at boot time.
- Fix: can't change volume name when there are long filename entries in the root directory (#57).
- Fix: absolute sector read/write functions not working properly when a file is mounted to a drive (#43).
- Fix: bad sector buffer management when writing to a mounted file causing data corruption on the mounted file (#58).
- Fix: drive parameters not updated on first access to a drive after a media change if the driver provides drive mapping via DRV_CONFIG, causing bad data read (#45).
@Eugeny1
Copy link
Author

Eugeny1 commented Jul 31, 2020

Thank you for the fixed code. Now system does not crash, but there's still a problem: in case of disk error (e.g. write protected or disk missing in the drive) the execution goes to the BASIC error handler and terminates into BASIC prompt with respective message "Disk offline" or "Disk write protected" instead of returning to the BDOS caller with A=0ffh (error condition).

@Konamiman Konamiman added fixplemented This bug has already been fixed/this feature has already been implemented in a released version and removed due in next version This will be fixed/implemented in the next version labels Aug 1, 2020
@Konamiman
Copy link
Owner

Fixed in v2.1.0 (please open a new issue for last comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixplemented This bug has already been fixed/this feature has already been implemented in a released version
Projects
None yet
Development

No branches or pull requests

2 participants