<commit_before> 
#include <stdio.h>
#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <ctype.h>
#include <fcntl.h>
#include <dos.h>

#include <hw/dos/dos.h>
#include <hw/necpc98/necpc98.h>

#include "isjp_cnv.h" // Shift-JIS converted "This is Japanese" string constant

#if TARGET_MSDOS == 32
unsigned short *TRAM_C = (unsigned short*)0xA0000;
unsigned short *TRAM_A = (unsigned short*)0xA2000;
unsigned char  *GRAM_B = (unsigned char*) 0xA8000;
unsigned char  *GRAM_R = (unsigned char*) 0xB0000;
unsigned char  *GRAM_G = (unsigned char*) 0xB8000;
#else
unsigned short far *TRAM_C = (unsigned short far*)0xA0000000;
unsigned short far *TRAM_A = (unsigned short far*)0xA2000000;
unsigned char far  *GRAM_B = (unsigned char far*) 0xA8000000;
unsigned char far  *GRAM_R = (unsigned char far*) 0xB0000000;
unsigned char far  *GRAM_G = (unsigned char far*) 0xB8000000;
#endif

static char hexes[] = "0123456789ABCDEF";

unsigned char bmp[0x10 * 2];

int main(int argc,char **argv) {
    unsigned int x,y,o;
    unsigned short ch;
    int c;

    /* NTS: Generally, if you write a doublewide character, the code is taken
     *      from that cell and continued over the next cell. The next cell
     *      contents are ignored. Except... that doesn't seem to be strictly
     *      true for ALL codes. Some codes are fullwidth but will show only
     *      the first half unless you write the same code twice. Some codes
     *      you think would make a doublewide code but don't. I'm not sure why.
     *
     *      If you see half of a character, try hitting 'f' to toggle filling
     *      both cells with the same code. */

	printf("NEC PC-98 doslib test program\n");
	if (!probe_nec_pc98()) {
		printf("Sorry, your system is not PC-98\n");
		return 1;
	}

    /* set the graphics mode */
    __asm {
        mov     ah,0x42         ; display area setup
        mov     ch,0xC0         ; 640x400 8-color graphics
        int     18h
    }

    /* AH=42h disables graphics layer, turn it on again */
    __asm {
        mov     ah,0x40         ; start displaying graphics
        int     18h
    }

    /* we want the 8-color mode */
    outp(0x6A,0x00);

    /* restore the color palette */
    outp(0xA8,0x37);
    outp(0xAA,0x15);
    outp(0xAC,0x26);
    outp(0xAE,0x04);

    ch = 'A';
    for (y=0;y < 25;y++) printf("\n");
    printf("Hit ESC to exit.\n");

    /* main loop */
#if TARGET_MSDOS == 32
    memset(GRAM_G,0,0x8000);
    memset(GRAM_R,0,0x8000);
    memset(GRAM_B,0,0x8000);
#else
    _fmemset(GRAM_G,0,0x8000);
    _fmemset(GRAM_R,0,0x8000);
    _fmemset(GRAM_B,0,0x8000);
#endif

    do {
        TRAM_C[0] = ch;
        TRAM_A[0] = 0xE1;
        TRAM_C[1] = ch;
        TRAM_A[1] = 0xE1;

        for (x=0;x < 4;x++) {
            TRAM_C[3+x] = hexes[(ch >> (12 - (x * 4))) & 0xF];
            TRAM_A[3+x] = 0xC1;
        }
<commit_msg>Hm, so on real PC-98 hardware INT 18h AH=42 does not clear the text layer, or else the 'Hit ESC to exit' message would not be visible.<commit_after> 
#include <stdio.h>
#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <ctype.h>
#include <fcntl.h>
#include <dos.h>

#include <hw/dos/dos.h>
#include <hw/necpc98/necpc98.h>

#include "isjp_cnv.h" // Shift-JIS converted "This is Japanese" string constant

#if TARGET_MSDOS == 32
unsigned short *TRAM_C = (unsigned short*)0xA0000;
unsigned short *TRAM_A = (unsigned short*)0xA2000;
unsigned char  *GRAM_B = (unsigned char*) 0xA8000;
unsigned char  *GRAM_R = (unsigned char*) 0xB0000;
unsigned char  *GRAM_G = (unsigned char*) 0xB8000;
#else
unsigned short far *TRAM_C = (unsigned short far*)0xA0000000;
unsigned short far *TRAM_A = (unsigned short far*)0xA2000000;
unsigned char far  *GRAM_B = (unsigned char far*) 0xA8000000;
unsigned char far  *GRAM_R = (unsigned char far*) 0xB0000000;
unsigned char far  *GRAM_G = (unsigned char far*) 0xB8000000;
#endif

static char hexes[] = "0123456789ABCDEF";

unsigned char bmp[0x10 * 2];

int main(int argc,char **argv) {
    unsigned int x,y,o;
    unsigned short ch;
    int c;

    /* NTS: Generally, if you write a doublewide character, the code is taken
     *      from that cell and continued over the next cell. The next cell
     *      contents are ignored. Except... that doesn't seem to be strictly
     *      true for ALL codes. Some codes are fullwidth but will show only
     *      the first half unless you write the same code twice. Some codes
     *      you think would make a doublewide code but don't. I'm not sure why.
     *
     *      If you see half of a character, try hitting 'f' to toggle filling
     *      both cells with the same code. */

	printf("NEC PC-98 doslib test program\n");
	if (!probe_nec_pc98()) {
		printf("Sorry, your system is not PC-98\n");
		return 1;
	}

    ch = 'A';
    for (y=0;y < 25;y++) printf("\n");
    printf("Hit ESC to exit.\n");

    /* set the graphics mode */
    __asm {
        mov     ah,0x42         ; display area setup
        mov     ch,0xC0         ; 640x400 8-color graphics
        int     18h
    }

    /* make sure graphics are showing */
    __asm {
        mov     ah,0x40         ; start displaying graphics
        int     18h
    }

    /* we want the 8-color mode */
    outp(0x6A,0x00);

    /* restore the color palette */
    outp(0xA8,0x37);
    outp(0xAA,0x15);
    outp(0xAC,0x26);
    outp(0xAE,0x04);

    /* main loop */
#if TARGET_MSDOS == 32
    memset(GRAM_G,0,0x8000);
    memset(GRAM_R,0,0x8000);
    memset(GRAM_B,0,0x8000);
#else
    _fmemset(GRAM_G,0,0x8000);
    _fmemset(GRAM_R,0,0x8000);
    _fmemset(GRAM_B,0,0x8000);
#endif

    do {
        TRAM_C[0] = ch;
        TRAM_A[0] = 0xE1;
        TRAM_C[1] = ch;
        TRAM_A[1] = 0xE1;

        for (x=0;x < 4;x++) {
            TRAM_C[3+x] = hexes[(ch >> (12 - (x * 4))) & 0xF];
            TRAM_A[3+x] = 0xC1;
        }

{'fraction_non_alphanumeric': 0.12288205296923836, 'fraction_numerical': 0.06481329165981246, 'mean_word_length': 2.658243080625752, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1601234', 'n_tokens_mistral': 2493, 'n_tokens_neox': 2182, 'n_words': 679}