AZO234 / NP2kai

Neko Project II kai
http://domisan.sakura.ne.jp/article/np2kai/np2kai.html
MIT License
260 stars 61 forks source link

Support for PC-9801/9821 port 0x43b - memory hole at 15-16MB #107

Open megatron-uk opened 4 years ago

megatron-uk commented 4 years ago

Hi,

I am attempting to do some graphics development on both my real, physical PC-9821An, as well as within xnp21kai (0.86 rev.22 8c96339).

I am following several programming guides that I have found detailing the use of the linear framebuffer support in PEGC packed-pixel hardware.

https://github.com/joncampbell123/dosbox-x/issues/1061 https://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=102975&page=all https://github.com/techfury90/pc98stuff/blob/master/vram9821/VRAM_WAT.C

The above code and comments state that by checking for the presence of a value at 0x43b, it is possible to determine whether the linear framebuffer is enabled, or if support needs to be toggled in the PC-98 BIOS for "memory hole at 15-16MB".

I cannot seem to see such an option in the emulated machine, regardless of whether I supply a real BIOS image from my own machine or not. And the value at 0x43b always returns as 0xFF.

The code I am using is simple:

if ((inp(0x043b)&0x04) ){
    puts("Memory hole at 15-16MB not enabled");
    return;
} else {
    puts("Memory hole at 15-16MB is enabled");
}

On xnp21kai it fails and returns 'not enable', on my PC-9821An it fails until I enable the BIOS option 'do not use memory hole at 15-16MB'.

Does the emulated PC-9821 support the memory hole check at 15-16MB? If not, what other mechanism exists within the emulated machine to check for the linear framebuffer support?

megatron-uk commented 4 years ago

Does NP21Kai support VRAM access via linear framebuffer, or is all support for the 'normal', banked 32KB access?

I'm trying the same VRAM code from http://darudarudan.syuriken.jp/kai/pc9821.htm#e256L and, like the code I've written myself, it complains about not being able use VRAM at the 16MB memory hole.

The same exe runs fine on my 9821An.

This is with the same memory manager (VEM486), and the same DOS4GW.exe on both real and emulated systems:

img20200816130541

Is there any support for the BIOS option to enable it?

vram_wat_no_mem_hole_emulated

megatron-uk commented 4 years ago

Okay, never mind. Even though the 16MB memory hole option is not there, if I do:

_farpokeb(_dos_ds, 0xE0102, 0x01);

I can get the framebuffer to appear at its alternate location at 0xFFF00000, instead of 0x00F00000.

AZO234 commented 4 years ago

Sorry to late replying. Thanks for your great information!

if ((inp(0x043b)&0x04) )

NP2kai cannot boot PC-9821's 'BIOS MENU', Then setting enable 'Using 16MB memory area' cannot do too.

_farpokeb(_dos_ds, 0xE0102, 0x01);

Probably that method is right.

I'll look for PC-9821's BIOS MENU boot method and implement of EGC(PEGC) port register.