<commit_before>#include <cstdlib>
#include <sys/farptr.h>
#include <conio.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#include <bios.h>

#define LOCK_VARIABLE(x)    _go32_dpmi_lock_data((void *)&x,(long)sizeof(x));
#define LOCK_FUNCTION(x)    _go32_dpmi_lock_code(x,(long)sizeof(x));

#define TIMER 0x8

_go32_dpmi_seginfo OldISR, NewISR;


#include <dos.h>
#include <conio.h>


static volatile unsigned long timer_ticks;
static unsigned timer_counter;

void timer_handler() {
    ++timer_ticks;

    outp(0x20, 0x20);
}

void timer_reset(unsigned short frequency) {
    timer_ticks = 0;
    timer_counter = 0x1234DD / frequency;
}
<commit_msg>Restore the interrupt handling to the original form<commit_after>#include <cstdlib>
#include <sys/farptr.h>
#include <conio.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#include <bios.h>

#define LOCK_VARIABLE(x)    _go32_dpmi_lock_data((void *)&x,(long)sizeof(x));
#define LOCK_FUNCTION(x)    _go32_dpmi_lock_code(x,(long)sizeof(x));

#define TIMER 0x8

_go32_dpmi_seginfo OldISR, NewISR;


#include <dos.h>
#include <conio.h>


static volatile unsigned int timer_ticks;
static unsigned timer_counter;
static unsigned timer_sum;

void timer_handler() {
    unsigned short old_sum = timer_sum;

    ++timer_ticks;

    timer_sum += timer_counter;


    if (timer_sum < old_sum) {
        _go32_dpmi_chain_protected_mode_interrupt_vector(TIMER,&OldISR);
    } else {
        outp(0x20, 0x20);
    }
}

void timer_reset(unsigned short frequency) {
    timer_ticks = 0;
    timer_counter = 0x1234DD / frequency;
}

{'fraction_non_alphanumeric': 0.12563451776649745, 'fraction_numerical': 0.02918781725888325, 'mean_word_length': 4.884328358208955, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3382465', 'n_tokens_mistral': 668, 'n_tokens_neox': 627, 'n_words': 127}