Closed nmlgc closed 4 months ago
Ick...
This is why the DOS kernel in DOSBox-X is written to start the DOS kernel at segment 80h instead of 60h in PC-98 mode, so that fixed variables could be allocated between 60h and 7Fh. Apparently it is considered normal for PC-98 games to read state directly from DOS kernel memory. Case in point: Touhou Project won't clear the text layer properly unless it can read the number of text layer rows from a fixed address somewhere around 60:114 (I forget exactly).
So to fix this, CON device emulation in PC-98 mode needs to mirror the cursor position at that address.
Booting a real PC-98 DOS bootdisk, I see where the row and column are stored:
I suppose it was time to move console emulation away from re-using IBM PC BIOS locations anyway...
I just pushed a commit that removes cursor position from 40:xx and puts it in segment 60:110-60:11C in the same way that normal DOS does it.
I don't think I broke anything, but it's best to double-check.
It does allow your program to print properly IF run when the cursor is at the bottom of the screen, and it allows the last line to appear otherwise.
Borland C is making unknown calls to INT DCh that I do not know how to emulate.
LOG: PC-98 INT 1Ah unknown call AX=040F BX=3574 CX=0000 DX=3574 SI=356E DI=3580 DS=0306 ES=0306
LOG: PC-98 INT DCh unknown call AX=0310 BX=0CA0 CX=3010 DX=1410 SI=356E DI=3580 DS=0306 ES=A000
LOG: PC-98 INT DCh unknown call AX=0300 BX=0006 CX=3010 DX=1500 SI=356E DI=3580 DS=0306 ES=0000
LOG: PC-98 INT DCh unknown call AX=0300 BX=0006 CX=3110 DX=1500 SI=356E DI=3580 DS=0306 ES=0000
Argh, hold on, the ANSI cursor positioning code is messed up right now...
Okay, try it now.
Looks almost correct now when printed at the bottom of the screen, except that cputs()
shouldn't move the cursor to the beginning of a line at the end of the string.
Calling it from further above swallows the first line though.
That will all be covered once all the addresses from memdos.txt are mapped, I guess?
( I instead went with ANSI escape sequences for the program I'm writing, since the conio.h APIs would still need slightly different code to cover both IBM and PC-98.)
I just fixed a silly bug in the ANSI emulation that might have caused this issue.
Just checked the COLORBUG.COM file, still happens.
The latest commit seems to be able to render COLORBUG.COM properly now.
Yup, this has been working for a while.
Two issues here:
cputs()
call.Here's my test source code, with a binary and linker map, compiled using the Japanese version of
Turbo C++ Version 4.02 Copyright (c) 1994 Borland International
.Correct output on Neko Project 21, and what you would expect from how the same binary behaves on IBM-compatibles:
Output on DOSBox-X:
I've narrowed down the first issue to
__NEC_WHEREXY
reading the wrong row value from[0060:0110]
, but wouldn't know how to fix this properly and non-hacky.